mail[Wesnoth-commits] r33881 - in /trunk/src: game_events.cpp team.cpp team.hpp


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

Header


Content

Posted by guillaume . melquiond on March 20, 2009 - 08:07:
Author: silene
Date: Fri Mar 20 08:07:10 2009
New Revision: 33881

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33881&view=rev
Log:
Removed config::child_list from team.cpp.

Modified:
    trunk/src/game_events.cpp
    trunk/src/team.cpp
    trunk/src/team.hpp

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=33881&r1=33880&r2=33881&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Fri Mar 20 08:07:10 2009
@@ -787,7 +787,7 @@
                std::string shroud_data = cfg["shroud_data"];
                std::string village_gold = cfg["village_gold"];
                const config& parsed = cfg.get_parsed_config();
-               const config::child_list& ai = parsed.get_children("ai");
+               const config::const_child_itors &ai = 
parsed.child_range("ai");
                /**
                 * @todo also allow client to modify a side's colour if it is 
possible
                 * to change it on the fly without causing visual glitches
@@ -848,7 +848,7 @@
                                
(*teams)[team_index].set_village_gold(lexical_cast_default<int>(village_gold));
                        }
                        // Override AI parameters
-                       if (!ai.empty()) {
+                       if (ai.first != ai.second) {
                                (*teams)[team_index].set_ai_parameters(ai);
                        }
                }

Modified: trunk/src/team.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/team.cpp?rev=33881&r1=33880&r2=33881&view=diff
==============================================================================
--- trunk/src/team.cpp (original)
+++ trunk/src/team.cpp Fri Mar 20 08:07:10 2009
@@ -137,18 +137,18 @@
        if (!user_team_name.translatable())
                user_team_name = 
user_team_name.from_serialized(user_team_name);
        config global_ai_params;
-       const config::child_list& ai_parameters = cfg.get_children("ai");
-       for(config::child_list::const_iterator aiparam = 
ai_parameters.begin(); aiparam != ai_parameters.end(); ++aiparam) {
-               ai_params.push_back(**aiparam);
-
-               if((**aiparam)["turns"].empty() && 
(**aiparam)["time_of_day"].empty()) {
-                       global_ai_params.append(**aiparam);
-               }
-       }
-
-       const config::child_list& ai_mems = cfg.get_children("ai_memory");
-       for(config::child_list::const_iterator aimem = ai_mems.begin(); aimem 
!= ai_mems.end(); ++aimem) {
-         ai_memory_.append(**aimem);
+
+       foreach (const config &aiparam, cfg.child_range("ai"))
+       {
+               ai_params.push_back(aiparam);
+
+               if (aiparam["turns"].empty() && 
aiparam["time_of_day"].empty()) {
+                       global_ai_params.append(aiparam);
+               }
+       }
+
+       foreach (const config &aimem, cfg.child_range("ai_memory")) {
+               ai_memory_.append(aimem);
        }
 
        // at the start of a scenario "start_gold" is not set, we need to 
take the
@@ -472,9 +472,9 @@
        }
 
        // Load in the villages the side controls at the start
-       const config::child_list& villages = cfg.get_children("village");
-       for(config::child_list::const_iterator v = villages.begin(); v != 
villages.end(); ++v) {
-               map_location loc(**v,game_events::get_state_of_game());
+       foreach (const config &v, cfg.child_range("village"))
+       {
+               map_location loc(v, game_events::get_state_of_game());
                if (map.is_village(loc)) {
                        villages_.insert(loc);
                } else {
@@ -708,12 +708,11 @@
   info_.ai_memory_=ai_mem;
 }
 
-void team::set_ai_parameters(const config::child_list& ai_parameters)
+void team::set_ai_parameters(const config::const_child_itors &ai_parameters)
 {
        info_.ai_params.clear();                // override
-       config::child_list::const_iterator i;
-       for (i = ai_parameters.begin(); i != ai_parameters.end(); ++i) {
-               info_.ai_params.push_back(**i);
+       foreach (const config &p, ai_parameters) {
+               info_.ai_params.push_back(p);
        }
 }
 

Modified: trunk/src/team.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/team.hpp?rev=33881&r1=33880&r2=33881&view=diff
==============================================================================
--- trunk/src/team.hpp (original)
+++ trunk/src/team.hpp Fri Mar 20 08:07:10 2009
@@ -253,7 +253,7 @@
        const config& ai_parameters() const { return aiparams_; }
        const config& ai_memory() const { return info_.ai_memory_; }
        void set_ai_memory(const config& ai_mem);
-       void set_ai_parameters(const config::child_list& ai_parameters);
+       void set_ai_parameters(const config::const_child_itors 
&ai_parameters);
 
        double leader_value() const { return info_.leader_value; }
        void set_leader_value(double value) { info_.leader_value = value; }




Related Messages


Powered by MHonArc, Updated Fri Mar 20 08:20:30 2009