mail[Wesnoth-commits] r14047 - /trunk/src/ai.cpp


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

Header


Content

Posted by Soliton on October 22, 2006 - 13:20:
Author: soliton
Date: Sun Oct 22 13:19:50 2006
New Revision: 14047

URL: http://svn.gna.org/viewcvs/wesnoth?rev=14047&view=rev
Log:
performance tweak suggested by zaimoni

Modified:
    trunk/src/ai.cpp

Modified: trunk/src/ai.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai.cpp?rev=14047&r1=14046&r2=14047&view=diff
==============================================================================
--- trunk/src/ai.cpp (original)
+++ trunk/src/ai.cpp Sun Oct 22 13:19:50 2006
@@ -809,9 +809,11 @@
 
        const bool passive_leader = 
utils::string_bool(current_team().ai_parameters()["passive_leader"]);
 
-       unit_map::iterator leader = find_leader(units_,team_num_);
-       if(leader != units_.end() && passive_leader) {
-               remove_unit_from_moves(leader->first,srcdst,dstsrc);
+       if (passive_leader) { 
+               unit_map::iterator leader = find_leader(units_,team_num_); 
+               if(leader != units_.end()) { 
+                       remove_unit_from_moves(leader->first,srcdst,dstsrc); 
+               }
        }
 
        //execute gotos - first collect gotos in a list
@@ -864,7 +866,7 @@
        LOG_AI << "get villages phase\n";
 
        // Iterator could be invalidated by combat analysis or 
move_leader_to_goals.
-       leader = find_leader(units_,team_num_);
+       unit_map::iterator leader = find_leader(units_,team_num_);
 
        LOG_AI << "villages...\n";
        const bool got_village = 
get_villages(possible_moves,srcdst,dstsrc,enemy_srcdst,enemy_dstsrc,leader);




Related Messages


Powered by MHonArc, Updated Sun Oct 22 14:21:32 2006