summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AssetManager.hpp1
-rw-r--r--src/Block.cpp20
-rw-r--r--src/Block.hpp24
3 files changed, 10 insertions, 35 deletions
diff --git a/src/AssetManager.hpp b/src/AssetManager.hpp
index f3d0718..e05ba31 100644
--- a/src/AssetManager.hpp
+++ b/src/AssetManager.hpp
@@ -3,6 +3,7 @@
#include <string>
#include <vector>
#include <map>
+#include <functional>
#include <GL/glew.h>
#include <glm/vec4.hpp>
diff --git a/src/Block.cpp b/src/Block.cpp
index 41199de..56fa371 100644
--- a/src/Block.cpp
+++ b/src/Block.cpp
@@ -1,25 +1,5 @@
#include "Block.hpp"
-#include <string>
-
-Block::~Block() {}
-
-Block::Block(unsigned short id, unsigned char state,
- unsigned char light, unsigned char sky)
- : id(id), state(state), light(light), sky (sky) {}
-
-Block::Block() : id(0), state(0), light(0), sky(0) {}
-
-bool operator==(const BlockId& lhs, const BlockId &rhs) {
- return (lhs.id == rhs.id) && (lhs.state == rhs.state);
-}
-
-bool operator<(const BlockId& lhs, const BlockId &rhs) {
- if (lhs.id < rhs.id)
- return true;
- return lhs.state < rhs.state;
-}
-
std::pair<std::string, std::string> TransformBlockIdToBlockStateName(BlockId blockId) {
switch (blockId.id) {
case 1: {
diff --git a/src/Block.hpp b/src/Block.hpp
index c922adf..fa8b51a 100644
--- a/src/Block.hpp
+++ b/src/Block.hpp
@@ -1,19 +1,7 @@
#pragma once
-#include <functional>
#include <utility>
-
-struct Block {
- Block();
- Block(unsigned short id, unsigned char state,
- unsigned char light, unsigned char sky);
- ~Block();
-
- unsigned short id : 13;
- unsigned char state : 4;
- unsigned char light : 4;
- unsigned char sky : 4;
-};
+#include <string>
struct BlockId {
unsigned short id : 13;
@@ -29,9 +17,15 @@ enum BlockFacing {
East
};
-bool operator==(const BlockId& lhs, const BlockId &rhs);
+inline bool operator==(const BlockId& lhs, const BlockId &rhs) {
+ return (lhs.id == rhs.id) && (lhs.state == rhs.state);
+}
-bool operator<(const BlockId& lhs, const BlockId &rhs);
+inline bool operator<(const BlockId& lhs, const BlockId &rhs) {
+ if (lhs.id != rhs.id)
+ return lhs.id < rhs.id;
+ return lhs.state < rhs.state;
+}
namespace std {
template <>