don't abort advancement on invalid advancement index

this would in theory give the player
the option to postpone a unit
advancement by selecting an invalid
advancement index. Now we just use the
first advancement in case of an invalid
advancement index.
This commit is contained in:
gfgtdf 2019-12-01 20:36:54 +01:00
parent b67579a030
commit 7ddf61f08a

View File

@ -111,9 +111,10 @@ namespace
const std::vector<std::string>& options = u->advances_to();
std::vector<config> mod_options = u->get_modification_advances();
assert(options.size() + mod_options.size() > 0);
if (choice >= options.size() + mod_options.size()) {
LOG_DP << "animate_unit_advancement suppressed: invalid option\n";
return false;
LOG_DP << "animate_unit_advancement: invalid option, using first option\n";
choice = 0;
}
// When the unit advances, it fades to white, and then switches