]> Shamusworld >> Repos - warehouse-man-deluxe/blobdiff - src/gameboard.h
Added undo move system, various improvements.
[warehouse-man-deluxe] / src / gameboard.h
index b32dc885b66d536fec7067ee6287b026fa776d48..9f59480e961c7a42a632552f4aee66b01fbd1813 100644 (file)
@@ -4,6 +4,11 @@
 enum { GTSpace=0x00, GTWall=0x01, GTBox=0x02, GTBoxSpot=0x04 };
 enum { PMInvalid, PMWalk, PMPush };
 
+struct UndoMove
+{
+       int dx, dy, type;
+};
+
 class GameBoard
 {
        public:
@@ -19,9 +24,14 @@ class GameBoard
                int MovePlayerS(void);
                int MovePlayerE(void);
                int MovePlayerW(void);
+               bool IsBoxNOfPlayer(void);
+               bool IsBoxSOfPlayer(void);
+               bool IsBoxEOfPlayer(void);
+               bool IsBoxWOfPlayer(void);
+               bool UndoLastMove(int &, int &, int &);
 
        private:
-               int Move(int & var, int direction, char, char);
+               int Move(int dx, int dy, char, char);
 
        public:
                int playerX, playerY;           // Player X/Y are zero-based
@@ -32,6 +42,8 @@ class GameBoard
                char * initialBoard;
                int initialX, initialY;
                int boardLength;
+               int numMoves;
+               UndoMove undo[8192];            // 8K moves ought to be enough for anybody
 };
 
 #endif // __GAMEBOARD_H__