diff --git a/AI/BattleAI/StackWithBonuses.cpp b/AI/BattleAI/StackWithBonuses.cpp index 752c84ca1..1f6711612 100644 --- a/AI/BattleAI/StackWithBonuses.cpp +++ b/AI/BattleAI/StackWithBonuses.cpp @@ -208,8 +208,7 @@ void StackWithBonuses::removeUnitBonus(const std::vector & bonus) && one.sid == b->sid && one.valType == b->valType && one.additionalInfo == b->additionalInfo - && one.effectRange == b->effectRange - && one.description == b->description; + && one.effectRange == b->effectRange; }); removeUnitBonus(selector); diff --git a/config/battlefields.json b/config/battlefields.json index c711bfc46..9d9b12fa3 100644 --- a/config/battlefields.json +++ b/config/battlefields.json @@ -79,14 +79,14 @@ "type" : "MORALE", "val" : 1, "valueType" : "BASE_NUMBER", - "description" : "Creatures of good town alignment on Holly Ground", + "description" : "core.arraytxt.123", "limiters": [{ "type" : "CREATURE_ALIGNMENT_LIMITER", "parameters" : ["good"] }] }, { "type" : "MORALE", "val" : -1, "valueType" : "BASE_NUMBER", - "description" : "Creatures of evil town alignment on Holly Ground", + "description" : "core.arraytxt.124", "limiters": [{ "type" : "CREATURE_ALIGNMENT_LIMITER", "parameters" : ["evil"] }] } ] @@ -99,7 +99,7 @@ "type" : "LUCK", "val" : 2, "valueType" : "BASE_NUMBER", - "description" : "Creatures of neutral town alignment on Clover Field", + "description" : "core.arraytxt.83", "limiters": [{ "type" : "CREATURE_ALIGNMENT_LIMITER", "parameters" : ["neutral"] }] } ] @@ -112,14 +112,14 @@ "type" : "MORALE", "val" : -1, "valueType" : "BASE_NUMBER", - "description" : "Creatures of good town alignment on Evil Fog", + "description" : "core.arraytxt.126", "limiters": [{ "type" : "CREATURE_ALIGNMENT_LIMITER", "parameters" : ["good"] }] }, { "type" : "MORALE", "val" : 1, "valueType" : "BASE_NUMBER", - "description" : "Creatures of evil town alignment on Evil Fog", + "description" : "core.arraytxt.125", "limiters": [{ "type" : "CREATURE_ALIGNMENT_LIMITER", "parameters" : ["evil"] }] } ] @@ -132,13 +132,13 @@ "type" : "NO_MORALE", "val" : 0, "valueType" : "INDEPENDENT_MIN", - "description" : "Creatures on Cursed Ground" + "description" : "core.arraytxt.112" }, { "type" : "NO_LUCK", "val" : 0, "valueType" : "INDEPENDENT_MIN", - "description" : "Creatures on Cursed Ground" + "description" : "core.arraytxt.81" }, { "type" : "BLOCK_MAGIC_ABOVE", diff --git a/lib/CArtHandler.cpp b/lib/CArtHandler.cpp index d18bfe425..2b0b65f2a 100644 --- a/lib/CArtHandler.cpp +++ b/lib/CArtHandler.cpp @@ -294,7 +294,7 @@ void CArtifact::addNewBonus(const std::shared_ptr& b) { b->source = BonusSource::ARTIFACT; b->duration = BonusDuration::PERMANENT; - b->description = getNameTranslated(); + b->description.appendName(id); CBonusSystemNode::addNewBonus(b); } diff --git a/lib/CSkillHandler.cpp b/lib/CSkillHandler.cpp index 619429dc7..3a42ee427 100644 --- a/lib/CSkillHandler.cpp +++ b/lib/CSkillHandler.cpp @@ -94,7 +94,7 @@ void CSkill::addNewBonus(const std::shared_ptr & b, int level) b->source = BonusSource::SECONDARY_SKILL; b->sid = BonusSourceID(id); b->duration = BonusDuration::PERMANENT; - b->description = getNameTranslated(); + b->description.appendTextID(getNameTextID()); levels[level-1].effects.push_back(b); } diff --git a/lib/CTownHandler.cpp b/lib/CTownHandler.cpp index 5eb5b2e4b..6ce3332f6 100644 --- a/lib/CTownHandler.cpp +++ b/lib/CTownHandler.cpp @@ -575,20 +575,9 @@ std::shared_ptr CTownHandler::createBonus(CBuilding * build, BonusType ty std::shared_ptr CTownHandler::createBonus(CBuilding * build, BonusType type, int val, BonusSubtypeID subtype, const TPropagatorPtr & prop) const { - std::ostringstream descr; - descr << build->getNameTranslated(); - return createBonusImpl(build->bid, build->town->faction->getId(), type, val, prop, descr.str(), subtype); -} + auto b = std::make_shared(BonusDuration::PERMANENT, type, BonusSource::TOWN_STRUCTURE, val, build->getUniqueTypeID(), subtype); -std::shared_ptr CTownHandler::createBonusImpl(const BuildingID & building, - const FactionID & faction, - BonusType type, - int val, - const TPropagatorPtr & prop, - const std::string & description, - BonusSubtypeID subtype) const -{ - auto b = std::make_shared(BonusDuration::PERMANENT, type, BonusSource::TOWN_STRUCTURE, val, BuildingTypeUniqueID(faction, building), subtype, description); + b->description.appendTextID(build->getNameTextID()); if(prop) b->addPropagator(prop); @@ -600,12 +589,13 @@ void CTownHandler::loadSpecialBuildingBonuses(const JsonNode & source, BonusList { for(const auto & b : source.Vector()) { - auto bonus = JsonUtils::parseBuildingBonus(b, building->town->faction->getId(), building->bid, building->getNameTranslated()); + auto bonus = std::make_shared(BonusDuration::PERMANENT, BonusType::NONE, BonusSource::TOWN_STRUCTURE, 0, BonusSourceID(building->getUniqueTypeID())); - if(bonus == nullptr) + if(!JsonUtils::parseBonus(b, bonus.get())) continue; - bonus->sid = BonusSourceID(building->getUniqueTypeID()); + bonus->description.appendTextID(building->getNameTextID()); + //JsonUtils::parseBuildingBonus produces UNKNOWN type propagator instead of empty. if(bonus->propagator != nullptr && bonus->propagator->getPropagatorType() == CBonusSystemNode::ENodeTypes::UNKNOWN) diff --git a/lib/CTownHandler.h b/lib/CTownHandler.h index 5af1d661b..933c1889f 100644 --- a/lib/CTownHandler.h +++ b/lib/CTownHandler.h @@ -303,13 +303,6 @@ class DLL_LINKAGE CTownHandler : public CHandlerBase createBonus(CBuilding * build, BonusType type, int val) const; std::shared_ptr createBonus(CBuilding * build, BonusType type, int val, BonusSubtypeID subtype) const; std::shared_ptr createBonus(CBuilding * build, BonusType type, int val, BonusSubtypeID subtype, const TPropagatorPtr & prop) const; - std::shared_ptr createBonusImpl(const BuildingID & building, - const FactionID & faction, - BonusType type, - int val, - const TPropagatorPtr & prop, - const std::string & description, - BonusSubtypeID subtype) const; /// loads CStructure's into town void loadStructure(CTown & town, const std::string & stringID, const JsonNode & source) const; diff --git a/lib/battle/BattleInfo.cpp b/lib/battle/BattleInfo.cpp index dfa02115d..169aa54b2 100644 --- a/lib/battle/BattleInfo.cpp +++ b/lib/battle/BattleInfo.cpp @@ -917,8 +917,7 @@ void BattleInfo::removeUnitBonus(uint32_t id, const std::vector & bonus) && one.sid == b->sid && one.valType == b->valType && one.additionalInfo == b->additionalInfo - && one.effectRange == b->effectRange - && one.description == b->description; + && one.effectRange == b->effectRange; }; sta->removeBonusesRecursive(selector); } diff --git a/lib/bonuses/Bonus.cpp b/lib/bonuses/Bonus.cpp index 35bc72c72..1f18f4ebc 100644 --- a/lib/bonuses/Bonus.cpp +++ b/lib/bonuses/Bonus.cpp @@ -90,7 +90,7 @@ JsonNode CAddInfo::toJsonNode() const } std::string Bonus::Description(std::optional customValue) const { - std::string str; + MetaString descriptionHelper; if(description.empty()) { @@ -99,42 +99,43 @@ std::string Bonus::Description(std::optional customValue) const switch(source) { case BonusSource::ARTIFACT: - str = sid.as().toEntity(VLC)->getNameTranslated(); + descriptionHelper.appendName(sid.as()); break; case BonusSource::SPELL_EFFECT: - str = sid.as().toEntity(VLC)->getNameTranslated(); + descriptionHelper.appendName(sid.as()); break; case BonusSource::CREATURE_ABILITY: - str = sid.as().toEntity(VLC)->getNamePluralTranslated(); + descriptionHelper.appendNamePlural(sid.as()); break; case BonusSource::SECONDARY_SKILL: - str = VLC->skills()->getById(sid.as())->getNameTranslated(); + descriptionHelper.appendTextID(sid.as().toEntity(VLC)->getNameTextID()); break; case BonusSource::HERO_SPECIAL: - str = VLC->heroTypes()->getById(sid.as())->getNameTranslated(); + descriptionHelper.appendTextID(sid.as().toEntity(VLC)->getNameTextID()); break; default: //todo: handle all possible sources - str = "Unknown"; + descriptionHelper.appendRawString("Unknown"); break; } } else - str = stacking; + descriptionHelper = MetaString::createFromRawString(stacking); } else { - str = description; + descriptionHelper = description; } - if(auto value = customValue.value_or(val)) { - //arraytxt already contains +-value - std::string valueString = boost::str(boost::format(" %+d") % value); - if(!boost::algorithm::ends_with(str, valueString)) - str += valueString; + auto valueToShow = customValue.value_or(val); + + if(valueToShow != 0) + { + descriptionHelper.replaceNumber(valueToShow); + descriptionHelper.replacePositiveNumber(valueToShow); } - return str; + return descriptionHelper.toString(); } static JsonNode additionalInfoToJson(BonusType type, CAddInfo addInfo) @@ -170,7 +171,7 @@ JsonNode Bonus::toJsonNode() const if(!stacking.empty()) root["stacking"].String() = stacking; if(!description.empty()) - root["description"].String() = description; + root["description"].String() = description.toString(); if(effectRange != BonusLimitEffect::NO_LIMIT) root["effectRange"].String() = vstd::findKey(bonusLimitEffect, effectRange); if(duration != BonusDuration::PERMANENT) @@ -187,27 +188,17 @@ JsonNode Bonus::toJsonNode() const } Bonus::Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID ID) - : Bonus(Duration, Type, Src, Val, ID, BonusSubtypeID(), std::string()) + : Bonus(Duration, Type, Src, Val, ID, BonusSubtypeID()) {} -Bonus::Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID ID, std::string Desc) - : Bonus(Duration, Type, Src, Val, ID, BonusSubtypeID(), Desc) -{} - -Bonus::Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID ID, BonusSubtypeID Subtype) - : Bonus(Duration, Type, Src, Val, ID, Subtype, std::string()) -{} - -Bonus::Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID ID, BonusSubtypeID Subtype, std::string Desc): +Bonus::Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID ID, BonusSubtypeID Subtype): duration(Duration), type(Type), subtype(Subtype), source(Src), val(Val), - sid(ID), - description(std::move(Desc)) + sid(ID) { - boost::algorithm::trim(description); targetSourceType = BonusSource::OTHER; } diff --git a/lib/bonuses/Bonus.h b/lib/bonuses/Bonus.h index b32bfde2c..d5d16e8cf 100644 --- a/lib/bonuses/Bonus.h +++ b/lib/bonuses/Bonus.h @@ -13,6 +13,7 @@ #include "BonusCustomTypes.h" #include "../constants/VariantIdentifier.h" #include "../constants/EntityIdentifiers.h" +#include "../MetaString.h" VCMI_LIB_NAMESPACE_BEGIN @@ -77,15 +78,15 @@ struct DLL_LINKAGE Bonus : public std::enable_shared_from_this TUpdaterPtr updater; TUpdaterPtr propagationUpdater; - std::string description; + MetaString description; Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID sourceID); - Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID sourceID, std::string Desc); Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID sourceID, BonusSubtypeID subtype); - Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID sourceID, BonusSubtypeID subtype, std::string Desc); Bonus(BonusDuration::Type Duration, BonusType Type, BonusSource Src, si32 Val, BonusSourceID sourceID, BonusSubtypeID subtype, BonusValueType ValType); Bonus() = default; +public: + template void serialize(Handler &h) { h & duration; diff --git a/lib/json/JsonBonus.cpp b/lib/json/JsonBonus.cpp index b56de5786..1b89a7823 100644 --- a/lib/json/JsonBonus.cpp +++ b/lib/json/JsonBonus.cpp @@ -625,19 +625,6 @@ std::shared_ptr JsonUtils::parseBonus(const JsonNode &ability) return b; } -std::shared_ptr JsonUtils::parseBuildingBonus(const JsonNode & ability, const FactionID & faction, const BuildingID & building, const std::string & description) -{ - /* duration = BonusDuration::PERMANENT - source = BonusSource::TOWN_STRUCTURE - bonusType, val, subtype - get from json - */ - auto b = std::make_shared(BonusDuration::PERMANENT, BonusType::NONE, BonusSource::TOWN_STRUCTURE, 0, BuildingTypeUniqueID(faction, building), description); - - if(!parseBonus(ability, b.get())) - return nullptr; - return b; -} - bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b) { const JsonNode * value = nullptr; @@ -682,9 +669,9 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b) if(!ability["description"].isNull()) { if (ability["description"].isString()) - b->description = ability["description"].String(); + b->description.appendTextID(ability["description"].String()); if (ability["description"].isNumber()) - b->description = VLC->generaltexth->translate("core.arraytxt", ability["description"].Integer()); + b->description.appendTextID("core.arraytxt." + std::to_string(ability["description"].Integer())); } value = &ability["effectRange"]; diff --git a/lib/json/JsonBonus.h b/lib/json/JsonBonus.h index db5ed492c..521a08226 100644 --- a/lib/json/JsonBonus.h +++ b/lib/json/JsonBonus.h @@ -23,7 +23,6 @@ namespace JsonUtils { std::shared_ptr parseBonus(const JsonVector & ability_vec); std::shared_ptr parseBonus(const JsonNode & ability); - std::shared_ptr parseBuildingBonus(const JsonNode & ability, const FactionID & faction, const BuildingID & building, const std::string & description); bool parseBonus(const JsonNode & ability, Bonus * placement); std::shared_ptr parseLimiter(const JsonNode & limiter); CSelector parseSelector(const JsonNode &ability); diff --git a/lib/mapObjects/CArmedInstance.cpp b/lib/mapObjects/CArmedInstance.cpp index b936863be..c10d3e981 100644 --- a/lib/mapObjects/CArmedInstance.cpp +++ b/lib/mapObjects/CArmedInstance.cpp @@ -101,28 +101,22 @@ void CArmedInstance::updateMoraleBonusFromArmy() factionsInArmy -= mixableFactions - 1; } - std::string description; + MetaString bonusDescription; if(factionsInArmy == 1) { b->val = +1; - description = VLC->generaltexth->arraytxt[115]; //All troops of one alignment +1 - description = description.substr(0, description.size()-3);//trim "+1" + bonusDescription.appendTextID("core.arraytxt.115"); //All troops of one alignment +1 } else if (!factions.empty()) // no bonus from empty garrison { b->val = 2 - static_cast(factionsInArmy); - MetaString formatter; - formatter.appendTextID("core.arraytxt.114"); //Troops of %d alignments %d - formatter.replaceNumber(factionsInArmy); - formatter.replaceNumber(b->val); - - description = formatter.toString(); - description = description.substr(0, description.size()-3);//trim value + bonusDescription.appendTextID("core.arraytxt.114"); //Troops of %d alignments %d + bonusDescription.replaceNumber(factionsInArmy); + bonusDescription.replaceNumber(b->val); } - boost::algorithm::trim(description); - b->description = description; + b->description = bonusDescription; CBonusSystemNode::treeHasChanged(); @@ -132,8 +126,8 @@ void CArmedInstance::updateMoraleBonusFromArmy() { if(!undeadModifier) { - undeadModifier = std::make_shared(BonusDuration::PERMANENT, BonusType::MORALE, BonusSource::ARMY, -1, BonusCustomSource::undeadMoraleDebuff, VLC->generaltexth->arraytxt[116]); - undeadModifier->description = undeadModifier->description.substr(0, undeadModifier->description.size()-2);//trim value + undeadModifier = std::make_shared(BonusDuration::PERMANENT, BonusType::MORALE, BonusSource::ARMY, -1, BonusCustomSource::undeadMoraleDebuff); + undeadModifier->description.appendTextID("core.arraytxt.116"); addNewBonus(undeadModifier); } } diff --git a/lib/mapObjects/CBank.cpp b/lib/mapObjects/CBank.cpp index 9dc7f48f4..88333895a 100644 --- a/lib/mapObjects/CBank.cpp +++ b/lib/mapObjects/CBank.cpp @@ -225,15 +225,15 @@ void CBank::doVisit(const CGHeroInstance * hero) const { case Obj::SHIPWRECK: textID = 123; - gbonus.bdescr.appendRawString(VLC->generaltexth->arraytxt[99]); + gbonus.bonus.description.appendRawString(VLC->generaltexth->arraytxt[99]); break; case Obj::DERELICT_SHIP: textID = 42; - gbonus.bdescr.appendRawString(VLC->generaltexth->arraytxt[101]); + gbonus.bonus.description.appendRawString(VLC->generaltexth->arraytxt[101]); break; case Obj::CRYPT: textID = 120; - gbonus.bdescr.appendRawString(VLC->generaltexth->arraytxt[98]); + gbonus.bonus.description.appendRawString(VLC->generaltexth->arraytxt[98]); break; } cb->giveHeroBonus(&gbonus); @@ -244,7 +244,8 @@ void CBank::doVisit(const CGHeroInstance * hero) const case Obj::PYRAMID: { GiveBonus gb; - gb.bonus = Bonus(BonusDuration::ONE_BATTLE, BonusType::LUCK, BonusSource::OBJECT_INSTANCE, -2, BonusSourceID(id), VLC->generaltexth->arraytxt[70]); + gb.bonus = Bonus(BonusDuration::ONE_BATTLE, BonusType::LUCK, BonusSource::OBJECT_INSTANCE, -2, BonusSourceID(id)); + gb.bonus.description.appendTextID("core.arraytxt.70"); gb.id = hero->id; cb->giveHeroBonus(&gb); textID = 107; diff --git a/lib/mapObjects/CGTownBuilding.cpp b/lib/mapObjects/CGTownBuilding.cpp index 94c855448..cfa0086b8 100644 --- a/lib/mapObjects/CGTownBuilding.cpp +++ b/lib/mapObjects/CGTownBuilding.cpp @@ -98,27 +98,33 @@ std::string CGTownBuilding::getCustomBonusGreeting(const Bonus & bonus) const { if(bonus.type == BonusType::TOWN_MAGIC_WELL) { - auto bonusGreeting = std::string(VLC->generaltexth->translate("vcmi.townHall.greetingInTownMagicWell")); - auto buildingName = town->getTown()->getSpecialBuilding(bType)->getNameTranslated(); - boost::algorithm::replace_first(bonusGreeting, "%s", buildingName); - return bonusGreeting; + MetaString wellGreeting = MetaString::createFromTextID("vcmi.townHall.greetingInTownMagicWell"); + + wellGreeting.replaceTextID(town->getTown()->getSpecialBuilding(bType)->getNameTextID()); + return wellGreeting.toString(); } - auto bonusGreeting = std::string(VLC->generaltexth->translate("vcmi.townHall.greetingCustomBonus")); //"%s gives you +%d %s%s" - std::string param; + + MetaString greeting = MetaString::createFromTextID("vcmi.townHall.greetingCustomBonus"); + + std::string paramTextID; std::string until; if(bonus.type == BonusType::MORALE) - param = VLC->generaltexth->allTexts[384]; - else if(bonus.type == BonusType::LUCK) - param = VLC->generaltexth->allTexts[385]; + paramTextID = "core.genrltxt.384"; // Morale - until = bonus.duration == BonusDuration::ONE_BATTLE - ? VLC->generaltexth->translate("vcmi.townHall.greetingCustomUntil") - : "."; + if(bonus.type == BonusType::LUCK) + paramTextID = "core.genrltxt.385"; // Luck - boost::format fmt = boost::format(bonusGreeting) % bonus.description % bonus.val % param % until; - std::string greeting = fmt.str(); - return greeting; +// greeting.replaceTextID(bonus.descriptionTextID); + greeting.replaceNumber(bonus.val); + greeting.replaceTextID(paramTextID); + + if (bonus.duration == BonusDuration::ONE_BATTLE) + greeting.replaceTextID("vcmi.townHall.greetingCustomUntil"); + else + greeting.replaceRawString("."); + + return greeting.toString(); } COPWBonus::COPWBonus(IGameCallback *cb) @@ -160,7 +166,7 @@ void COPWBonus::onHeroVisit (const CGHeroInstance * h) const if(!h->hasBonusFrom(BonusSource::OBJECT_TYPE, BonusSourceID(Obj(Obj::STABLES)))) //does not stack with advMap Stables { GiveBonus gb; - gb.bonus = Bonus(BonusDuration::ONE_WEEK, BonusType::MOVEMENT, BonusSource::OBJECT_TYPE, 600, BonusSourceID(Obj(Obj::STABLES)), BonusCustomSubtype::heroMovementLand, VLC->generaltexth->arraytxt[100]); + gb.bonus = Bonus(BonusDuration::ONE_WEEK, BonusType::MOVEMENT, BonusSource::OBJECT_TYPE, 600, BonusSourceID(Obj(Obj::STABLES)), BonusCustomSubtype::heroMovementLand); gb.id = heroID; cb->giveHeroBonus(&gb); diff --git a/lib/networkPacks/NetPacksLib.cpp b/lib/networkPacks/NetPacksLib.cpp index 752aed618..6960eda51 100644 --- a/lib/networkPacks/NetPacksLib.cpp +++ b/lib/networkPacks/NetPacksLib.cpp @@ -1005,30 +1005,26 @@ void GiveBonus::applyGs(CGameState *gs) auto b = std::make_shared(bonus); cbsn->addNewBonus(b); - std::string &descr = b->description; - if(!bdescr.empty()) + if(b->description.empty()) { - descr = bdescr.toString(); - } - else if(!descr.empty()) - { - //use preseet description - } - else if((bonus.type == BonusType::LUCK || bonus.type == BonusType::MORALE) + if((bonus.type == BonusType::LUCK || bonus.type == BonusType::MORALE) && (bonus.source == BonusSource::OBJECT_TYPE || bonus.source == BonusSource::OBJECT_INSTANCE)) - { - //no description, use generic - //?could use allways when Type == BonusDuration::Type::ONE_BATTLE - descr = VLC->generaltexth->arraytxt[bonus.val > 0 ? 110 : 109]; //+/-%d Temporary until next battle" - } - else - { - logGlobal->debug("Empty bonus decription. Type=%d", (int) bonus.type); + { + //?could use allways when Type == BonusDuration::Type::ONE_BATTLE + if (bonus.val > 0) + b->description.appendTextID("core.arraytxt.110"); //+%d Temporary until next battle" + else + b->description.appendTextID("core.arraytxt.109"); //-%d Temporary until next battle" + } + else + { + logGlobal->debug("Empty bonus decription. Type=%d", (int) bonus.type); + } } // Some of(?) versions of H3 use " %s" here instead of %d. Try to replace both of them - boost::replace_first(descr, "%d", std::to_string(std::abs(bonus.val))); // " +/-%d Temporary until next battle - boost::replace_first(descr, " %s", boost::str(boost::format(" %+d") % bonus.val)); // " %s" in arraytxt.69, fountian of fortune + //boost::replace_first(descr, "%d", std::to_string(std::abs(bonus.val))); // " +/-%d Temporary until next battle + //boost::replace_first(descr, " %s", boost::str(boost::format(" %+d") % bonus.val)); // " %s" in arraytxt.69, fountian of fortune } void ChangeObjPos::applyGs(CGameState *gs) diff --git a/lib/networkPacks/PacksForClient.h b/lib/networkPacks/PacksForClient.h index 25a98b460..e0be8f2e4 100644 --- a/lib/networkPacks/PacksForClient.h +++ b/lib/networkPacks/PacksForClient.h @@ -382,7 +382,6 @@ struct DLL_LINKAGE GiveBonus : public CPackForClient ETarget who = ETarget::OBJECT; VariantIdentifier id; Bonus bonus; - MetaString bdescr; void visitTyped(ICPackVisitor & visitor) override; @@ -390,7 +389,6 @@ struct DLL_LINKAGE GiveBonus : public CPackForClient { h & bonus; h & id; - h & bdescr; h & who; assert(id.getNum() != -1); } diff --git a/lib/serializer/JsonUpdater.cpp b/lib/serializer/JsonUpdater.cpp index 92b4bfc45..0d31638c7 100644 --- a/lib/serializer/JsonUpdater.cpp +++ b/lib/serializer/JsonUpdater.cpp @@ -207,8 +207,7 @@ void JsonUpdater::serializeBonuses(const std::string & fieldName, CBonusSystemNo && mask->sid == b->sid && mask->valType == b->valType && mask->additionalInfo == b->additionalInfo - && mask->effectRange == b->effectRange - && mask->description == b->description; + && mask->effectRange == b->effectRange; }; value->removeBonuses(selector); diff --git a/lib/spells/BonusCaster.cpp b/lib/spells/BonusCaster.cpp index 5c635c97a..3989f0e15 100644 --- a/lib/spells/BonusCaster.cpp +++ b/lib/spells/BonusCaster.cpp @@ -32,9 +32,9 @@ BonusCaster::~BonusCaster() = default; void BonusCaster::getCasterName(MetaString & text) const { - if(!bonus->description.empty()) - text.replaceRawString(bonus->description); - else +// if(!bonus->descriptionTextID.empty()) +// text.replaceTextID(bonus->descriptionTextID); +// else actualCaster->getCasterName(text); } diff --git a/test/spells/effects/EffectFixture.cpp b/test/spells/effects/EffectFixture.cpp index 88d1ed2f4..5cf558a44 100644 --- a/test/spells/effects/EffectFixture.cpp +++ b/test/spells/effects/EffectFixture.cpp @@ -33,8 +33,7 @@ bool operator==(const Bonus & b1, const Bonus & b2) && b1.sid == b2.sid && b1.valType == b2.valType && b1.additionalInfo == b2.additionalInfo - && b1.effectRange == b2.effectRange - && b1.description == b2.description; + && b1.effectRange == b2.effectRange; } namespace test