From 8fa615a8f744d1fcca86293ae7ec128e9551a6a6 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 28 Apr 2024 12:53:10 +0300 Subject: [PATCH] Fix possible crash on AI attempting to build building in town --- AI/VCAI/Goals/BuildThis.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AI/VCAI/Goals/BuildThis.cpp b/AI/VCAI/Goals/BuildThis.cpp index 065db0b01..378db7283 100644 --- a/AI/VCAI/Goals/BuildThis.cpp +++ b/AI/VCAI/Goals/BuildThis.cpp @@ -35,12 +35,12 @@ TSubgoal BuildThis::whatToDoToAchieve() 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: - town = t; + town = candidateTown; break; //TODO: look for prerequisites? this is not our reponsibility default: continue;