Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Rules.h

Go to the documentation of this file.
00001 #ifndef HEADER_RULES_H
00002 #define HEADER_RULES_H
00003 
00004 class V2;
00005 class MarkMask;
00006 class Field;
00007 class OnCondition;
00008 
00009 #include "NoCopy.h"
00010 #include "Cube.h"
00011 #include "Dir.h"
00012 
00013 /**
00014  * Game rules.
00015  */
00016 class Rules : public NoCopy {
00017     private:
00018         Dir::eDir m_dir;
00019         bool m_readyToDie;
00020         bool m_readyToTurn;
00021         bool m_readyToActive;
00022         bool m_pushing;
00023         bool m_lastFall;
00024         int m_outDepth;
00025         Dir::eDir m_touchDir;
00026 
00027         Cube *m_model;
00028         MarkMask *m_mask;
00029     private:
00030         bool checkDeadMove();
00031         bool checkDeadFall();
00032         bool checkDeadStress();
00033 
00034         bool isOnStack();
00035         bool isOnCond(const OnCondition &cond);
00036         bool isOnWall();
00037 
00038         bool isFalling() const;
00039         Cube::t_models whoIsFalling();
00040 
00041         bool isHeavier(Cube::eWeight power) const;
00042         Cube::t_models whoIsHeavier(Cube::eWeight power);
00043 
00044         bool canDir(Dir::eDir dir, Cube::eWeight power);
00045         bool canMoveOthers(Dir::eDir dir, Cube::eWeight weight);
00046         bool touchSpec(Dir::eDir dir);
00047         void setTouched(Dir::eDir dir);
00048         void moveDirBrute(Dir::eDir dir);
00049 
00050         void freeOldPos();
00051     public:
00052         Rules(Cube *model);
00053         ~Rules();
00054         void takeField(Field *field);
00055 
00056         void occupyNewPos();
00057         bool checkDead(Cube::eAction lastAction);
00058         void changeState();
00059         void finishRound();
00060 
00061         int actionOut();
00062         void actionFall();
00063         bool clearLastFall();
00064         bool actionMoveDir(Dir::eDir dir);
00065         void actionTurnSide() { m_readyToTurn = true; }
00066         void actionActivate() { m_readyToActive = true; }
00067 
00068         Dir::eDir getDir() const { return m_dir; }
00069         Dir::eDir getTouchDir() const { return m_touchDir; }
00070         std::string getAction() const;
00071         std::string getState() const;
00072         bool isOnStrongPad(Cube::eWeight weight);
00073         bool isAtBorder() const;
00074         bool isFreePlace(const V2 &loc) const;
00075         const Cube::t_models getResist(Dir::eDir dir) const;
00076 };
00077 
00078 #endif

Generated on Wed Jun 1 09:54:31 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2