mail[Wesnoth-commits] r13062 - /branches/1.2/src/unit.cpp


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

Header


Content

Posted by wesnoth on August 09, 2006 - 20:13:
Author: xan
Date: Wed Aug  9 20:13:21 2006
New Revision: 13062

URL: http://svn.gna.org/viewcvs/wesnoth?rev=13062&view=rev
Log:
Do not serialize detailed unit description, unless it has changed.

Modified:
    branches/1.2/src/unit.cpp

Modified: branches/1.2/src/unit.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.2/src/unit.cpp?rev=13062&r1=13061&r2=13062&view=diff
==============================================================================
--- branches/1.2/src/unit.cpp (original)
+++ branches/1.2/src/unit.cpp Wed Aug  9 20:13:21 2006
@@ -1147,9 +1147,15 @@
        }
        
        std::map<std::string,unit_type>::const_iterator uti = 
gamedata_->unit_types.find(cfg["type"]);
+       const unit_type* ut = NULL;
+       if(uti != gamedata_->unit_types.end()) {
+               ut = 
&uti->second.get_gender_unit_type(gender_).get_variation(variation_);
+       }
        if(!type_set) {
-               if(uti != gamedata_->unit_types.end()) {
-                       const unit_type* ut = 
&uti->second.get_gender_unit_type(gender_).get_variation(variation_);
+               if(ut) {
+                       if(cfg_["unit_description"] == "") {
+                               cfg_["unit_description"] = 
ut->unit_description();
+                       }
                        config t_atks;
                        config u_atks;
                        for(config::const_child_itors range = 
ut->cfg_.child_range("attack");
@@ -1246,8 +1252,7 @@
        }
        
        if(!type_set) {
-               if(uti != gamedata_->unit_types.end()) {
-                       const unit_type* ut = 
&uti->second.get_gender_unit_type(gender_).get_variation(variation_);
+               if(ut) {
                        defensive_animations_ = ut->defensive_animations_;
                        teleport_animations_ = ut->teleport_animations_;
                        extra_animations_ = ut->extra_animations_;
@@ -1357,6 +1362,14 @@
        cfg["y"] = y;
        cfg["id"] = id();
        cfg["type"] = id();
+       std::map<std::string,unit_type>::const_iterator uti = 
gamedata_->unit_types.find(id());
+       const unit_type* ut = NULL;
+       if(uti != gamedata_->unit_types.end()) {
+               ut = 
&uti->second.get_gender_unit_type(gender_).get_variation(variation_);
+       }
+       if(ut && cfg["unit_description"] == ut->unit_description()) {
+               cfg["unit_description"] = "";
+       }
 
        std::stringstream hp;
        hp << hit_points_;




Related Messages


Powered by MHonArc, Updated Thu Aug 10 05:00:24 2006