mail[Wesnoth-commits] r24564 - in /trunk/src: unit.cpp unit_types.cpp unit_types.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by esr on March 12, 2008 - 13:39:
Author: esr
Date: Wed Mar 12 13:39:50 2008
New Revision: 24564

URL: http://svn.gna.org/viewcvs/wesnoth?rev=24564&view=rev
Log:
Rip out some archaisms...
* gender_id in [unit]: not documented, not used
* id in [unit]: not documented, not used. We're going to need this name later.
* name in [unit_type]: Described as a backward-compatibility hack in a
                       comment, no longer anywhere in mainline or UMC.

Modified:
    trunk/src/unit.cpp
    trunk/src/unit_types.cpp
    trunk/src/unit_types.hpp

Modified: trunk/src/unit.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=24564&r1=24563&r2=24564&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Wed Mar 12 13:39:50 2008
@@ -548,11 +548,9 @@
                cfg_["gender"] = gender_string(generate_gender(*t,true));
        }
 
-       if(type_id()!=t->id() || cfg_["gender"] != cfg_["gender_id"]) {
+       if(type_id()!=t->id()) {
                do_heal = true; // Can't heal until after mods applied.
                type_ = t->id();
-               cfg_["id"] = type_;
-               cfg_["gender_id"] = cfg_["gender"];
        }
 
        if(utils::string_bool(cfg_["random_traits"], true)) {
@@ -1147,7 +1145,7 @@
 //- @param use_traits  ??
 void unit::read(const config& cfg, bool use_traits, game_state* state)
 {
-       if(cfg["id"].empty() && cfg["type"].empty()) {
+       if(cfg["type"].empty()) {
                throw game::load_game_failed("Attempt to de-serialize an 
empty unit");
        }
        cfg_ = cfg;
@@ -1157,7 +1155,6 @@
        }
 
        validate_side(side_);
-       bool id_set = cfg["id"] != "";
 
        // Prevent un-initialized variables
        hit_points_=1;
@@ -1251,7 +1248,7 @@
        bool type_set = false;
        type_ = "";
        assert(gamedata_ != NULL);
-       if(!(cfg["type"].empty() || cfg["type"] == cfg["id"]) || 
cfg["gender"] != cfg["gender_id"]) {
+       if(!cfg["type"].empty()) {
                std::map<std::string,unit_type>::const_iterator i = 
gamedata_->unit_types.find(cfg["type"]);
                if(i != gamedata_->unit_types.end()) {
                        advance_to(&i->second.get_gender_unit_type(gender_), 
use_traits, state);
@@ -1273,11 +1270,7 @@
                        movement_ = 0;
                }
        }
-       if(cfg_["id"]=="") {
-               type_ = cfg_["type"];
-       } else {
-               type_ = cfg_["id"];
-       }
+       type_ = cfg_["type"];
        if(!type_set || cfg["race"] != "") {
                const race_map::const_iterator race_it = 
gamedata_->races.find(cfg["race"]);
                if(race_it != gamedata_->races.end()) {
@@ -1301,7 +1294,7 @@
                cfg_["unit_description"] = custom_unit_desc;
        }
 
-       if(cfg["profile"] != "" && !id_set) {
+       if(cfg["profile"] != "") {
                cfg_["profile"] = cfg["profile"];
        }
 
@@ -1443,7 +1436,6 @@
        cfg.add_child("abilities",abilities_b_);
        cfg["x"] = x;
        cfg["y"] = y;
-       cfg["id"] = type_id();
        std::map<std::string,unit_type>::const_iterator uti = 
gamedata_->unit_types.find(type_id());
        const unit_type* ut = NULL;
        if(uti != gamedata_->unit_types.end()) {
@@ -1472,7 +1464,6 @@
        cfg["side"] = sd.str();
 
        cfg["gender"] = gender_string(gender_);
-       cfg["gender_id"] = gender_string(gender_);
 
        cfg["variation"] = variation_;
 
@@ -2962,7 +2953,6 @@
  * experience
  * gender
  * hitpoints
- * id
  * level
  * max_attacks
  * max_experience
@@ -3003,7 +2993,6 @@
                "experience",
                "gender",
                "hitpoints",
-               "id",
                "ignore_race_traits",
                "ignore_global_traits",
                "level",

Modified: trunk/src/unit_types.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_types.cpp?rev=24564&r1=24563&r2=24564&view=diff
==============================================================================
--- trunk/src/unit_types.cpp (original)
+++ trunk/src/unit_types.cpp Wed Mar 12 13:39:50 2008
@@ -694,27 +694,11 @@
 {
        if(id_.empty()) {
                id_ = cfg_["id"];
-
-               if(id_.empty()) {
-                       // This code is only for compatibility with old unit 
defs and savefiles.
-                       id_ = cfg_["name"];
-               }
-
                //id_.erase(std::remove(id_.begin(),id_.end(),' '),id_.end());
        }
 
        return id_;
 }
-
-
-#if 0
-const std::string& unit_type::name() const
-{
-       return cfg_["id"];
-}
-#endif
-
-
 
 const std::string& unit_type::image_profile() const
 {

Modified: trunk/src/unit_types.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_types.hpp?rev=24564&r1=24563&r2=24564&view=diff
==============================================================================
--- trunk/src/unit_types.hpp (original)
+++ trunk/src/unit_types.hpp Wed Mar 12 13:39:50 2008
@@ -179,11 +179,6 @@
        const t_string& language_name() const { return cfg_["name"]; }
 
        const std::string& id() const;
-       //Disabling this one for consistency with other similar structures,
-       //where name() is always the user-visible, translated, name.
-       //language_name should eventually be renamed name()
-       // const std::string& name() const;
-
        const std::string& image() const { return cfg_["image"]; }
        const std::string& image_profile() const;
        const t_string& unit_description() const;




Related Messages


Powered by MHonArc, Updated Wed Mar 12 15:21:58 2008