Author: dave
Date: Mon Nov 17 00:43:59 2008
New Revision: 30779

URL: http://svn.gna.org/viewcvs/wesnoth?rev=30779&view=rev
Log:
fix to bug 12606: AI freeze

Modified:
    trunk/src/ai.cpp

Modified: trunk/src/ai.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai.cpp?rev=30779&r1=30778&r2=30779&view=diff
==============================================================================
--- trunk/src/ai.cpp (original)
+++ trunk/src/ai.cpp Mon Nov 17 00:43:59 2008
@@ -1546,27 +1546,26 @@
                        targets = find_targets(leader,enemy_dstsrc);
                        
targets.insert(targets.end(),additional_targets_.begin(),
                                                     additional_targets_.end());
+                       LOG_AI << "Found " << targets.size() << " targets\n"; 
                        if(targets.empty()) {
                                return false;
                        }
                }
 
-               LOG_AI << "choosing move...\n";
+               LOG_AI << "choosing move with " << targets.size() << " 
targets\n";
                std::pair<location,location> move = choose_move(targets, srcdst,
                                dstsrc, enemy_dstsrc);
+               LOG_AI << "choose_move ends with " << targets.size() << " 
targets\n";
 
                for(std::vector<target>::const_iterator ittg = targets.begin();
                                ittg != targets.end(); ++ittg) {
                        assert(map_.on_board(ittg->loc));
                }
 
-               if(move.first.valid() == false) {
+               if(move.first.valid() == false || move.second.valid() == false) 
{
                        break;
                }
 
-               if(move.second.valid() == false) {
-                       return true;
-               }
                assert (map_.on_board(move.first)
                        && map_.on_board(move.second));
 


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

Reply via email to