Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8774 was 8623, checked in by bensch, 18 years ago

orxonox/trunk: merged the network branche back here
merged with command:
svn merge -r8230:HEAD https://svn.orxonox.net/orxonox/branches/network .
conflicts resolved in favour of the network branche (conflicts were in network)

File size: 2.7 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 int getTeamId(){ return teamId; }
39    inline void setTeamId( int teamId ){ this->teamId = teamId; }
40   
41    inline int getPreferedTeamId(){ return preferedTeamId; }
42    inline void setPreferedTeamId( int preferedTeamId ){ this->preferedTeamId = preferedTeamId; }
43   
44    inline int getScore(){ return score; }
45    inline void setScore( int score ){ this->score = score; }
46   
47    inline int getPlayableClassId(){ return playableClassId; }
48    void setPlayableClassId( int classId ){ this->playableClassId = classId; };
49   
50    inline int getPlayableUniqueId(){ return playableUniqueId; }
51    void setPlayableUniqueId( int uniqueId );
52   
53    inline std::string getModelFileName(){ return modelFileName; }
54    inline void setModelFileName( std::string filename ){ modelFileName = filename; }
55   
56    Playable * getPlayable();
57   
58    inline std::string getNickName(){ return this->nickName; }
59    void setNickName( std::string nick );
60    static bool changeNickHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
61    void shellNick( const std::string&  newNick );
62   
63    static void deleteAllPlayerStats();
64
65  private:
66    int userId;                //!< userId
67    int teamId;                //!< teamId
68    int preferedTeamId;        //!< preferedTeamId
69
70    std::string nickName;      //!< players nickname
71    std::string oldNickName;   //!< nickname player had before
72
73    int score;                 //!< users score points
74    int playableClassId;       //!< players playable class id
75    int playableUniqueId;      //!< playable's uniqueId
76    std::string modelFileName; //!< model filename
77
78    Playable * playable;       //!< pointer to players playable
79
80    // handles for SynchronizeableVars
81    int userId_handle;
82    int teamId_handle;
83    int preferedTeamId_handle;
84    int score_handle;
85    int playableClassId_handle;
86    int playableUniqueId_handle;
87    int modelFileName_handle;
88    int nickName_handler;
89   
90    void init();
91};
92
93#endif /* _PLAYER_STATS_H */
Note: See TracBrowser for help on using the repository browser.