diff --git a/client/lobby/CBonusSelection.cpp b/client/lobby/CBonusSelection.cpp index e63167a0c..4237cdb90 100644 --- a/client/lobby/CBonusSelection.cpp +++ b/client/lobby/CBonusSelection.cpp @@ -509,9 +509,9 @@ void CBonusSelection::CRegion::clickReleased(const Point & cursorPosition) void CBonusSelection::CRegion::showPopupWindow(const Point & cursorPosition) { // FIXME: For some reason "down" is only ever contain indeterminate_value - auto text = CSH->si->campState->scenario(idOfMapAndRegion).regionText; - if(!graphicsNotSelected->getSurface()->isTransparent(cursorPosition - pos.topLeft()) && text.size()) + auto & text = CSH->si->campState->scenario(idOfMapAndRegion).regionText; + if(!graphicsNotSelected->getSurface()->isTransparent(cursorPosition - pos.topLeft()) && !text.empty()) { - CRClickPopup::createAndPush(text); + CRClickPopup::createAndPush(text.toString()); } } diff --git a/client/mainmenu/CPrologEpilogVideo.cpp b/client/mainmenu/CPrologEpilogVideo.cpp index b37383c03..33231d4da 100644 --- a/client/mainmenu/CPrologEpilogVideo.cpp +++ b/client/mainmenu/CPrologEpilogVideo.cpp @@ -36,7 +36,7 @@ CPrologEpilogVideo::CPrologEpilogVideo(CampaignScenarioPrologEpilog _spe, std::f }; CCS->soundh->setCallback(voiceSoundHandle, onVoiceStop); - text = std::make_shared(Rect(100, 500, 600, 100), EFonts::FONT_BIG, ETextAlignment::CENTER, Colors::METALLIC_GOLD, spe.prologText); + text = std::make_shared(Rect(100, 500, 600, 100), EFonts::FONT_BIG, ETextAlignment::CENTER, Colors::METALLIC_GOLD, spe.prologText.toString()); text->scrollTextTo(-100); } diff --git a/lib/campaign/CampaignHandler.cpp b/lib/campaign/CampaignHandler.cpp index ad1e9146f..2efc2fac2 100644 --- a/lib/campaign/CampaignHandler.cpp +++ b/lib/campaign/CampaignHandler.cpp @@ -169,7 +169,7 @@ CampaignScenario CampaignHandler::readScenarioFromJson(JsonNode & reader) ret.prologVideo = VideoPath::fromJson(identifier["video"]); ret.prologMusic = AudioPath::fromJson(identifier["music"]); ret.prologVoice = AudioPath::fromJson(identifier["voice"]); - ret.prologText = identifier["text"].String(); + ret.prologText.jsonDeserialize(identifier["text"]); } return ret; }; @@ -181,7 +181,7 @@ CampaignScenario CampaignHandler::readScenarioFromJson(JsonNode & reader) ret.regionColor = reader["color"].Integer(); ret.difficulty = reader["difficulty"].Integer(); - ret.regionText = reader["regionText"].String(); + ret.regionText.jsonDeserialize(reader["regionText"]); ret.prolog = prologEpilogReader(reader["prolog"]); ret.epilog = prologEpilogReader(reader["epilog"]); @@ -410,7 +410,7 @@ CampaignScenario CampaignHandler::readScenarioFromMemory( CBinaryReader & reader ret.prologVideo = CampaignHandler::prologVideoName(index); ret.prologMusic = CampaignHandler::prologMusicName(reader.readUInt8()); ret.prologVoice = isOriginalCampaign ? CampaignHandler::prologVoiceName(index) : AudioPath(); - ret.prologText = readLocalizedString(reader, header.filename, header.modName, header.encoding, identifier); + ret.prologText.appendTextID(readLocalizedString(reader, header.filename, header.modName, header.encoding, identifier)); } return ret; }; @@ -428,7 +428,7 @@ CampaignScenario CampaignHandler::readScenarioFromMemory( CBinaryReader & reader } ret.regionColor = reader.readUInt8(); ret.difficulty = reader.readUInt8(); - ret.regionText = readLocalizedString(reader, header.filename, header.modName, header.encoding, ret.mapName + ".region"); + ret.regionText.appendTextID(readLocalizedString(reader, header.filename, header.modName, header.encoding, ret.mapName + ".region")); ret.prolog = prologEpilogReader(ret.mapName + ".prolog"); ret.epilog = prologEpilogReader(ret.mapName + ".epilog"); diff --git a/lib/campaign/CampaignScenarioPrologEpilog.h b/lib/campaign/CampaignScenarioPrologEpilog.h index ab67cc584..64611be70 100644 --- a/lib/campaign/CampaignScenarioPrologEpilog.h +++ b/lib/campaign/CampaignScenarioPrologEpilog.h @@ -10,6 +10,7 @@ #pragma once #include "../filesystem/ResourcePath.h" +#include "../MetaString.h" VCMI_LIB_NAMESPACE_BEGIN @@ -19,7 +20,7 @@ struct DLL_LINKAGE CampaignScenarioPrologEpilog VideoPath prologVideo; AudioPath prologMusic; // from CmpMusic.txt AudioPath prologVoice; - std::string prologText; + MetaString prologText; template void serialize(Handler &h, const int formatVersion) { diff --git a/lib/campaign/CampaignState.h b/lib/campaign/CampaignState.h index fc5f1cbdf..cbe133467 100644 --- a/lib/campaign/CampaignState.h +++ b/lib/campaign/CampaignState.h @@ -182,7 +182,7 @@ struct DLL_LINKAGE CampaignScenario ui8 regionColor = 0; ui8 difficulty = 0; - std::string regionText; + MetaString regionText; CampaignScenarioPrologEpilog prolog; CampaignScenarioPrologEpilog epilog;