Author: suokko
Date: Tue Sep 16 22:00:03 2008
New Revision: 29498

URL: http://svn.gna.org/viewcvs/wesnoth?rev=29498&view=rev
Log:
*Removed formula AI from start for default ai do_move() because it was buggy
*Fixed bugs in move_leader_to_keep

Modified:
    trunk/src/ai.cpp
    trunk/src/ai_move.cpp

Modified: trunk/src/ai.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai.cpp?rev=29498&r1=29497&r2=29498&view=diff
==============================================================================
--- trunk/src/ai.cpp (original)
+++ trunk/src/ai.cpp Tue Sep 16 22:00:03 2008
@@ -536,7 +536,7 @@
                }
 
                if(rt != p.routes.end()) {
-                       
assert(static_cast<size_t>(u_it->second.movement_left()) >= 
rt->second.steps.size()-1 && "Trying to move unit without enough move points 
left\n");
+                       
assert(static_cast<size_t>(u_it->second.movement_left()) >= 
rt->second.steps.size() && "Trying to move unit without enough move points 
left\n");
                        u_it->second.set_movement(rt->second.move_left);
 
                        std::vector<location> steps = rt->second.steps;
@@ -1007,8 +1007,8 @@
 
        // Formula AI is first going to move everything that it can
 
-       if (master_)
-               static_cast<formula_ai*>(ai_manager::get_ai("formula_ai", 
info_).get())->play_turn();
+//     if (master_)
+//             static_cast<formula_ai*>(ai_manager::get_ai("formula_ai", 
info_).get())->play_turn();
 
        typedef paths::route route;
 

Modified: trunk/src/ai_move.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai_move.cpp?rev=29498&r1=29497&r2=29498&view=diff
==============================================================================
--- trunk/src/ai_move.cpp (original)
+++ trunk/src/ai_move.cpp Tue Sep 16 22:00:03 2008
@@ -817,6 +817,7 @@
        const int number_of_recruit = current_team().gold() / 
current_team().average_recruit_price();
 
        // If the leader is not on his starting location, move him there.
+       if (number_of_recruit)
        {
                {
                        // Make a map of the possible locations the leader can 
move to,
@@ -865,8 +866,8 @@
                                gamemap::location target;
                                if (distance > leader->second.movement_left())
                                {
-                                       target = 
route->second.steps[leader->second.movement_left()+1];
-                                       
route->second.steps.erase(route->second.steps.begin() + 
leader->second.movement_left(),route->second.steps.end());
+                                       target = 
route->second.steps[leader->second.movement_left()];
+                                       
route->second.steps.erase(route->second.steps.begin() + 
leader->second.movement_left() + 1,route->second.steps.end());
                                        route->second.move_left = 0;
                                } else {
                                        target = *i;
@@ -874,7 +875,7 @@
                                }
                                best_value = value;
                                best_target = target;
-                               ERR_AI << "Considiring keep: " << *i << 
+                               DBG_AI << "Considiring keep: " << *i << 
                                        " empty slots: " << empty_slots << 
                                        " distance: " << distance << 
                                        " enemy: " << enemy << 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to