Shevonar has proposed merging lp:~shevonar/widelands/feature-random-tribe-and-AI into lp:widelands.
Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #722757 in widelands: "Play as a random tribe" https://bugs.launchpad.net/widelands/+bug/722757 Bug #771379 in widelands: "Play against a random AI strength (defensive, aggressive, normal)" https://bugs.launchpad.net/widelands/+bug/771379 Bug #853217 in widelands: "start multiplayer game with all slots closed" https://bugs.launchpad.net/widelands/+bug/853217 For more details, see: https://code.launchpad.net/~shevonar/widelands/feature-random-tribe-and-AI/+merge/76897 AI: random will not result in AI: None -- https://code.launchpad.net/~shevonar/widelands/feature-random-tribe-and-AI/+merge/76897 Your team Widelands Developers is requested to review the proposed merge of lp:~shevonar/widelands/feature-random-tribe-and-AI into lp:widelands.
=== modified file 'src/network/nethost.cc' --- src/network/nethost.cc 2011-09-19 17:48:27 +0000 +++ src/network/nethost.cc 2011-09-25 10:36:26 +0000 @@ -174,8 +174,10 @@ newstate = PlayerSettings::stateClosed; } } else if (it == impls.end()) { - uint8_t random = (std::rand() % impls.size()); // Choose a random AI - it = impls.begin() + random; + do { + uint8_t random = (std::rand() % impls.size()); // Choose a random AI + it = impls.begin() + random; + } while ((*it)->name == "None"); setPlayerAI(number, (*it)->name, true); newstate = PlayerSettings::stateComputer; break; === modified file 'src/wlapplication.cc' --- src/wlapplication.cc 2011-09-19 17:48:27 +0000 +++ src/wlapplication.cc 2011-09-25 10:36:26 +0000 @@ -1902,8 +1902,10 @@ it = impls.begin(); } else if (it == impls.end()) { s.players[number].random_ai = true; - uint8_t random = (std::rand() % impls.size()); // Choose a random AI - it = impls.begin() + random; + do { + uint8_t random = (std::rand() % impls.size()); // Choose a random AI + it = impls.begin() + random; + } while ((*it)->name == "None"); } s.players[number].ai = (*it)->name; }
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp