diff --git a/AI/Nullkiller/Goals/AbstractGoal.cpp b/AI/Nullkiller/Goals/AbstractGoal.cpp index e188b78d1..d2e4f0d8c 100644 --- a/AI/Nullkiller/Goals/AbstractGoal.cpp +++ b/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(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(goalType); + return std::to_string(goalType); } if(hero.get(true)) //FIXME: used to crash when we lost hero and failed goal desc += " (" + hero->getNameTranslated() + ")"; diff --git a/AI/Nullkiller/Goals/GatherArmy.cpp b/AI/Nullkiller/Goals/GatherArmy.cpp index ce4d146ca..ce668e7cb 100644 --- a/AI/Nullkiller/Goals/GatherArmy.cpp +++ b/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(value); + return "Hero " + hero.get()->name + " gathered army of value " + std::to_string(value); } TSubgoal GatherArmy::whatToDoToAchieve() diff --git a/AI/VCAI/Goals/AbstractGoal.cpp b/AI/VCAI/Goals/AbstractGoal.cpp index b469c8008..3ea9d1d76 100644 --- a/AI/VCAI/Goals/AbstractGoal.cpp +++ b/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(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(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(goalType); + return std::to_string(goalType); } if(hero.get(true)) //FIXME: used to crash when we lost hero and failed goal desc += " (" + hero->getNameTranslated() + ")"; diff --git a/AI/VCAI/Goals/GatherArmy.cpp b/AI/VCAI/Goals/GatherArmy.cpp index d692944a3..8f092d70a 100644 --- a/AI/VCAI/Goals/GatherArmy.cpp +++ b/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(value); + return "Hero " + hero.get()->getNameTranslated() + " gathered army of value " + std::to_string(value); } TSubgoal GatherArmy::whatToDoToAchieve() diff --git a/AI/VCAI/Goals/VisitHero.cpp b/AI/VCAI/Goals/VisitHero.cpp index 09ae2bba8..2638880e5 100644 --- a/AI/VCAI/Goals/VisitHero.cpp +++ b/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(objid); + return "hero " + hero.get()->getNameTranslated() + " visited hero " + std::to_string(objid); } TSubgoal VisitHero::whatToDoToAchieve() diff --git a/AI/VCAI/Goals/VisitObj.cpp b/AI/VCAI/Goals/VisitObj.cpp index 7ebaba442..91d0d887d 100644 --- a/AI/VCAI/Goals/VisitObj.cpp +++ b/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(objid); + return "hero " + hero.get()->getNameTranslated() + " captured Object ID = " + std::to_string(objid); } TGoalVec VisitObj::getAllPossibleSubgoals() diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index d6be0044d..d5f60108b 100644 --- a/client/CPlayerInterface.cpp +++ b/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(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(autosaveCount++ + 1)); + LOCPLINT->cb->save("Saves/" + prefix + "Autosave_" + std::to_string(autosaveCount++ + 1)); autosaveCount %= 5; } diff --git a/client/CServerHandler.cpp b/client/CServerHandler.cpp index 8a64df231..b8f8900c4 100644 --- a/client/CServerHandler.cpp +++ b/client/CServerHandler.cpp @@ -198,12 +198,12 @@ void CServerHandler::startLocalServerAndConnect() #if defined(SINGLE_PROCESS_APP) boost::condition_variable cond; - std::vector args{"--uuid=" + uuid, "--port=" + boost::lexical_cast(getHostPort())}; + std::vector 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(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([&cond, args, this] { @@ -384,7 +384,7 @@ ui16 CServerHandler::getDefaultPort() std::string CServerHandler::getDefaultPortStr() { - return boost::lexical_cast(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(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(settings["session"]["port"].Integer()); + comm += " --lobby-port=" + std::to_string(settings["session"]["port"].Integer()); comm += " --lobby-uuid=" + settings["session"]["hostUuid"].String(); } diff --git a/client/adventureMap/CInfoBar.cpp b/client/adventureMap/CInfoBar.cpp index 2a9f4cc5c..bf948e78e 100644 --- a/client/adventureMap/CInfoBar.cpp +++ b/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(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(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(95, 31, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, labelText); @@ -159,7 +159,7 @@ CInfoBar::VisibleGameStatusInfo::VisibleGameStatusInfo() { hallIcons.push_back(std::make_shared("itmtl", i, 0, 6 + 42 * (int)i , 11)); if(halls[i]) - hallLabels.push_back(std::make_shared( 26 + 42 * (int)i, 64, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast(halls[i]))); + hallLabels.push_back(std::make_shared( 26 + 42 * (int)i, 64, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(halls[i]))); } } diff --git a/client/adventureMap/CResDataBar.cpp b/client/adventureMap/CResDataBar.cpp index 43c016b96..8d4cf1b91 100644 --- a/client/adventureMap/CResDataBar.cpp +++ b/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(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)); } diff --git a/client/battle/BattleInterfaceClasses.cpp b/client/battle/BattleInterfaceClasses.cpp index 72a4f0b0d..7614b9e82 100644 --- a/client/battle/BattleInterfaceClasses.cpp +++ b/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(br.exp[weAreAttacker ? 0 : 1])); + boost::algorithm::replace_first(str, "%d", std::to_string(br.exp[weAreAttacker ? 0 : 1])); } description = std::make_shared(str, Rect(69, 203, 330, 68), 0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE); diff --git a/client/battle/BattleSiegeController.cpp b/client/battle/BattleSiegeController.cpp index 602912807..d0102de16 100644 --- a/client/battle/BattleSiegeController.cpp +++ b/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(getImageIndex()); + std::string addit = std::to_string(getImageIndex()); switch(what) { diff --git a/client/gui/CGuiHandler.cpp b/client/gui/CGuiHandler.cpp index 33e803b40..1ebc32c11 100644 --- a/client/gui/CGuiHandler.cpp +++ b/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(mainFPSmng->getFramerate()); + std::string fps = std::to_string(mainFPSmng->getFramerate()); graphics->fonts[FONT_BIG]->renderTextLeft(screen, fps, Colors::YELLOW, Point(10, 10)); } diff --git a/client/lobby/CBonusSelection.cpp b/client/lobby/CBonusSelection.cpp index 099e66feb..104184418 100644 --- a/client/lobby/CBonusSelection.cpp +++ b/client/lobby/CBonusSelection.cpp @@ -98,7 +98,7 @@ CBonusSelection::CBonusSelection() for(size_t b = 0; b < difficultyIcons.size(); ++b) { - difficultyIcons[b] = std::make_shared("GSPBUT" + boost::lexical_cast(b + 3) + ".DEF", 0, 0, 709, 455); + difficultyIcons[b] = std::make_shared("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(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(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(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 bonusButton = std::make_shared(Point(475 + i * 68, 455), "", CButton::tooltip(desc, desc)); if(picNumber != -1) - picName += ":" + boost::lexical_cast(picNumber); + picName += ":" + std::to_string(picNumber); auto anim = std::make_shared(); anim->setCustom(picName, 0); diff --git a/client/mainmenu/CMainMenu.cpp b/client/mainmenu/CMainMenu.cpp index 09a674ccc..a2176f593 100644 --- a/client/mainmenu/CMainMenu.cpp +++ b/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(CSH->getHostPort()), true); + inputPort->setText(std::to_string(CSH->getHostPort()), true); buttonCancel = std::make_shared(Point(142, 142), "MUBCANC.DEF", CGI->generaltexth->zelp[561], std::bind(&CSimpleJoinScreen::leaveScreen, this), SDLK_ESCAPE); statusBar = CGStatusBar::create(std::make_shared(background->getSurface(), Rect(7, 186, 218, 18), 7, 186)); diff --git a/client/render/CAnimation.cpp b/client/render/CAnimation.cpp index 19fe67dfe..40cf03681 100644 --- a/client/render/CAnimation.cpp +++ b/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(sourceGroup)+":"+boost::lexical_cast(sourceFrame); + std::string temp = name+":"+std::to_string(sourceGroup)+":"+std::to_string(sourceFrame); clone["file"].String() = temp; } diff --git a/client/widgets/CComponent.cpp b/client/widgets/CComponent.cpp index 40ef9ca57..c5a5bd8f3 100644 --- a/client/widgets/CComponent.cpp +++ b/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(val); + case resource: return std::to_string(val); case creature: { auto creature = CGI->creh->getByIndex(subtype); if ( val ) - return boost::lexical_cast(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(val)); + boost::replace_first(level, "1", std::to_string(val)); return level; } else { - return boost::lexical_cast(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(); diff --git a/client/widgets/CreatureCostBox.cpp b/client/widgets/CreatureCostBox.cpp index 6a4d56286..d41242d8d 100644 --- a/client/widgets/CreatureCostBox.cpp +++ b/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(res[item.first])); + item.second.first->setText(std::to_string(res[item.first])); } void CreatureCostBox::createItems(TResources res) diff --git a/client/widgets/MiscWidgets.cpp b/client/widgets/MiscWidgets.cpp index aae6198d7..6a7c99ee8 100644 --- a/client/widgets/MiscWidgets.cpp +++ b/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(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(75 + 28 * (int)i, 58, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, - boost::lexical_cast(hero.details->primskills[i]))); + std::to_string(hero.details->primskills[i]))); - labels.push_back(std::make_shared(158, 98, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast(hero.details->mana))); + labels.push_back(std::make_shared(158, 98, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, std::to_string(hero.details->mana))); morale = std::make_shared("IMRL22", hero.details->morale + 3, 0, 5, 74); luck = std::make_shared("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(157, 58, FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, - boost::lexical_cast(town.details->goldIncome)); + std::to_string(town.details->goldIncome)); } if(town.details->garrisonedHero) //garrisoned hero icon garrisonedHero = std::make_shared("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(newAmount)); + amount->setText(std::to_string(newAmount)); else amount->setText(""); } diff --git a/client/widgets/TextControls.cpp b/client/widgets/TextControls.cpp index 4bc229cbb..e31d34647 100644 --- a/client/widgets/TextControls.cpp +++ b/client/widgets/TextControls.cpp @@ -669,9 +669,9 @@ void CTextInput::numberFilter(std::string & text, const std::string & oldText, i { int value = boost::lexical_cast(text); if(value < minValue) - text = boost::lexical_cast(minValue); + text = std::to_string(minValue); else if(value > maxValue) - text = boost::lexical_cast(maxValue); + text = std::to_string(maxValue); } catch(boost::bad_lexical_cast &) { diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index 62b38ece3..d0b903335 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -285,7 +285,7 @@ CDwellingInfoBox::CDwellingInfoBox(int centerX, int centerY, const CGTownInstanc title = std::make_shared(80, 30, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, creature->getNamePluralTranslated()); animation = std::make_shared(30, 44, creature, true, true); - std::string text = boost::lexical_cast(Town->creatures.at(level).first); + std::string text = std::to_string(Town->creatures.at(level).first); available = std::make_shared(80,190, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->allTexts[217] + text); costPerTroop = std::make_shared(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("RESOURCE", i, 0, 0, 0)); - resAmount.push_back(std::make_shared(0,0, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast(creature->cost[i]))); + resAmount.push_back(std::make_shared(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(LOCPLINT->cb->howManyHeroes(false))); + boost::algorithm::replace_first(tmp,"%d",std::to_string(LOCPLINT->cb->howManyHeroes(false))); LOCPLINT->showInfoDialog(tmp, std::vector>(), soundBase::sound_todo); allow = false; } @@ -903,7 +903,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(town->bonusValue.second)); + boost::algorithm::replace_first(descr,"%d",std::to_string(town->bonusValue.second)); } } LOCPLINT->showInfoDialog(descr, comps); @@ -1002,9 +1002,9 @@ CCreaInfo::CCreaInfo(Point position, const CGTownInstance * Town, int Level, boo std::string value; if(showAvailable) - value = boost::lexical_cast(town->creatures[level].first); + value = std::to_string(town->creatures[level].first); else - value = std::string("+") + boost::lexical_cast(town->creatureGrowth(level)); + value = std::string("+") + std::to_string(town->creatureGrowth(level)); if(compact) { @@ -1027,9 +1027,9 @@ void CCreaInfo::update() { std::string value; if(showAvailable) - value = boost::lexical_cast(town->creatures[level].first); + value = std::to_string(town->creatures[level].first); else - value = std::string("+") + boost::lexical_cast(town->creatureGrowth(level)); + value = std::string("+") + std::to_string(town->creatureGrowth(level)); if(value != label->getText()) label->setText(value); @@ -1258,7 +1258,7 @@ void CCastleInterface::recreateIcons() icon->setFrame(iconIndex); TResources townIncome = town->dailyIncome(); - income->setText(boost::lexical_cast(townIncome[Res::GOLD])); + income->setText(std::to_string(townIncome[Res::GOLD])); hall = std::make_shared(80, 413, town, true); fort = std::make_shared(122, 413, town, false); @@ -1536,9 +1536,9 @@ void LabeledValue::init(std::string nameText, std::string descr, int min, int ma std::string valueText; if(min && max) { - valueText = boost::lexical_cast(min); + valueText = std::to_string(min); if(min != max) - valueText += '-' + boost::lexical_cast(max); + valueText += '-' + std::to_string(max); } name = std::make_shared(3, 0, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, nameText); value = std::make_shared(pos.w-3, pos.h-2, FONT_SMALL, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, valueText); @@ -1660,7 +1660,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(available); + std::string availableText = CGI->generaltexth->allTexts[217]+ std::to_string(available); availableCount = std::make_shared(78, 119, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, availableText); } } @@ -1727,7 +1727,7 @@ void CFortScreen::RecruitArea::creaturesChangedEventHandler() { if(availableCount) { - std::string availableText = CGI->generaltexth->allTexts[217] + boost::lexical_cast(town->creatures[level].first); + std::string availableText = CGI->generaltexth->allTexts[217] + std::to_string(town->creatures[level].first); availableCount->setText(availableText); } } @@ -1836,7 +1836,7 @@ CBlacksmithDialog::CBlacksmithDialog(bool possible, CreatureID creMachineID, Art boost::str(boost::format(CGI->generaltexth->allTexts[274]) % creature->getNameSingularTranslated())); costText = std::make_shared(165, 218, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->jktexts[43]); costValue = std::make_shared(165, 290, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, - boost::lexical_cast(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(Point(42, 312), "IBUY30.DEF", CButton::tooltip(text), [&](){ close(); }, SDLK_RETURN); diff --git a/client/windows/CCreatureWindow.cpp b/client/windows/CCreatureWindow.cpp index 5b4cece27..69362a1f1 100644 --- a/client/windows/CCreatureWindow.cpp +++ b/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(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(duration)); + boost::replace_first(spellText, "%d", std::to_string(duration)); spellIcons.push_back(std::make_shared("SpellInt", effect + 1, 0, firstPos.x + offset.x * printed, firstPos.y + offset.y * printed)); clickableAreas.push_back(std::make_shared(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(commander->getExpRank())); - boost::replace_first(area->text, "%d", boost::lexical_cast(CGI->heroh->reqExp(commander->getExpRank() + 1))); - boost::replace_first(area->text, "%d", boost::lexical_cast(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(rank)); - boost::replace_first(expText, "%i", boost::lexical_cast(stack->experience)); + boost::replace_first(expText, "%i", std::to_string(rank)); + boost::replace_first(expText, "%i", std::to_string(stack->experience)); number = static_cast(CGI->creh->expRanks[tier][rank] - stack->experience); - boost::replace_first(expText, "%i", boost::lexical_cast(number)); + boost::replace_first(expText, "%i", std::to_string(number)); number = CGI->creh->maxExpPerBattle[tier]; //percent - boost::replace_first(expText, "%i%", boost::lexical_cast(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(number)); + boost::replace_first(expText, "%i", std::to_string(number)); - boost::replace_first(expText, "%i", boost::lexical_cast(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((stack->count * (stack->experience - expmin)) / expmin); //Maximum New Recruits without losing current Rank - boost::replace_first(expText, "%i", boost::lexical_cast(number)); //TODO + boost::replace_first(expText, "%i", std::to_string(number)); //TODO - boost::replace_first(expText, "%.2f", boost::lexical_cast(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(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(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(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; } diff --git a/client/windows/CHeroWindow.cpp b/client/windows/CHeroWindow.cpp index 052b4f4ac..a925b8d11 100644 --- a/client/windows/CHeroWindow.cpp +++ b/client/windows/CHeroWindow.cpp @@ -252,7 +252,7 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded) for(size_t g=0; gbonusValue = heroWArt.getPrimSkillLevel(static_cast(g)); - primSkillValues[g]->setText(boost::lexical_cast(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(curHero->level)); - boost::replace_first(expArea->text, "%d", boost::lexical_cast(CGI->heroh->reqExp(curHero->level+1))); - boost::replace_first(expArea->text, "%d", boost::lexical_cast(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(curHero->getNameTranslated())); - boost::replace_first(spellPointsArea->text, "%d", boost::lexical_cast(curHero->mana)); - boost::replace_first(spellPointsArea->text, "%d", boost::lexical_cast(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; diff --git a/client/windows/CKingdomInterface.cpp b/client/windows/CKingdomInterface.cpp index c4e142fdf..090d2bed2 100644 --- a/client/windows/CKingdomInterface.cpp +++ b/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(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(hero->mana) + '/' + - boost::lexical_cast(hero->manaLimit()); + return std::to_string(hero->mana) + '/' + + std::to_string(hero->manaLimit()); case HERO_EXPERIENCE: - return boost::lexical_cast(hero->exp); + return std::to_string(hero->exp); } } return InfoBoxAbstractHeroData::getValueText(); @@ -393,15 +393,15 @@ void InfoBoxHeroData::prepareMessage(std::string & text, std::shared_ptrgeneraltexth->allTexts[205]; - boost::replace_first(text, "%s", boost::lexical_cast(hero->getNameTranslated())); - boost::replace_first(text, "%d", boost::lexical_cast(hero->mana)); - boost::replace_first(text, "%d", boost::lexical_cast(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(hero->level)); - boost::replace_first(text, "%d", boost::lexical_cast(CGI->heroh->reqExp(hero->level+1))); - boost::replace_first(text, "%d", boost::lexical_cast(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 CKingdomInterface::createOwnedObject(size_t index) if(index < objects.size()) { OwnedObjectInfo & obj = objects[index]; - std::string value = boost::lexical_cast(obj.count); + std::string value = std::to_string(obj.count); auto data = std::make_shared(value, "", "FLAGPORT", obj.imageID, obj.hoverText); return std::make_shared(Point(), InfoBox::POS_CORNER, InfoBox::SIZE_SMALL, data); } @@ -596,7 +596,7 @@ void CKingdomInterface::generateMinesList(const std::vector(minesCount[i]); + std::string value = std::to_string(minesCount[i]); auto data = std::make_shared(value, "", "OVMINES", i, CGI->generaltexth->translate("core.minename", i)); minesBox[i] = std::make_shared(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(); incomeArea->pos = Rect(pos.x+580, pos.y+31+footerPos, 136, 68); incomeArea->hoverText = CGI->generaltexth->allTexts[255]; - incomeAmount = std::make_shared(628, footerPos + 70, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, boost::lexical_cast(totalIncome)); + incomeAmount = std::make_shared(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("OVSLOT", 6); name = std::make_shared(74, 8, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, town->getNameTranslated()); - income = std::make_shared( 190, 60, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast(town->dailyIncome()[Res::GOLD])); + income = std::make_shared( 190, 60, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, std::to_string(town->dailyIncome()[Res::GOLD])); hall = std::make_shared( 69, 31, town, true); fort = std::make_shared(111, 31, town, false); @@ -801,7 +801,7 @@ void CTownItem::updateGarrisons() void CTownItem::update() { - std::string incomeVal = boost::lexical_cast(town->dailyIncome()[Res::GOLD]); + std::string incomeVal = std::to_string(town->dailyIncome()[Res::GOLD]); if (incomeVal != income->getText()) income->setText(incomeVal); diff --git a/client/windows/CSpellWindow.cpp b/client/windows/CSpellWindow.cpp index 0a4daffc7..6150ab154 100644 --- a/client/windows/CSpellWindow.cpp +++ b/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(435, 426, FONT_SMALL, ETextAlignment::CENTER, Colors::YELLOW, boost::lexical_cast(myHero->mana)); + mana = std::make_shared(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( 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(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(causedDmg)); + boost::algorithm::replace_first(dmgInfo, "%d", std::to_string(causedDmg)); } CRClickPopup::createAndPush(mySpell->getDescriptionTranslated(schoolLevel) + dmgInfo, std::make_shared(CComponent::spell, mySpell->id)); diff --git a/client/windows/CTradeWindow.cpp b/client/windows/CTradeWindow.cpp index 1faa587cf..17af4e591 100644 --- a/client/windows/CTradeWindow.cpp +++ b/client/windows/CTradeWindow.cpp @@ -532,10 +532,10 @@ void CTradeWindow::initSubs(bool Left) switch(itemsType[1]) { case CREATURE: - item->subtitle = boost::lexical_cast(hero->getStackCount(SlotID(item->serial))); + item->subtitle = std::to_string(hero->getStackCount(SlotID(item->serial))); break; case RESOURCE: - item->subtitle = boost::lexical_cast(LOCPLINT->cb->getResourceAmount(static_cast(item->serial))); + item->subtitle = std::to_string(LOCPLINT->cb->getResourceAmount(static_cast(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(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( slider->getValue() * r2 ); + return std::to_string( slider->getValue() * r2 ); else - return boost::lexical_cast(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(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(hero->calculateXp(val)); - expOnAltar->setText(boost::lexical_cast(val)); + expOnAltar->setText(std::to_string(val)); } void CAltarWindow::setExpToLevel() { - expToLevel->setText(boost::lexical_cast(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 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(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(hero->calculateXp(val)); - printAtMiddleLoc(boost::lexical_cast(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 altarSlot, const C arts->artifactsOnAltar.insert(art); altarSlot->setArtInstance(art); - altarSlot->subtitle = boost::lexical_cast(val); + altarSlot->subtitle = std::to_string(val); deal->block(false); return true; diff --git a/client/windows/CreaturePurchaseCard.cpp b/client/windows/CreaturePurchaseCard.cpp index b880146d3..4678a6546 100644 --- a/client/windows/CreaturePurchaseCard.cpp +++ b/client/windows/CreaturePurchaseCard.cpp @@ -66,8 +66,8 @@ void CreaturePurchaseCard::initAmountInfo() void CreaturePurchaseCard::updateAmountInfo(int value) { - availableAmount->setText(boost::lexical_cast(maxAmount-value)); - purchaseAmount->setText(boost::lexical_cast(value)); + availableAmount->setText(std::to_string(maxAmount-value)); + purchaseAmount->setText(std::to_string(value)); } void CreaturePurchaseCard::initSlider() diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index 9ab436628..265bdc595 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -291,8 +291,8 @@ void CRecruitmentWindow::sliderMoved(int to) return; buyButton->block(!to); - availableValue->setText(boost::lexical_cast(selected->amount - to)); - toRecruitValue->setText(boost::lexical_cast(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::functionfilters += std::bind(&CTextInput::numberFilter, _1, _2, leftMin, leftMax); rightInput->filters += std::bind(&CTextInput::numberFilter, _1, _2, rightMin, rightMax); - leftInput->setText(boost::lexical_cast(leftAmount), false); - rightInput->setText(boost::lexical_cast(rightAmount), false); + leftInput->setText(std::to_string(leftAmount), false); + rightInput->setText(std::to_string(rightAmount), false); animLeft = std::make_shared(20, 54, creature, true, false); animRight = std::make_shared(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(leftAmount)); - rightInput->setText(boost::lexical_cast(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(selected, 1, 162, 299, h[1]); title = std::make_shared(200, 35, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[37]); - cost = std::make_shared(320, 328, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast(GameConstants::HERO_GOLD_COST)); + cost = std::make_shared(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(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(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(artifs)); + boost::algorithm::replace_first(description, "%d", std::to_string(artifs)); portrait = std::make_shared("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(hero->level)); - boost::algorithm::replace_first(experienceAreas[b]->text, "%d", boost::lexical_cast(CGI->heroh->reqExp(hero->level+1))); - boost::algorithm::replace_first(experienceAreas[b]->text, "%d", boost::lexical_cast(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(); 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(hero->mana)); - boost::algorithm::replace_first(spellPointsAreas[b]->text, "%d", boost::lexical_cast(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(true, Rect(Point(176 + 490 * b, 39), Point(32, 32)), true); luck[b] = std::make_shared(false, Rect(Point(212 + 490 * b, 39), Point(32, 32)), true); @@ -1058,7 +1058,7 @@ void CExchangeWindow::updateWidgets() for(int m=0; mgetPrimSkillLevel(static_cast(m)); - primSkillValues[leftRight][m]->setText(boost::lexical_cast(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 & cost, int state, int bgShip->center(waterCenter); // Create resource icons and costs. - std::string goldValue = boost::lexical_cast(cost[Res::GOLD]); - std::string woodValue = boost::lexical_cast(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(118, 294, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, goldValue); woodCost = std::make_shared(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("TWCRPORT", parent->army->getCreature(SlotID(id))->idNumber + 2); - count = std::make_shared(28, 76,FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, boost::lexical_cast(size)); + count = std::make_shared(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(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(totalSumm[i])); + totalLabels[i]->setText(std::to_string(totalSumm[i])); } } } @@ -1712,7 +1712,7 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner): for(int i=0; iprimskills.size(); ++i) { primSkillValues.push_back(std::make_shared(310 + 66 * counter, 407 + 11*i, FONT_TINY, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, - boost::lexical_cast(iter.second.details->primskills[i]))); + std::to_string(iter.second.details->primskills[i]))); } } } diff --git a/lib/CBonusTypeHandler.cpp b/lib/CBonusTypeHandler.cpp index a7ee5d26e..0fd2ad35a 100644 --- a/lib/CBonusTypeHandler.cpp +++ b/lib/CBonusTypeHandler.cpp @@ -166,7 +166,7 @@ std::string CBonusTypeHandler::bonusToGraphics(const std::shared_ptr & bo { if(vstd::iswithin(bonus->val, 1, 5)) { - fileName = "E_SPLVL" + boost::lexical_cast(bonus->val) + ".bmp"; + fileName = "E_SPLVL" + std::to_string(bonus->val) + ".bmp"; } break; } diff --git a/lib/CCreatureHandler.cpp b/lib/CCreatureHandler.cpp index 7d0078464..f18381af0 100644 --- a/lib/CCreatureHandler.cpp +++ b/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(i)); + creaturesOfLevel[i].setDescription("Creatures of tier " + std::to_string(i)); loadCommanders(); } diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index c1dc7edee..242479ff0 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -191,7 +191,7 @@ DLL_LINKAGE void MetaString::toString(std::string &dst) const } break; case TNUMBER: - dst += boost::lexical_cast(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(numbers[nums++])); + boost::replace_first(dst, "%d", std::to_string(numbers[nums++])); break; case TREPLACE_PLUSNUMBER: - boost::replace_first(dst, "%+d", '+' + boost::lexical_cast(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(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(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])); diff --git a/lib/JsonDetail.cpp b/lib/JsonDetail.cpp index 50cda76d0..8c0442ad7 100644 --- a/lib/JsonDetail.cpp +++ b/lib/JsonDetail.cpp @@ -1177,7 +1177,7 @@ namespace Validation if (path.getType() == JsonNode::JsonType::DATA_STRING) errors += path.String(); else - errors += boost::lexical_cast(static_cast(path.Float())); + errors += std::to_string(static_cast(path.Float())); } } else diff --git a/lib/filesystem/CCompressedStream.cpp b/lib/filesystem/CCompressedStream.cpp index 520011784..ed10455f0 100644 --- a/lib/filesystem/CCompressedStream.cpp +++ b/lib/filesystem/CCompressedStream.cpp @@ -162,7 +162,7 @@ si64 CCompressedStream::readMore(ui8 *data, si64 size) break; default: if (inflateState->msg == nullptr) - throw std::runtime_error("Decompression error. Return code was " + boost::lexical_cast(ret)); + throw std::runtime_error("Decompression error. Return code was " + std::to_string(ret)); else throw std::runtime_error(std::string("Decompression error: ") + inflateState->msg); } diff --git a/lib/rmg/float3.h b/lib/rmg/float3.h index 3398f2877..538e6be77 100644 --- a/lib/rmg/float3.h +++ b/lib/rmg/float3.h @@ -135,9 +135,9 @@ public: std::string toString() const { - return "(" + boost::lexical_cast(x) + - " " + boost::lexical_cast(y) + - " " + boost::lexical_cast(z) + ")"; + return "(" + std::to_string(x) + + " " + std::to_string(y) + + " " + std::to_string(z) + ")"; } bool valid() const diff --git a/mapeditor/Animation.cpp b/mapeditor/Animation.cpp index 20632c9d0..7e36a58bd 100644 --- a/mapeditor/Animation.cpp +++ b/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(sourceGroup)+":"+boost::lexical_cast(sourceFrame); + std::string temp = name+":"+std::to_string(sourceGroup)+":"+std::to_string(sourceFrame); clone["file"].String() = temp; } diff --git a/server/CQuery.cpp b/server/CQuery.cpp index b42699e27..695a4ec3e 100644 --- a/server/CQuery.cpp +++ b/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(*itr); + ret += std::to_string(*itr); while(++itr != std::end(c)) { ret += delimeter; - ret += boost::lexical_cast(*itr); + ret += std::to_string(*itr); } } ret += closer;