| 1 | /*! | 
|---|
| 2 | * @file player_stats.h | 
|---|
| 3 | * @brief Definition of PlayerStats | 
|---|
| 4 | */ | 
|---|
| 5 |  | 
|---|
| 6 | #ifndef _PLAYER_STATS_H | 
|---|
| 7 | #define _PLAYER_STATS_H | 
|---|
| 8 |  | 
|---|
| 9 | #include "synchronizeable.h" | 
|---|
| 10 | #include "playable.h" | 
|---|
| 11 |  | 
|---|
| 12 | #include <string> | 
|---|
| 13 | #include <list> | 
|---|
| 14 |  | 
|---|
| 15 | enum | 
|---|
| 16 | { | 
|---|
| 17 | TEAM_NOTEAM = -3, | 
|---|
| 18 | TEAM_RANDOM = -2, | 
|---|
| 19 | TEAM_SPECTATOR = -1 | 
|---|
| 20 | }; | 
|---|
| 21 |  | 
|---|
| 22 | //! A class for storing player information | 
|---|
| 23 | class PlayerStats : public Synchronizeable | 
|---|
| 24 | { | 
|---|
| 25 |  | 
|---|
| 26 | public: | 
|---|
| 27 | PlayerStats( const TiXmlElement* root = NULL ); | 
|---|
| 28 | PlayerStats( int userId ); | 
|---|
| 29 | virtual ~PlayerStats(); | 
|---|
| 30 |  | 
|---|
| 31 | virtual void varChangeHandler( std::list<int> & id ); | 
|---|
| 32 |  | 
|---|
| 33 | static PlayerStats * getStats( int userId ); | 
|---|
| 34 |  | 
|---|
| 35 | inline int getUserId(){ return userId; } | 
|---|
| 36 |  | 
|---|
| 37 | inline int getTeamId(){ return teamId; } | 
|---|
| 38 | inline void setTeamId( int teamId ){ this->teamId = teamId; } | 
|---|
| 39 |  | 
|---|
| 40 | inline int getPreferedTeamId(){ return preferedTeamId; } | 
|---|
| 41 | inline void setPreferedTeamId( int preferedTeamId ){ this->preferedTeamId = preferedTeamId; } | 
|---|
| 42 |  | 
|---|
| 43 | inline int getScore(){ return score; } | 
|---|
| 44 | inline void setScore( int score ){ this->score = score; } | 
|---|
| 45 |  | 
|---|
| 46 | inline int getPlayableClassId(){ return playableClassId; } | 
|---|
| 47 | void setPlayableClassId( int classId ){ this->playableClassId = classId; }; | 
|---|
| 48 |  | 
|---|
| 49 | inline int getPlayableUniqueId(){ return playableUniqueId; } | 
|---|
| 50 | void setPlayableUniqueId( int uniqueId ); | 
|---|
| 51 |  | 
|---|
| 52 | inline std::string getModelFileName(){ return modelFileName; } | 
|---|
| 53 | inline void setModelFileName( std::string filename ){ modelFileName = filename; } | 
|---|
| 54 |  | 
|---|
| 55 | Playable * getPlayable(); | 
|---|
| 56 |  | 
|---|
| 57 | private: | 
|---|
| 58 | int userId;                //!< userId | 
|---|
| 59 | int teamId;                //!< teamId | 
|---|
| 60 | int preferedTeamId;        //!< preferedTeamId | 
|---|
| 61 |  | 
|---|
| 62 | int score;                 //!< users score points | 
|---|
| 63 | int playableClassId;       //!< players playable class id | 
|---|
| 64 | int playableUniqueId;      //!< playable's uniqueId | 
|---|
| 65 | std::string modelFileName; //!< model filename | 
|---|
| 66 |  | 
|---|
| 67 | Playable * playable;       //!< pointer to players playable | 
|---|
| 68 |  | 
|---|
| 69 | // handles for SynchronizeableVars | 
|---|
| 70 | int userId_handle; | 
|---|
| 71 | int teamId_handle; | 
|---|
| 72 | int preferedTeamId_handle; | 
|---|
| 73 | int score_handle; | 
|---|
| 74 | int playableClassId_handle; | 
|---|
| 75 | int playableUniqueId_handle; | 
|---|
| 76 | int modelFileName_handle; | 
|---|
| 77 |  | 
|---|
| 78 | void init(); | 
|---|
| 79 | }; | 
|---|
| 80 |  | 
|---|
| 81 | #endif /* _PLAYER_STATS_H */ | 
|---|