Author: sapient
Date: Sun Jul 6 02:23:06 2008
New Revision: 27773
URL: http://svn.gna.org/viewcvs/wesnoth?rev=27773&view=rev
Log:
*fix bug #3697, bug #4124, and bug #11239 - preserving unit.role in next
scenario
*fix and/or remove some no-op code in unit::read and unit::get_checksum
*remove redundant unit.value (use unit.cost instead)
Modified:
trunk/changelog
trunk/src/unit.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=27773&r1=27772&r2=27773&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sun Jul 6 02:23:06 2008
@@ -19,6 +19,8 @@
* the "zoc" key works for [unit_type] too, and for [unit] accepts other
boolean values than 1 and 0 (bug #11889).
* new effect apply_to=type to transform the unit to a different type
+ * remove redundant unit.value (use unit.cost instead)
+ * preserve unit.role in next scenario (bugs #3697, #4124, and #11329)
* GUI improvements:
* Rewrote the textbox history saving of the new widget library. This rewrite
is incompatible with the old version, but since the library is still in
Modified: trunk/src/unit.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=27773&r1=27772&r2=27773&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Sun Jul 6 02:23:06 2008
@@ -676,7 +676,6 @@
}
void unit::new_level()
{
- role_ = "";
ai_special_ = "";
// Set the goto-command to be going to no-where
@@ -1190,14 +1189,6 @@
variables_.clear();
}
- type_name_ = cfg["language_name"];
- undead_variation_ = cfg["undead_variation"];
-
- flag_rgb_ = cfg["flag_rgb"];
- alpha_ = lexical_cast_default<fixed_t>(cfg["alpha"]);
-
- unit_value_ = lexical_cast_default<int>(cfg["value"]);
-
facing_ = gamemap::location::parse_direction(cfg["facing"]);
if(facing_ == gamemap::location::NDIRECTIONS) facing_ =
gamemap::location::SOUTH_EAST;
@@ -1222,14 +1213,18 @@
race_ = &dummy_race;
}
}
- variation_ = cfg["variation"];
level_ = lexical_cast_default<int>(cfg["level"], level_);
-
+ if(cfg["undead_variation"] != "") {
+ undead_variation_ = cfg["undead_variation"];
+ }
if(cfg["max_attacks"] != "") {
max_attacks_ = lexical_cast_default<int>(cfg["max_attacks"],1);
}
attacks_left_ = lexical_cast_default<int>(cfg["attacks_left"],
max_attacks_);
+ if(cfg["alpha"] != "") {
+ alpha_ = lexical_cast_default<fixed_t>(cfg["alpha"]);
+ }
if(cfg["zoc"] != "") {
emit_zoc_ = utils::string_bool(cfg["zoc"]);
}
@@ -1238,6 +1233,9 @@
}
if(custom_unit_desc != "") {
cfg_["description"] = custom_unit_desc;
+ }
+ if(cfg["cost"] != "") {
+ unit_value_ = lexical_cast_default<int>(cfg["cost"]);
}
if(cfg["profile"] != "") {
@@ -1528,7 +1526,6 @@
for(std::vector<attack_type>::const_iterator i = attacks_.begin(); i !=
attacks_.end(); ++i) {
cfg.add_child("attack",i->get_cfg());
}
- cfg["value"] = lexical_cast_default<std::string>(unit_value_);
cfg["cost"] = lexical_cast_default<std::string>(unit_value_);
cfg.clear_children("modifications");
cfg.add_child("modifications",modifications_);
@@ -2983,7 +2980,7 @@
config wcfg;
u.write(unit_config);
const std::string main_keys[] =
- { "advanceto",
+ { "advances_to",
"alignment",
"cost",
"experience",
@@ -3003,7 +3000,6 @@
"resting",
"undead_variation",
"upkeep",
- "value",
"zoc",
""};
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits