mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix possible crash on AI attempting to build building in town
This commit is contained in:
parent
a0375d4e89
commit
8fa615a8f7
@ -35,12 +35,12 @@ TSubgoal BuildThis::whatToDoToAchieve()
|
|||||||
|
|
||||||
if(!town)
|
if(!town)
|
||||||
{
|
{
|
||||||
for(const CGTownInstance * t : cb->getTownsInfo())
|
for(const CGTownInstance * candidateTown : cb->getTownsInfo())
|
||||||
{
|
{
|
||||||
switch(cb->canBuildStructure(town, b))
|
switch(cb->canBuildStructure(candidateTown, b))
|
||||||
{
|
{
|
||||||
case EBuildingState::ALLOWED:
|
case EBuildingState::ALLOWED:
|
||||||
town = t;
|
town = candidateTown;
|
||||||
break; //TODO: look for prerequisites? this is not our reponsibility
|
break; //TODO: look for prerequisites? this is not our reponsibility
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user