add new attribute side_name= in [side]
We cannot call it name becasue thats already used by the unti that is generated from the side tag. if given (nonempty), side_name= will be used instead of current_player in some dialogs (new turn dialog, statistics). In [scenario] side_name= defaults to name= while in [multiplayer] side_name= defaults to empty (so that current_player is used in those dialogs by default). This specially fixes http://gna.org/bugs/?24226 while still giving wml authors in mp and in sp the option to use the real players name in those dialogs.
This commit is contained in:
parent
0d254fb03e
commit
c941f60c49
10 changed files with 20 additions and 15 deletions
|
@ -1027,6 +1027,7 @@ config side_engine::new_config() const
|
|||
desc = player_id_;
|
||||
}
|
||||
if(res["name"].str().empty() && !desc.empty()) {
|
||||
//TODO: maybe we should add this in to the leaders config instead of the side config?
|
||||
res["name"] = desc;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ void campaign_controller::show_carryover_message(playsingle_controller& playcont
|
|||
continue;
|
||||
}
|
||||
if (persistent_teams > 1) {
|
||||
report << "\n<b>" << t.current_player() << "</b>\n";
|
||||
report << "\n<b>" << t.side_name() << "</b>\n";
|
||||
}
|
||||
|
||||
report_victory(report, t, finishing_bonus_per_turn, turns_left, finishing_bonus);
|
||||
|
|
|
@ -240,7 +240,7 @@ void scenario_settings_table(display& gui, int selected)
|
|||
}
|
||||
|
||||
str << COLUMN_SEPARATOR << team::get_side_highlight(n)
|
||||
<< teams[n].current_player() << COLUMN_SEPARATOR
|
||||
<< teams[n].side_name() << COLUMN_SEPARATOR
|
||||
<< n + 1 << COLUMN_SEPARATOR
|
||||
<< teams[n].start_gold() << COLUMN_SEPARATOR
|
||||
<< teams[n].base_income() << COLUMN_SEPARATOR
|
||||
|
|
|
@ -154,7 +154,7 @@ void menu_handler::show_statistics(int side_num)
|
|||
{
|
||||
team ¤t_team = teams()[side_num - 1];
|
||||
// Current Player name
|
||||
const std::string &player = current_team.current_player();
|
||||
const std::string &player = current_team.side_name();
|
||||
//add player's name to title of dialog
|
||||
std::stringstream title_str;
|
||||
title_str << _("Statistics") << " (" << player << ")";
|
||||
|
@ -272,7 +272,7 @@ void menu_handler::status_table(int selected)
|
|||
}
|
||||
|
||||
if (pc_.get_classification().campaign_type == game_classification::CAMPAIGN_TYPE::MULTIPLAYER)
|
||||
leader_name = teams()[n].current_player();
|
||||
leader_name = teams()[n].side_name();
|
||||
|
||||
} else {
|
||||
leader_bools.push_back(false);
|
||||
|
@ -393,7 +393,7 @@ void menu_handler::scenario_settings_table(int selected)
|
|||
}
|
||||
|
||||
str << COLUMN_SEPARATOR << team::get_side_highlight(n)
|
||||
<< teams()[n].current_player() << COLUMN_SEPARATOR
|
||||
<< teams()[n].side_name() << COLUMN_SEPARATOR
|
||||
<< n + 1 << COLUMN_SEPARATOR
|
||||
<< teams()[n].start_gold() << COLUMN_SEPARATOR
|
||||
<< teams()[n].base_income() << COLUMN_SEPARATOR
|
||||
|
|
|
@ -430,7 +430,7 @@ void playsingle_controller::show_turn_dialog(){
|
|||
gui_->recalculate_minimap();
|
||||
std::string message = _("It is now $name|’s turn");
|
||||
utils::string_map symbols;
|
||||
symbols["name"] = gamestate().board_.teams()[current_side() - 1].current_player();
|
||||
symbols["name"] = gamestate().board_.teams()[current_side() - 1].side_name();
|
||||
message = utils::interpolate_variables_into_string(message, &symbols);
|
||||
gui2::show_transient_message(gui_->video(), "", message);
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ static config unit_side(reports::context & rc, const unit* u)
|
|||
std::stringstream text;
|
||||
text << " " << u->side();
|
||||
|
||||
add_image(report, flag_icon + mods, u_team.current_player(), "");
|
||||
add_image(report, flag_icon + mods, u_team.side_name(), "");
|
||||
add_text(report, text.str(), "", "");
|
||||
return report;
|
||||
}
|
||||
|
@ -1485,7 +1485,7 @@ REPORT_GENERATOR(side_playing, rc)
|
|||
std::string mods = "~RC(" + old_rgb + ">" + new_rgb + ")";
|
||||
if (flag_icon.empty())
|
||||
flag_icon = game_config::images::flag_icon;
|
||||
return image_report(flag_icon + mods, active_team.current_player());
|
||||
return image_report(flag_icon + mods, active_team.side_name());
|
||||
}
|
||||
|
||||
REPORT_GENERATOR(observers, rc)
|
||||
|
|
|
@ -168,6 +168,7 @@ void saved_game::write_general_info(config_writer& out) const
|
|||
|
||||
void saved_game::set_defaults()
|
||||
{
|
||||
const bool is_multiplayer_tag = classification().get_tagname() == "multiplayer";
|
||||
static const std::vector<std::string> team_defaults = boost::assign::list_of
|
||||
("carryover_percentage")
|
||||
("carryover_add")
|
||||
|
@ -179,6 +180,10 @@ void saved_game::set_defaults()
|
|||
{
|
||||
side["save_id"] = side["id"];
|
||||
}
|
||||
if(!is_multiplayer_tag && side["side_name"].blank())
|
||||
{
|
||||
side["side_name"] = side["name"];
|
||||
}
|
||||
// Set some team specific values to their defaults specified in scenario
|
||||
BOOST_FOREACH(const std::string& att_name, team_defaults)
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ const boost::container::flat_set<std::string> team::attributes = boost::assign::
|
|||
("recall_cost")("recruit")("save_id")("id")("scroll_to_leader")
|
||||
("share_vision")("share_maps")("share_view")("shroud")("shroud_data")("start_gold")
|
||||
("suppress_end_turn_confirmation")
|
||||
("team_name")("user_team_name")("village_gold")("village_support")("is_local")
|
||||
("team_name")("user_team_name")("side_name")("village_gold")("village_support")("is_local")
|
||||
// Multiplayer attributes.
|
||||
("action_bonus_count")("allow_changes")("allow_player")("color_lock")
|
||||
("countdown_time")("disallow_observers")("faction")
|
||||
|
@ -85,6 +85,7 @@ team::team_info::team_info() :
|
|||
can_recruit(),
|
||||
team_name(),
|
||||
user_team_name(),
|
||||
side_name(),
|
||||
save_id(),
|
||||
current_player(),
|
||||
countdown_time(),
|
||||
|
@ -123,6 +124,7 @@ void team::team_info::read(const config &cfg)
|
|||
income = cfg["income"];
|
||||
team_name = cfg["team_name"].str();
|
||||
user_team_name = cfg["user_team_name"];
|
||||
side_name = cfg["side_name"];
|
||||
save_id = cfg["save_id"].str();
|
||||
current_player = cfg["current_player"].str();
|
||||
countdown_time = cfg["countdown_time"].str();
|
||||
|
@ -239,6 +241,7 @@ void team::team_info::write(config& cfg) const
|
|||
cfg["income"] = income;
|
||||
cfg["team_name"] = team_name;
|
||||
cfg["user_team_name"] = user_team_name;
|
||||
cfg["side_name"] = side_name;
|
||||
cfg["save_id"] = save_id;
|
||||
cfg["current_player"] = current_player;
|
||||
cfg["flag"] = flag;
|
||||
|
|
|
@ -117,6 +117,7 @@ private:
|
|||
std::set<std::string> can_recruit;
|
||||
std::string team_name;
|
||||
t_string user_team_name;
|
||||
t_string side_name;
|
||||
std::string save_id;
|
||||
// 'id' of the current player (not necessarily unique)
|
||||
std::string current_player;
|
||||
|
@ -302,6 +303,7 @@ public:
|
|||
void set_flag(const std::string& flag) { info_.flag = flag; }
|
||||
void set_flag_icon(const std::string& flag_icon) { info_.flag_icon = flag_icon; }
|
||||
|
||||
const std::string& side_name() const { return info_.side_name.empty() ? info_.current_player : info_.side_name; }
|
||||
//Returns true if the hex is shrouded/fogged for this side, or
|
||||
//any other ally with shared vision.
|
||||
bool shrouded(const map_location& loc) const;
|
||||
|
|
|
@ -297,12 +297,6 @@ protected:
|
|||
BOOST_FOREACH(const config *u, unit_configs_) {
|
||||
uc.add_unit(*u);
|
||||
}
|
||||
|
||||
// Find the first leader and use its name as the player name.
|
||||
unit_map::iterator u = board_.units().find_first_leader(t_->side());
|
||||
if ((u != board_.units().end()) && t_->current_player().empty())
|
||||
t_->set_current_player(u->name());
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue