Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8881 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
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
[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   
[7984]38    inline int getTeamId(){ return teamId; }
39    inline void setTeamId( int teamId ){ this->teamId = teamId; }
[7974]40   
[8067]41    inline int getPreferedTeamId(){ return preferedTeamId; }
42    inline void setPreferedTeamId( int preferedTeamId ){ this->preferedTeamId = preferedTeamId; }
43   
[7974]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   
[7979]53    inline std::string getModelFileName(){ return modelFileName; }
54    inline void setModelFileName( std::string filename ){ modelFileName = filename; }
55   
[7974]56    Playable * getPlayable();
[8623]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();
[7974]64
65  private:
66    int userId;                //!< userId
[7984]67    int teamId;                //!< teamId
[8067]68    int preferedTeamId;        //!< preferedTeamId
[7974]69
[8623]70    std::string nickName;      //!< players nickname
71    std::string oldNickName;   //!< nickname player had before
72
[7974]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;
[8067]82    int teamId_handle;
83    int preferedTeamId_handle;
[7974]84    int score_handle;
85    int playableClassId_handle;
86    int playableUniqueId_handle;
87    int modelFileName_handle;
[8623]88    int nickName_handler;
[7974]89   
90    void init();
91};
92
93#endif /* _PLAYER_STATS_H */
Note: See TracBrowser for help on using the repository browser.