mail[Wesnoth-commits] r20621 - /trunk/src/race.cpp


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

Header


Content

Posted by koraq on September 20, 2007 - 17:40:
Author: mordante
Date: Thu Sep 20 17:39:40 2007
New Revision: 20621

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20621&view=rev
Log:
Make sure all members are initialized in the constructor.

Modified:
    trunk/src/race.cpp

Modified: trunk/src/race.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/race.cpp?rev=20621&r1=20620&r2=20621&view=diff
==============================================================================
--- trunk/src/race.cpp (original)
+++ trunk/src/race.cpp Thu Sep 20 17:39:40 2007
@@ -129,24 +129,35 @@
        return originalRes;
 }
 
-unit_race::unit_race() : ntraits_(0), chain_size_(0), 
traits_(&empty_traits), global_traits_(true)
-{
-}
-
-unit_race::unit_race(const config& cfg) : name_(cfg["name"]), 
ntraits_(atoi(cfg["num_traits"].c_str())),
-                                                                             
    traits_(&cfg.get_children("trait")), 
global_traits_(!utils::string_bool(cfg["ignore_global_traits"]))
-{
-       id_ = cfg["id"];
+unit_race::unit_race() : 
+               id_(),
+               name_(),
+               description_(),
+               ntraits_(0), 
+               chain_size_(0), 
+               traits_(&empty_traits), 
+               global_traits_(true)
+{
+}
+
+unit_race::unit_race(const config& cfg) : 
+               id_(cfg["id"]),
+               name_(cfg["name"]), 
+               description_(cfg["description"]),
+               ntraits_(atoi(cfg["num_traits"].c_str())),
+               chain_size_(atoi(cfg["markov_chain_size"].c_str())),
+               traits_(&cfg.get_children("trait")), 
+               
global_traits_(!utils::string_bool(cfg["ignore_global_traits"]))
+
+{
        if(id_.empty()) {
                // This code is only for compatibility with old race defs.
                id_ = (cfg["name"]);
        }
-       description_ = cfg["description"];
        
        names_[MALE] = utils::split(cfg["male_names"]);
        names_[FEMALE] = utils::split(cfg["female_names"]);
 
-       chain_size_ = atoi(cfg["markov_chain_size"].c_str());
        if(chain_size_ <= 0)
                chain_size_ = 2;
 




Related Messages


Powered by MHonArc, Updated Thu Sep 20 19:00:49 2007