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
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"
[8184]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
[7974]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   
[8014]34    static PlayerStats * getStats( int userId );
[7974]35   
36    inline int getUserId(){ return userId; }
37   
[8184]38    inline std::string getPlayerName(){ return playerName; }
39    inline std::string setPlayerName( std::string name );
40   
[7984]41    inline int getTeamId(){ return teamId; }
42    inline void setTeamId( int teamId ){ this->teamId = teamId; }
[7974]43   
[8067]44    inline int getPreferedTeamId(){ return preferedTeamId; }
45    inline void setPreferedTeamId( int preferedTeamId ){ this->preferedTeamId = preferedTeamId; }
46   
[7974]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   
[7979]56    inline std::string getModelFileName(){ return modelFileName; }
57    inline void setModelFileName( std::string filename ){ modelFileName = filename; }
58   
[7974]59    Playable * getPlayable();
[8184]60   
61    static bool changePlayernameHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
[7974]62
63  private:
64    int userId;                //!< userId
[8184]65
66    std::string playerName;    //!< playername
67
[7984]68    int teamId;                //!< teamId
[8067]69    int preferedTeamId;        //!< preferedTeamId
[7974]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;
[8184]80    int playerName_handle;
[8067]81    int teamId_handle;
82    int preferedTeamId_handle;
[7974]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.