mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-30 23:18:08 +02:00
Fix for AI not recognizing 2nd T7-building of Factory as dwelling
This lead to it being built dead-last in the build-order instead of the AI trying to go for it quite early.
This commit is contained in:
parent
5ff834aac2
commit
9012560e38
@ -212,7 +212,7 @@ BuildingInfo BuildAnalyzer::getBuildingOrPrerequisite(
|
||||
int creatureLevel = -1;
|
||||
int creatureUpgrade = 0;
|
||||
|
||||
if(BuildingID::DWELL_FIRST <= toBuild && toBuild <= BuildingID::DWELL_UP_LAST)
|
||||
if(toBuild.IsDwelling())
|
||||
{
|
||||
creatureLevel = BuildingID::getLevelFromDwelling(toBuild);
|
||||
creatureUpgrade = BuildingID::getUpgradedFromDwelling(toBuild);
|
||||
@ -271,7 +271,7 @@ BuildingInfo BuildAnalyzer::getBuildingOrPrerequisite(
|
||||
|
||||
auto otherDwelling = [](const BuildingID & id) -> bool
|
||||
{
|
||||
return BuildingID::DWELL_FIRST <= id && id <= BuildingID::DWELL_UP_LAST;
|
||||
return id.IsDwelling();
|
||||
};
|
||||
|
||||
if(vstd::contains_if(missingBuildings, otherDwelling))
|
||||
@ -420,7 +420,7 @@ BuildingInfo::BuildingInfo(
|
||||
}
|
||||
else
|
||||
{
|
||||
if(BuildingID::DWELL_FIRST <= id && id <= BuildingID::DWELL_UP_LAST)
|
||||
if(id.IsDwelling())
|
||||
{
|
||||
creatureGrows = creature->getGrowth();
|
||||
|
||||
|
@ -366,6 +366,11 @@ public:
|
||||
dwelling.advance(GameConstants::CREATURES_PER_TOWN - 1);
|
||||
}
|
||||
|
||||
bool IsDwelling() const
|
||||
{
|
||||
return (DWELL_FIRST <= num && num <= DWELL_UP_LAST) || (DWELL_LVL_8 <= num && num <= DWELL_LVL_8_UP) || num == DWELL_UP2_FIRST;
|
||||
}
|
||||
|
||||
bool IsSpecialOrGrail() const
|
||||
{
|
||||
return num == SPECIAL_1 || num == SPECIAL_2 || num == SPECIAL_3 || num == SPECIAL_4 || num == GRAIL;
|
||||
|
Loading…
Reference in New Issue
Block a user