mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 08:32:03 +00:00
merge 2006-07-27T13:11:54Z!benoit.timbert@free.fr:
sample_ai should no longer crash the game if the recruitment list of the faction is empty.
This commit is contained in:
parent
0afb158715
commit
e32933a6c5
@ -148,6 +148,7 @@ protected:
|
||||
|
||||
void do_recruitment() {
|
||||
const std::set<std::string>& options = current_team().recruits();
|
||||
if (!options.empty()) {
|
||||
const int choice = (rand()%options.size());
|
||||
std::set<std::string>::const_iterator i = options.begin();
|
||||
std::advance(i,choice);
|
||||
@ -157,6 +158,7 @@ protected:
|
||||
do_recruitment();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<std::string> get_available_ais()
|
||||
|
Loading…
x
Reference in New Issue
Block a user