mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Replace MetaString operator << with member function
This commit is contained in:
@@ -167,7 +167,7 @@ void CQuestLog::recreateLabelList()
|
|||||||
if (auto seersHut = dynamic_cast<const CGSeerHut *>(quests[i].obj))
|
if (auto seersHut = dynamic_cast<const CGSeerHut *>(quests[i].obj))
|
||||||
{
|
{
|
||||||
MetaString toSeer;
|
MetaString toSeer;
|
||||||
toSeer << VLC->generaltexth->allTexts[347];
|
toSeer.addRawString(VLC->generaltexth->allTexts[347]);
|
||||||
toSeer.addReplacement(seersHut->seerName);
|
toSeer.addReplacement(seersHut->seerName);
|
||||||
text.addReplacement(toSeer.toString());
|
text.addReplacement(toSeer.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,18 +147,23 @@ public:
|
|||||||
localStrings.push_back(txt);
|
localStrings.push_back(txt);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
MetaString& operator<<(const std::string &txt)
|
|
||||||
{
|
|
||||||
message.push_back(TEXACT_STRING);
|
|
||||||
exactStrings.push_back(txt);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
MetaString& operator<<(int64_t txt)
|
MetaString& operator<<(int64_t txt)
|
||||||
{
|
{
|
||||||
message.push_back(TNUMBER);
|
message.push_back(TNUMBER);
|
||||||
numbers.push_back(txt);
|
numbers.push_back(txt);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addRawString(std::string value)
|
||||||
|
{
|
||||||
|
message.push_back(TEXACT_STRING);
|
||||||
|
exactStrings.push_back(value);
|
||||||
|
}
|
||||||
|
void addNumber(int64_t value)
|
||||||
|
{
|
||||||
|
message.push_back(TNUMBER);
|
||||||
|
numbers.push_back(value);
|
||||||
|
}
|
||||||
void addReplacement(ui8 type, ui32 serial)
|
void addReplacement(ui8 type, ui32 serial)
|
||||||
{
|
{
|
||||||
message.push_back(TREPLACE_LSTRING);
|
message.push_back(TREPLACE_LSTRING);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void ShrineInstanceConstructor::randomizeObject(CGShrine * shrine, CRandomGenera
|
|||||||
if (visitTextParameter.isNumber())
|
if (visitTextParameter.isNumber())
|
||||||
shrine->visitText.addTxt(MetaString::ADVOB_TXT, static_cast<ui32>(visitTextParameter.Float()));
|
shrine->visitText.addTxt(MetaString::ADVOB_TXT, static_cast<ui32>(visitTextParameter.Float()));
|
||||||
else
|
else
|
||||||
shrine->visitText << visitTextParameter.String();
|
shrine->visitText.addRawString(visitTextParameter.String());
|
||||||
|
|
||||||
if(shrine->spell == SpellID::NONE) // shrine has no predefined spell
|
if(shrine->spell == SpellID::NONE) // shrine has no predefined spell
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -179,15 +179,15 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
|||||||
{
|
{
|
||||||
case Obj::SHIPWRECK:
|
case Obj::SHIPWRECK:
|
||||||
textID = 123;
|
textID = 123;
|
||||||
gbonus.bdescr << VLC->generaltexth->arraytxt[99];
|
gbonus.bdescr.addRawString(VLC->generaltexth->arraytxt[99]);
|
||||||
break;
|
break;
|
||||||
case Obj::DERELICT_SHIP:
|
case Obj::DERELICT_SHIP:
|
||||||
textID = 42;
|
textID = 42;
|
||||||
gbonus.bdescr << VLC->generaltexth->arraytxt[101];
|
gbonus.bdescr.addRawString(VLC->generaltexth->arraytxt[101]);
|
||||||
break;
|
break;
|
||||||
case Obj::CRYPT:
|
case Obj::CRYPT:
|
||||||
textID = 120;
|
textID = 120;
|
||||||
gbonus.bdescr << VLC->generaltexth->arraytxt[98];
|
gbonus.bdescr.addRawString(VLC->generaltexth->arraytxt[98]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cb->giveHeroBonus(&gbonus);
|
cb->giveHeroBonus(&gbonus);
|
||||||
@@ -208,7 +208,7 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
|||||||
case Obj::CREATURE_BANK:
|
case Obj::CREATURE_BANK:
|
||||||
case Obj::DRAGON_UTOPIA:
|
case Obj::DRAGON_UTOPIA:
|
||||||
default:
|
default:
|
||||||
iw.text << VLC->generaltexth->advobtxt[33];// This was X, now is completely empty
|
iw.text.addRawString(VLC->generaltexth->advobtxt[33]);// This was X, now is completely empty
|
||||||
iw.text.addReplacement(getObjectName());
|
iw.text.addReplacement(getObjectName());
|
||||||
}
|
}
|
||||||
if(textID != -1)
|
if(textID != -1)
|
||||||
@@ -227,7 +227,7 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
|||||||
if (bc->resources[it] != 0)
|
if (bc->resources[it] != 0)
|
||||||
{
|
{
|
||||||
iw.components.emplace_back(Component::EComponentType::RESOURCE, it, bc->resources[it], 0);
|
iw.components.emplace_back(Component::EComponentType::RESOURCE, it, bc->resources[it], 0);
|
||||||
loot << "%d %s";
|
loot.addRawString("%d %s");
|
||||||
loot.addReplacement(iw.components.back().val);
|
loot.addReplacement(iw.components.back().val);
|
||||||
loot.addReplacement(MetaString::RES_NAMES, iw.components.back().subtype);
|
loot.addReplacement(MetaString::RES_NAMES, iw.components.back().subtype);
|
||||||
cb->giveResource(hero->getOwner(), static_cast<EGameResID>(it), bc->resources[it]);
|
cb->giveResource(hero->getOwner(), static_cast<EGameResID>(it), bc->resources[it]);
|
||||||
@@ -237,7 +237,7 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
|||||||
for (auto & elem : bc->artifacts)
|
for (auto & elem : bc->artifacts)
|
||||||
{
|
{
|
||||||
iw.components.emplace_back(Component::EComponentType::ARTIFACT, elem, 0, 0);
|
iw.components.emplace_back(Component::EComponentType::ARTIFACT, elem, 0, 0);
|
||||||
loot << "%s";
|
loot.addRawString("%s");
|
||||||
loot.addReplacement(MetaString::ART_NAMES, elem);
|
loot.addReplacement(MetaString::ART_NAMES, elem);
|
||||||
cb->giveHeroNewArtifact(hero, VLC->arth->objects[elem], ArtifactPosition::FIRST_AVAILABLE);
|
cb->giveHeroNewArtifact(hero, VLC->arth->objects[elem], ArtifactPosition::FIRST_AVAILABLE);
|
||||||
}
|
}
|
||||||
@@ -312,7 +312,7 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
|||||||
for(const auto & elem : ourArmy.Slots())
|
for(const auto & elem : ourArmy.Slots())
|
||||||
{
|
{
|
||||||
iw.components.emplace_back(*elem.second);
|
iw.components.emplace_back(*elem.second);
|
||||||
loot << "%s";
|
loot.addRawString("%s");
|
||||||
loot.addReplacement(*elem.second);
|
loot.addReplacement(*elem.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ std::string CGCreature::getHoverText(PlayerColor player) const
|
|||||||
CCreature::CreatureQuantityId monsterQuantityId = stacks.begin()->second->getQuantityID();
|
CCreature::CreatureQuantityId monsterQuantityId = stacks.begin()->second->getQuantityID();
|
||||||
int quantityTextIndex = 172 + 3 * (int)monsterQuantityId;
|
int quantityTextIndex = 172 + 3 * (int)monsterQuantityId;
|
||||||
if(settings["gameTweaks"]["numericCreaturesQuantities"].Bool())
|
if(settings["gameTweaks"]["numericCreaturesQuantities"].Bool())
|
||||||
ms << CCreature::getQuantityRangeStringForId(monsterQuantityId);
|
ms.addRawString(CCreature::getQuantityRangeStringForId(monsterQuantityId));
|
||||||
else
|
else
|
||||||
ms.addTxt(MetaString::ARRAY_TXT, quantityTextIndex);
|
ms.addTxt(MetaString::ARRAY_TXT, quantityTextIndex);
|
||||||
ms << " " ;
|
ms.addRawString(" ");
|
||||||
ms.addTxt(MetaString::CRE_PL_NAMES,subID);
|
ms.addTxt(MetaString::CRE_PL_NAMES,subID);
|
||||||
ms.toString(hoverName);
|
ms.toString(hoverName);
|
||||||
return hoverName;
|
return hoverName;
|
||||||
@@ -50,10 +50,10 @@ std::string CGCreature::getHoverText(const CGHeroInstance * hero) const
|
|||||||
{
|
{
|
||||||
MetaString ms;
|
MetaString ms;
|
||||||
ms << stacks.begin()->second->count;
|
ms << stacks.begin()->second->count;
|
||||||
ms << " " ;
|
ms.addRawString(" ");
|
||||||
ms.addTxt(MetaString::CRE_PL_NAMES,subID);
|
ms.addTxt(MetaString::CRE_PL_NAMES,subID);
|
||||||
|
|
||||||
ms << "\n";
|
ms.addRawString("\n");
|
||||||
|
|
||||||
int decision = takenAction(hero, true);
|
int decision = takenAction(hero, true);
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ std::string CGCreature::getHoverText(const CGHeroInstance * hero) const
|
|||||||
ms.addTxt(MetaString::GENERAL_TXT,243);
|
ms.addTxt(MetaString::GENERAL_TXT,243);
|
||||||
break;
|
break;
|
||||||
default: //decision = cost in gold
|
default: //decision = cost in gold
|
||||||
ms << boost::to_string(boost::format(VLC->generaltexth->allTexts[244]) % decision);
|
ms.addRawString(boost::to_string(boost::format(VLC->generaltexth->allTexts[244]) % decision));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ void CGCreature::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
boost::algorithm::replace_first(tmp, "%d", std::to_string(getStackCount(SlotID(0))));
|
boost::algorithm::replace_first(tmp, "%d", std::to_string(getStackCount(SlotID(0))));
|
||||||
boost::algorithm::replace_first(tmp, "%d", std::to_string(action));
|
boost::algorithm::replace_first(tmp, "%d", std::to_string(action));
|
||||||
boost::algorithm::replace_first(tmp,"%s",VLC->creh->objects[subID]->getNamePluralTranslated());
|
boost::algorithm::replace_first(tmp,"%s",VLC->creh->objects[subID]->getNamePluralTranslated());
|
||||||
ynd.text << tmp;
|
ynd.text.addRawString(tmp);
|
||||||
cb->showBlockingDialog(&ynd);
|
cb->showBlockingDialog(&ynd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ void CGPandoraBox::giveContentsAfterExp(const CGHeroInstance *h) const
|
|||||||
for(const auto & elem : creatures.Slots())
|
for(const auto & elem : creatures.Slots())
|
||||||
{ //build list of joined creatures
|
{ //build list of joined creatures
|
||||||
iw.components.emplace_back(*elem.second);
|
iw.components.emplace_back(*elem.second);
|
||||||
loot << "%s";
|
loot.addRawString("%s");
|
||||||
loot.addReplacement(*elem.second);
|
loot.addReplacement(*elem.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ void CGPandoraBox::giveContentsAfterExp(const CGHeroInstance *h) const
|
|||||||
}
|
}
|
||||||
if(!hasGuardians && !msg.empty())
|
if(!hasGuardians && !msg.empty())
|
||||||
{
|
{
|
||||||
iw.text << msg;
|
iw.text.addRawString(msg);
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -290,7 +290,7 @@ void CGPandoraBox::getText( InfoWindow &iw, bool &afterBattle, int text, const C
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iw.text << message;
|
iw.text.addRawString(message);
|
||||||
afterBattle = true;
|
afterBattle = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,7 @@ void CGPandoraBox::getText( InfoWindow &iw, bool &afterBattle, int val, int nega
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iw.text << message;
|
iw.text.addRawString(message);
|
||||||
afterBattle = true;
|
afterBattle = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -461,7 +461,7 @@ void CGEvent::activated( const CGHeroInstance * h ) const
|
|||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = h->tempOwner;
|
iw.player = h->tempOwner;
|
||||||
if(!message.empty())
|
if(!message.empty())
|
||||||
iw.text << message;
|
iw.text.addRawString(message);
|
||||||
else
|
else
|
||||||
iw.text.addTxt(MetaString::ADVOB_TXT, 16);
|
iw.text.addTxt(MetaString::ADVOB_TXT, 16);
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ void COPWBonus::onHeroVisit (const CGHeroInstance * h) const
|
|||||||
mp.hid = heroID;
|
mp.hid = heroID;
|
||||||
cb->setMovePoints(&mp);
|
cb->setMovePoints(&mp);
|
||||||
|
|
||||||
iw.text << VLC->generaltexth->allTexts[580];
|
iw.text.addRawString(VLC->generaltexth->allTexts[580]);
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -168,7 +168,7 @@ void COPWBonus::onHeroVisit (const CGHeroInstance * h) const
|
|||||||
cb->setManaPoints (heroID, 2 * h->manaLimit());
|
cb->setManaPoints (heroID, 2 * h->manaLimit());
|
||||||
//TODO: investigate line below
|
//TODO: investigate line below
|
||||||
//cb->setObjProperty (town->id, ObjProperty::VISITED, true);
|
//cb->setObjProperty (town->id, ObjProperty::VISITED, true);
|
||||||
iw.text << getVisitingBonusGreeting();
|
iw.text.addRawString(getVisitingBonusGreeting());
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
//extra visit penalty if hero alredy had double mana points (or even more?!)
|
//extra visit penalty if hero alredy had double mana points (or even more?!)
|
||||||
town->addHeroToStructureVisitors(h, indexOnTV);
|
town->addHeroToStructureVisitors(h, indexOnTV);
|
||||||
@@ -246,7 +246,7 @@ void CTownBonus::onHeroVisit (const CGHeroInstance * h) const
|
|||||||
if(what != PrimarySkill::NONE)
|
if(what != PrimarySkill::NONE)
|
||||||
{
|
{
|
||||||
iw.player = cb->getOwner(heroID);
|
iw.player = cb->getOwner(heroID);
|
||||||
iw.text << getVisitingBonusGreeting();
|
iw.text.addRawString(getVisitingBonusGreeting());
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
cb->changePrimSkill (cb->getHero(heroID), what, val);
|
cb->changePrimSkill (cb->getHero(heroID), what, val);
|
||||||
town->addHeroToStructureVisitors(h, indexOnTV);
|
town->addHeroToStructureVisitors(h, indexOnTV);
|
||||||
@@ -278,7 +278,7 @@ void CTownBonus::applyBonuses(CGHeroInstance * h, const BonusList & bonuses) con
|
|||||||
addToVisitors = true;
|
addToVisitors = true;
|
||||||
|
|
||||||
iw.player = cb->getOwner(h->id);
|
iw.player = cb->getOwner(h->id);
|
||||||
iw.text << getCustomBonusGreeting(gb.bonus);
|
iw.text.addRawString(getCustomBonusGreeting(gb.bonus));
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
}
|
}
|
||||||
if(addToVisitors)
|
if(addToVisitors)
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ void CGTownInstance::onHeroVisit(const CGHeroInstance * h) const
|
|||||||
{
|
{
|
||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = h->tempOwner;
|
iw.player = h->tempOwner;
|
||||||
iw.text << h->commander->getName();
|
iw.text.addRawString(h->commander->getName());
|
||||||
iw.components.emplace_back(*h->commander);
|
iw.components.emplace_back(*h->commander);
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,12 +187,14 @@ void CQuest::getVisitText(MetaString &iwText, std::vector<Component> &components
|
|||||||
if(firstVisit)
|
if(firstVisit)
|
||||||
{
|
{
|
||||||
isCustom = isCustomFirst;
|
isCustom = isCustomFirst;
|
||||||
iwText << (text = firstVisitText);
|
text = firstVisitText;
|
||||||
|
iwText.addRawString(text);
|
||||||
}
|
}
|
||||||
else if(failRequirements)
|
else if(failRequirements)
|
||||||
{
|
{
|
||||||
isCustom = isCustomNext;
|
isCustom = isCustomNext;
|
||||||
iwText << (text = nextVisitText);
|
text = nextVisitText;
|
||||||
|
iwText.addRawString(text);
|
||||||
}
|
}
|
||||||
switch (missionType)
|
switch (missionType)
|
||||||
{
|
{
|
||||||
@@ -209,7 +211,7 @@ void CQuest::getVisitText(MetaString &iwText, std::vector<Component> &components
|
|||||||
if(m2stats[i])
|
if(m2stats[i])
|
||||||
{
|
{
|
||||||
components.emplace_back(Component::EComponentType::PRIM_SKILL, i, m2stats[i], 0);
|
components.emplace_back(Component::EComponentType::PRIM_SKILL, i, m2stats[i], 0);
|
||||||
loot << "%d %s";
|
loot.addRawString("%d %s");
|
||||||
loot.addReplacement(m2stats[i]);
|
loot.addReplacement(m2stats[i]);
|
||||||
loot.addReplacement(VLC->generaltexth->primarySkillNames[i]);
|
loot.addReplacement(VLC->generaltexth->primarySkillNames[i]);
|
||||||
}
|
}
|
||||||
@@ -244,7 +246,7 @@ void CQuest::getVisitText(MetaString &iwText, std::vector<Component> &components
|
|||||||
for(const auto & elem : m5arts)
|
for(const auto & elem : m5arts)
|
||||||
{
|
{
|
||||||
components.emplace_back(Component::EComponentType::ARTIFACT, elem, 0, 0);
|
components.emplace_back(Component::EComponentType::ARTIFACT, elem, 0, 0);
|
||||||
loot << "%s";
|
loot.addRawString("%s");
|
||||||
loot.addReplacement(MetaString::ART_NAMES, elem);
|
loot.addReplacement(MetaString::ART_NAMES, elem);
|
||||||
}
|
}
|
||||||
if(!isCustom)
|
if(!isCustom)
|
||||||
@@ -257,7 +259,7 @@ void CQuest::getVisitText(MetaString &iwText, std::vector<Component> &components
|
|||||||
for(const auto & elem : m6creatures)
|
for(const auto & elem : m6creatures)
|
||||||
{
|
{
|
||||||
components.emplace_back(elem);
|
components.emplace_back(elem);
|
||||||
loot << "%s";
|
loot.addRawString("%s");
|
||||||
loot.addReplacement(elem);
|
loot.addReplacement(elem);
|
||||||
}
|
}
|
||||||
if(!isCustom)
|
if(!isCustom)
|
||||||
@@ -272,7 +274,7 @@ void CQuest::getVisitText(MetaString &iwText, std::vector<Component> &components
|
|||||||
if(m7resources[i])
|
if(m7resources[i])
|
||||||
{
|
{
|
||||||
components.emplace_back(Component::EComponentType::RESOURCE, i, m7resources[i], 0);
|
components.emplace_back(Component::EComponentType::RESOURCE, i, m7resources[i], 0);
|
||||||
loot << "%d %s";
|
loot.addRawString("%d %s");
|
||||||
loot.addReplacement(m7resources[i]);
|
loot.addReplacement(m7resources[i]);
|
||||||
loot.addReplacement(MetaString::RES_NAMES, i);
|
loot.addReplacement(MetaString::RES_NAMES, i);
|
||||||
}
|
}
|
||||||
@@ -295,12 +297,12 @@ void CQuest::getRolloverText(MetaString &ms, bool onHover) const
|
|||||||
assert(missionType != MISSION_NONE);
|
assert(missionType != MISSION_NONE);
|
||||||
|
|
||||||
if(onHover)
|
if(onHover)
|
||||||
ms << "\n\n";
|
ms.addRawString("\n\n");
|
||||||
|
|
||||||
std::string questName = missionName(missionType);
|
std::string questName = missionName(missionType);
|
||||||
std::string questState = missionState(onHover ? 3 : 4);
|
std::string questState = missionState(onHover ? 3 : 4);
|
||||||
|
|
||||||
ms << VLC->generaltexth->translate("core.seerhut.quest", questName, questState,textOption);
|
ms.addRawString(VLC->generaltexth->translate("core.seerhut.quest", questName, questState,textOption));
|
||||||
|
|
||||||
switch(missionType)
|
switch(missionType)
|
||||||
{
|
{
|
||||||
@@ -314,7 +316,7 @@ void CQuest::getRolloverText(MetaString &ms, bool onHover) const
|
|||||||
{
|
{
|
||||||
if (m2stats[i])
|
if (m2stats[i])
|
||||||
{
|
{
|
||||||
loot << "%d %s";
|
loot.addRawString("%d %s");
|
||||||
loot.addReplacement(m2stats[i]);
|
loot.addReplacement(m2stats[i]);
|
||||||
loot.addReplacement(VLC->generaltexth->primarySkillNames[i]);
|
loot.addReplacement(VLC->generaltexth->primarySkillNames[i]);
|
||||||
}
|
}
|
||||||
@@ -333,7 +335,7 @@ void CQuest::getRolloverText(MetaString &ms, bool onHover) const
|
|||||||
MetaString loot;
|
MetaString loot;
|
||||||
for(const auto & elem : m5arts)
|
for(const auto & elem : m5arts)
|
||||||
{
|
{
|
||||||
loot << "%s";
|
loot.addRawString("%s");
|
||||||
loot.addReplacement(MetaString::ART_NAMES, elem);
|
loot.addReplacement(MetaString::ART_NAMES, elem);
|
||||||
}
|
}
|
||||||
ms.addReplacement(loot.buildList());
|
ms.addReplacement(loot.buildList());
|
||||||
@@ -344,7 +346,7 @@ void CQuest::getRolloverText(MetaString &ms, bool onHover) const
|
|||||||
MetaString loot;
|
MetaString loot;
|
||||||
for(const auto & elem : m6creatures)
|
for(const auto & elem : m6creatures)
|
||||||
{
|
{
|
||||||
loot << "%s";
|
loot.addRawString("%s");
|
||||||
loot.addReplacement(elem);
|
loot.addReplacement(elem);
|
||||||
}
|
}
|
||||||
ms.addReplacement(loot.buildList());
|
ms.addReplacement(loot.buildList());
|
||||||
@@ -357,7 +359,7 @@ void CQuest::getRolloverText(MetaString &ms, bool onHover) const
|
|||||||
{
|
{
|
||||||
if (m7resources[i])
|
if (m7resources[i])
|
||||||
{
|
{
|
||||||
loot << "%d %s";
|
loot.addRawString("%d %s");
|
||||||
loot.addReplacement(m7resources[i]);
|
loot.addReplacement(m7resources[i]);
|
||||||
loot.addReplacement(MetaString::RES_NAMES, i);
|
loot.addReplacement(MetaString::RES_NAMES, i);
|
||||||
}
|
}
|
||||||
@@ -378,7 +380,7 @@ void CQuest::getRolloverText(MetaString &ms, bool onHover) const
|
|||||||
|
|
||||||
void CQuest::getCompletionText(MetaString &iwText, std::vector<Component> &components, bool isCustom, const CGHeroInstance * h) const
|
void CQuest::getCompletionText(MetaString &iwText, std::vector<Component> &components, bool isCustom, const CGHeroInstance * h) const
|
||||||
{
|
{
|
||||||
iwText << completedText;
|
iwText.addRawString(completedText);
|
||||||
switch(missionType)
|
switch(missionType)
|
||||||
{
|
{
|
||||||
case CQuest::MISSION_LEVEL:
|
case CQuest::MISSION_LEVEL:
|
||||||
@@ -393,7 +395,7 @@ void CQuest::getCompletionText(MetaString &iwText, std::vector<Component> &compo
|
|||||||
{
|
{
|
||||||
if (m2stats[i])
|
if (m2stats[i])
|
||||||
{
|
{
|
||||||
loot << "%d %s";
|
loot.addRawString("%d %s");
|
||||||
loot.addReplacement(m2stats[i]);
|
loot.addReplacement(m2stats[i]);
|
||||||
loot.addReplacement(VLC->generaltexth->primarySkillNames[i]);
|
loot.addReplacement(VLC->generaltexth->primarySkillNames[i]);
|
||||||
}
|
}
|
||||||
@@ -407,7 +409,7 @@ void CQuest::getCompletionText(MetaString &iwText, std::vector<Component> &compo
|
|||||||
MetaString loot;
|
MetaString loot;
|
||||||
for(const auto & elem : m5arts)
|
for(const auto & elem : m5arts)
|
||||||
{
|
{
|
||||||
loot << "%s";
|
loot.addRawString("%s");
|
||||||
loot.addReplacement(MetaString::ART_NAMES, elem);
|
loot.addReplacement(MetaString::ART_NAMES, elem);
|
||||||
}
|
}
|
||||||
if (!isCustomComplete)
|
if (!isCustomComplete)
|
||||||
@@ -419,7 +421,7 @@ void CQuest::getCompletionText(MetaString &iwText, std::vector<Component> &compo
|
|||||||
MetaString loot;
|
MetaString loot;
|
||||||
for(const auto & elem : m6creatures)
|
for(const auto & elem : m6creatures)
|
||||||
{
|
{
|
||||||
loot << "%s";
|
loot.addRawString("%s");
|
||||||
loot.addReplacement(elem);
|
loot.addReplacement(elem);
|
||||||
}
|
}
|
||||||
if (!isCustomComplete)
|
if (!isCustomComplete)
|
||||||
@@ -433,7 +435,7 @@ void CQuest::getCompletionText(MetaString &iwText, std::vector<Component> &compo
|
|||||||
{
|
{
|
||||||
if (m7resources[i])
|
if (m7resources[i])
|
||||||
{
|
{
|
||||||
loot << "%d %s";
|
loot.addRawString("%d %s");
|
||||||
loot.addReplacement(m7resources[i]);
|
loot.addReplacement(m7resources[i]);
|
||||||
loot.addReplacement(MetaString::RES_NAMES, i);
|
loot.addReplacement(MetaString::RES_NAMES, i);
|
||||||
}
|
}
|
||||||
@@ -747,7 +749,7 @@ void CGSeerHut::onHeroVisit(const CGHeroInstance * h) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iw.text << VLC->generaltexth->seerEmpty[quest->completedOption];
|
iw.text.addRawString(VLC->generaltexth->seerEmpty[quest->completedOption]);
|
||||||
if (ID == Obj::SEER_HUT)
|
if (ID == Obj::SEER_HUT)
|
||||||
iw.text.addReplacement(seerName);
|
iw.text.addReplacement(seerName);
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
@@ -1161,7 +1163,11 @@ void CGBorderGuard::getVisitText (MetaString &text, std::vector<Component> &comp
|
|||||||
void CGBorderGuard::getRolloverText (MetaString &text, bool onHover) const
|
void CGBorderGuard::getRolloverText (MetaString &text, bool onHover) const
|
||||||
{
|
{
|
||||||
if (!onHover)
|
if (!onHover)
|
||||||
text << VLC->generaltexth->tentColors[subID] << " " << VLC->objtypeh->getObjectName(Obj::KEYMASTER, subID);
|
{
|
||||||
|
text.addRawString(VLC->generaltexth->tentColors[subID]);
|
||||||
|
text.addRawString(" ");
|
||||||
|
text.addRawString(VLC->objtypeh->getObjectName(Obj::KEYMASTER, subID));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGBorderGuard::checkQuest(const CGHeroInstance * h) const
|
bool CGBorderGuard::checkQuest(const CGHeroInstance * h) const
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ void CGResource::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
{
|
{
|
||||||
BlockingDialog ynd(true,false);
|
BlockingDialog ynd(true,false);
|
||||||
ynd.player = h->getOwner();
|
ynd.player = h->getOwner();
|
||||||
ynd.text << message;
|
ynd.text.addRawString(message);
|
||||||
cb->showBlockingDialog(&ynd);
|
cb->showBlockingDialog(&ynd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -288,7 +288,7 @@ void CGResource::collectRes(const PlayerColor & player) const
|
|||||||
if(!message.empty())
|
if(!message.empty())
|
||||||
{
|
{
|
||||||
sii.type = EInfoWindowMode::AUTO;
|
sii.type = EInfoWindowMode::AUTO;
|
||||||
sii.text << message;
|
sii.text.addRawString(message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -727,7 +727,7 @@ void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
|
|||||||
{
|
{
|
||||||
iw.components.emplace_back(Component::EComponentType::ARTIFACT, subID, 0, 0);
|
iw.components.emplace_back(Component::EComponentType::ARTIFACT, subID, 0, 0);
|
||||||
if(message.length())
|
if(message.length())
|
||||||
iw.text << message;
|
iw.text.addRawString(message);
|
||||||
else
|
else
|
||||||
iw.text.addTxt(MetaString::ART_EVNTS, subID);
|
iw.text.addTxt(MetaString::ART_EVNTS, subID);
|
||||||
}
|
}
|
||||||
@@ -737,7 +737,7 @@ void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
|
|||||||
int spellID = storedArtifact->getScrollSpellID();
|
int spellID = storedArtifact->getScrollSpellID();
|
||||||
iw.components.emplace_back(Component::EComponentType::SPELL, spellID, 0, 0);
|
iw.components.emplace_back(Component::EComponentType::SPELL, spellID, 0, 0);
|
||||||
if(message.length())
|
if(message.length())
|
||||||
iw.text << message;
|
iw.text.addRawString(message);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iw.text.addTxt(MetaString::ADVOB_TXT,135);
|
iw.text.addTxt(MetaString::ADVOB_TXT,135);
|
||||||
@@ -763,7 +763,7 @@ void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
|
|||||||
BlockingDialog ynd(true,false);
|
BlockingDialog ynd(true,false);
|
||||||
ynd.player = h->getOwner();
|
ynd.player = h->getOwner();
|
||||||
if(message.length())
|
if(message.length())
|
||||||
ynd.text << message;
|
ynd.text.addRawString(message);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: Guard text is more complex in H3, see mantis issue 2325 for details
|
// TODO: Guard text is more complex in H3, see mantis issue 2325 for details
|
||||||
@@ -781,7 +781,7 @@ void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
|
|||||||
{
|
{
|
||||||
BlockingDialog ynd(true,false);
|
BlockingDialog ynd(true,false);
|
||||||
ynd.player = h->getOwner();
|
ynd.player = h->getOwner();
|
||||||
ynd.text << message;
|
ynd.text.addRawString(message);
|
||||||
cb->showBlockingDialog(&ynd);
|
cb->showBlockingDialog(&ynd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -980,7 +980,7 @@ void CGShrine::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
iw.player = h->getOwner();
|
iw.player = h->getOwner();
|
||||||
iw.text = visitText;
|
iw.text = visitText;
|
||||||
iw.text.addTxt(MetaString::SPELL_NAME,spell);
|
iw.text.addTxt(MetaString::SPELL_NAME,spell);
|
||||||
iw.text << ".";
|
iw.text.addRawString(".");
|
||||||
|
|
||||||
if(!h->getArt(ArtifactPosition::SPELLBOOK))
|
if(!h->getArt(ArtifactPosition::SPELLBOOK))
|
||||||
{
|
{
|
||||||
@@ -1055,7 +1055,7 @@ void CGSignBottle::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
{
|
{
|
||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = h->getOwner();
|
iw.player = h->getOwner();
|
||||||
iw.text << message;
|
iw.text.addRawString(message);
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
|
|
||||||
if(ID == Obj::OCEAN_BOTTLE)
|
if(ID == Obj::OCEAN_BOTTLE)
|
||||||
|
|||||||
@@ -96,19 +96,19 @@ void CMapHeader::setupEvents()
|
|||||||
//Victory condition - defeat all
|
//Victory condition - defeat all
|
||||||
TriggeredEvent standardVictory;
|
TriggeredEvent standardVictory;
|
||||||
standardVictory.effect.type = EventEffect::VICTORY;
|
standardVictory.effect.type = EventEffect::VICTORY;
|
||||||
standardVictory.effect.toOtherMessage = VLC->generaltexth->allTexts[5];
|
standardVictory.effect.toOtherMessage = "core.genrltxt.5";
|
||||||
standardVictory.identifier = "standardVictory";
|
standardVictory.identifier = "standardVictory";
|
||||||
standardVictory.description.clear(); // TODO: display in quest window
|
standardVictory.description.clear(); // TODO: display in quest window
|
||||||
standardVictory.onFulfill = VLC->generaltexth->allTexts[659];
|
standardVictory.onFulfill = "core.genrltxt.659";
|
||||||
standardVictory.trigger = EventExpression(victoryCondition);
|
standardVictory.trigger = EventExpression(victoryCondition);
|
||||||
|
|
||||||
//Loss condition - 7 days without town
|
//Loss condition - 7 days without town
|
||||||
TriggeredEvent standardDefeat;
|
TriggeredEvent standardDefeat;
|
||||||
standardDefeat.effect.type = EventEffect::DEFEAT;
|
standardDefeat.effect.type = EventEffect::DEFEAT;
|
||||||
standardDefeat.effect.toOtherMessage = VLC->generaltexth->allTexts[8];
|
standardDefeat.effect.toOtherMessage = "core.genrltxt.8";
|
||||||
standardDefeat.identifier = "standardDefeat";
|
standardDefeat.identifier = "standardDefeat";
|
||||||
standardDefeat.description.clear(); // TODO: display in quest window
|
standardDefeat.description.clear(); // TODO: display in quest window
|
||||||
standardDefeat.onFulfill = VLC->generaltexth->allTexts[7];
|
standardDefeat.onFulfill = "core.genrltxt.7";
|
||||||
standardDefeat.trigger = EventExpression(defeatCondition);
|
standardDefeat.trigger = EventExpression(defeatCondition);
|
||||||
|
|
||||||
triggeredEvents.push_back(standardVictory);
|
triggeredEvents.push_back(standardVictory);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace {
|
|||||||
if (value.isNumber())
|
if (value.isNumber())
|
||||||
ret.addTxt(MetaString::ADVOB_TXT, static_cast<ui32>(value.Float()));
|
ret.addTxt(MetaString::ADVOB_TXT, static_cast<ui32>(value.Float()));
|
||||||
else
|
else
|
||||||
ret << value.String();
|
ret.addRawString(value.String());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ void Damage::describeEffect(std::vector<MetaString> & log, const Mechanics * m,
|
|||||||
//todo: handle newlines in metastring
|
//todo: handle newlines in metastring
|
||||||
std::string text = VLC->generaltexth->allTexts[343]; //Does %d points of damage.
|
std::string text = VLC->generaltexth->allTexts[343]; //Does %d points of damage.
|
||||||
boost::algorithm::trim(text);
|
boost::algorithm::trim(text);
|
||||||
line << text;
|
line.addRawString(text);
|
||||||
line.addReplacement(static_cast<int>(damage)); //no more text afterwards
|
line.addReplacement(static_cast<int>(damage)); //no more text afterwards
|
||||||
log.push_back(line);
|
log.push_back(line);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1216,7 +1216,7 @@ void CGameHandler::addGenericKilledLog(BattleLogMessage & blm, const CStack * de
|
|||||||
txt % (multiple ? VLC->generaltexth->allTexts[42] : defender->unitType()->getNameSingularTranslated()); // creature perishes
|
txt % (multiple ? VLC->generaltexth->allTexts[42] : defender->unitType()->getNameSingularTranslated()); // creature perishes
|
||||||
}
|
}
|
||||||
MetaString line;
|
MetaString line;
|
||||||
line << txt.str();
|
line.addRawString(txt.str());
|
||||||
blm.lines.push_back(std::move(line));
|
blm.lines.push_back(std::move(line));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2810,9 +2810,12 @@ void CGameHandler::useScholarSkill(ObjectInstanceID fromHero, ObjectInstanceID t
|
|||||||
iw.text.addTxt(MetaString::SPELL_NAME, it.toEnum());
|
iw.text.addTxt(MetaString::SPELL_NAME, it.toEnum());
|
||||||
switch (size--)
|
switch (size--)
|
||||||
{
|
{
|
||||||
case 2: iw.text.addTxt(MetaString::GENERAL_TXT, 141);
|
case 2:
|
||||||
case 1: break;
|
iw.text.addTxt(MetaString::GENERAL_TXT, 141);
|
||||||
default: iw.text << ", ";
|
case 1:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
iw.text.addRawString(", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iw.text.addTxt(MetaString::GENERAL_TXT, 142);//from %s
|
iw.text.addTxt(MetaString::GENERAL_TXT, 142);//from %s
|
||||||
@@ -2835,9 +2838,12 @@ void CGameHandler::useScholarSkill(ObjectInstanceID fromHero, ObjectInstanceID t
|
|||||||
iw.text.addTxt(MetaString::SPELL_NAME, it.toEnum());
|
iw.text.addTxt(MetaString::SPELL_NAME, it.toEnum());
|
||||||
switch (size--)
|
switch (size--)
|
||||||
{
|
{
|
||||||
case 2: iw.text.addTxt(MetaString::GENERAL_TXT, 141);
|
case 2:
|
||||||
case 1: break;
|
iw.text.addTxt(MetaString::GENERAL_TXT, 141);
|
||||||
default: iw.text << ", ";
|
case 1:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
iw.text.addRawString(", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iw.text.addTxt(MetaString::GENERAL_TXT, 148);//from %s
|
iw.text.addTxt(MetaString::GENERAL_TXT, 148);//from %s
|
||||||
@@ -5348,7 +5354,7 @@ void CGameHandler::handleTimeEvents()
|
|||||||
//prepare dialog
|
//prepare dialog
|
||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = color;
|
iw.player = color;
|
||||||
iw.text << ev.message;
|
iw.text.addRawString(ev.message);
|
||||||
|
|
||||||
for (int i=0; i<ev.resources.size(); i++)
|
for (int i=0; i<ev.resources.size(); i++)
|
||||||
{
|
{
|
||||||
@@ -5396,12 +5402,10 @@ void CGameHandler::handleTownEvents(CGTownInstance * town, NewTurn &n)
|
|||||||
&& ((ev.computerAffected && !pinfo->human)
|
&& ((ev.computerAffected && !pinfo->human)
|
||||||
|| (ev.humanAffected && pinfo->human)))
|
|| (ev.humanAffected && pinfo->human)))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// dialog
|
// dialog
|
||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = player;
|
iw.player = player;
|
||||||
iw.text << ev.message;
|
iw.text.addRawString(ev.message);
|
||||||
|
|
||||||
if (ev.resources.nonZero())
|
if (ev.resources.nonZero())
|
||||||
{
|
{
|
||||||
@@ -5787,9 +5791,9 @@ void CGameHandler::getVictoryLossMessage(PlayerColor player, const EVictoryLossC
|
|||||||
{
|
{
|
||||||
out.player = player;
|
out.player = player;
|
||||||
out.text.clear();
|
out.text.clear();
|
||||||
out.text << victoryLossCheckResult.messageToSelf;
|
out.text.addRawString(VLC->generaltexth->translate(victoryLossCheckResult.messageToOthers));
|
||||||
// hackish, insert one player-specific string, if applicable
|
// hackish, insert one player-specific string, if applicable
|
||||||
if (victoryLossCheckResult.messageToSelf.find("%s") != std::string::npos)
|
if (victoryLossCheckResult.messageToOthers.find("%s") != std::string::npos)
|
||||||
out.text.addReplacement(MetaString::COLOR, player.getNum());
|
out.text.addReplacement(MetaString::COLOR, player.getNum());
|
||||||
|
|
||||||
out.components.emplace_back(Component::EComponentType::FLAG, player.getNum(), 0, 0);
|
out.components.emplace_back(Component::EComponentType::FLAG, player.getNum(), 0, 0);
|
||||||
@@ -7217,7 +7221,7 @@ void CGameHandler::showInfoDialog(const std::string & msg, PlayerColor player)
|
|||||||
{
|
{
|
||||||
InfoWindow iw;
|
InfoWindow iw;
|
||||||
iw.player = player;
|
iw.player = player;
|
||||||
iw.text << msg;
|
iw.text.addRawString(msg);
|
||||||
showInfoDialog(&iw);
|
showInfoDialog(&iw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user