Author: shadowmaster
Date: Wed Aug 27 01:16:40 2008
New Revision: 29011
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29011&view=rev
Log:
* Apply patch #1081
Modified:
trunk/RELEASE_NOTES
trunk/changelog
trunk/data/tools/wmllint
trunk/src/unit_types.cpp
Modified: trunk/RELEASE_NOTES
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/RELEASE_NOTES?rev=29011&r1=29010&r2=29011&view=diff
==============================================================================
--- trunk/RELEASE_NOTES (original)
+++ trunk/RELEASE_NOTES Wed Aug 27 01:16:40 2008
@@ -12,3 +12,13 @@
***
+The advanceto key in [unit_type] was changed to advances_to, as internally it
+is immediately renamed to advances_to and used that way in both unit.cpp and
+unit_types.cpp, along with being the key that is actually used in [unit],
+thus being what *should* be edited in stored units.
+
+The advanceto key is now deprecated and will be removed in 1.5.6,
+wmllint can make the required changes.
+
+***
+
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=29011&r1=29010&r2=29011&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Wed Aug 27 01:16:40 2008
@@ -30,6 +30,8 @@
* fix bug where max_experience of stored units was not the true max when
playing with under 100% exp. settings
* prevent some negative/nonsense values in direct WML unit modifications
+ * Renamed the advanceto key in [unit_type] to advances_to in order to be
+ consistent with its own and [unit]'s internals.
* Miscellaneous and bug fixes:
* Changed side_drop handling not to automaticaly assign AI for side if
leader is dead (bug #12186)
Modified: trunk/data/tools/wmllint
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmllint?rev=29011&r1=29010&r2=29011&view=diff
==============================================================================
--- trunk/data/tools/wmllint (original)
+++ trunk/data/tools/wmllint Wed Aug 27 01:16:40 2008
@@ -2179,6 +2179,7 @@
# In unit type definitions
if under("unit_type") or under("female") or under("unit"):
line = line.replace("unit_description=", "description=")
+ line = line.replace("advanceto=", "advances_to=")
# Inside themes
if within("theme"):
line = line.replace("[unit_description]", "[unit_name]")
Modified: trunk/src/unit_types.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_types.cpp?rev=29011&r1=29010&r2=29011&view=diff
==============================================================================
--- trunk/src/unit_types.cpp (original)
+++ trunk/src/unit_types.cpp Wed Aug 27 01:16:40 2008
@@ -898,9 +898,16 @@
}
const std::string& advance_to_val = cfg["advanceto"];
- if(advance_to_val != "null" && advance_to_val != "")
+ if(advance_to_val != "null" && advance_to_val != "") {
advances_to_ = utils::split(advance_to_val);
- DBG_UT << "unit_type '" << id_ << "' advances to : " << advance_to_val <<
"\n";
+ lg::wml_error << "Usage of 'advanceto' is deprecated; support for this
will be removed in 1.5.6. (use 'advances_to' instead)\n";
+ }
+ // This overwrites the previous if both exist, should preserve backwards
compatibility
+ const std::string& advances_to_val = cfg["advances_to"];
+ if(advances_to_val != "null" && advances_to_val != "")
+ advances_to_ = utils::split(advances_to_val);
+ DBG_UT << "unit_type '" << id_ << "' advanceto : " << advance_to_val <<
"\n";
+ DBG_UT << "unit_type '" << id_ << "' advances to : " << advances_to_val <<
"\n";
build_status_ = CREATED;
}
@@ -1313,19 +1320,24 @@
void unit_type_data::unit_type_map_wrapper::add_advancefrom(const config&
unit_cfg) const
{
//find the units this one can advance into and add advancefrom information
for them
- std::vector<std::string> advance_to = utils::split(unit_cfg["advanceto"]);
- if ( (advance_to.size() > 0) && (advance_to[0] != "null") ){
+ std::vector<std::string> advances_to = utils::split(unit_cfg["advanceto"]);
+ // Storing advances_to here to check if it contains anything,
+ // if it does, overwrite the deprecated key.
+ const std::string& advances_to_val = unit_cfg["advances_to"];
+ if(advances_to_val != "null" && advances_to_val != "")
+ advances_to = utils::split(advances_to_val);
+ if ( (advances_to.size() > 0) && (advances_to[0] != "null") ){
int count = 0;
- for (std::vector<std::string>::const_iterator i_adv =
advance_to.begin(); i_adv != advance_to.end(); i_adv++){
+ for (std::vector<std::string>::const_iterator i_adv =
advances_to.begin(); i_adv != advances_to.end(); i_adv++){
count++;
DBG_UT << "Unit: " << unit_cfg["id"] << ", AdvanceTo " << count <<
": " << *i_adv << "\n";
- unit_type_map::iterator itor_advanceto = types_.find(*i_adv);
- if(itor_advanceto == types_.end()) {
+ unit_type_map::iterator itor_advances_to = types_.find(*i_adv);
+ if(itor_advances_to == types_.end()) {
// if we can't add the advancefrom information yet, we should
// just remember it for later (to prevent infinite recursion)
future_advancefroms[*i_adv].insert(unit_cfg["id"]);
} else {
-
itor_advanceto->second.add_advancesfrom(unit_cfg["id"]);
+
itor_advances_to->second.add_advancesfrom(unit_cfg["id"]);
}
}
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits