mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-28 03:57:02 +02:00
NullkillerAI: fix build analyser when town has no upgrade for creature
This commit is contained in:
parent
0d15089dd4
commit
6da233c387
@ -194,7 +194,9 @@ BuildingInfo BuildAnalyzer::getBuildingOrPrerequisite(
|
|||||||
{
|
{
|
||||||
int level = toBuild - BuildingID::DWELL_FIRST;
|
int level = toBuild - BuildingID::DWELL_FIRST;
|
||||||
auto creatures = townInfo->creatures.at(level % GameConstants::CREATURES_PER_TOWN);
|
auto creatures = townInfo->creatures.at(level % GameConstants::CREATURES_PER_TOWN);
|
||||||
auto creatureID = creatures.at(level / GameConstants::CREATURES_PER_TOWN);
|
auto creatureID = creatures.size() > level / GameConstants::CREATURES_PER_TOWN
|
||||||
|
? creatures.at(level / GameConstants::CREATURES_PER_TOWN)
|
||||||
|
: creatures.front();
|
||||||
|
|
||||||
baseCreatureID = creatures.front();
|
baseCreatureID = creatures.front();
|
||||||
creature = creatureID.toCreature();
|
creature = creatureID.toCreature();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user