Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/player_stats.h @ 8184

Last change on this file since 8184 was 8184, checked in by rennerc, 18 years ago

do network cleanup in multiplayerworld destructor

File size: 2.5 KB
Line 
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#include "message_manager.h"
12
13#include <string>
14#include <list>
15
16enum
17{
18  TEAM_NOTEAM = -3,
19  TEAM_RANDOM = -2,
20  TEAM_SPECTATOR = -1
21};
22
23//! A class for storing player information
24class PlayerStats : public Synchronizeable
25{
26
27  public:
28    PlayerStats( const TiXmlElement* root = NULL );
29    PlayerStats( int userId );
30    virtual ~PlayerStats();
31   
32    virtual void varChangeHandler( std::list<int> & id );
33   
34    static PlayerStats * getStats( int userId );
35   
36    inline int getUserId(){ return userId; }
37   
38    inline std::string getPlayerName(){ return playerName; }
39    inline std::string setPlayerName( std::string name );
40   
41    inline int getTeamId(){ return teamId; }
42    inline void setTeamId( int teamId ){ this->teamId = teamId; }
43   
44    inline int getPreferedTeamId(){ return preferedTeamId; }
45    inline void setPreferedTeamId( int preferedTeamId ){ this->preferedTeamId = preferedTeamId; }
46   
47    inline int getScore(){ return score; }
48    inline void setScore( int score ){ this->score = score; }
49   
50    inline int getPlayableClassId(){ return playableClassId; }
51    void setPlayableClassId( int classId ){ this->playableClassId = classId; };
52   
53    inline int getPlayableUniqueId(){ return playableUniqueId; }
54    void setPlayableUniqueId( int uniqueId );
55   
56    inline std::string getModelFileName(){ return modelFileName; }
57    inline void setModelFileName( std::string filename ){ modelFileName = filename; }
58   
59    Playable * getPlayable();
60   
61    static bool changePlayernameHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
62
63  private:
64    int userId;                //!< userId
65
66    std::string playerName;    //!< playername
67
68    int teamId;                //!< teamId
69    int preferedTeamId;        //!< preferedTeamId
70
71    int score;                 //!< users score points
72    int playableClassId;       //!< players playable class id
73    int playableUniqueId;      //!< playable's uniqueId
74    std::string modelFileName; //!< model filename
75
76    Playable * playable;       //!< pointer to players playable
77
78    // handles for SynchronizeableVars
79    int userId_handle;
80    int playerName_handle;
81    int teamId_handle;
82    int preferedTeamId_handle;
83    int score_handle;
84    int playableClassId_handle;
85    int playableUniqueId_handle;
86    int modelFileName_handle;
87   
88    void init();
89};
90
91#endif /* _PLAYER_STATS_H */
Note: See TracBrowser for help on using the repository browser.