Преглед на файлове

Fix possible crash on AI attempting to build building in town

Ivan Savenko преди 1 година
родител
ревизия
8fa615a8f7
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3 3
      AI/VCAI/Goals/BuildThis.cpp

+ 3 - 3
AI/VCAI/Goals/BuildThis.cpp

@@ -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;