player.h
1 //------------------------------------------------------------------------------
2 // player.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2010 "Blzut3" <admin@maniacsvault.net>
22 //------------------------------------------------------------------------------
23 #ifndef __PLAYER_H_
24 #define __PLAYER_H_
25 
26 #define MAX_TEAMS 4
27 
28 #include "dptr.h"
29 #include "global.h"
30 #include <QHash>
31 #include <QString>
32 
37 class MAIN_EXPORT Player
38 {
39  public:
40  enum PlayerTeam
41  {
42  TEAM_BLUE,
43  TEAM_RED,
44  TEAM_GREEN,
45  TEAM_GOLD,
46 
47  TEAM_NONE = 0xFF
48  };
49 
50  Player();
51  Player(const QString &name, unsigned short score, unsigned short ping,
52  PlayerTeam team=TEAM_NONE, bool spectator=false, bool bot=false);
53  Player(const Player& other);
54  Player& operator=(const Player& other);
55  virtual ~Player();
56 
57  const QString &name() const;
58  short score() const;
59  unsigned short ping() const;
60  bool isSpectating() const;
61  bool isBot() const;
62  bool isTeamlessBot() const;
63  PlayerTeam teamNum() const;
64 
65  bool operator==(const Player& other) const;
66 
70  QString nameFormatted() const;
71 
77  QString nameColorTagsStripped() const;
78 
79  private:
80  DPtr<Player> d;
81 };
82 
83 uint qHash(const Player& player);
84 
85 #endif
Data structure that holds information about players in a server.
Definition: player.h:37