Explorar o código

Removed getStr(bool), replaced with similar toString()

Ivan Savenko %!s(int64=2) %!d(string=hai) anos
pai
achega
86a7f5f5cd

+ 1 - 1
AI/BattleAI/BattleAI.cpp

@@ -244,7 +244,7 @@ void CBattleAI::battleStart(const CCreatureSet *army1, const CCreatureSet *army2
 
 void CBattleAI::print(const std::string &text) const
 {
-	logAi->trace("%s Battle AI[%p]: %s", playerID.getStr(), this, text);
+	logAi->trace("%s Battle AI[%p]: %s", playerID.toString(), this, text);
 }
 
 std::optional<BattleAction> CBattleAI::considerFleeingOrSurrendering()

+ 1 - 1
AI/BattleAI/BattleEvaluator.cpp

@@ -703,7 +703,7 @@ void BattleEvaluator::evaluateCreatureSpellcast(const CStack * stack, PossibleSp
 
 void BattleEvaluator::print(const std::string & text) const
 {
-	logAi->trace("%s Battle AI[%p]: %s", playerID.getStr(), this, text);
+	logAi->trace("%s Battle AI[%p]: %s", playerID.toString(), this, text);
 }
 
 

+ 1 - 1
AI/BattleAI/StackWithBonuses.cpp

@@ -231,7 +231,7 @@ void StackWithBonuses::removeUnitBonus(const CSelector & selector)
 std::string StackWithBonuses::getDescription() const
 {
 	std::ostringstream oss;
-	oss << unitOwner().getStr();
+	oss << unitOwner().toString();
 	oss << " battle stack [" << unitId() << "]: " << getCount() << " of ";
 	if(type)
 		oss << type->getJsonKey();

+ 7 - 7
AI/Nullkiller/AIGateway.cpp

@@ -192,7 +192,7 @@ void AIGateway::gameOver(PlayerColor player, const EVictoryLossCheckResult & vic
 {
 	LOG_TRACE_PARAMS(logAi, "victoryLossCheckResult '%s'", victoryLossCheckResult.messageToSelf.toString());
 	NET_EVENT_HANDLER;
-	logAi->debug("Player %d (%s): I heard that player %d (%s) %s.", playerID, playerID.getStr(), player, player.getStr(), (victoryLossCheckResult.victory() ? "won" : "lost"));
+	logAi->debug("Player %d (%s): I heard that player %d (%s) %s.", playerID, playerID.toString(), player, player.toString(), (victoryLossCheckResult.victory() ? "won" : "lost"));
 
 	// some whitespace to flush stream
 	logAi->debug(std::string(200, ' '));
@@ -201,12 +201,12 @@ void AIGateway::gameOver(PlayerColor player, const EVictoryLossCheckResult & vic
 	{
 		if(victoryLossCheckResult.victory())
 		{
-			logAi->debug("AIGateway: Player %d (%s) won. I won! Incredible!", player, player.getStr());
+			logAi->debug("AIGateway: Player %d (%s) won. I won! Incredible!", player, player.toString());
 			logAi->debug("Turn nr %d", myCb->getDate());
 		}
 		else
 		{
-			logAi->debug("AIGateway: Player %d (%s) lost. It's me. What a disappointment! :(", player, player.getStr());
+			logAi->debug("AIGateway: Player %d (%s) lost. It's me. What a disappointment! :(", player, player.toString());
 		}
 
 		// some whitespace to flush stream
@@ -776,7 +776,7 @@ void AIGateway::makeTurn()
 	MAKING_TURN;
 
 	auto day = cb->getDate(Date::DAY);
-	logAi->info("Player %d (%s) starting turn, day %d", playerID, playerID.getStr(), day);
+	logAi->info("Player %d (%s) starting turn, day %d", playerID, playerID.toString(), day);
 
 	boost::shared_lock<boost::shared_mutex> gsLock(CGameState::mutex);
 	setThreadName("AIGateway::makeTurn");
@@ -1096,7 +1096,7 @@ void AIGateway::battleEnd(const BattleResult * br, QueryID queryID)
 	assert(status.getBattle() == ONGOING_BATTLE);
 	status.setBattle(ENDING_BATTLE);
 	bool won = br->winner == myCb->battleGetMySide();
-	logAi->debug("Player %d (%s): I %s the %s!", playerID, playerID.getStr(), (won ? "won" : "lost"), battlename);
+	logAi->debug("Player %d (%s): I %s the %s!", playerID, playerID.toString(), (won ? "won" : "lost"), battlename);
 	battlename.clear();
 
 	if (queryID != QueryID::NONE)
@@ -1421,7 +1421,7 @@ void AIGateway::tryRealize(Goals::Trade & g) //trade
 
 void AIGateway::endTurn()
 {
-	logAi->info("Player %d (%s) ends turn", playerID, playerID.getStr());
+	logAi->info("Player %d (%s) ends turn", playerID, playerID.toString());
 	if(!status.haveTurn())
 	{
 		logAi->error("Not having turn at the end of turn???");
@@ -1441,7 +1441,7 @@ void AIGateway::endTurn()
 	}
 	while(status.haveTurn()); //for some reasons, our request may fail -> stop requesting end of turn only after we've received a confirmation that it's over
 
-	logGlobal->info("Player %d (%s) ended turn", playerID, playerID.getStr());
+	logGlobal->info("Player %d (%s) ended turn", playerID, playerID.toString());
 }
 
 void AIGateway::buildArmyIn(const CGTownInstance * t)

+ 6 - 6
AI/VCAI/VCAI.cpp

@@ -204,7 +204,7 @@ void VCAI::gameOver(PlayerColor player, const EVictoryLossCheckResult & victoryL
 {
 	LOG_TRACE_PARAMS(logAi, "victoryLossCheckResult '%s'", victoryLossCheckResult.messageToSelf.toString());
 	NET_EVENT_HANDLER;
-	logAi->debug("Player %d (%s): I heard that player %d (%s) %s.", playerID, playerID.getStr(), player, player.getStr(), (victoryLossCheckResult.victory() ? "won" : "lost"));
+	logAi->debug("Player %d (%s): I heard that player %d (%s) %s.", playerID, playerID.toString(), player, player.toString(), (victoryLossCheckResult.victory() ? "won" : "lost"));
 	if(player == playerID)
 	{
 		if(victoryLossCheckResult.victory())
@@ -214,7 +214,7 @@ void VCAI::gameOver(PlayerColor player, const EVictoryLossCheckResult & victoryL
 		}
 		else
 		{
-			logAi->debug("VCAI: Player %d (%s) lost. It's me. What a disappointment! :(", player, player.getStr());
+			logAi->debug("VCAI: Player %d (%s) lost. It's me. What a disappointment! :(", player, player.toString());
 		}
 
 		finish();
@@ -779,7 +779,7 @@ void VCAI::makeTurn()
 	MAKING_TURN;
 
 	auto day = cb->getDate(Date::DAY);
-	logAi->info("Player %d (%s) starting turn, day %d", playerID, playerID.getStr(), day);
+	logAi->info("Player %d (%s) starting turn, day %d", playerID, playerID.toString(), day);
 
 	boost::shared_lock<boost::shared_mutex> gsLock(CGameState::mutex);
 	setThreadName("VCAI::makeTurn");
@@ -1593,7 +1593,7 @@ void VCAI::battleEnd(const BattleResult * br, QueryID queryID)
 	assert(status.getBattle() == ONGOING_BATTLE);
 	status.setBattle(ENDING_BATTLE);
 	bool won = br->winner == myCb->battleGetMySide();
-	logAi->debug("Player %d (%s): I %s the %s!", playerID, playerID.getStr(), (won ? "won" : "lost"), battlename);
+	logAi->debug("Player %d (%s): I %s the %s!", playerID, playerID.toString(), (won ? "won" : "lost"), battlename);
 	battlename.clear();
 
 	if (queryID != QueryID::NONE)
@@ -2288,7 +2288,7 @@ HeroPtr VCAI::primaryHero() const
 
 void VCAI::endTurn()
 {
-	logAi->info("Player %d (%s) ends turn", playerID, playerID.getStr());
+	logAi->info("Player %d (%s) ends turn", playerID, playerID.toString());
 	if(!status.haveTurn())
 	{
 		logAi->error("Not having turn at the end of turn???");
@@ -2300,7 +2300,7 @@ void VCAI::endTurn()
 	}
 	while(status.haveTurn()); //for some reasons, our request may fail -> stop requesting end of turn only after we've received a confirmation that it's over
 
-	logGlobal->info("Player %d (%s) ended turn", playerID, playerID.getStr());
+	logGlobal->info("Player %d (%s) ended turn", playerID, playerID.toString());
 }
 
 void VCAI::striveToGoal(Goals::TSubgoal basicGoal)

+ 2 - 2
client/CPlayerInterface.cpp

@@ -125,7 +125,7 @@ struct HeroObjectRetriever
 CPlayerInterface::CPlayerInterface(PlayerColor Player):
 	localState(std::make_unique<PlayerLocalState>(*this))
 {
-	logGlobal->trace("\tHuman player interface for player %s being constructed", Player.getStr());
+	logGlobal->trace("\tHuman player interface for player %s being constructed", Player.toString());
 	destinationTeleport = ObjectInstanceID();
 	destinationTeleportPos = int3(-1);
 	GH.defActionsDef = 0;
@@ -147,7 +147,7 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player):
 
 CPlayerInterface::~CPlayerInterface()
 {
-	logGlobal->trace("\tHuman player interface for player %s being destructed", playerID.getStr());
+	logGlobal->trace("\tHuman player interface for player %s being destructed", playerID.toString());
 	delete showingDialog;
 	delete cingconsole;
 	if (LOCPLINT == this)

+ 6 - 6
client/Client.cpp

@@ -408,7 +408,7 @@ void CClient::initPlayerEnvironments()
 	bool hasHumanPlayer = false;
 	for(auto & color : allPlayers)
 	{
-		logNetwork->info("Preparing environment for player %s", color.getStr());
+		logNetwork->info("Preparing environment for player %s", color.toString());
 		playerEnvironments[color] = std::make_shared<CPlayerEnvironment>(color, this, std::make_shared<CCallback>(gs, color, this));
 		
 		if(!hasHumanPlayer && gs->players[color].isHuman())
@@ -439,7 +439,7 @@ void CClient::initPlayerInterfaces()
 
 		if(!vstd::contains(playerint, color))
 		{
-			logNetwork->info("Preparing interface for player %s", color.getStr());
+			logNetwork->info("Preparing interface for player %s", color.toString());
 			if(playerInfo.second.isControlledByAI())
 			{
 				bool alliedToHuman = false;
@@ -448,12 +448,12 @@ void CClient::initPlayerInterfaces()
 						alliedToHuman = true;
 
 				auto AiToGive = aiNameForPlayer(playerInfo.second, false, alliedToHuman);
-				logNetwork->info("Player %s will be lead by %s", color.getStr(), AiToGive);
+				logNetwork->info("Player %s will be lead by %s", color.toString(), AiToGive);
 				installNewPlayerInterface(CDynLibHandler::getNewAI(AiToGive), color);
 			}
 			else
 			{
-				logNetwork->info("Player %s will be lead by human", color.getStr());
+				logNetwork->info("Player %s will be lead by human", color.toString());
 				installNewPlayerInterface(std::make_shared<CPlayerInterface>(color), color);
 			}
 		}
@@ -503,7 +503,7 @@ void CClient::installNewPlayerInterface(std::shared_ptr<CGameInterface> gameInte
 
 	playerint[color] = gameInterface;
 
-	logGlobal->trace("\tInitializing the interface for player %s", color.getStr());
+	logGlobal->trace("\tInitializing the interface for player %s", color.toString());
 	auto cb = std::make_shared<CCallback>(gs, color, this);
 	battleCallbacks[color] = cb;
 	gameInterface->initGameInterface(playerEnvironments.at(color), cb);
@@ -519,7 +519,7 @@ void CClient::installNewBattleInterface(std::shared_ptr<CBattleGameInterface> ba
 
 	if(needCallback)
 	{
-		logGlobal->trace("\tInitializing the battle interface for player %s", color.getStr());
+		logGlobal->trace("\tInitializing the battle interface for player %s", color.toString());
 		auto cbc = std::make_shared<CBattleCallback>(color, this);
 		battleCallbacks[color] = cbc;
 		battleInterface->initBattleInterface(playerEnvironments.at(color), cbc);

+ 1 - 1
client/ClientCommandManager.cpp

@@ -97,7 +97,7 @@ void ClientCommandManager::handleGoSoloCommand()
 			if(elem.second.human)
 			{
 				auto AiToGive = CSH->client->aiNameForPlayer(*CSH->client->getPlayerSettings(elem.first), false, false);
-				printCommandMessage("Player " + elem.first.getStr() + " will be lead by " + AiToGive, ELogLevel::INFO);
+				printCommandMessage("Player " + elem.first.toString() + " will be lead by " + AiToGive, ELogLevel::INFO);
 				CSH->client->installNewPlayerInterface(CDynLibHandler::getNewAI(AiToGive), elem.first);
 			}
 		}

+ 3 - 3
client/NetPacksClient.cpp

@@ -874,7 +874,7 @@ void ApplyClientNetPackVisitor::visitPlayerBlocked(PlayerBlocked & pack)
 
 void ApplyClientNetPackVisitor::visitYourTurn(YourTurn & pack)
 {
-	logNetwork->debug("Server gives turn to %s", pack.player.getStr());
+	logNetwork->debug("Server gives turn to %s", pack.player.toString());
 
 	callAllInterfaces(cl, &IGameEventsReceiver::playerStartsTurn, pack.player);
 	callOnlyThatInterface(cl, pack.player, &CGameInterface::yourTurn, pack.queryID);
@@ -882,12 +882,12 @@ void ApplyClientNetPackVisitor::visitYourTurn(YourTurn & pack)
 
 void ApplyClientNetPackVisitor::visitTurnTimeUpdate(TurnTimeUpdate & pack)
 {
-	logNetwork->debug("Server sets turn timer {turn: %d, base: %d, battle: %d, creature: %d} for %s", pack.turnTimer.turnTimer, pack.turnTimer.baseTimer, pack.turnTimer.battleTimer, pack.turnTimer.creatureTimer, pack.player.getStr());
+	logNetwork->debug("Server sets turn timer {turn: %d, base: %d, battle: %d, creature: %d} for %s", pack.turnTimer.turnTimer, pack.turnTimer.baseTimer, pack.turnTimer.battleTimer, pack.turnTimer.creatureTimer, pack.player.toString());
 }
 
 void ApplyClientNetPackVisitor::visitPlayerMessageClient(PlayerMessageClient & pack)
 {
-	logNetwork->debug("pack.player %s sends a message: %s", pack.player.getStr(), pack.text);
+	logNetwork->debug("pack.player %s sends a message: %s", pack.player.toString(), pack.text);
 
 	std::ostringstream str;
 	if(pack.player.isSpectator())

+ 1 - 1
client/battle/BattleInterface.cpp

@@ -244,7 +244,7 @@ void BattleInterface::giveCommand(EActionType action, BattleHex tile, SpellID sp
 	auto side = curInt->cb->playerToSide(curInt->playerID);
 	if(!side)
 	{
-		logGlobal->error("Player %s is not in battle", curInt->playerID.getStr());
+		logGlobal->error("Player %s is not in battle", curInt->playerID.toString());
 		return;
 	}
 

+ 1 - 1
client/lobby/CSelectionBase.cpp

@@ -240,7 +240,7 @@ void InfoCard::changeSelection()
 		int pid = p.first;
 		if(pset)
 		{
-			auto name = boost::str(boost::format("%s (%d-%d %s)") % p.second.name % p.second.connection % pid % pset->color.getStr());
+			auto name = boost::str(boost::format("%s (%d-%d %s)") % p.second.name % p.second.connection % pid % pset->color.toString());
 			labelGroupPlayersAssigned->add(24, 285 + (int)labelGroupPlayersAssigned->currentSize()*(int)graphics->fonts[FONT_SMALL]->getLineHeight(), name);
 		}
 		else

+ 1 - 1
client/render/Graphics.cpp

@@ -151,7 +151,7 @@ void Graphics::blueToPlayersAdv(SDL_Surface * sur, PlayerColor player)
 		}
 		else
 		{
-			logGlobal->error("Wrong player id in blueToPlayersAdv (%s)!", player.getStr());
+			logGlobal->error("Wrong player id in blueToPlayersAdv (%s)!", player.toString());
 			return;
 		}
 //FIXME: not all player colored images have player palette at last 32 indexes

+ 10 - 4
lib/CPlayerState.cpp

@@ -11,6 +11,8 @@
 
 #include "CPlayerState.h"
 #include "gameState/QuestInfo.h"
+#include "CGeneralTextHandler.h"
+#include "VCMI_Lib.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 
@@ -43,7 +45,7 @@ PlayerState::~PlayerState() = default;
 
 std::string PlayerState::nodeName() const
 {
-	return "Player " + color.getStrCap(false);
+	return "Player " + color.toString();
 }
 
 PlayerColor PlayerState::getId() const
@@ -60,18 +62,22 @@ int32_t PlayerState::getIconIndex() const
 {
 	return color.getNum();
 }
+
 std::string PlayerState::getJsonKey() const
 {
-	return color.getStr(false);
+	return color.toString();
 }
+
 std::string PlayerState::getNameTranslated() const
 {
-	return color.getStr(true);
+	return VLC->generaltexth->translate(getNameTextID());
 }
+
 std::string PlayerState::getNameTextID() const
 {
-	return color.getStr(false);
+	return TextIdentifier("core.plcolors", color.getNum()).get();
 }
+
 void PlayerState::registerIcons(const IconRegistar & cb) const
 {
 	//We cannot register new icons for players

+ 1 - 1
lib/CStack.cpp

@@ -162,7 +162,7 @@ const CGHeroInstance * CStack::getMyHero() const
 std::string CStack::nodeName() const
 {
 	std::ostringstream oss;
-	oss << owner.getStr();
+	oss << owner.toString();
 	oss << " battle stack [" << ID << "]: " << getCount() << " of ";
 	if(type)
 		oss << type->getNamePluralTextID();

+ 1 - 1
lib/StartInfo.cpp

@@ -41,7 +41,7 @@ PlayerSettings & StartInfo::getIthPlayersSettings(const PlayerColor & no)
 {
 	if(playerInfos.find(no) != playerInfos.end())
 		return playerInfos[no];
-	logGlobal->error("Cannot find info about player %s. Throwing...", no.getStr());
+	logGlobal->error("Cannot find info about player %s. Throwing...", no.toString());
 	throw std::runtime_error("Cannot find info about player");
 }
 const PlayerSettings & StartInfo::getIthPlayersSettings(const PlayerColor & no) const

+ 2 - 2
lib/battle/BattleInfo.cpp

@@ -532,7 +532,7 @@ const CGHeroInstance * BattleInfo::getHero(const PlayerColor & player) const
 		if(side.color == player)
 			return side.hero;
 
-	logGlobal->error("Player %s is not in battle!", player.getStr());
+	logGlobal->error("Player %s is not in battle!", player.toString());
 	return nullptr;
 }
 
@@ -542,7 +542,7 @@ ui8 BattleInfo::whatSide(const PlayerColor & player) const
 		if(sides[i].color == player)
 			return i;
 
-	logGlobal->warn("BattleInfo::whatSide: Player %s is not in battle!", player.getStr());
+	logGlobal->warn("BattleInfo::whatSide: Player %s is not in battle!", player.toString());
 	return -1;
 }
 

+ 2 - 2
lib/battle/CBattleInfoEssentials.cpp

@@ -164,7 +164,7 @@ BattlePerspective::BattlePerspective CBattleInfoEssentials::battleGetMySide() co
 	if(*player == getBattle()->getSidePlayer(BattleSide::DEFENDER))
 		return BattlePerspective::RIGHT_SIDE;
 
-	logGlobal->error("Cannot find player %s in battle!", player->getStr());
+	logGlobal->error("Cannot find player %s in battle!", player->toString());
 	return BattlePerspective::INVALID;
 }
 
@@ -296,7 +296,7 @@ BattleSideOpt CBattleInfoEssentials::playerToSide(const PlayerColor & player) co
 	if(getBattle()->getSidePlayer(BattleSide::DEFENDER) == player)
 		return BattleSideOpt(BattleSide::DEFENDER);
 
-	logGlobal->warn("Cannot find side for player %s", player.getStr());
+	logGlobal->warn("Cannot find side for player %s", player.toString());
 
 	return std::nullopt;
 }

+ 9 - 30
lib/constants/EntityIdentifiers.cpp

@@ -199,36 +199,15 @@ bool PlayerColor::isValidPlayer() const
 
 bool PlayerColor::isSpectator() const
 {
-	return num == SPECTATOR.num;
-}
-
-std::string PlayerColor::getStr(bool L10n) const
-{
-	std::string ret = "unnamed";
-	if(isValidPlayer())
-	{
-		if(L10n)
-			ret = VLC->generaltexth->colors[num];
-		else
-			ret = GameConstants::PLAYER_COLOR_NAMES[num];
-	}
-	else if(L10n)
-	{
-		ret = VLC->generaltexth->allTexts[508];
-		ret[0] = std::tolower(ret[0]);
-	}
-
-	return ret;
-}
-
-std::string PlayerColor::getStrCap(bool L10n) const
-{
-	std::string ret = getStr(L10n);
-	ret[0] = std::toupper(ret[0]);
-	return ret;
-}
-
-si32 PlayerColor::decode(const std::string & identifier)
+	return num == SPECTATOR.num;
+}
+
+std::string PlayerColor::toString() const
+{
+	return encode(num);
+}
+
+si32 PlayerColor::decode(const std::string & identifier)
 {
 	return vstd::find_pos(GameConstants::PLAYER_COLOR_NAMES, identifier);
 }

+ 10 - 11
lib/constants/EntityIdentifiers.h

@@ -236,17 +236,16 @@ public:
 	static const PlayerColor NEUTRAL; //255
 	static const PlayerColor PLAYER_LIMIT; //player limit per map
 
-	bool isValidPlayer() const; //valid means < PLAYER_LIMIT (especially non-neutral)
-	bool isSpectator() const;
-
-	std::string getStr(bool L10n = false) const;
-	std::string getStrCap(bool L10n = false) const;
-
-	static si32 decode(const std::string& identifier);
-	static std::string encode(const si32 index);
-};
-
-class TeamID : public Identifier<TeamID>
+	bool isValidPlayer() const; //valid means < PLAYER_LIMIT (especially non-neutral)
+	bool isSpectator() const;
+
+	std::string toString() const;
+
+	static si32 decode(const std::string& identifier);
+	static std::string encode(const si32 index);
+};
+
+class TeamID : public Identifier<TeamID>
 {
 public:
 	using Identifier<TeamID>::Identifier;

+ 1 - 1
lib/gameState/CGameState.cpp

@@ -136,7 +136,7 @@ HeroTypeID CGameState::pickUnusedHeroTypeRandomly(const PlayerColor & owner)
 		return *RandomGeneratorUtil::nextItem(factionHeroes, getRandomGenerator());
 	}
 
-	logGlobal->warn("Cannot find free hero of appropriate faction for player %s - trying to get first available...", owner.getStr());
+	logGlobal->warn("Cannot find free hero of appropriate faction for player %s - trying to get first available...", owner.toString());
 	if(!otherHeroes.empty())
 	{
 		return *RandomGeneratorUtil::nextItem(otherHeroes, getRandomGenerator());

+ 4 - 4
lib/mapping/MapFormatH3M.cpp

@@ -1297,12 +1297,12 @@ CGObjectInstance * CMapLoaderH3M::readHeroPlaceholder(const int3 & mapPosition)
 	if(htid.getNum() == -1)
 	{
 		object->powerRank = reader->readUInt8();
-		logGlobal->debug("Map '%s': Hero placeholder: by power at %s, owned by %s", mapName, mapPosition.toString(), object->getOwner().getStr());
+		logGlobal->debug("Map '%s': Hero placeholder: by power at %s, owned by %s", mapName, mapPosition.toString(), object->getOwner().toString());
 	}
 	else
 	{
 		object->heroType = htid;
-		logGlobal->debug("Map '%s': Hero placeholder: %s at %s, owned by %s", mapName, VLC->heroh->getById(htid)->getJsonKey(), mapPosition.toString(), object->getOwner().getStr());
+		logGlobal->debug("Map '%s': Hero placeholder: %s at %s, owned by %s", mapName, VLC->heroh->getById(htid)->getJsonKey(), mapPosition.toString(), object->getOwner().toString());
 	}
 
 	return object;
@@ -1774,9 +1774,9 @@ CGObjectInstance * CMapLoaderH3M::readHero(const int3 & mapPosition, const Objec
 	}
 
 	if (object->subID != -1)
-		logGlobal->debug("Map '%s': Hero on map: %s at %s, owned by %s", mapName, VLC->heroh->getByIndex(object->subID)->getJsonKey(), mapPosition.toString(), object->getOwner().getStr());
+		logGlobal->debug("Map '%s': Hero on map: %s at %s, owned by %s", mapName, VLC->heroh->getByIndex(object->subID)->getJsonKey(), mapPosition.toString(), object->getOwner().toString());
 	else
-		logGlobal->debug("Map '%s': Hero on map: (random) at %s, owned by %s", mapName, mapPosition.toString(), object->getOwner().getStr());
+		logGlobal->debug("Map '%s': Hero on map: (random) at %s, owned by %s", mapName, mapPosition.toString(), object->getOwner().toString());
 
 	reader->skipZero(16);
 	return object;

+ 1 - 1
mapeditor/graphics.cpp

@@ -238,7 +238,7 @@ void Graphics::blueToPlayersAdv(QImage * sur, PlayerColor player)
 		}
 		else
 		{
-			logGlobal->error("Wrong player id in blueToPlayersAdv (%s)!", player.getStr());
+			logGlobal->error("Wrong player id in blueToPlayersAdv (%s)!", player.toString());
 			return;
 		}
 		//FIXME: not all player colored images have player palette at last 32 indexes

+ 2 - 2
mapeditor/validator.cpp

@@ -97,14 +97,14 @@ std::list<Validator::Issue> Validator::validate(const CMap * map)
 			if(o->getOwner() != PlayerColor::NEUTRAL && o->getOwner().getNum() < map->players.size())
 			{
 				if(!map->players[o->getOwner().getNum()].canAnyonePlay())
-					issues.emplace_back(QString(tr("Object %1 is assigned to non-playable player %2")).arg(o->instanceName.c_str(), o->getOwner().getStr().c_str()), true);
+					issues.emplace_back(QString(tr("Object %1 is assigned to non-playable player %2")).arg(o->instanceName.c_str(), o->getOwner().toString().c_str()), true);
 			}
 			//checking towns
 			if(auto * ins = dynamic_cast<CGTownInstance*>(o.get()))
 			{
 				bool has = amountOfCastles.count(ins->getOwner().getNum());
 				if(!has && ins->getOwner() != PlayerColor::NEUTRAL)
-					issues.emplace_back(tr("Town %1 has undefined owner %2").arg(ins->instanceName.c_str(), ins->getOwner().getStr().c_str()), true);
+					issues.emplace_back(tr("Town %1 has undefined owner %2").arg(ins->instanceName.c_str(), ins->getOwner().toString().c_str()), true);
 				if(has)
 					++amountOfCastles[ins->getOwner().getNum()];
 			}

+ 2 - 2
server/CGameHandler.cpp

@@ -1072,7 +1072,7 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
 		return false;
 	}
 
-	logGlobal->trace("Player %d (%s) wants to move hero %d from %s to %s", asker, asker.getStr(), hid.getNum(), h->pos.toString(), dst.toString());
+	logGlobal->trace("Player %d (%s) wants to move hero %d from %s to %s", asker, asker.toString(), hid.getNum(), h->pos.toString(), dst.toString());
 	const int3 hmpos = h->convertToVisitablePos(dst);
 
 	if (!gs->map->isInTheMap(hmpos))
@@ -3991,7 +3991,7 @@ bool CGameHandler::isBlockedByQueries(const CPack *pack, PlayerColor player)
 	{
 		complain(boost::str(boost::format(
 			"\r\n| Player \"%s\" has to answer queries before attempting any further actions.\r\n| Top Query: \"%s\"\r\n")
-			% boost::to_upper_copy<std::string>(player.getStr())
+			% boost::to_upper_copy<std::string>(player.toString())
 			% query->toString()
 		));
 		return true;

+ 3 - 3
server/processors/HeroPoolProcessor.cpp

@@ -272,7 +272,7 @@ const CHeroClass * HeroPoolProcessor::pickClassFor(bool isNative, const PlayerCo
 {
 	if(!player.isValidPlayer())
 	{
-		logGlobal->error("Cannot pick hero for player %d. Wrong owner!", player.getStr());
+		logGlobal->error("Cannot pick hero for player %d. Wrong owner!", player.toString());
 		return nullptr;
 	}
 
@@ -285,7 +285,7 @@ const CHeroClass * HeroPoolProcessor::pickClassFor(bool isNative, const PlayerCo
 
 	if(potentialClasses.empty())
 	{
-		logGlobal->error("There are no heroes available for player %s!", player.getStr());
+		logGlobal->error("There are no heroes available for player %s!", player.toString());
 		return nullptr;
 	}
 
@@ -306,7 +306,7 @@ const CHeroClass * HeroPoolProcessor::pickClassFor(bool isNative, const PlayerCo
 
 	if (possibleClasses.empty())
 	{
-		logGlobal->error("Cannot pick native hero for %s. Picking any...", player.getStr());
+		logGlobal->error("Cannot pick native hero for %s. Picking any...", player.toString());
 		possibleClasses = potentialClasses;
 	}
 

+ 3 - 3
server/processors/PlayerMessageProcessor.cpp

@@ -92,7 +92,7 @@ bool PlayerMessageProcessor::handleHostCommand(PlayerColor player, const std::st
 		{
 			for(auto & c : gameHandler->connections)
 			{
-				if(c.first.getStr(false) == playername)
+				if(c.first.toString() == playername)
 					playerToKick = c.first;
 			}
 		}
@@ -113,7 +113,7 @@ bool PlayerMessageProcessor::handleHostCommand(PlayerColor player, const std::st
 			broadcastSystemMessage("No cheaters registered!");
 
 		for (auto const & entry : cheaters)
-			broadcastSystemMessage("Player " + entry.getStr() + " is cheater!");
+			broadcastSystemMessage("Player " + entry.toString() + " is cheater!");
 
 		return true;
 	}
@@ -406,7 +406,7 @@ bool PlayerMessageProcessor::handleCheatCode(const std::string & cheat, PlayerCo
 		if (words.front() == "ai" && i.second.human)
 			continue;
 
-		if (words.front() != "all" && words.front() != i.first.getStr())
+		if (words.front() != "all" && words.front() != i.first.toString())
 			continue;
 
 		std::vector<std::string> parameters = words;

+ 1 - 1
server/queries/CQuery.cpp

@@ -75,7 +75,7 @@ std::string CQuery::toString() const
 
 	for(size_t i = 0; i < size; i++)
 	{
-		names += boost::to_upper_copy<std::string>(players[i].getStr());
+		names += boost::to_upper_copy<std::string>(players[i].toString());
 
 		if(i < size - 2)
 			names += ", ";