← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~gunchleoc/widelands/bug-1619157-random-ai-none into lp:widelands

 

GunChleoc has proposed merging lp:~gunchleoc/widelands/bug-1619157-random-ai-none into lp:widelands.

Commit message:
Random AI no longer selects the empty AI.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1619157 in widelands: "Random AI should not select "None""
  https://bugs.launchpad.net/widelands/+bug/1619157

For more details, see:
https://code.launchpad.net/~gunchleoc/widelands/bug-1619157-random-ai-none/+merge/306518

Since this is clearly a regression and the fix is tiny, I am in favour of having this in Build 19.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~gunchleoc/widelands/bug-1619157-random-ai-none into lp:widelands.
=== modified file 'src/logic/single_player_game_settings_provider.cc'
--- src/logic/single_player_game_settings_provider.cc	2016-08-04 15:49:05 +0000
+++ src/logic/single_player_game_settings_provider.cc	2016-09-22 17:42:29 +0000
@@ -142,7 +142,7 @@
 			do {
 				uint8_t random = (std::rand() % impls.size());  // Choose a random AI
 				it = impls.begin() + random;
-			} while ((*it)->name == "None");
+			} while ((*it)->name == "empty");
 		}
 		s.players[number].ai = (*it)->name;
 	}

=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc	2016-08-04 15:49:05 +0000
+++ src/network/nethost.cc	2016-09-22 17:42:29 +0000
@@ -180,7 +180,7 @@
 				do {
 					uint8_t random = (std::rand() % impls.size());  // Choose a random AI
 					it = impls.begin() + random;
-				} while ((*it)->name == "None");
+				} while ((*it)->name == "empty");
 				set_player_ai(number, (*it)->name, true);
 				newstate = PlayerSettings::stateComputer;
 				break;


Follow ups