Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9723 was 9656, checked in by bensch, 18 years ago

orxonox/trunk: merged the proxy bache back with no conflicts

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