mail[Wesnoth-commits] r40046 - /trunk/src/unit.cpp


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

Header


Content

Posted by alinktomine on December 03, 2009 - 03:26:
Author: alink
Date: Thu Dec  3 03:26:58 2009
New Revision: 40046

URL: http://svn.gna.org/viewcvs/wesnoth?rev=40046&view=rev
Log:
Optimize a little registering of specific profile's unit.

Modified:
    trunk/src/unit.cpp

Modified: trunk/src/unit.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=40046&r1=40045&r2=40046&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Thu Dec  3 03:26:58 2009
@@ -765,17 +765,18 @@
                cfg_.merge_with(t->movement_type().get_parent()->get_cfg());
        }
        // If unit has specific profile, remember it and keep it after 
advancing
-       std::string specific_profile;
-       if (type() != NULL)     {
-               const std::string profile = cfg_["profile"];
-               if (!profile.empty() && profile != type()->cfg_["profile"]){
-                       specific_profile = profile;
+       bool specific_profile = false;
+       const std::string profile = cfg_["profile"];
+       if (!profile.empty()) {
+               const unit_type* u_type = type();
+               if (u_type != NULL && profile != u_type->cfg_["profile"]){
+                       specific_profile = true;
                }
        }
 
        cfg_.merge_with(t->cfg_);
-       if (!specific_profile.empty()) {
-               cfg_["profile"] = specific_profile;
+       if (specific_profile) {
+               cfg_["profile"] = profile;
        }
        cfg_.clear_children("male");
        cfg_.clear_children("female");




Related Messages


Powered by MHonArc, Updated Thu Dec 03 03:40:08 2009