Replace the input fields for id and name of a side in the editor.

The definitions of teams might be more useful.
Also, id and name of a side are mixed with the ones of the leader unit
which makes handling them difficult.
This commit is contained in:
fendrin 2013-12-28 14:23:46 +01:00
parent 2d1b61b325
commit 17ad07a8c4
5 changed files with 17 additions and 16 deletions

View file

@ -102,7 +102,7 @@
[label]
definition = "default"
label = _ "Identifier:"
label = _ "Team Identifier:"
[/label]
[/column]
@ -112,7 +112,7 @@
horizontal_alignment = "left"
[text_box]
id = "id"
id = "team_name"
definition = "default"
label = ""
[/text_box]
@ -130,7 +130,7 @@
[label]
definition = "default"
label = _ "Name:"
label = _ "Team Name:"
[/label]
[/column]
@ -141,7 +141,7 @@
horizontal_alignment = "left"
[text_box]
id = "name"
id = "user_team_name"
definition = "default"
label = ""
[/text_box]

View file

@ -197,8 +197,8 @@ void context_manager::edit_side_dialog(int side)
team::CONTROLLER controller = t.controller();
int controller_num = 0;
std::string id = t.save_id();
std::string name = t.name();
std::string user_team_name = t.user_team_name();
std::string team_name = t.team_name();
int gold = t.gold();
int income = t.base_income();
@ -212,7 +212,7 @@ void context_manager::edit_side_dialog(int side)
bool fog = t.uses_fog();
bool shroud = t.uses_shroud();
bool ok = gui2::teditor_edit_side::execute(side +1, id, name,
bool ok = gui2::teditor_edit_side::execute(side +1, team_name, user_team_name,
gold, income, village_gold, village_support,
fog, share_view, shroud, share_maps,
controller, controller_num,
@ -220,7 +220,7 @@ void context_manager::edit_side_dialog(int side)
gui_.video());
if (ok) {
get_map_context().set_side_setup(side, id, name,
get_map_context().set_side_setup(side, team_name, user_team_name,
gold, income, village_gold, village_support,
fog, share_view, shroud, share_maps, controller, hidden, no_leader);
}

View file

@ -164,15 +164,16 @@ map_context::map_context(const config& game_config, const std::string& filename,
}
void map_context::set_side_setup(int side, const std::string& id, const std::string& name,
void map_context::set_side_setup(int side, const std::string& team_name, const std::string& user_team_name,
int gold, int income, int village_gold, int village_support,
bool fog, bool share_view, bool shroud, bool share_maps,
team::CONTROLLER controller, bool hidden, bool no_leader)
{
assert(teams_.size() > static_cast<unsigned int>(side));
team& t = teams_[side];
t.set_save_id(id);
t.set_name(name);
// t.set_save_id(id);
// t.set_name(name);
t.change_team(team_name, user_team_name);
t.have_leader(!no_leader);
t.change_controller(controller);
t.set_gold(gold);

View file

@ -60,8 +60,8 @@ teditor_edit_side::teditor_edit_side(int side, std::string& id, std::string& nam
side_stream << side;
register_label("side_number", true, side_stream.str(), true);
register_text("id", true, id, true);
register_text("name", true, name, true);
register_text("team_name", true, id, true);
register_text("user_team_name", true, name, true);
register_integer("gold", true, gold);
register_integer("income", true, income);

View file

@ -27,21 +27,21 @@ class teditor_edit_side : public tdialog
{
public:
teditor_edit_side(int side, std::string& id, std::string& name,
teditor_edit_side(int side, std::string& team_name, std::string& user_team_name,
int& gold, int& income, int& village_income, int& village_support,
bool& fog, bool& share_view, bool& shroud, bool& share_maps,
team::CONTROLLER& controller, int controller_num,
bool& no_leader, bool& hidden);
/** The execute function see @ref tdialog for more information. */
static bool execute(int side, std::string& id, std::string& name,
static bool execute(int side, std::string& team_name, std::string& user_team_name,
int& gold, int& income, int& village_income, int& village_support,
bool& fog, bool& share_view, bool& shroud, bool& share_maps,
team::CONTROLLER& controller, int controller_num,
bool& no_leader, bool& hidden,
CVideo& video)
{
return teditor_edit_side(side, id, name,
return teditor_edit_side(side, team_name, user_team_name,
gold, income, village_income, village_support,
fog, share_view, shroud, share_maps,
controller, controller_num,