Reflects changes of 2008-03-05T11:42:06Z!shadowm@wesnoth.org (backport to 1.4).

This is supposed to fix issues with canrecruit="yes". Currently the
engine checked in most locations only for canrecruit == "0" or "1",
and skipped the standard WML boolean syntax (which is achieved with
utils::string_bool()).

Code which already did assignments of the canrecruit attribute to 0 or
1 have been left untouched; they should still work
This commit is contained in:
Ignacio R. Morelle 2008-03-05 17:22:35 +00:00
parent 8d5043491a
commit eed4c46003
3 changed files with 5 additions and 4 deletions

View file

@ -55,6 +55,7 @@
#include "serialization/binary_wml.hpp"
#include "serialization/parser.hpp"
#include "serialization/preprocessor.hpp"
#include "serialization/string_utils.hpp"
#include "sha1.hpp"
#ifdef HAVE_PYTHON

View file

@ -964,7 +964,7 @@ void extract_summary_data_from_save(const game_state& gamestate, config& out)
const config::child_list& units = (**s).get_children("unit");
for(config::child_list::const_iterator u = units.begin(); u != units.end(); ++u) {
if((**u)["canrecruit"] == "1") {
if(utils::string_bool( (**u)["canrecruit"], false) == true) {
leader = (**u)["id"];
break;
}
@ -1022,7 +1022,7 @@ void extract_summary_from_config(config& cfg_save, config& cfg_summary)
const config::child_list& players = cfg_save.get_children("player");
for(config::child_list::const_iterator i = players.begin(); i != players.end(); ++i) {
if ((**i)["canrecruit"] == "1"){
if (utils::string_bool( (**i)["canrecruit"], false) == true){
leader = (**i)["save_id"];
}
}
@ -1045,7 +1045,7 @@ void extract_summary_from_config(config& cfg_save, config& cfg_summary)
const config::child_list& units = (**s).get_children("unit");
for(config::child_list::const_iterator u = units.begin(); u != units.end(); ++u) {
if((**u)["canrecruit"] == "1") {
if(utils::string_bool( (**u)["canrecruit"], false) == true) {
leader = (**u)["id"];
break;
}

View file

@ -455,7 +455,7 @@ void wait::generate_menu()
// saves.
config::const_child_itors side_units = sd.child_range("unit");
for(;side_units.first != side_units.second; ++side_units.first) {
if((**side_units.first)["canrecruit"] == "1") {
if(utils::string_bool((**side_units.first)["canrecruit"], false)) {
leader_type = (**side_units.first)["type"];
break;
}