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