1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Remove explicit convesion to int in operators

This commit is contained in:
Ivan Savenko
2023-11-05 18:58:07 +02:00
parent 10e110320b
commit abad4b01ce
35 changed files with 97 additions and 105 deletions

View File

@@ -638,14 +638,14 @@ CGCreature * ObjectManager::chooseGuard(si32 strength, bool zoneGuard)
if(!possibleCreatures.empty())
{
creId = *RandomGeneratorUtil::nextItem(possibleCreatures, zone.getRand());
amount = strength / VLC->creh->objects[creId]->getAIValue();
amount = strength / creId.toEntity(VLC)->getAIValue();
if (amount >= 4)
amount = static_cast<int>(amount * zone.getRand().nextDouble(0.75, 1.25));
}
else //just pick any available creature
{
creId = CreatureID(132); //Azure Dragon
amount = strength / VLC->creh->objects[creId]->getAIValue();
creId = CreatureID::AZURE_DRAGON; //Azure Dragon
amount = strength / creId.toEntity(VLC)->getAIValue();
}
auto guardFactory = VLC->objtypeh->getHandlerFor(Obj::MONSTER, creId);