00001 #ifndef __PLAYERBASE_H
00002 #define __PLAYERBASE_H
00003
00004 #include <vector>
00005 #include "util.h"
00006 #include "tile.h"
00007 #include "tool.h"
00008
00014 class PlayerBase
00015 {
00016 public:
00017 PlayerBase(unsigned id, string nm, char race, char color, int x=0, int y=0);
00018 PlayerBase(const PlayerBase& p);
00019 PlayerBase();
00020 virtual ~PlayerBase();
00021
00022 PlayerBase& operator=(const PlayerBase& p);
00023
00024 unsigned getIndex() const ;
00025 char getRace() const ;
00026 char getColor() const ;
00027 int getPosX() const ;
00028 int getPosY() const ;
00029 int getTileX() const ;
00030 int getTileY() const ;
00031 int getResource(Resource r) const ;
00032 int getVelocity() const ;
00033 int getBaseVelocity() const {return baseVelocity;};
00034 int getDirX() const ;
00035 int getDirY() const ;
00036 bool isMoving() const ;
00037 bool isAlive() const ;
00038 unsigned getCardinalDirection() const;
00039 const string& getName() const ;
00040
00044 virtual string getProperties() const ;
00045
00046 void setIndex(unsigned i);
00047 void setAlive(bool lives);
00048 void setRace(char c);
00049 void setColor(char c);
00050 void setPosX(int x);
00051 void setPosY(int y);
00052 void setPos(int x, int y) {setPosX(x), setPosY(y);};
00053 void setDirX(int x);
00054 void setDirY(int y);
00055 void setResource(Resource r, int a);
00056 void setName(const string& n);
00057
00058 void stop();
00059 void setCardinalDirection(unsigned direction);
00060 void setVelocity(int v);
00061
00067 virtual void setProperties(const string& properties);
00068
00073 void print() const;
00074
00075 protected:
00076 int index;
00077 string name;
00078 char race;
00079 char color;
00080 int posx;
00081 int posy;
00082 int dirx;
00083 int diry;
00084 int baseVelocity;
00085 int velocity;
00086 int resources[NUMRESOURCES];
00087 bool alive;
00088 };
00089
00090 #endif