From d61e77efc744e6b9980685fd4e3a1928a53fa6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Rosen?= Date: Tue, 11 May 2010 20:11:56 +0000 Subject: [PATCH] apply patch #1668 by kevg, saving unit status in savefile --- changelog | 1 + src/unit.cpp | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/changelog b/changelog index 7b6e61e74e5..d72d337b060 100644 --- a/changelog +++ b/changelog @@ -114,6 +114,7 @@ Version 1.9.0-svn: * Fixed tab completion not working in the new lobby (bug #14730) * Fixed compilation for g++ 4.5 * Cleaned up the gui2 code at various places + * Fixed restoring and saving unit statuses (bug #15889) * Music and sound effects * New version of "Northerners" by Stephen Rozanc (TreizeCouleurs) diff --git a/src/unit.cpp b/src/unit.cpp index 102f50a3421..5956a2aeefb 100644 --- a/src/unit.cpp +++ b/src/unit.cpp @@ -439,8 +439,8 @@ unit::unit(const config &cfg, bool use_traits, game_state* state) : "support will be removed in 1.9.2.\n"; if (!utils::string_bool(st.second, true)) set_state("unhealable", true); - } else if (utils::string_bool(st.second)) { - set_state(st.first, true); + } else { + set_state(st.first, utils::string_bool(st.second)); } } cfg_.clear_children("status"); @@ -1106,10 +1106,7 @@ const std::map unit::get_states() const for (std::map::const_iterator i = known_boolean_state_names_.begin(), i_end = known_boolean_state_names_.end(); i != i_end; ++i) { - if (get_state(i->second)) { - all_states.insert(make_pair(i->first, "yes" )); - } - + all_states[i->first] = get_state(i->second) ? "yes" : "no"; } return all_states; }