mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Rewardable objects may now define guards. Converted Crypt to rewardable.
This commit is contained in:
@@ -62,17 +62,20 @@ Rewardable::Configuration CRewardableConstructor::generateConfiguration(IGameCal
|
||||
|
||||
void CRewardableConstructor::configureObject(CGObjectInstance * object, vstd::RNG & rng) const
|
||||
{
|
||||
if(auto * rewardableObject = dynamic_cast<CRewardableObject*>(object))
|
||||
{
|
||||
rewardableObject->configuration = generateConfiguration(object->cb, rng, object->ID);
|
||||
auto * rewardableObject = dynamic_cast<CRewardableObject*>(object);
|
||||
|
||||
if (rewardableObject->configuration.info.empty())
|
||||
{
|
||||
if (objectInfo.getParameters()["rewards"].isNull())
|
||||
logMod->error("Object %s has invalid configuration! No defined rewards found!", getJsonKey());
|
||||
else
|
||||
logMod->error("Object %s has invalid configuration! Make sure that defined appear chances are continuous!", getJsonKey());
|
||||
}
|
||||
if (!rewardableObject)
|
||||
throw std::runtime_error("Object " + std::to_string(object->getObjGroupIndex()) + ", " + std::to_string(object->getObjTypeIndex()) + " is not a rewardable object!" );
|
||||
|
||||
rewardableObject->configuration = generateConfiguration(object->cb, rng, object->ID);
|
||||
rewardableObject->initializeGuards();
|
||||
|
||||
if (rewardableObject->configuration.info.empty())
|
||||
{
|
||||
if (objectInfo.getParameters()["rewards"].isNull())
|
||||
logMod->error("Object %s has invalid configuration! No defined rewards found!", getJsonKey());
|
||||
else
|
||||
logMod->error("Object %s has invalid configuration! Make sure that defined appear chances are continuous!", getJsonKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user