mail[Wesnoth-commits] r25354 - in /trunk/src: dialogs.cpp unit_types.cpp


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

Header


Content

Posted by joerg . hinrichs on March 30, 2008 - 23:57:
Author: jhinrichs
Date: Sun Mar 30 23:57:29 2008
New Revision: 25354

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25354&view=rev
Log:
A better fix for the unit_type problems. Unlike the last one it does not 
break help and also fixes creating units in debug mode.

Modified:
    trunk/src/dialogs.cpp
    trunk/src/unit_types.cpp

Modified: trunk/src/dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/dialogs.cpp?rev=25354&r1=25353&r2=25354&view=diff
==============================================================================
--- trunk/src/dialogs.cpp (original)
+++ trunk/src/dialogs.cpp Sun Mar 30 23:57:29 2008
@@ -971,6 +971,8 @@
        if (t==NULL)
                return det;
 
+    unit_type_data::instance().unit_types.build_unit_type(t->id(), 
unit_type::WITHOUT_ANIMATIONS);
+
        std::string mod = "~RC(" + t->flag_rgb() + ">" + 
team::get_side_colour_index(side_) + ")";
        det.image = image::get_image(t->image()+mod);
 

Modified: trunk/src/unit_types.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_types.cpp?rev=25354&r1=25353&r2=25354&view=diff
==============================================================================
--- trunk/src/unit_types.cpp (original)
+++ trunk/src/unit_types.cpp Sun Mar 30 23:57:29 2008
@@ -916,9 +916,6 @@
                
unit_types.races().insert(std::pair<std::string,unit_race>(race.id(),race));
                increment_set_config_progress();
        }
-
-       //Add dummy unit
-       unit_types.insert(std::pair<const 
std::string,unit_type>("dummy_unit",unit_type()));
 
        unsigned base_unit_count = 0;
        for(i = cfg.child_range("unit_type"); i.first != i.second; ++i.first)
@@ -1030,7 +1027,13 @@
 
     //This might happen if units of another era are requested (for example 
for savegames)
     if (itor == types_.end()){
-        return types_.find("dummy_unit");
+        itor == types_.find("dummy_unit");
+        if (itor != types_.end())
+            return itor;
+        else{
+            types_.insert(std::pair<std::string, unit_type>("dummy_unit", 
unit_type()) );
+            return types_.find("dummy_unit");
+        }
     }
 
     //check if the unit_type is constructed and build it if necessary




Related Messages


Powered by MHonArc, Updated Mon Mar 31 00:42:44 2008