00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #ifndef __PLAYER_H_
00024 #define __PLAYER_H_
00025 
00026 #define MAX_TEAMS 4
00027 
00028 #include "global.h"
00029 #include <QHash>
00030 #include <QString>
00031 
00035 class MAIN_EXPORT Player
00036 {
00037         public:
00038                 enum PlayerTeam
00039                 {
00040                         TEAM_BLUE,
00041                         TEAM_RED,
00042                         TEAM_GREEN,
00043                         TEAM_GOLD,
00044 
00045                         TEAM_NONE = 0xFF
00046                 };
00047 
00048                 Player();
00049                 Player(const QString &name, unsigned short score, unsigned short ping, PlayerTeam team=TEAM_NONE, bool spectator=false, bool bot=false);
00050 
00051                 const QString   &name() const { return playerName; }
00052                 short                   score() const { return currentScore; }
00053                 unsigned short  ping() const { return currentPing; }
00054                 bool                    isSpectating() const { return spectator; }
00055                 bool                    isBot() const { return bot; }
00056                 bool                    isTeamlessBot() const { return bot && team == TEAM_NONE; }
00057                 PlayerTeam              teamNum() const { return team; }
00058 
00059                 bool                    operator==(const Player& other) const;
00060 
00064                 QString                 nameFormatted() const;
00065 
00071                 QString                 nameColorTagsStripped() const;
00072 
00073         protected:
00074 
00075                 QString                 playerName;
00076                 short                   currentScore;
00077                 unsigned short  currentPing;
00078                 bool                    spectator;
00079                 bool                    bot;
00080                 PlayerTeam              team;
00081 };
00082 
00083 uint qHash(const Player& player);
00084 
00085 #endif