1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#include "PlayerBase.h"
#include <cstdlib>
PlayerBase::PlayerBase() :
TeamController(),
rank(-1),
spectator(false),
isFromDemo(false),
readyToStart(false),
desynced(false),
cpuUsage (0.0f)
{
}
void PlayerBase::SetValue(const std::string& key, const std::string& value)
{
if (key == "team") {
team = std::atoi(value.c_str());
} else if (key == "name") {
name = value;
} else if (key == "rank") {
rank = std::atoi(value.c_str());
} else if (key == "countrycode") {
countryCode = value;
} else if (key == "spectator") {
spectator = static_cast<bool>(std::atoi(value.c_str()));
} else if (key == "isfromdemo") {
isFromDemo = static_cast<bool>(std::atoi(value.c_str()));
} else {
customValues[key] = value;
}
}
|