1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Resolve problem with unwanted propagation of abilities descriptions

This commit is contained in:
Opuszek
2025-08-21 19:38:30 +02:00
parent 154645da68
commit aeab0fda0b
7 changed files with 221 additions and 19 deletions

View File

@@ -142,6 +142,7 @@ void CBonusTypeHandler::loadItem(const JsonNode & source, CBonusType & dest, con
dest.identifier = name;
dest.hidden = source["hidden"].Bool(); //Null -> false
dest.creatureNature = source["creatureNature"].Bool(); //Null -> false
dest.propagateDescription = source["propagateDescription"].isNull() ? true : source["propagateDescription"].Bool(); //Null -> true
if (!dest.hidden)
LIBRARY->generaltexth->registerString( "vcmi", dest.getDescriptionTextID(), source["description"]);
@@ -196,6 +197,12 @@ bool CBonusTypeHandler::isCreatureNatureBonus(BonusType bonus) const
return bonusTypes.at(static_cast<int>(bonus))->creatureNature;
}
bool CBonusTypeHandler::shouldPropagateDescription(BonusType bonus) const
{
return bonusTypes.at(static_cast<int>(bonus))->propagateDescription;
}
std::vector<BonusType> CBonusTypeHandler::getAllObjets() const
{
std::vector<BonusType> ret;

View File

@@ -38,6 +38,7 @@ private:
bool creatureNature = false;
bool hidden = true;
bool propagateDescription = true;
};
class DLL_LINKAGE CBonusTypeHandler : public IBonusTypeHandler
@@ -57,6 +58,7 @@ public:
const std::string & bonusToString(BonusType bonus) const;
bool isCreatureNatureBonus(BonusType bonus) const;
bool shouldPropagateDescription(BonusType bonus) const;
std::vector<BonusType> getAllObjets() const;
private: