|
@@ -428,6 +428,35 @@ static TUpdaterPtr parseUpdater(const JsonNode & updaterJson)
|
|
|
}
|
|
|
return std::make_shared<TimesStackSizeUpdater>(minimum, maximum, std::max(1, stepSize));
|
|
|
}
|
|
|
+ if(updaterJson["type"].String() == "TIMES_ARMY_SIZE")
|
|
|
+ {
|
|
|
+ auto result = std::make_shared<TimesArmySizeUpdater>();
|
|
|
+
|
|
|
+ result->minimum = updaterJson["minimum"].isNull() ? std::numeric_limits<int>::min() : updaterJson["minimum"].Integer();
|
|
|
+ result->maximum = updaterJson["maximum"].isNull() ? std::numeric_limits<int>::max() : updaterJson["maximum"].Integer();
|
|
|
+ result->stepSize = updaterJson["stepSize"].isNull() ? 1 : updaterJson["stepSize"].Integer();
|
|
|
+ result->filteredLevel = updaterJson["filteredLevel"].isNull() ? -1 : updaterJson["filteredLevel"].Integer();
|
|
|
+ if (result->minimum > result->maximum)
|
|
|
+ {
|
|
|
+ logMod->warn("TIMES_ARMY_SIZE updater: minimum value (%d) is above maximum value(%d)!", result->minimum, result->maximum);
|
|
|
+ std::swap(result->minimum, result->maximum);
|
|
|
+ }
|
|
|
+ if (!updaterJson["filteredFaction"].isNull())
|
|
|
+ {
|
|
|
+ LIBRARY->identifiers()->requestIdentifier( "faction", updaterJson["filteredFaction"], [result](int32_t identifier)
|
|
|
+ {
|
|
|
+ result->filteredFaction = FactionID(identifier);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (!updaterJson["filteredCreature"].isNull())
|
|
|
+ {
|
|
|
+ LIBRARY->identifiers()->requestIdentifier( "creature", updaterJson["filteredCreature"], [result](int32_t identifier)
|
|
|
+ {
|
|
|
+ result->filteredCreature = CreatureID(identifier);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
else
|
|
|
logMod->warn("Unknown updater type \"%s\"", updaterJson["type"].String());
|
|
|
break;
|