Explorar o código

Merge pull request #1662 from rilian-la-te/reduce-lexical-cast

vcmi: reduce boost::lexical_cast usage
Ivan Savenko %!s(int64=2) %!d(string=hai) anos
pai
achega
0ea73cae7f

+ 2 - 2
AI/Nullkiller/Goals/AbstractGoal.cpp

@@ -47,7 +47,7 @@ std::string AbstractGoal::toString() const //TODO: virtualize
 	switch(goalType)
 	{
 	case COLLECT_RES:
-		desc = "COLLECT RESOURCE " + GameConstants::RESOURCE_NAMES[resID] + " (" + boost::lexical_cast<std::string>(value) + ")";
+		desc = "COLLECT RESOURCE " + GameConstants::RESOURCE_NAMES[resID] + " (" + std::to_string(value) + ")";
 		break;
 	case TRADE:
 	{
@@ -66,7 +66,7 @@ std::string AbstractGoal::toString() const //TODO: virtualize
 		desc = "DIG AT TILE " + tile.toString();
 		break;
 	default:
-		return boost::lexical_cast<std::string>(goalType);
+		return std::to_string(goalType);
 	}
 	if(hero.get(true)) //FIXME: used to crash when we lost hero and failed goal
 		desc += " (" + hero->getNameTranslated() + ")";

+ 1 - 1
AI/Nullkiller/Goals/GatherArmy.cpp

@@ -36,7 +36,7 @@ bool GatherArmy::operator==(const GatherArmy & other) const
 
 std::string GatherArmy::completeMessage() const
 {
-	return "Hero " + hero.get()->name + " gathered army of value " + boost::lexical_cast<std::string>(value);
+	return "Hero " + hero.get()->name + " gathered army of value " + std::to_string(value);
 }
 
 TSubgoal GatherArmy::whatToDoToAchieve()

+ 3 - 3
AI/VCAI/Goals/AbstractGoal.cpp

@@ -61,7 +61,7 @@ std::string AbstractGoal::name() const //TODO: virtualize
 	case BUILD_STRUCTURE:
 		return "BUILD STRUCTURE";
 	case COLLECT_RES:
-		desc = "COLLECT RESOURCE " + GameConstants::RESOURCE_NAMES[resID] + " (" + boost::lexical_cast<std::string>(value) + ")";
+		desc = "COLLECT RESOURCE " + GameConstants::RESOURCE_NAMES[resID] + " (" + std::to_string(value) + ")";
 		break;
 	case TRADE:
 	{
@@ -81,7 +81,7 @@ std::string AbstractGoal::name() const //TODO: virtualize
 	}
 	break;
 	case FIND_OBJ:
-		desc = "FIND OBJ " + boost::lexical_cast<std::string>(objid);
+		desc = "FIND OBJ " + std::to_string(objid);
 		break;
 	case VISIT_HERO:
 	{
@@ -103,7 +103,7 @@ std::string AbstractGoal::name() const //TODO: virtualize
 		desc = "DIG AT TILE " + tile.toString();
 		break;
 	default:
-		return boost::lexical_cast<std::string>(goalType);
+		return std::to_string(goalType);
 	}
 	if(hero.get(true)) //FIXME: used to crash when we lost hero and failed goal
 		desc += " (" + hero->getNameTranslated() + ")";

+ 1 - 1
AI/VCAI/Goals/GatherArmy.cpp

@@ -33,7 +33,7 @@ bool GatherArmy::operator==(const GatherArmy & other) const
 
 std::string GatherArmy::completeMessage() const
 {
-	return "Hero " + hero.get()->getNameTranslated() + " gathered army of value " + boost::lexical_cast<std::string>(value);
+	return "Hero " + hero.get()->getNameTranslated() + " gathered army of value " + std::to_string(value);
 }
 
 TSubgoal GatherArmy::whatToDoToAchieve()

+ 1 - 1
AI/VCAI/Goals/VisitHero.cpp

@@ -33,7 +33,7 @@ bool VisitHero::operator==(const VisitHero & other) const
 
 std::string VisitHero::completeMessage() const
 {
-	return "hero " + hero.get()->getNameTranslated() + " visited hero " + boost::lexical_cast<std::string>(objid);
+	return "hero " + hero.get()->getNameTranslated() + " visited hero " + std::to_string(objid);
 }
 
 TSubgoal VisitHero::whatToDoToAchieve()

+ 1 - 1
AI/VCAI/Goals/VisitObj.cpp

@@ -33,7 +33,7 @@ bool VisitObj::operator==(const VisitObj & other) const
 
 std::string VisitObj::completeMessage() const
 {
-	return "hero " + hero.get()->getNameTranslated() + " captured Object ID = " + boost::lexical_cast<std::string>(objid);
+	return "hero " + hero.get()->getNameTranslated() + " captured Object ID = " + std::to_string(objid);
 }
 
 TGoalVec VisitObj::getAllPossibleSubgoals()

+ 2 - 2
client/CPlayerInterface.cpp

@@ -275,13 +275,13 @@ void CPlayerInterface::yourTurn()
 			{
 				int index = getLastIndex(prefix + "Newgame_");
 				index %= SAVES_COUNT;
-				cb->save("Saves/" + prefix + "Newgame_Autosave_" + boost::lexical_cast<std::string>(index + 1));
+				cb->save("Saves/" + prefix + "Newgame_Autosave_" + std::to_string(index + 1));
 			}
 			firstCall = 0;
 		}
 		else if(frequency > 0 && cb->getDate() % frequency == 0)
 		{
-			LOCPLINT->cb->save("Saves/" + prefix + "Autosave_" + boost::lexical_cast<std::string>(autosaveCount++ + 1));
+			LOCPLINT->cb->save("Saves/" + prefix + "Autosave_" + std::to_string(autosaveCount++ + 1));
 			autosaveCount %= 5;
 		}
 

+ 5 - 5
client/CServerHandler.cpp

@@ -198,12 +198,12 @@ void CServerHandler::startLocalServerAndConnect()
 	
 #if defined(SINGLE_PROCESS_APP)
 	boost::condition_variable cond;
-	std::vector<std::string> args{"--uuid=" + uuid, "--port=" + boost::lexical_cast<std::string>(getHostPort())};
+	std::vector<std::string> args{"--uuid=" + uuid, "--port=" + std::to_string(getHostPort())};
 	if(settings["session"]["lobby"].Bool() && settings["session"]["host"].Bool())
 	{
 		args.push_back("--lobby=" + settings["session"]["address"].String());
 		args.push_back("--connections=" + settings["session"]["hostConnections"].String());
-		args.push_back("--lobby-port=" + boost::lexical_cast<std::string>(settings["session"]["port"].Integer()));
+		args.push_back("--lobby-port=" + std::to_string(settings["session"]["port"].Integer()));
 		args.push_back("--lobby-uuid=" + settings["session"]["hostUuid"].String());
 	}
 	threadRunLocalServer = std::make_shared<boost::thread>([&cond, args, this] {
@@ -384,7 +384,7 @@ ui16 CServerHandler::getDefaultPort()
 
 std::string CServerHandler::getDefaultPortStr()
 {
-	return boost::lexical_cast<std::string>(getDefaultPort());
+	return std::to_string(getDefaultPort());
 }
 
 std::string CServerHandler::getHostAddress() const
@@ -880,14 +880,14 @@ void CServerHandler::threadRunServer()
 	setThreadName("CServerHandler::threadRunServer");
 	const std::string logName = (VCMIDirs::get().userLogsPath() / "server_log.txt").string();
 	std::string comm = VCMIDirs::get().serverPath().string()
-		+ " --port=" + boost::lexical_cast<std::string>(getHostPort())
+		+ " --port=" + std::to_string(getHostPort())
 		+ " --run-by-client"
 		+ " --uuid=" + uuid;
 	if(settings["session"]["lobby"].Bool() && settings["session"]["host"].Bool())
 	{
 		comm += " --lobby=" + settings["session"]["address"].String();
 		comm += " --connections=" + settings["session"]["hostConnections"].String();
-		comm += " --lobby-port=" + boost::lexical_cast<std::string>(settings["session"]["port"].Integer());
+		comm += " --lobby-port=" + std::to_string(settings["session"]["port"].Integer());
 		comm += " --lobby-uuid=" + settings["session"]["hostUuid"].String();
 	}
 		

+ 3 - 3
client/adventureMap/CInfoBar.cpp

@@ -66,9 +66,9 @@ CInfoBar::VisibleDateInfo::VisibleDateInfo()
 
 	std::string labelText;
 	if(LOCPLINT->cb->getDate(Date::DAY_OF_WEEK) == 1 && LOCPLINT->cb->getDate(Date::DAY) != 1) // monday of any week but first - show new week info
-		labelText = CGI->generaltexth->allTexts[63] + " " + boost::lexical_cast<std::string>(LOCPLINT->cb->getDate(Date::WEEK));
+		labelText = CGI->generaltexth->allTexts[63] + " " + std::to_string(LOCPLINT->cb->getDate(Date::WEEK));
 	else
-		labelText = CGI->generaltexth->allTexts[64] + " " + boost::lexical_cast<std::string>(LOCPLINT->cb->getDate(Date::DAY_OF_WEEK));
+		labelText = CGI->generaltexth->allTexts[64] + " " + std::to_string(LOCPLINT->cb->getDate(Date::DAY_OF_WEEK));
 
 	label = std::make_shared<CLabel>(95, 31, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, labelText);
 
@@ -159,7 +159,7 @@ CInfoBar::VisibleGameStatusInfo::VisibleGameStatusInfo()
 	{
 		hallIcons.push_back(std::make_shared<CAnimImage>("itmtl", i, 0, 6 + 42 * (int)i , 11));
 		if(halls[i])
-			hallLabels.push_back(std::make_shared<CLabel>( 26 + 42 * (int)i, 64, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(halls[i])));
+			hallLabels.push_back(std::make_shared<CLabel>( 26 + 42 * (int)i, 64, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(halls[i])));
 	}
 }
 

+ 1 - 1
client/adventureMap/CResDataBar.cpp

@@ -82,7 +82,7 @@ void CResDataBar::draw(SDL_Surface * to)
 	//TODO: all this should be labels, but they require proper text update on change
 	for (auto i=Res::WOOD; i<=Res::GOLD; vstd::advance(i, 1))
 	{
-		std::string text = boost::lexical_cast<std::string>(LOCPLINT->cb->getResourceAmount(i));
+		std::string text = std::to_string(LOCPLINT->cb->getResourceAmount(i));
 
 		graphics->fonts[FONT_SMALL]->renderTextLeft(to, text, Colors::WHITE, Point(txtpos[i].first, txtpos[i].second));
 	}

+ 1 - 1
client/battle/BattleInterfaceClasses.cpp

@@ -522,7 +522,7 @@ BattleResultWindow::BattleResultWindow(const BattleResult & br, CPlayerInterface
 		{
 			str += CGI->generaltexth->allTexts[305];
 			boost::algorithm::replace_first(str, "%s", ourHero->getNameTranslated());
-			boost::algorithm::replace_first(str, "%d", boost::lexical_cast<std::string>(br.exp[weAreAttacker ? 0 : 1]));
+			boost::algorithm::replace_first(str, "%d", std::to_string(br.exp[weAreAttacker ? 0 : 1]));
 		}
 
 		description = std::make_shared<CTextBox>(str, Rect(69, 203, 330, 68), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);

+ 1 - 1
client/battle/BattleSiegeController.cpp

@@ -59,7 +59,7 @@ std::string BattleSiegeController::getWallPieceImageName(EWallVisual::EWallVisua
 	};
 
 	const std::string & prefix = town->town->clientInfo.siegePrefix;
-	std::string addit = boost::lexical_cast<std::string>(getImageIndex());
+	std::string addit = std::to_string(getImageIndex());
 
 	switch(what)
 	{

+ 1 - 1
client/gui/CGuiHandler.cpp

@@ -762,7 +762,7 @@ void CGuiHandler::drawFPSCounter()
 	static SDL_Rect overlay = { 0, 0, 64, 32};
 	uint32_t black = SDL_MapRGB(screen->format, 10, 10, 10);
 	SDL_FillRect(screen, &overlay, black);
-	std::string fps = boost::lexical_cast<std::string>(mainFPSmng->getFramerate());
+	std::string fps = std::to_string(mainFPSmng->getFramerate());
 	graphics->fonts[FONT_BIG]->renderTextLeft(screen, fps, Colors::YELLOW, Point(10, 10));
 }
 

+ 5 - 5
client/lobby/CBonusSelection.cpp

@@ -98,7 +98,7 @@ CBonusSelection::CBonusSelection()
 
 	for(size_t b = 0; b < difficultyIcons.size(); ++b)
 	{
-		difficultyIcons[b] = std::make_shared<CAnimImage>("GSPBUT" + boost::lexical_cast<std::string>(b + 3) + ".DEF", 0, 0, 709, 455);
+		difficultyIcons[b] = std::make_shared<CAnimImage>("GSPBUT" + std::to_string(b + 3) + ".DEF", 0, 0, 709, 455);
 	}
 
 	if(getCampaign()->camp->header.difficultyChoosenByPlayer)
@@ -179,7 +179,7 @@ void CBonusSelection::createBonusesIcons()
 		case CScenarioTravel::STravelBonus::MONSTER:
 			picNumber = bonDescs[i].info2 + 2;
 			desc = CGI->generaltexth->allTexts[717];
-			boost::algorithm::replace_first(desc, "%d", boost::lexical_cast<std::string>(bonDescs[i].info3));
+			boost::algorithm::replace_first(desc, "%d", std::to_string(bonDescs[i].info3));
 			boost::algorithm::replace_first(desc, "%s", CGI->creatures()->getByIndex(bonDescs[i].info2)->getNamePluralTranslated());
 			break;
 		case CScenarioTravel::STravelBonus::BUILDING:
@@ -235,7 +235,7 @@ void CBonusSelection::createBonusesIcons()
 			std::string substitute; //text to be printed instead of %s
 			for(int v = 0; v < toPrint.size(); ++v)
 			{
-				substitute += boost::lexical_cast<std::string>(toPrint[v].second);
+				substitute += std::to_string(toPrint[v].second);
 				substitute += " " + CGI->generaltexth->primarySkillNames[toPrint[v].first];
 				if(v != toPrint.size() - 1)
 				{
@@ -278,7 +278,7 @@ void CBonusSelection::createBonusesIcons()
 			picNumber = serialResID;
 
 			desc = CGI->generaltexth->allTexts[717];
-			boost::algorithm::replace_first(desc, "%d", boost::lexical_cast<std::string>(bonDescs[i].info2));
+			boost::algorithm::replace_first(desc, "%d", std::to_string(bonDescs[i].info2));
 			std::string replacement;
 			if(serialResID <= 6)
 			{
@@ -324,7 +324,7 @@ void CBonusSelection::createBonusesIcons()
 		std::shared_ptr<CToggleButton> bonusButton = std::make_shared<CToggleButton>(Point(475 + i * 68, 455), "", CButton::tooltip(desc, desc));
 
 		if(picNumber != -1)
-			picName += ":" + boost::lexical_cast<std::string>(picNumber);
+			picName += ":" + std::to_string(picNumber);
 
 		auto anim = std::make_shared<CAnimation>();
 		anim->setCustom(picName, 0);

+ 1 - 1
client/mainmenu/CMainMenu.cpp

@@ -476,7 +476,7 @@ CSimpleJoinScreen::CSimpleJoinScreen(bool host)
 		inputAddress->giveFocus();
 	}
 	inputAddress->setText(host ? CServerHandler::localhostAddress : CSH->getHostAddress(), true);
-	inputPort->setText(boost::lexical_cast<std::string>(CSH->getHostPort()), true);
+	inputPort->setText(std::to_string(CSH->getHostPort()), true);
 
 	buttonCancel = std::make_shared<CButton>(Point(142, 142), "MUBCANC.DEF", CGI->generaltexth->zelp[561], std::bind(&CSimpleJoinScreen::leaveScreen, this), SDLK_ESCAPE);
 	statusBar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(7, 186, 218, 18), 7, 186));

+ 1 - 1
client/render/CAnimation.cpp

@@ -253,7 +253,7 @@ void CAnimation::duplicateImage(const size_t sourceGroup, const size_t sourceFra
 
 	if(clone.getType() == JsonNode::JsonType::DATA_NULL)
 	{
-		std::string temp =  name+":"+boost::lexical_cast<std::string>(sourceGroup)+":"+boost::lexical_cast<std::string>(sourceFrame);
+		std::string temp =  name+":"+std::to_string(sourceGroup)+":"+std::to_string(sourceFrame);
 		clone["file"].String() = temp;
 	}
 

+ 4 - 4
client/widgets/CComponent.cpp

@@ -199,12 +199,12 @@ std::string CComponent::getSubtitleInternal()
 	{
 	case primskill:  return boost::str(boost::format("%+d %s") % val % (subtype < 4 ? CGI->generaltexth->primarySkillNames[subtype] : CGI->generaltexth->allTexts[387]));
 	case secskill:   return CGI->generaltexth->levels[val-1] + "\n" + CGI->skillh->getByIndex(subtype)->getNameTranslated();
-	case resource:   return boost::lexical_cast<std::string>(val);
+	case resource:   return std::to_string(val);
 	case creature:
 		{
 			auto creature = CGI->creh->getByIndex(subtype);
 			if ( val )
-				return boost::lexical_cast<std::string>(val) + " " + (val > 1 ? creature->getNamePluralTranslated() : creature->getNameSingularTranslated());
+				return std::to_string(val) + " " + (val > 1 ? creature->getNamePluralTranslated() : creature->getNameSingularTranslated());
 			else
 				return val > 1 ? creature->getNamePluralTranslated() : creature->getNameSingularTranslated();
 		}
@@ -214,12 +214,12 @@ std::string CComponent::getSubtitleInternal()
 			if(subtype == 1) //+1 level - tree of knowledge
 			{
 				std::string level = CGI->generaltexth->allTexts[442];
-				boost::replace_first(level, "1", boost::lexical_cast<std::string>(val));
+				boost::replace_first(level, "1", std::to_string(val));
 				return level;
 			}
 			else
 			{
-				return boost::lexical_cast<std::string>(val); //amount of experience OR level required for seer hut;
+				return std::to_string(val); //amount of experience OR level required for seer hut;
 			}
 		}
 	case spell:      return CGI->spells()->getByIndex(subtype)->getNameTranslated();

+ 1 - 1
client/widgets/CreatureCostBox.cpp

@@ -26,7 +26,7 @@ CreatureCostBox::CreatureCostBox(Rect position, std::string titleText)
 void CreatureCostBox::set(TResources res)
 {
 	for(auto & item : resources)
-		item.second.first->setText(boost::lexical_cast<std::string>(res[item.first]));
+		item.second.first->setText(std::to_string(res[item.first]));
 }
 
 void CreatureCostBox::createItems(TResources res)

+ 5 - 5
client/widgets/MiscWidgets.cpp

@@ -201,7 +201,7 @@ void CMinorResDataBar::showAll(SDL_Surface * to)
 
 	for (Res::ERes i=Res::WOOD; i<=Res::GOLD; vstd::advance(i, 1))
 	{
-		std::string text = boost::lexical_cast<std::string>(LOCPLINT->cb->getResourceAmount(i));
+		std::string text = std::to_string(LOCPLINT->cb->getResourceAmount(i));
 
 		graphics->fonts[FONT_SMALL]->renderTextCenter(to, text, Colors::WHITE, Point(pos.x + 50 + 76 * i, pos.y + pos.h/2));
 	}
@@ -296,9 +296,9 @@ void CHeroTooltip::init(const InfoAboutHero & hero)
 	{
 		for(size_t i = 0; i < hero.details->primskills.size(); i++)
 			labels.push_back(std::make_shared<CLabel>(75 + 28 * (int)i, 58, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE,
-					   boost::lexical_cast<std::string>(hero.details->primskills[i])));
+					   std::to_string(hero.details->primskills[i])));
 
-		labels.push_back(std::make_shared<CLabel>(158, 98, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(hero.details->mana)));
+		labels.push_back(std::make_shared<CLabel>(158, 98, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, std::to_string(hero.details->mana)));
 
 		morale = std::make_shared<CAnimImage>("IMRL22", hero.details->morale + 3, 0, 5, 74);
 		luck = std::make_shared<CAnimImage>("ILCK22", hero.details->luck + 3, 0, 5, 91);
@@ -339,7 +339,7 @@ void CTownTooltip::init(const InfoAboutTown & town)
 		if(town.details->goldIncome)
 		{
 			income = std::make_shared<CLabel>(157, 58, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE,
-					   boost::lexical_cast<std::string>(town.details->goldIncome));
+					   std::to_string(town.details->goldIncome));
 		}
 		if(town.details->garrisonedHero) //garrisoned hero icon
 			garrisonedHero = std::make_shared<CPicture>("TOWNQKGH", 149, 76);
@@ -483,7 +483,7 @@ void CCreaturePic::show(SDL_Surface * to)
 void CCreaturePic::setAmount(int newAmount)
 {
 	if(newAmount != 0)
-		amount->setText(boost::lexical_cast<std::string>(newAmount));
+		amount->setText(std::to_string(newAmount));
 	else
 		amount->setText("");
 }

+ 2 - 2
client/widgets/TextControls.cpp

@@ -669,9 +669,9 @@ void CTextInput::numberFilter(std::string & text, const std::string & oldText, i
 	{
 		int value = boost::lexical_cast<int>(text);
 		if(value < minValue)
-			text = boost::lexical_cast<std::string>(minValue);
+			text = std::to_string(minValue);
 		else if(value > maxValue)
-			text = boost::lexical_cast<std::string>(maxValue);
+			text = std::to_string(maxValue);
 	}
 	catch(boost::bad_lexical_cast &)
 	{

+ 14 - 14
client/windows/CCastleInterface.cpp

@@ -285,7 +285,7 @@ CDwellingInfoBox::CDwellingInfoBox(int centerX, int centerY, const CGTownInstanc
 	title = std::make_shared<CLabel>(80, 30, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, creature->getNamePluralTranslated());
 	animation = std::make_shared<CCreaturePic>(30, 44, creature, true, true);
 
-	std::string text = boost::lexical_cast<std::string>(Town->creatures.at(level).first);
+	std::string text = std::to_string(Town->creatures.at(level).first);
 	available = std::make_shared<CLabel>(80,190, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[217] + text);
 	costPerTroop = std::make_shared<CLabel>(80, 227, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[346]);
 
@@ -294,7 +294,7 @@ CDwellingInfoBox::CDwellingInfoBox(int centerX, int centerY, const CGTownInstanc
 		if(creature->cost[i])
 		{
 			resPicture.push_back(std::make_shared<CAnimImage>("RESOURCE", i, 0, 0, 0));
-			resAmount.push_back(std::make_shared<CLabel>(0,0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(creature->cost[i])));
+			resAmount.push_back(std::make_shared<CLabel>(0,0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(creature->cost[i])));
 		}
 	}
 
@@ -410,7 +410,7 @@ void CHeroGSlot::clickLeft(tribool down, bool previousState)
 				if(!hero && LOCPLINT->cb->howManyHeroes(false) >= VLC->modh->settings.MAX_HEROES_ON_MAP_PER_PLAYER)
 				{
 					std::string tmp = CGI->generaltexth->allTexts[18]; //You already have %d adventuring heroes under your command.
-					boost::algorithm::replace_first(tmp,"%d",boost::lexical_cast<std::string>(LOCPLINT->cb->howManyHeroes(false)));
+					boost::algorithm::replace_first(tmp,"%d",std::to_string(LOCPLINT->cb->howManyHeroes(false)));
 					LOCPLINT->showInfoDialog(tmp, std::vector<std::shared_ptr<CComponent>>(), soundBase::sound_todo);
 					allow = false;
 				}
@@ -918,7 +918,7 @@ void CCastleBuildings::enterFountain(const BuildingID & building, BuildingSubID:
 		{
 			descr += "\n\n" + hasProduced;
 			boost::algorithm::replace_first(descr,"%s",CGI->generaltexth->restypes[town->bonusValue.first]);
-			boost::algorithm::replace_first(descr,"%d",boost::lexical_cast<std::string>(town->bonusValue.second));
+			boost::algorithm::replace_first(descr,"%d",std::to_string(town->bonusValue.second));
 		}
 	}
 	LOCPLINT->showInfoDialog(descr, comps);
@@ -1017,9 +1017,9 @@ CCreaInfo::CCreaInfo(Point position, const CGTownInstance * Town, int Level, boo
 
 	std::string value;
 	if(showAvailable)
-		value = boost::lexical_cast<std::string>(town->creatures[level].first);
+		value = std::to_string(town->creatures[level].first);
 	else
-		value = std::string("+") + boost::lexical_cast<std::string>(town->creatureGrowth(level));
+		value = std::string("+") + std::to_string(town->creatureGrowth(level));
 
 	if(compact)
 	{
@@ -1042,9 +1042,9 @@ void CCreaInfo::update()
 	{
 		std::string value;
 		if(showAvailable)
-			value = boost::lexical_cast<std::string>(town->creatures[level].first);
+			value = std::to_string(town->creatures[level].first);
 		else
-			value = std::string("+") + boost::lexical_cast<std::string>(town->creatureGrowth(level));
+			value = std::string("+") + std::to_string(town->creatureGrowth(level));
 
 		if(value != label->getText())
 			label->setText(value);
@@ -1273,7 +1273,7 @@ void CCastleInterface::recreateIcons()
 
 	icon->setFrame(iconIndex);
 	TResources townIncome = town->dailyIncome();
-	income->setText(boost::lexical_cast<std::string>(townIncome[Res::GOLD]));
+	income->setText(std::to_string(townIncome[Res::GOLD]));
 
 	hall = std::make_shared<CTownInfo>(80, 413, town, true);
 	fort = std::make_shared<CTownInfo>(122, 413, town, false);
@@ -1551,9 +1551,9 @@ void LabeledValue::init(std::string nameText, std::string descr, int min, int ma
 	std::string valueText;
 	if(min && max)
 	{
-		valueText = boost::lexical_cast<std::string>(min);
+		valueText = std::to_string(min);
 		if(min != max)
-			valueText += '-' + boost::lexical_cast<std::string>(max);
+			valueText += '-' + std::to_string(max);
 	}
 	name = std::make_shared<CLabel>(3, 0, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, nameText);
 	value = std::make_shared<CLabel>(pos.w-3, pos.h-2, FONT_SMALL, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, valueText);
@@ -1675,7 +1675,7 @@ CFortScreen::RecruitArea::RecruitArea(int posX, int posY, const CGTownInstance *
 		if(vstd::contains(town->builtBuildings, getMyBuilding()->bid))
 		{
 			ui32 available = town->creatures[level].first;
-			std::string availableText = CGI->generaltexth->allTexts[217]+ boost::lexical_cast<std::string>(available);
+			std::string availableText = CGI->generaltexth->allTexts[217]+ std::to_string(available);
 			availableCount = std::make_shared<CLabel>(78, 119, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, availableText);
 		}
 	}
@@ -1742,7 +1742,7 @@ void CFortScreen::RecruitArea::creaturesChangedEventHandler()
 {
 	if(availableCount)
 	{
-		std::string availableText = CGI->generaltexth->allTexts[217] + boost::lexical_cast<std::string>(town->creatures[level].first);
+		std::string availableText = CGI->generaltexth->allTexts[217] + std::to_string(town->creatures[level].first);
 		availableCount->setText(availableText);
 	}
 }
@@ -1851,7 +1851,7 @@ CBlacksmithDialog::CBlacksmithDialog(bool possible, CreatureID creMachineID, Art
 				boost::str(boost::format(CGI->generaltexth->allTexts[274]) % creature->getNameSingularTranslated()));
 	costText = std::make_shared<CLabel>(165, 218, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->jktexts[43]);
 	costValue = std::make_shared<CLabel>(165, 290, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE,
-	                boost::lexical_cast<std::string>(aid.toArtifact(CGI->artifacts())->getPrice()));
+	                std::to_string(aid.toArtifact(CGI->artifacts())->getPrice()));
 
 	std::string text = boost::str(boost::format(CGI->generaltexth->allTexts[595]) % creature->getNameSingularTranslated());
 	buy = std::make_shared<CButton>(Point(42, 312), "IBUY30.DEF", CButton::tooltip(text), [&](){ close(); }, SDLK_RETURN);

+ 16 - 16
client/windows/CCreatureWindow.cpp

@@ -158,7 +158,7 @@ static std::string skillToFile(int skill, int level, bool selected)
 	if (level == 0)
 		sufix = "no"; //not avaliable - no number
 	else
-		sufix = boost::lexical_cast<std::string>(level-1);
+		sufix = std::to_string(level-1);
 	if (selected)
 		sufix += "="; //level-up highlight
 
@@ -209,7 +209,7 @@ CStackWindow::ActiveSpellsSection::ActiveSpellsSection(CStackWindow * owner, int
 			boost::replace_first(spellText, "%s", spell->getNameTranslated());
 			//FIXME: support permanent duration
 			int duration = battleStack->getBonusLocalFirst(Selector::source(Bonus::SPELL_EFFECT,effect))->turnsRemain;
-			boost::replace_first(spellText, "%d", boost::lexical_cast<std::string>(duration));
+			boost::replace_first(spellText, "%d", std::to_string(duration));
 
 			spellIcons.push_back(std::make_shared<CAnimImage>("SpellInt", effect + 1, 0, firstPos.x + offset.x * printed, firstPos.y + offset.y * printed));
 			clickableAreas.push_back(std::make_shared<LRClickableAreaWText>(Rect(firstPos + offset * printed, Point(50, 38)), spellText, spellText));
@@ -571,9 +571,9 @@ CStackWindow::MainSection::MainSection(CStackWindow * owner, int yOffset, bool s
 			expArea = area;
 			area->text = CGI->generaltexth->allTexts[2];
 			area->bonusValue =	commander->getExpRank();
-			boost::replace_first(area->text, "%d", boost::lexical_cast<std::string>(commander->getExpRank()));
-			boost::replace_first(area->text, "%d", boost::lexical_cast<std::string>(CGI->heroh->reqExp(commander->getExpRank() + 1)));
-			boost::replace_first(area->text, "%d", boost::lexical_cast<std::string>(commander->experience));
+			boost::replace_first(area->text, "%d", std::to_string(commander->getExpRank()));
+			boost::replace_first(area->text, "%d", std::to_string(CGI->heroh->reqExp(commander->getExpRank() + 1)));
+			boost::replace_first(area->text, "%d", std::to_string(commander->experience));
 		}
 		else
 		{
@@ -868,32 +868,32 @@ std::string CStackWindow::generateStackExpDescription()
 	std::string expText = CGI->generaltexth->translate("vcmi.stackExperience.description");
 	boost::replace_first(expText, "%s", creature->getNamePluralTranslated());
 	boost::replace_first(expText, "%s", CGI->generaltexth->translate("vcmi.stackExperience.rank", rank));
-	boost::replace_first(expText, "%i", boost::lexical_cast<std::string>(rank));
-	boost::replace_first(expText, "%i", boost::lexical_cast<std::string>(stack->experience));
+	boost::replace_first(expText, "%i", std::to_string(rank));
+	boost::replace_first(expText, "%i", std::to_string(stack->experience));
 	number = static_cast<int>(CGI->creh->expRanks[tier][rank] - stack->experience);
-	boost::replace_first(expText, "%i", boost::lexical_cast<std::string>(number));
+	boost::replace_first(expText, "%i", std::to_string(number));
 
 	number = CGI->creh->maxExpPerBattle[tier]; //percent
-	boost::replace_first(expText, "%i%", boost::lexical_cast<std::string>(number));
+	boost::replace_first(expText, "%i%", std::to_string(number));
 	number *= CGI->creh->expRanks[tier].back() / 100; //actual amount
-	boost::replace_first(expText, "%i", boost::lexical_cast<std::string>(number));
+	boost::replace_first(expText, "%i", std::to_string(number));
 
-	boost::replace_first(expText, "%i", boost::lexical_cast<std::string>(stack->count)); //Number of Creatures in stack
+	boost::replace_first(expText, "%i", std::to_string(stack->count)); //Number of Creatures in stack
 
 	int expmin = std::max(CGI->creh->expRanks[tier][std::max(rank-1, 0)], (ui32)1);
 	number = static_cast<int>((stack->count * (stack->experience - expmin)) / expmin); //Maximum New Recruits without losing current Rank
-	boost::replace_first(expText, "%i", boost::lexical_cast<std::string>(number)); //TODO
+	boost::replace_first(expText, "%i", std::to_string(number)); //TODO
 
-	boost::replace_first(expText, "%.2f", boost::lexical_cast<std::string>(1)); //TODO Experience Multiplier
+	boost::replace_first(expText, "%.2f", std::to_string(1)); //TODO Experience Multiplier
 	number = CGI->creh->expAfterUpgrade;
-	boost::replace_first(expText, "%.2f", boost::lexical_cast<std::string>(number) + "%"); //Upgrade Multiplier
+	boost::replace_first(expText, "%.2f", std::to_string(number) + "%"); //Upgrade Multiplier
 
 	expmin = CGI->creh->expRanks[tier][9];
 	int expmax = CGI->creh->expRanks[tier][10];
 	number = expmax - expmin;
-	boost::replace_first(expText, "%i", boost::lexical_cast<std::string>(number)); //Experience after Rank 10
+	boost::replace_first(expText, "%i", std::to_string(number)); //Experience after Rank 10
 	number = (stack->count * (expmax - expmin)) / expmin;
-	boost::replace_first(expText, "%i", boost::lexical_cast<std::string>(number)); //Maximum New Recruits to remain at Rank 10 if at Maximum Experience
+	boost::replace_first(expText, "%i", std::to_string(number)); //Maximum New Recruits to remain at Rank 10 if at Maximum Experience
 
 	return expText;
 }

+ 7 - 7
client/windows/CHeroWindow.cpp

@@ -252,7 +252,7 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded)
 	for(size_t g=0; g<primSkillAreas.size(); ++g)
 	{
 		primSkillAreas[g]->bonusValue = heroWArt.getPrimSkillLevel(static_cast<PrimarySkill::PrimarySkill>(g));
-		primSkillValues[g]->setText(boost::lexical_cast<std::string>(primSkillAreas[g]->bonusValue));
+		primSkillValues[g]->setText(std::to_string(primSkillAreas[g]->bonusValue));
 	}
 
 	//secondary skills support
@@ -282,15 +282,15 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded)
 
 	//printing experience - original format does not support ui64
 	expArea->text = CGI->generaltexth->allTexts[2];
-	boost::replace_first(expArea->text, "%d", boost::lexical_cast<std::string>(curHero->level));
-	boost::replace_first(expArea->text, "%d", boost::lexical_cast<std::string>(CGI->heroh->reqExp(curHero->level+1)));
-	boost::replace_first(expArea->text, "%d", boost::lexical_cast<std::string>(curHero->exp));
+	boost::replace_first(expArea->text, "%d", std::to_string(curHero->level));
+	boost::replace_first(expArea->text, "%d", std::to_string(CGI->heroh->reqExp(curHero->level+1)));
+	boost::replace_first(expArea->text, "%d", std::to_string(curHero->exp));
 
 	//printing spell points, boost::format can't be used due to locale issues
 	spellPointsArea->text = CGI->generaltexth->allTexts[205];
-	boost::replace_first(spellPointsArea->text, "%s", boost::lexical_cast<std::string>(curHero->getNameTranslated()));
-	boost::replace_first(spellPointsArea->text, "%d", boost::lexical_cast<std::string>(curHero->mana));
-	boost::replace_first(spellPointsArea->text, "%d", boost::lexical_cast<std::string>(heroWArt.manaLimit()));
+	boost::replace_first(spellPointsArea->text, "%s", curHero->getNameTranslated());
+	boost::replace_first(spellPointsArea->text, "%d", std::to_string(curHero->mana));
+	boost::replace_first(spellPointsArea->text, "%d", std::to_string(heroWArt.manaLimit()));
 
 	//if we have exchange window with this curHero open
 	bool noDismiss=false;

+ 15 - 15
client/windows/CKingdomInterface.cpp

@@ -138,7 +138,7 @@ std::string InfoBoxAbstractHeroData::getValueText()
 	case HERO_MANA:
 	case HERO_EXPERIENCE:
 	case HERO_PRIMARY_SKILL:
-		return boost::lexical_cast<std::string>(getValue());
+		return std::to_string(getValue());
 	case HERO_SPECIAL:
 		return CGI->generaltexth->jktexts[5];
 	case HERO_SECONDARY_SKILL:
@@ -377,10 +377,10 @@ std::string InfoBoxHeroData::getValueText()
 		switch (type)
 		{
 		case HERO_MANA:
-			return boost::lexical_cast<std::string>(hero->mana) + '/' +
-				boost::lexical_cast<std::string>(hero->manaLimit());
+			return std::to_string(hero->mana) + '/' +
+				std::to_string(hero->manaLimit());
 		case HERO_EXPERIENCE:
-			return boost::lexical_cast<std::string>(hero->exp);
+			return std::to_string(hero->exp);
 		}
 	}
 	return InfoBoxAbstractHeroData::getValueText();
@@ -393,15 +393,15 @@ void InfoBoxHeroData::prepareMessage(std::string & text, std::shared_ptr<CCompon
 	{
 	case HERO_MANA:
 		text = CGI->generaltexth->allTexts[205];
-		boost::replace_first(text, "%s", boost::lexical_cast<std::string>(hero->getNameTranslated()));
-		boost::replace_first(text, "%d", boost::lexical_cast<std::string>(hero->mana));
-		boost::replace_first(text, "%d", boost::lexical_cast<std::string>(hero->manaLimit()));
+		boost::replace_first(text, "%s", hero->getNameTranslated());
+		boost::replace_first(text, "%d", std::to_string(hero->mana));
+		boost::replace_first(text, "%d", std::to_string(hero->manaLimit()));
 		break;
 	case HERO_EXPERIENCE:
 		text = CGI->generaltexth->allTexts[2];
-		boost::replace_first(text, "%d", boost::lexical_cast<std::string>(hero->level));
-		boost::replace_first(text, "%d", boost::lexical_cast<std::string>(CGI->heroh->reqExp(hero->level+1)));
-		boost::replace_first(text, "%d", boost::lexical_cast<std::string>(hero->exp));
+		boost::replace_first(text, "%d", std::to_string(hero->level));
+		boost::replace_first(text, "%d", std::to_string(CGI->heroh->reqExp(hero->level+1)));
+		boost::replace_first(text, "%d", std::to_string(hero->exp));
 		break;
 	default:
 		InfoBoxAbstractHeroData::prepareMessage(text, comp);
@@ -539,7 +539,7 @@ std::shared_ptr<CIntObject> CKingdomInterface::createOwnedObject(size_t index)
 	if(index < objects.size())
 	{
 		OwnedObjectInfo & obj = objects[index];
-		std::string value = boost::lexical_cast<std::string>(obj.count);
+		std::string value = std::to_string(obj.count);
 		auto data = std::make_shared<InfoBoxCustom>(value, "", "FLAGPORT", obj.imageID, obj.hoverText);
 		return std::make_shared<InfoBox>(Point(), InfoBox::POS_CORNER, InfoBox::SIZE_SMALL, data);
 	}
@@ -596,7 +596,7 @@ void CKingdomInterface::generateMinesList(const std::vector<const CGObjectInstan
 	}
 	for(int i=0; i<7; i++)
 	{
-		std::string value = boost::lexical_cast<std::string>(minesCount[i]);
+		std::string value = std::to_string(minesCount[i]);
 		auto data = std::make_shared<InfoBoxCustom>(value, "", "OVMINES", i, CGI->generaltexth->translate("core.minename", i));
 		minesBox[i] = std::make_shared<InfoBox>(Point(20+i*80, 31+footerPos), InfoBox::POS_INSIDE, InfoBox::SIZE_SMALL, data);
 		minesBox[i]->removeUsedEvents(LCLICK|RCLICK); //fixes #890 - mines boxes ignore clicks
@@ -604,7 +604,7 @@ void CKingdomInterface::generateMinesList(const std::vector<const CGObjectInstan
 	incomeArea = std::make_shared<CHoverableArea>();
 	incomeArea->pos = Rect(pos.x+580, pos.y+31+footerPos, 136, 68);
 	incomeArea->hoverText = CGI->generaltexth->allTexts[255];
-	incomeAmount = std::make_shared<CLabel>(628, footerPos + 70, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, boost::lexical_cast<std::string>(totalIncome));
+	incomeAmount = std::make_shared<CLabel>(628, footerPos + 70, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, std::to_string(totalIncome));
 }
 
 void CKingdomInterface::generateButtons()
@@ -772,7 +772,7 @@ CTownItem::CTownItem(const CGTownInstance * Town)
 	background = std::make_shared<CAnimImage>("OVSLOT", 6);
 	name = std::make_shared<CLabel>(74, 8, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, town->getNameTranslated());
 
-	income = std::make_shared<CLabel>( 190, 60, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(town->dailyIncome()[Res::GOLD]));
+	income = std::make_shared<CLabel>( 190, 60, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(town->dailyIncome()[Res::GOLD]));
 	hall = std::make_shared<CTownInfo>( 69, 31, town, true);
 	fort = std::make_shared<CTownInfo>(111, 31, town, false);
 
@@ -801,7 +801,7 @@ void CTownItem::updateGarrisons()
 
 void CTownItem::update()
 {
-	std::string incomeVal = boost::lexical_cast<std::string>(town->dailyIncome()[Res::GOLD]);
+	std::string incomeVal = std::to_string(town->dailyIncome()[Res::GOLD]);
 	if (incomeVal != income->getText())
 		income->setText(incomeVal);
 

+ 3 - 3
client/windows/CSpellWindow.cpp

@@ -181,7 +181,7 @@ CSpellWindow::CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _m
 
 	for(auto item : schoolBorders)
 		item->preload();
-	mana = std::make_shared<CLabel>(435, 426, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, boost::lexical_cast<std::string>(myHero->mana));
+	mana = std::make_shared<CLabel>(435, 426, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, std::to_string(myHero->mana));
 	statusBar = CGStatusBar::create(7, 569, "Spelroll.bmp");
 
 	interactiveAreas.push_back(std::make_shared<InteractiveArea>( Rect( 479 + pos.x, 405 + pos.y, 36, 56), std::bind(&CSpellWindow::fexitb,         this),    460, this));
@@ -393,7 +393,7 @@ void CSpellWindow::setCurrentPage(int value)
 	leftCorner->visible = currentPage != 0;
 	rightCorner->visible = (currentPage+1) < pagesWithinCurrentTab();
 
-	mana->setText(boost::lexical_cast<std::string>(myHero->mana));//just in case, it will be possible to cast spell without closing book
+	mana->setText(std::to_string(myHero->mana));//just in case, it will be possible to cast spell without closing book
 }
 
 void CSpellWindow::turnPageLeft()
@@ -581,7 +581,7 @@ void CSpellWindow::SpellArea::clickRight(tribool down, bool previousState)
 		else
 		{
 			dmgInfo = CGI->generaltexth->allTexts[343];
-			boost::algorithm::replace_first(dmgInfo, "%d", boost::lexical_cast<std::string>(causedDmg));
+			boost::algorithm::replace_first(dmgInfo, "%d", std::to_string(causedDmg));
 		}
 
 		CRClickPopup::createAndPush(mySpell->getDescriptionTranslated(schoolLevel) + dmgInfo, std::make_shared<CComponent>(CComponent::spell, mySpell->id));

+ 11 - 11
client/windows/CTradeWindow.cpp

@@ -532,10 +532,10 @@ void CTradeWindow::initSubs(bool Left)
 			switch(itemsType[1])
 			{
 			case CREATURE:
-				item->subtitle = boost::lexical_cast<std::string>(hero->getStackCount(SlotID(item->serial)));
+				item->subtitle = std::to_string(hero->getStackCount(SlotID(item->serial)));
 				break;
 			case RESOURCE:
-				item->subtitle = boost::lexical_cast<std::string>(LOCPLINT->cb->getResourceAmount(static_cast<Res::ERes>(item->serial)));
+				item->subtitle = std::to_string(LOCPLINT->cb->getResourceAmount(static_cast<Res::ERes>(item->serial)));
 				break;
 			}
 		}
@@ -940,7 +940,7 @@ std::string CMarketplaceWindow::selectionSubtitle(bool Left) const
 					? slider->getValue() * r1
 					: (((deal->isBlocked())) ? 0 : r1);
 
-				return boost::lexical_cast<std::string>(val);
+				return std::to_string(val);
 			}
 		case ARTIFACT_INSTANCE:
 			return ((deal->isBlocked()) ? "0" : "1");
@@ -952,9 +952,9 @@ std::string CMarketplaceWindow::selectionSubtitle(bool Left) const
 		{
 		case RESOURCE:
 			if(slider)
-				return boost::lexical_cast<std::string>( slider->getValue() * r2 );
+				return std::to_string( slider->getValue() * r2 );
 			else
-				return boost::lexical_cast<std::string>(r2);
+				return std::to_string(r2);
 		case ARTIFACT_TYPE:
 			return ((deal->isBlocked()) ? "0" : "1");
 		case PLAYER:
@@ -1353,7 +1353,7 @@ Point CAltarWindow::selectionOffset(bool Left) const
 std::string CAltarWindow::selectionSubtitle(bool Left) const
 {
 	if(Left && slider && hLeft)
-		return boost::lexical_cast<std::string>(slider->getValue());
+		return std::to_string(slider->getValue());
 	else if(!Left && hRight)
 		return hRight->subtitle;
 	else
@@ -1409,12 +1409,12 @@ void CAltarWindow::calcTotalExp()
 		}
 	}
 	val = static_cast<int>(hero->calculateXp(val));
-	expOnAltar->setText(boost::lexical_cast<std::string>(val));
+	expOnAltar->setText(std::to_string(val));
 }
 
 void CAltarWindow::setExpToLevel()
 {
-	expToLevel->setText(boost::lexical_cast<std::string>(CGI->heroh->reqExp(CGI->heroh->level(hero->exp)+1) - hero->exp));
+	expToLevel->setText(std::to_string(CGI->heroh->reqExp(CGI->heroh->level(hero->exp)+1) - hero->exp));
 }
 
 void CAltarWindow::blockTrade()
@@ -1433,7 +1433,7 @@ void CAltarWindow::updateRight(std::shared_ptr<CTradeableItem> toUpdate)
 {
 	int val = sacrificedUnits[toUpdate->serial];
 	toUpdate->setType(val ? CREATURE : CREATURE_PLACEHOLDER);
-	toUpdate->subtitle = val ? boost::str(boost::format(CGI->generaltexth->allTexts[122]) % boost::lexical_cast<std::string>(hero->calculateXp(val * expPerUnit[toUpdate->serial]))) : ""; //%s exp
+	toUpdate->subtitle = val ? boost::str(boost::format(CGI->generaltexth->allTexts[122]) % std::to_string(hero->calculateXp(val * expPerUnit[toUpdate->serial]))) : ""; //%s exp
 }
 
 int CAltarWindow::firstFreeSlot()
@@ -1479,7 +1479,7 @@ void CAltarWindow::showAll(SDL_Surface * to)
 		int dmp, val;
 		market->getOffer(arts->commonInfo->src.art->artType->getId(), 0, dmp, val, EMarketMode::ARTIFACT_EXP);
 		val = static_cast<int>(hero->calculateXp(val));
-		printAtMiddleLoc(boost::lexical_cast<std::string>(val), 304, 498, FONT_SMALL, Colors::WHITE, to);
+		printAtMiddleLoc(std::to_string(val), 304, 498, FONT_SMALL, Colors::WHITE, to);
 	}
 }
 
@@ -1508,7 +1508,7 @@ bool CAltarWindow::putOnAltar(std::shared_ptr<CTradeableItem> altarSlot, const C
 
 	arts->artifactsOnAltar.insert(art);
 	altarSlot->setArtInstance(art);
-	altarSlot->subtitle = boost::lexical_cast<std::string>(val);
+	altarSlot->subtitle = std::to_string(val);
 
 	deal->block(false);
 	return true;

+ 2 - 2
client/windows/CreaturePurchaseCard.cpp

@@ -66,8 +66,8 @@ void CreaturePurchaseCard::initAmountInfo()
 
 void CreaturePurchaseCard::updateAmountInfo(int value)
 {
-	availableAmount->setText(boost::lexical_cast<std::string>(maxAmount-value));
-	purchaseAmount->setText(boost::lexical_cast<std::string>(value));
+	availableAmount->setText(std::to_string(maxAmount-value));
+	purchaseAmount->setText(std::to_string(value));
 }
 
 void CreaturePurchaseCard::initSlider()

+ 21 - 21
client/windows/GUIClasses.cpp

@@ -291,8 +291,8 @@ void CRecruitmentWindow::sliderMoved(int to)
 		return;
 
 	buyButton->block(!to);
-	availableValue->setText(boost::lexical_cast<std::string>(selected->amount - to));
-	toRecruitValue->setText(boost::lexical_cast<std::string>(to));
+	availableValue->setText(std::to_string(selected->amount - to));
+	toRecruitValue->setText(std::to_string(to));
 
 	totalCostValue->set(selected->creature->cost * to);
 }
@@ -323,8 +323,8 @@ CSplitWindow::CSplitWindow(const CCreature * creature, std::function<void(int, i
 	leftInput->filters += std::bind(&CTextInput::numberFilter, _1, _2, leftMin, leftMax);
 	rightInput->filters += std::bind(&CTextInput::numberFilter, _1, _2, rightMin, rightMax);
 
-	leftInput->setText(boost::lexical_cast<std::string>(leftAmount), false);
-	rightInput->setText(boost::lexical_cast<std::string>(rightAmount), false);
+	leftInput->setText(std::to_string(leftAmount), false);
+	rightInput->setText(std::to_string(rightAmount), false);
 
 	animLeft = std::make_shared<CCreaturePic>(20, 54, creature, true, false);
 	animRight = std::make_shared<CCreaturePic>(177, 54,creature, true, false);
@@ -365,8 +365,8 @@ void CSplitWindow::setAmount(int value, bool left)
 	leftAmount  = left ? value : total - value;
 	rightAmount = left ? total - value : value;
 
-	leftInput->setText(boost::lexical_cast<std::string>(leftAmount));
-	rightInput->setText(boost::lexical_cast<std::string>(rightAmount));
+	leftInput->setText(std::to_string(leftAmount));
+	rightInput->setText(std::to_string(rightAmount));
 }
 
 void CSplitWindow::apply()
@@ -451,7 +451,7 @@ CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj)
 	h2 = std::make_shared<HeroPortrait>(selected, 1, 162, 299, h[1]);
 
 	title = std::make_shared<CLabel>(200, 35, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[37]);
-	cost = std::make_shared<CLabel>(320, 328, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(GameConstants::HERO_GOLD_COST));
+	cost = std::make_shared<CLabel>(320, 328, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(GameConstants::HERO_GOLD_COST));
 
 	auto rumorText = boost::str(boost::format(CGI->generaltexth->allTexts[216]) % LOCPLINT->cb->getTavernRumor(tavernObj));
 	rumor = std::make_shared<CTextBox>(rumorText, Rect(32, 190, 330, 68), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE);
@@ -570,9 +570,9 @@ CTavernWindow::HeroPortrait::HeroPortrait(int & sel, int id, int x, int y, const
 
 		description = CGI->generaltexth->allTexts[215];
 		boost::algorithm::replace_first(description, "%s", h->getNameTranslated());
-		boost::algorithm::replace_first(description, "%d", boost::lexical_cast<std::string>(h->level));
+		boost::algorithm::replace_first(description, "%d", std::to_string(h->level));
 		boost::algorithm::replace_first(description, "%s", h->type->heroClass->getNameTranslated());
-		boost::algorithm::replace_first(description, "%d", boost::lexical_cast<std::string>(artifs));
+		boost::algorithm::replace_first(description, "%d", std::to_string(artifs));
 
 		portrait = std::make_shared<CAnimImage>("portraitsLarge", h->portrait);
 	}
@@ -968,17 +968,17 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
 		experienceAreas[b]->pos = Rect(Point(pos.x + 105 + 490 * b, pos.y + (qeLayout ? 41 : 45)), Point(32, 32));
 		experienceAreas[b]->hoverText = CGI->generaltexth->heroscrn[9];
 		experienceAreas[b]->text = CGI->generaltexth->allTexts[2];
-		boost::algorithm::replace_first(experienceAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->level));
-		boost::algorithm::replace_first(experienceAreas[b]->text, "%d", boost::lexical_cast<std::string>(CGI->heroh->reqExp(hero->level+1)));
-		boost::algorithm::replace_first(experienceAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->exp));
+		boost::algorithm::replace_first(experienceAreas[b]->text, "%d", std::to_string(hero->level));
+		boost::algorithm::replace_first(experienceAreas[b]->text, "%d", std::to_string(CGI->heroh->reqExp(hero->level+1)));
+		boost::algorithm::replace_first(experienceAreas[b]->text, "%d", std::to_string(hero->exp));
 
 		spellPointsAreas[b] = std::make_shared<LRClickableAreaWText>();
 		spellPointsAreas[b]->pos = Rect(Point(pos.x + 141 + 490 * b, pos.y + (qeLayout ? 41 : 45)), Point(32, 32));
 		spellPointsAreas[b]->hoverText = CGI->generaltexth->heroscrn[22];
 		spellPointsAreas[b]->text = CGI->generaltexth->allTexts[205];
 		boost::algorithm::replace_first(spellPointsAreas[b]->text, "%s", hero->getNameTranslated());
-		boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->mana));
-		boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", boost::lexical_cast<std::string>(hero->manaLimit()));
+		boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", std::to_string(hero->mana));
+		boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", std::to_string(hero->manaLimit()));
 
 		morale[b] = std::make_shared<MoraleLuckBox>(true, Rect(Point(176 + 490 * b, 39), Point(32, 32)), true);
 		luck[b] = std::make_shared<MoraleLuckBox>(false,  Rect(Point(212 + 490 * b, 39), Point(32, 32)), true);
@@ -1058,7 +1058,7 @@ void CExchangeWindow::updateWidgets()
 		for(int m=0; m<GameConstants::PRIMARY_SKILLS; ++m)
 		{
 			auto value = herosWArt[leftRight]->getPrimSkillLevel(static_cast<PrimarySkill::PrimarySkill>(m));
-			primSkillValues[leftRight][m]->setText(boost::lexical_cast<std::string>(value));
+			primSkillValues[leftRight][m]->setText(std::to_string(value));
 		}
 
 		for(int m=0; m < hero->secSkills.size(); ++m)
@@ -1091,8 +1091,8 @@ CShipyardWindow::CShipyardWindow(const std::vector<si32> & cost, int state, int
 	bgShip->center(waterCenter);
 
 	// Create resource icons and costs.
-	std::string goldValue = boost::lexical_cast<std::string>(cost[Res::GOLD]);
-	std::string woodValue = boost::lexical_cast<std::string>(cost[Res::WOOD]);
+	std::string goldValue = std::to_string(cost[Res::GOLD]);
+	std::string woodValue = std::to_string(cost[Res::WOOD]);
 
 	goldCost = std::make_shared<CLabel>(118, 294, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, goldValue);
 	woodCost = std::make_shared<CLabel>(212, 294, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, woodValue);
@@ -1156,7 +1156,7 @@ CTransformerWindow::CItem::CItem(CTransformerWindow * parent_, int size_, int id
 	pos.x += 45  + (id%3)*83 + id/6*83;
 	pos.y += 109 + (id/3)*98;
 	icon = std::make_shared<CAnimImage>("TWCRPORT", parent->army->getCreature(SlotID(id))->idNumber + 2);
-	count = std::make_shared<CLabel>(28, 76,FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast<std::string>(size));
+	count = std::make_shared<CLabel>(28, 76,FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(size));
 }
 
 void CTransformerWindow::makeDeal()
@@ -1526,7 +1526,7 @@ void CHillFortWindow::updateGarrisons()
 					slotIcons[i][j]->visible = true;
 					slotIcons[i][j]->setFrame(res);
 
-					slotLabels[i][j]->setText(boost::lexical_cast<std::string>(val));
+					slotLabels[i][j]->setText(std::to_string(val));
 					j++;
 				}
 			}
@@ -1549,7 +1549,7 @@ void CHillFortWindow::updateGarrisons()
 		else
 		{
 			totalIcons[i]->visible = true;
-			totalLabels[i]->setText(boost::lexical_cast<std::string>(totalSumm[i]));
+			totalLabels[i]->setText(std::to_string(totalSumm[i]));
 		}
 	}
 }
@@ -1712,7 +1712,7 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner):
 				for(int i=0; i<iter.second.details->primskills.size(); ++i)
 				{
 					primSkillValues.push_back(std::make_shared<CLabel>(310 + 66 * counter, 407 + 11*i, FONT_TINY, ETextAlignment::BOTTOMRIGHT, Colors::WHITE,
-							   boost::lexical_cast<std::string>(iter.second.details->primskills[i])));
+							   std::to_string(iter.second.details->primskills[i])));
 				}
 			}
 		}

+ 1 - 1
lib/CBonusTypeHandler.cpp

@@ -166,7 +166,7 @@ std::string CBonusTypeHandler::bonusToGraphics(const std::shared_ptr<Bonus> & bo
 	{
 		if(vstd::iswithin(bonus->val, 1, 5))
 		{
-			fileName = "E_SPLVL" + boost::lexical_cast<std::string>(bonus->val) + ".bmp";
+			fileName = "E_SPLVL" + std::to_string(bonus->val) + ".bmp";
 		}
 		break;
 	}

+ 1 - 1
lib/CCreatureHandler.cpp

@@ -420,7 +420,7 @@ CCreatureHandler::CCreatureHandler()
 	creaturesOfLevel[0].setDescription("Creatures of unnormalized tier");
 
 	for(int i = 1; i < ARRAY_COUNT(creaturesOfLevel); i++)
-		creaturesOfLevel[i].setDescription("Creatures of tier " + boost::lexical_cast<std::string>(i));
+		creaturesOfLevel[i].setDescription("Creatures of tier " + std::to_string(i));
 	loadCommanders();
 }
 

+ 5 - 5
lib/CGameState.cpp

@@ -191,7 +191,7 @@ DLL_LINKAGE void MetaString::toString(std::string &dst) const
 			}
 			break;
 		case TNUMBER:
-			dst += boost::lexical_cast<std::string>(numbers[nums++]);
+			dst += std::to_string(numbers[nums++]);
 			break;
 		case TREPLACE_ESTRING:
 			boost::replace_first(dst, "%s", exactStrings[exSt++]);
@@ -204,10 +204,10 @@ DLL_LINKAGE void MetaString::toString(std::string &dst) const
 			}
 			break;
 		case TREPLACE_NUMBER:
-			boost::replace_first(dst, "%d", boost::lexical_cast<std::string>(numbers[nums++]));
+			boost::replace_first(dst, "%d", std::to_string(numbers[nums++]));
 			break;
 		case TREPLACE_PLUSNUMBER:
-			boost::replace_first(dst, "%+d", '+' + boost::lexical_cast<std::string>(numbers[nums++]));
+			boost::replace_first(dst, "%+d", '+' + std::to_string(numbers[nums++]));
 			break;
 		default:
 			logGlobal->error("MetaString processing error! Received message of type %d", int(elem));
@@ -251,7 +251,7 @@ DLL_LINKAGE std::string MetaString::buildList () const
 			}
 				break;
 			case TNUMBER:
-				lista += boost::lexical_cast<std::string>(numbers[nums++]);
+				lista += std::to_string(numbers[nums++]);
 				break;
 			case TREPLACE_ESTRING:
 				lista.replace (lista.find("%s"), 2, exactStrings[exSt++]);
@@ -264,7 +264,7 @@ DLL_LINKAGE std::string MetaString::buildList () const
 			}
 				break;
 			case TREPLACE_NUMBER:
-				lista.replace (lista.find("%d"), 2, boost::lexical_cast<std::string>(numbers[nums++]));
+				lista.replace (lista.find("%d"), 2, std::to_string(numbers[nums++]));
 				break;
 			default:
 				logGlobal->error("MetaString processing error! Received message of type %d",int(message[i]));

+ 1 - 1
lib/JsonDetail.cpp

@@ -1177,7 +1177,7 @@ namespace Validation
 				if (path.getType() == JsonNode::JsonType::DATA_STRING)
 					errors += path.String();
 				else
-					errors += boost::lexical_cast<std::string>(static_cast<unsigned>(path.Float()));
+					errors += std::to_string(static_cast<unsigned>(path.Float()));
 			}
 		}
 		else

+ 3 - 3
lib/rmg/float3.h

@@ -135,9 +135,9 @@ public:
 
 	std::string toString() const
 	{
-		return	"(" + boost::lexical_cast<std::string>(x) +
-				" " + boost::lexical_cast<std::string>(y) +
-				" " + boost::lexical_cast<std::string>(z) + ")";
+		return	"(" + std::to_string(x) +
+				" " + std::to_string(y) +
+				" " + std::to_string(z) + ")";
 	}
 
 	bool valid() const

+ 1 - 1
mapeditor/Animation.cpp

@@ -653,7 +653,7 @@ void Animation::duplicateImage(const size_t sourceGroup, const size_t sourceFram
 
 	if(clone.getType() == JsonNode::JsonType::DATA_NULL)
 	{
-		std::string temp =  name+":"+boost::lexical_cast<std::string>(sourceGroup)+":"+boost::lexical_cast<std::string>(sourceFrame);
+		std::string temp =  name+":"+std::to_string(sourceGroup)+":"+std::to_string(sourceFrame);
 		clone["file"].String() = temp;
 	}
 

+ 2 - 2
server/CQuery.cpp

@@ -23,11 +23,11 @@ std::string formatContainer(const Container & c, std::string delimeter = ", ", s
 	auto itr = std::begin(c);
 	if(itr != std::end(c))
 	{
-		ret += boost::lexical_cast<std::string>(*itr);
+		ret += std::to_string(*itr);
 		while(++itr != std::end(c))
 		{
 			ret += delimeter;
-			ret += boost::lexical_cast<std::string>(*itr);
+			ret += std::to_string(*itr);
 		}
 	}
 	ret += closer;