Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/player_stats.h @ 9571

Last change on this file since 9571 was 9110, checked in by bensch, 18 years ago

orxonox/trunk: merged the Presentation back

File size: 2.8 KB
RevLine 
[7974]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"
[8623]11#include "message_manager.h"
[7974]12
13#include <string>
14#include <list>
15
[8067]16enum
17{
18  TEAM_NOTEAM = -3,
19  TEAM_RANDOM = -2,
20  TEAM_SPECTATOR = -1
21};
22
[9110]23struct PlayerScore
24{
25  std::string name;
26  int score;
27};
28typedef std::list<PlayerScore> TeamScoreList;
29typedef std::map<int,TeamScoreList> ScoreList;
30
[7974]31//! A class for storing player information
32class PlayerStats : public Synchronizeable
33{
34
35  public:
36    PlayerStats( const TiXmlElement* root = NULL );
37    PlayerStats( int userId );
38    virtual ~PlayerStats();
39   
40    virtual void varChangeHandler( std::list<int> & id );
41   
[8014]42    static PlayerStats * getStats( int userId );
[7974]43   
44    inline int getUserId(){ return userId; }
45   
[7984]46    inline int getTeamId(){ return teamId; }
47    inline void setTeamId( int teamId ){ this->teamId = teamId; }
[7974]48   
[8067]49    inline int getPreferedTeamId(){ return preferedTeamId; }
50    inline void setPreferedTeamId( int preferedTeamId ){ this->preferedTeamId = preferedTeamId; }
51   
[7974]52    inline int getScore(){ return score; }
53    inline void setScore( int score ){ this->score = score; }
54   
55    inline int getPlayableClassId(){ return playableClassId; }
56    void setPlayableClassId( int classId ){ this->playableClassId = classId; };
57   
58    inline int getPlayableUniqueId(){ return playableUniqueId; }
59    void setPlayableUniqueId( int uniqueId );
60   
[7979]61    inline std::string getModelFileName(){ return modelFileName; }
62    inline void setModelFileName( std::string filename ){ modelFileName = filename; }
63   
[7974]64    Playable * getPlayable();
[8623]65   
66    inline std::string getNickName(){ return this->nickName; }
67    void setNickName( std::string nick );
68    static bool changeNickHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
69    void shellNick( const std::string&  newNick );
70   
71    static void deleteAllPlayerStats();
[9110]72   
73    static ScoreList getScoreList();
[7974]74
75  private:
76    int userId;                //!< userId
[7984]77    int teamId;                //!< teamId
[8067]78    int preferedTeamId;        //!< preferedTeamId
[7974]79
[8623]80    std::string nickName;      //!< players nickname
81    std::string oldNickName;   //!< nickname player had before
82
[7974]83    int score;                 //!< users score points
84    int playableClassId;       //!< players playable class id
85    int playableUniqueId;      //!< playable's uniqueId
86    std::string modelFileName; //!< model filename
87
88    Playable * playable;       //!< pointer to players playable
89
90    // handles for SynchronizeableVars
91    int userId_handle;
[8067]92    int teamId_handle;
93    int preferedTeamId_handle;
[7974]94    int score_handle;
95    int playableClassId_handle;
96    int playableUniqueId_handle;
97    int modelFileName_handle;
[8623]98    int nickName_handler;
[7974]99   
100    void init();
101};
102
103#endif /* _PLAYER_STATS_H */
Note: See TracBrowser for help on using the repository browser.