create "fight_on_without_leader" field of [side]

this field is intended to allow battles to continue after the death of a leader
if a side has this flag enabled and any units alive, they will be considered
to have a leader regardless of canrecruit.
This commit is contained in:
Chris Beck 2014-04-07 19:14:30 -04:00
parent 3f4879ace4
commit ec379ce355
2 changed files with 7 additions and 1 deletions

View File

@ -48,7 +48,8 @@ const int team::default_team_gold_ = 100;
// Update this list of attributes if you change what is used to define a side
// (excluding those attributes used to define the side's leader).
const char * const team::attributes[] = {
"ai_config", "color", "controller", "current_player", "flag",
"ai_config", "color", "controller", "current_player",
"fight_on_without_leader", "flag",
"flag_icon", "fog", "fog_data", "gold", "hidden", "income",
"no_leader", "objectives", "objectives_changed", "persistent", "lost",
"recall_cost", "recruit", "save_id", "scroll_to_leader",
@ -101,6 +102,7 @@ team::team_info::team_info() :
allow_player(false),
chose_random(false),
no_leader(true),
fight_on_without_leader(false),
hidden(true),
no_turn_confirmation(false),
color(),
@ -131,6 +133,7 @@ void team::team_info::read(const config &cfg)
allow_player = cfg["allow_player"].to_bool(true);
chose_random = cfg["chose_random"].to_bool(false);
no_leader = cfg["no_leader"].to_bool();
fight_on_without_leader = cfg["fight_on_without_leader"].to_bool(false);
hidden = cfg["hidden"].to_bool();
no_turn_confirmation = cfg["suppress_end_turn_confirmation"].to_bool();
side = cfg["side"].to_int(1);
@ -257,6 +260,7 @@ void team::team_info::write(config& cfg) const
cfg["allow_player"] = allow_player;
cfg["chose_random"] = chose_random;
cfg["no_leader"] = no_leader;
cfg["fight_on_without_leader"] = fight_on_without_leader;
cfg["hidden"] = hidden;
cfg["suppress_end_turn_confirmation"] = no_turn_confirmation;
cfg["scroll_to_leader"] = scroll_to_leader;

View File

@ -104,6 +104,7 @@ private:
bool allow_player;
bool chose_random;
bool no_leader;
bool fight_on_without_leader;
bool hidden;
bool no_turn_confirmation; // Can suppress confirmations when ending a turn.
@ -264,6 +265,7 @@ public:
void set_auto_shroud_updates(bool value) { auto_shroud_updates_ = value; }
bool get_disallow_observers() const {return info_.disallow_observers; }
bool no_leader() const { return info_.no_leader; }
bool fight_on_without_leader() const { return info_.fight_on_without_leader; }
void have_leader(bool value=true) { info_.no_leader = !value; }
bool hidden() const { return info_.hidden; }
void set_hidden(bool value) { info_.hidden=value; }