1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-25 00:37:24 +02:00

Rewardables will use per-object name, if available

This commit is contained in:
Ivan Savenko
2023-03-30 22:29:58 +03:00
parent e652b3eef0
commit 508d68f77c
2 changed files with 18 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#include "../CModHandler.h"
#include "JsonRandom.h"
#include "../IGameCallback.h"
#include "../CGeneralTextHandler.h"
VCMI_LIB_NAMESPACE_BEGIN
@ -307,9 +308,22 @@ bool CRandomRewardObjectInfo::givesBonuses() const
return testForKey(parameters, "bonuses");
}
const JsonNode & CRandomRewardObjectInfo::getParameters() const
{
return parameters;
}
void CRewardableConstructor::initTypeData(const JsonNode & config)
{
objectInfo.init(config);
if (!config["name"].isNull())
VLC->generaltexth->registerString( config.meta, getNameTextID(), config["name"].String());
}
bool CRewardableConstructor::hasNameTextID() const
{
return !objectInfo.getParameters()["name"].isNull();
}
CGObjectInstance * CRewardableConstructor::create(std::shared_ptr<const ObjectTemplate> tmpl) const