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

Unit.h

Go to the documentation of this file.
00001 #ifndef HEADER_UNIT_H
00002 #define HEADER_UNIT_H
00003 
00004 class Cube;
00005 class InputProvider;
00006 
00007 #include "KeyControl.h"
00008 #include "ControlSym.h"
00009 #include "Dir.h"
00010 #include "V2.h"
00011 
00012 #include "SDL.h"
00013 #include <string>
00014 
00015 /**
00016  * Unit to drive.
00017  */
00018 class Unit {
00019     private:
00020         KeyControl m_buttons;
00021         ControlSym m_symbols;
00022         Cube *m_model;
00023         bool m_startActive;
00024     private:
00025         char goLeft();
00026         char goRight();
00027         char goUp();
00028         char goDown();
00029     public:
00030         Unit(const KeyControl &buttons, const ControlSym &symbols,
00031                 bool startActive=false);
00032         void takeModel(Cube *model) { m_model = model; }
00033         bool startActive() { return m_startActive; }
00034 
00035         bool canDrive() const;
00036         bool willMove() const;
00037         char drive(const InputProvider *input);
00038         char driveBorrowed(const InputProvider *input,
00039                 const KeyControl &buttons);
00040         void activate();
00041 
00042         char mySymbol(SDLKey key) const;
00043         char mySymbolBorrowed(SDLKey key, const KeyControl &buttons) const;
00044         char myOrder(Dir::eDir dir) const;
00045         char driveOrder(char move);
00046 
00047         bool isMoving() const;
00048         bool isTurning() const;
00049         bool isPushing() const;
00050         bool equalsModel(const Cube *other) const;
00051         V2 getLoc() const;
00052         int getW() const;
00053         int getH() const;
00054         bool isFreePlace(const V2 &loc) const;
00055 
00056         int countAnimPhases(const std::string &anim) const;
00057         bool isPowerful() const;
00058 };
00059 
00060 #endif

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