Marked 'x' and 'y' unit attributes as useless to simplify the code a bit.

This commit is contained in:
Guillaume Melquiond 2010-02-27 09:45:22 +00:00
parent 935a621473
commit 61bdf84e06
5 changed files with 3 additions and 13 deletions

View File

@ -249,8 +249,6 @@ void unit_creator::add_unit(const config &cfg)
config temp_cfg(cfg);
map_location loc = find_location(temp_cfg);
temp_cfg["side"] = str_cast(team_.side());
temp_cfg.remove_attribute("x");
temp_cfg.remove_attribute("y");
temp_cfg.remove_attribute("placement");
temp_cfg.remove_attribute("player_id");
temp_cfg.remove_attribute("faction_from_recruit");

View File

@ -2317,8 +2317,6 @@ WML_HANDLER_FUNCTION(unstore_unit, /*event_info*/, cfg)
try {
config tmp_cfg(var);
tmp_cfg.remove_attribute("x");
tmp_cfg.remove_attribute("y");
const unit u(resources::units, tmp_cfg, false);
preferences::encountered_units().insert(u.type_id());

View File

@ -911,9 +911,8 @@ protected:
"hidden", "music", "colour", "ai_config", "gold",
"start_gold", "team_rgb", "village_gold", "controller",
"persistent", "share_view",
"share_maps", "recruit", "fog", "shroud", "shroud_data" };
static char const *mp_side_attrs[] = {
"share_maps", "recruit", "fog", "shroud", "shroud_data",
// Multiplayer attributes.
"income_lock", "gold_lock", "team_lock", "leader",
"random_leader", "terrain_liked",
"allow_changes", "faction_name", "user_description" };
@ -933,9 +932,6 @@ protected:
foreach (const char *attr, side_attrs) {
cfg.remove_attribute(attr);
}
foreach (const char *attr, mp_side_attrs) {
cfg.remove_attribute(attr);
}
uc.add_unit(cfg);
}

View File

@ -1771,8 +1771,6 @@ static int intf_put_unit(lua_State *L)
if (unit_arg == 1) {
x = lexical_cast_default(cfg["x"], 0);
y = lexical_cast_default(cfg["y"], 0);
cfg.remove_attribute("x");
cfg.remove_attribute("y");
}
try {
u = new unit(resources::units, cfg, true, resources::state_of_game);

View File

@ -523,7 +523,7 @@ unit::unit(unit_map* unitmap, const config& cfg,
"experience", "resting", "unrenamable", "alignment",
"canrecruit",
// Useless attributes created when saving units to WML:
"flag_rgb", "language_name" };
"flag_rgb", "language_name", "x", "y" };
foreach (const char *attr, internalized_attrs) {
input_cfg.remove_attribute(attr);
cfg_.remove_attribute(attr);