From 7ddf61f08a37a7add18491ff7d46c7235c0b7372 Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Sun, 1 Dec 2019 20:36:54 +0100 Subject: [PATCH] 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. --- src/actions/advancement.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/actions/advancement.cpp b/src/actions/advancement.cpp index 86f1a986ef6..049e022d12d 100644 --- a/src/actions/advancement.cpp +++ b/src/actions/advancement.cpp @@ -111,9 +111,10 @@ namespace const std::vector& options = u->advances_to(); std::vector 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