24 #include "strings.hpp"
34 Player::PlayerTeam team;
48 Player::Player(
const QString &name,
long score,
unsigned long ping,
49 PlayerTeam team,
bool spectator,
bool bot)
54 d->spectator = spectator;
59 Player::Player(
const Player &other)
74 bool Player::isBot()
const
79 bool Player::isSpectating()
const
84 bool Player::isTeamlessBot()
const
86 return d->bot && d->team == TEAM_NONE;
89 const QString &Player::name()
const
97 for (
int i = 0; i < d->name.length(); ++i)
99 if (d->name[i] < 32 || d->name[i] > 126)
103 if (d->name[i] == ESCAPE_COLOR_CHAR)
108 int colorCodeIdx = i + 1;
110 for (; colorCodeIdx < d->name.length(); ++colorCodeIdx)
112 QChar symbol = d->name[colorCodeIdx];
115 else if ((range && symbol ==
']') || !range)
118 if (range && colorCodeIdx >= d->name.length())
134 for (
const auto &c : d->name)
137 if ((c < 32 || c > 126) && c != ESCAPE_COLOR_CHAR)
140 switch (c.toLatin1())
159 unsigned long Player::ping()
const
164 long Player::score()
const
169 Player::PlayerTeam Player::teamNum()
const
174 bool Player::operator==(
const Player &other)
const
176 return name().compare(other.name(), Qt::CaseInsensitive) == 0;
181 uint qHash(
const Player &player)
183 return qHash(player.name());