summaryrefslogtreecommitdiff
path: root/src/Level.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Level.h')
-rw-r--r--src/Level.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/Level.h b/src/Level.h
new file mode 100644
index 0000000..1607f0c
--- /dev/null
+++ b/src/Level.h
@@ -0,0 +1,45 @@
+#ifndef DNG_LEVEL_H
+#define DNG_LEVEL_H
+
+static const char PLAYER_TKN = 'p';
+static const char WALL_TKN = 'w';
+static const char EMPTY_TKN = '0';
+static const char TREASURE_TKN = 't';
+static const char ENEMY_TKN = 'e';
+static const char BLANK_SPACE = '\0';
+static const char WALL_SPACE = '#';
+
+#include <memory>
+#include <vector>
+
+struct Pos
+{
+ int id;
+ int x;
+ int y;
+} typedef Coord;
+
+class Level
+{
+
+public:
+ void loadLevelFromFile(const char* filePath);
+
+ bool isEmpty(int x, int y);
+
+ bool canStep(int dx, int dy);
+
+ void print();
+
+ int nextId();
+
+ std::vector<std::vector<char>> map;
+ Pos player;
+ std::vector<Pos> enemyPositions;
+ std::vector<Pos> treasurePositions;
+
+private:
+ int idCounter = 1; // defaults at 1 (player always 0)
+};
+
+#endif // DNG_LEVEL_H