mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Make AI able tobuy extra buildings. Fix bug #2640
This commit is contained in:
parent
d23328f697
commit
a4f375d9c0
@ -1404,6 +1404,16 @@ void VCAI::buildStructure(const CGTownInstance * t)
|
|||||||
return;
|
return;
|
||||||
if (tryBuildAnyStructure(t, std::vector<BuildingID>(extra, extra + ARRAY_COUNT(extra))))
|
if (tryBuildAnyStructure(t, std::vector<BuildingID>(extra, extra + ARRAY_COUNT(extra))))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//at the end, try to get and build any extra dwelling upgrades (for example HotA 3rd level dwelling)
|
||||||
|
std::vector<BuildingID> extraDwellingUpgrades;
|
||||||
|
|
||||||
|
for (auto buildingInfo : t->town->buildings)
|
||||||
|
if (buildingInfo.first > 43)
|
||||||
|
extraDwellingUpgrades.push_back(buildingInfo.first);
|
||||||
|
|
||||||
|
if (tryBuildAnyStructure(t, extraDwellingUpgrades))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VCAI::isGoodForVisit(const CGObjectInstance *obj, HeroPtr h, SectorMap &sm)
|
bool VCAI::isGoodForVisit(const CGObjectInstance *obj, HeroPtr h, SectorMap &sm)
|
||||||
|
Loading…
Reference in New Issue
Block a user