Unstoring a leader for a side without a leader...

...sets the leader for that side (bug #11048).
This commit is contained in:
Mark de Wever 2008-02-14 18:16:49 +00:00
parent 51dd6e3dab
commit 8fc1d83434
4 changed files with 15 additions and 1 deletions

View file

@ -8,6 +8,9 @@ Version 1.3.16+svn:
* user interface:
* quick replays no longer scroll to leaders
* scrolling to the leader the very first time happens instantly now
* WML engine:
* unstoring a leader for a side without a leader sets the leader for
that side (bug #11048)
* miscellaneous and bug fixes:
* replays of midgame saves get the right recall list now (bug #10868)
* Fixed controller problems when reloading MP game (bug #11046 and bit more)

View file

@ -2178,7 +2178,7 @@ void event_handler::handle_event_command(const queued_event& event_info,
// The code in dialogs::advance_unit tests whether the unit can advance
dialogs::advance_unit(*game_data_ptr, *game_map, *units, loc, *screen, !sel, true);
}
} else {
player_info *player=state_of_game->get_player((*teams)[u.side()-1].save_id());
@ -2231,6 +2231,13 @@ void event_handler::handle_event_command(const queued_event& event_info,
<< " and the map location is invalid.\n";
}
}
// If we unstore a leader make sure the team gets a leader if not the loading
// in MP might abort since a side without a leader has a recall list.
if(u.can_recruit()) {
(*teams)[u.side() - 1].no_leader() = false;
}
} catch(game::load_game_failed& e) {
ERR_NG << "could not de-serialize unit: '" << e.message << "'\n";
}

View file

@ -113,6 +113,7 @@ team::team_info::team_info(const config& cfg) :
share_view(false),
disallow_observers(utils::string_bool(cfg["disallow_observers"])),
allow_player(utils::string_bool(cfg["allow_player"], true)),
no_leader(utils::string_bool(cfg["no_leader"])),
music(cfg["music"]),
colour(cfg["colour"].size() ? cfg["colour"] : cfg["side"])
{
@ -298,6 +299,7 @@ void team::team_info::write(config& cfg) const
cfg["village_gold"] = str_cast(income_per_village);
cfg["disallow_observers"] = disallow_observers ? "yes" : "no";
cfg["allow_player"] = allow_player ? "yes" : "no";
cfg["no_leader"] = no_leader ? "yes" : "no";
std::stringstream enemies_str;
for(std::vector<int>::const_iterator en = enemies.begin(); en != enemies.end(); ++en) {

View file

@ -111,6 +111,7 @@ public:
bool share_maps, share_view;
bool disallow_observers;
bool allow_player;
bool no_leader;
std::string music;
@ -257,6 +258,7 @@ public:
void set_auto_shroud_updates(bool value) { auto_shroud_updates_ = value; }
bool get_disallow_observers() {return info_.disallow_observers; };
std::string map_colour_to() const { return info_.colour; };
bool& no_leader() { return info_.no_leader; }
static int nteams();