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

Cube Class Reference

Inheritance diagram for Cube:

Inheritance graph
[legend]
Collaboration diagram for Cube:

Collaboration graph
[legend]

Detailed Description

A object in game.

Definition at line 19 of file Cube.h.

Public Types

typedef std::vector< Cube * > t_models
enum  eWeight { NONE, LIGHT, HEAVY, FIXED }
enum  eAction { ACTION_NO, ACTION_FALL, ACTION_MOVE }

Public Member Functions

 Cube (const V2 &location, eWeight weight, eWeight power, bool alive, Shape *shape)
 Create new model.
 ~Cube ()
 Delete all member but not field.
void setGoal (const Goal &goal)
void setIndex (int model_index)
int getIndex () const
bool isBusy () const
void setBusy (bool busy)
void change_die ()
 Die.
void change_goOut ()
 Go out of room.
void change_remove ()
 Go out of game, e.g.
void change_turnSide ()
void change_setLocation (V2 loc)
V2 getLocation () const
bool isAlive () const
bool isLeft () const
bool isOut () const
bool isLost () const
bool isSatisfy () const
bool isWrong () const
bool isWall () const
bool shouldGoOut () const
eWeight getWeight () const
eWeight getPower () const
const Shapeshape () const
Dir::eDir getLastMoveDir () const
bool isOutDir (Dir::eDir dir) const
void setOutDir (Dir::eDir outDir)
void decOutCapacity ()
 Special model 'output_DIR' has capacity to absorb two fishes, then it changes to normal 'item_light'.
bool isTalking () const
void takeDialogs (const DialogStack *dialogs)
bool isDisintegrated ()
bool isInvisible ()
Animanim ()
const Animconst_anim () const
Rulesrules ()
const Rulesconst_rules () const
virtual std::string toString () const


Member Typedef Documentation

typedef std::vector<Cube*> Cube::t_models
 

Definition at line 21 of file Cube.h.


Member Enumeration Documentation

enum Cube::eAction
 

Enumeration values:
ACTION_NO 
ACTION_FALL 
ACTION_MOVE 

Definition at line 28 of file Cube.h.

00028                      {
00029             ACTION_NO,
00030             ACTION_FALL,
00031             ACTION_MOVE
00032         };

enum Cube::eWeight
 

Enumeration values:
NONE 
LIGHT 
HEAVY 
FIXED 

Definition at line 22 of file Cube.h.

00022                      {
00023             NONE,
00024             LIGHT,
00025             HEAVY,
00026             FIXED
00027         };


Constructor & Destructor Documentation

Cube::Cube const V2 location,
eWeight  weight,
eWeight  power,
bool  alive,
Shape shape
 

Create new model.

Definition at line 22 of file Cube.cpp.

00025 : m_loc(location), m_goal(Goal::noGoal())
00026 {
00027     m_index = -1;
00028     m_busy = false;
00029 
00030     m_weight = weight;
00031     m_power = power;
00032     m_alive = alive;
00033     m_out = false;
00034     m_lookLeft = true;
00035     m_lost = false;
00036     m_outDir = Dir::DIR_NO;
00037     m_outCapacity = 0;
00038 
00039     m_shape = new_shape;
00040     m_rules = new Rules(this);
00041     m_anim = new Anim();
00042     m_dialogs = NULL;
00043 }

Cube::~Cube  ) 
 

Delete all member but not field.

Definition at line 48 of file Cube.cpp.

00049 {
00050     //NOTE: rules must be destroyed before shape because they unmask self
00051     delete m_rules;
00052     delete m_shape;
00053     delete m_anim;
00054 }


Member Function Documentation

Anim* Cube::anim  )  [inline]
 

Definition at line 92 of file Cube.h.

00092 { return m_anim; }

void Cube::change_die  ) 
 

Die.

Definition at line 60 of file Cube.cpp.

00061 {
00062     m_alive = false;
00063     anim()->changeEffect(new EffectDisintegrate());
00064 }

void Cube::change_goOut  ) 
 

Go out of room.

Definition at line 70 of file Cube.cpp.

00071 {
00072     m_out = true;
00073     change_remove();
00074 }

void Cube::change_remove  ) 
 

Go out of game, e.g.

disintegrated skeleton.

Definition at line 80 of file Cube.cpp.

00081 {
00082     m_lost = true;
00083     m_weight = NONE;
00084     //NOTE: hack, object is moved out
00085     m_loc = V2(-1000, -1000);
00086 }

void Cube::change_setLocation V2  loc  )  [inline]
 

Definition at line 66 of file Cube.h.

00066 { m_loc = loc; }

void Cube::change_turnSide  ) 
 

Definition at line 89 of file Cube.cpp.

00090 {
00091     m_lookLeft = !m_lookLeft;
00092 }

const Anim* Cube::const_anim  )  const [inline]
 

Definition at line 93 of file Cube.h.

00093 { return m_anim; }

const Rules* Cube::const_rules  )  const [inline]
 

Definition at line 95 of file Cube.h.

00095 { return m_rules; }

void Cube::decOutCapacity  ) 
 

Special model 'output_DIR' has capacity to absorb two fishes, then it changes to normal 'item_light'.

Definition at line 112 of file Cube.cpp.

00113 {
00114     if (m_outCapacity > 0) {
00115         m_outCapacity--;
00116         if (m_outCapacity == 0) {
00117             m_outDir = Dir::DIR_NO;
00118             m_weight = LIGHT;
00119         }
00120     }
00121 }

int Cube::getIndex  )  const [inline]
 

Definition at line 58 of file Cube.h.

00058 { return m_index; }

Dir::eDir Cube::getLastMoveDir  )  const
 

Definition at line 95 of file Cube.cpp.

00096 {
00097     return m_rules->getDir();
00098 }

V2 Cube::getLocation  )  const [inline]
 

Definition at line 68 of file Cube.h.

00068 { return m_loc; }

eWeight Cube::getPower  )  const [inline]
 

Definition at line 79 of file Cube.h.

00079 { return m_power; }

eWeight Cube::getWeight  )  const [inline]
 

Definition at line 78 of file Cube.h.

00078 { return m_weight; }

bool Cube::isAlive  )  const [inline]
 

Definition at line 69 of file Cube.h.

00069 { return m_alive; }

bool Cube::isBusy  )  const [inline]
 

Definition at line 59 of file Cube.h.

00059 { return m_busy; }

bool Cube::isDisintegrated  ) 
 

Definition at line 124 of file Cube.cpp.

00125 {
00126     return m_anim->isDisintegrated();
00127 }

bool Cube::isInvisible  ) 
 

Definition at line 130 of file Cube.cpp.

00131 {
00132     return m_anim->isInvisible();
00133 }

bool Cube::isLeft  )  const [inline]
 

Definition at line 70 of file Cube.h.

00070 { return m_lookLeft; }

bool Cube::isLost  )  const [inline]
 

Definition at line 72 of file Cube.h.

00072 { return m_lost; }

bool Cube::isOut  )  const [inline]
 

Definition at line 71 of file Cube.h.

00071 { return m_out; }

bool Cube::isOutDir Dir::eDir  dir  )  const [inline]
 

Definition at line 83 of file Cube.h.

00083 { return m_outDir == dir; }

bool Cube::isSatisfy  )  const [inline]
 

Definition at line 73 of file Cube.h.

00073 { return m_goal.isSatisfy(this); }

bool Cube::isTalking  )  const
 

Definition at line 136 of file Cube.cpp.

00137 {
00138     return (m_dialogs && m_dialogs->isTalking(m_index));
00139 }

bool Cube::isWall  )  const [inline]
 

Definition at line 75 of file Cube.h.

00075 { return m_weight >= Cube::FIXED; }

bool Cube::isWrong  )  const [inline]
 

Definition at line 74 of file Cube.h.

00074 { return m_goal.isWrong(this); }

Rules* Cube::rules  )  [inline]
 

Definition at line 94 of file Cube.h.

00094 { return m_rules; }

void Cube::setBusy bool  busy  )  [inline]
 

Definition at line 60 of file Cube.h.

00060 { m_busy = busy; }

void Cube::setGoal const Goal goal  )  [inline]
 

Definition at line 56 of file Cube.h.

00056 { m_goal = goal; }

void Cube::setIndex int  model_index  )  [inline]
 

Definition at line 57 of file Cube.h.

00057 { m_index = model_index; }

void Cube::setOutDir Dir::eDir  outDir  ) 
 

Definition at line 101 of file Cube.cpp.

00102 {
00103     m_outCapacity = 2;
00104     m_outDir = dir;
00105 }

const Shape* Cube::shape  )  const [inline]
 

Definition at line 80 of file Cube.h.

00080 { return m_shape; }

bool Cube::shouldGoOut  )  const [inline]
 

Definition at line 76 of file Cube.h.

00076 { return m_goal.shouldGoOut(); }

void Cube::takeDialogs const DialogStack dialogs  )  [inline]
 

Definition at line 88 of file Cube.h.

00088 { m_dialogs = dialogs; }

std::string Cube::toString  )  const [virtual]
 

Definition at line 142 of file Cube.cpp.

00143 {
00144     return ExInfo("model")
00145             .addInfo("loc", m_loc.toString())
00146             .addInfo("alive", m_alive)
00147             .addInfo("weight", m_weight)
00148             .addInfo("power", m_power)
00149             .addInfo("shape", m_shape->toString()).info();
00150 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:54:47 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2