aboutsummaryrefslogtreecommitdiff
path: root/include/game.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/game.hpp')
-rw-r--r--include/game.hpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/game.hpp b/include/game.hpp
index 40ca113..647a12d 100644
--- a/include/game.hpp
+++ b/include/game.hpp
@@ -2,6 +2,7 @@
# define GAME_HPP
#include <string>
+#include <vector>
#include <algorithm>
class Game
@@ -24,15 +25,18 @@ public:
CellWall,
CellCrate,
CellPayload,
+ CellCrateSolved
};
struct Position
{
- int y, x;
+ size_t y, x;
};
+ bool won();
void move(Direction direction);
Cell get(int y, int x) const;
+ Cell get(Position pos) const;
size_t getHeight() const;
size_t getWidth() const;
Position const &getPlayer() const;
@@ -44,6 +48,15 @@ private:
Cell **m_grid;
Position m_playerPos;
Direction m_playerDirection;
+ std::vector<Position> m_cratePos;
+ std::vector<Position> m_payloadPos;
+
+ bool tryMoveCrate(Position &pos, Direction direction);
+ bool validPosition(Position pos);
+ static Position makePos(int y, int x);
};
+bool operator==(Game::Position const &a, Game::Position const &b);
+bool operator!=(Game::Position const &a, Game::Position const &b);
+
#endif