Browse Source

Merge pull request #3849 from IvanSavenko/fix_vcai_crash

Fix possible crash on AI attempting to build building in town
Ivan Savenko 1 year ago
parent
commit
be54836401
1 changed files with 3 additions and 3 deletions
  1. 3 3
      AI/VCAI/Goals/BuildThis.cpp

+ 3 - 3
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;