diff options
Diffstat (limited to 'history.h')
-rw-r--r-- | history.h | 184 |
1 files changed, 95 insertions, 89 deletions
@@ -17,139 +17,145 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * $Id: history.h 87 2007-06-22 22:37:36Z tom $ + * $Id: history.h 95 2007-09-21 23:01:10Z tom $ */ #ifndef VDR_SPIDER_HISTORY_H #define VDR_SPIDER_HISTORY_H #include "spider.h" -class Pack; -class Pile; -typedef Array<Pile*> Piles; -class FinalHeap; -class Move; -typedef Vector<Move*> Moves; -/** --- class History ------------------------------------------------------ **/ - -class History +namespace Spider { -private: - Moves history; - unsigned int executed; + class Pack; + class Pile; + typedef Array<Pile*> Piles; + class FinalHeap; + class Move; + typedef Vector<Move*> Moves; -public: - /** Constructor */ - History(); + //--- class Spider::History -------------------------------------------------- - /** Destructor */ - ~History(); + class History + { + private: + Moves history; + unsigned int executed; - /** Current move in the history */ - Move* current(); + public: - /** Add a new move */ - void add(Move* move); + /** Constructor */ + History(); - /** Set previous move as current */ - void backward(); + /** Destructor */ + ~History(); - /** Set next move as current */ - void forward(); + /** Current move in the history */ + Move* current(); - /** Are there executed moves in the history */ - bool movesExecuted(); + /** Add a new move */ + void add(Move* move); - /** Are there moves to execute in the history */ - bool movesToExecute(); -}; + /** Set previous move as current */ + void backward(); + /** Set next move as current */ + void forward(); -/** --- base class Move ---------------------------------------------------- **/ + /** Are there executed moves in the history */ + bool movesExecuted(); -class Move -{ -public: + /** Are there moves to execute in the history */ + bool movesToExecute(); + }; - /** Destructor */ - virtual ~Move() {}; - /** Do the move */ - virtual void execute() = 0; + //--- class Spider::Move ----------------------------------------------------- - /** Redo the move */ - virtual void takeBack() = 0; -}; + class Move + { + public: + /** Destructor */ + virtual ~Move() {}; -/** --- class DealMove ----------------------------------------------------- **/ + /** Do the move */ + virtual void execute() = 0; -class DealMove : public Move -{ -private: - Pack* source; - Piles& destination; + /** Redo the move */ + virtual void takeBack() = 0; + }; -public: - /** Constructor */ - DealMove(Pack* s, Piles& d); + //--- class Spider::DealMove ------------------------------------------------- - /** Do the move */ - void execute(); + class DealMove : public Move + { + private: + Pack* source; + Piles& destination; - /** Redo the move */ - void takeBack(); -}; + public: + /** Constructor */ + DealMove(Pack* s, Piles& d); -/** --- class NormalMove --------------------------------------------------- **/ + /** Do the move */ + void execute(); -class NormalMove : public Move -{ -private: - Pile* source; - Pile* destination; - int count; - bool turn; + /** Redo the move */ + void takeBack(); + }; -public: - /** Constructor */ - NormalMove(Pile* s, Pile* d, int c, bool t); + //--- class Spider::NormalMove ----------------------------------------------- - /** Do the move */ - void execute(); + class NormalMove : public Move + { + private: + Pile* source; + Pile* destination; + int count; + bool turn; - /** Redo the move */ - void takeBack(); -}; + public: + /** Constructor */ + NormalMove(Pile* s, Pile* d, int c, bool t); -/** --- class FinalMove ---------------------------------------------------- **/ + /** Do the move */ + void execute(); -class FinalMove : public Move -{ -private: - Pile* source; - FinalHeap* destination; - int count; - bool turn; - bool bonus; + /** Redo the move */ + void takeBack(); + }; + + + //--- class Spider::FinalMove ------------------------------------------------ + + class FinalMove : public Move + { + private: + Pile* source; + FinalHeap* destination; + int count; + bool turn; + bool bonus; + + public: -public: + /** Constructor */ + FinalMove(Pile* s, FinalHeap* d, int c, bool t, bool b); - /** Constructor */ - FinalMove(Pile* s, FinalHeap* d, int c, bool t, bool b); + /** Do the move */ + void execute(); - /** Do the move */ - void execute(); + /** Redo the move */ + void takeBack(); + }; - /** Redo the move */ - void takeBack(); -}; +} // namespace Spider #endif // VDR_SPIDER_HISTORY_H |