Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9562 was 9521, checked in by patrick, 18 years ago

extended the callback function for message handlers to match the new sender/dest message structure

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