1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

War machines factory are now never guarded by default

This commit is contained in:
Ivan Savenko 2024-11-17 13:51:36 +00:00
parent d81d682939
commit 4ccce20eda

View File

@ -88,25 +88,28 @@ void DwellingInstanceConstructor::randomizeObject(CGDwelling * dwelling, vstd::R
dwelling->creatures.back().second.push_back(cre->getId());
}
bool guarded = false; //TODO: serialize for sanity
bool guarded = false;
if(guards.getType() == JsonNode::JsonType::DATA_BOOL) //simple switch
if(guards.getType() == JsonNode::JsonType::DATA_BOOL)
{
//simple switch
if(guards.Bool())
{
guarded = true;
}
}
else if(guards.getType() == JsonNode::JsonType::DATA_VECTOR) //custom guards (eg. Elemental Conflux)
else if(guards.getType() == JsonNode::JsonType::DATA_VECTOR)
{
//custom guards (eg. Elemental Conflux)
JsonRandom::Variables emptyVariables;
for(auto & stack : randomizer.loadCreatures(guards, rng, emptyVariables))
{
dwelling->putStack(SlotID(dwelling->stacksCount()), new CStackInstance(stack.getId(), stack.count));
}
}
else //default condition - creatures are of level 5 or higher
else if (dwelling->ID == Obj::CREATURE_GENERATOR1 || dwelling->ID == Obj::CREATURE_GENERATOR4)
{
//default condition - this is dwelling with creatures of level 5 or higher
for(auto creatureEntry : availableCreatures)
{
if(creatureEntry.at(0)->getLevel() >= 5)