mail[Wesnoth-commits] r33363 - /trunk/src/formula_ai.cpp


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

Header


Content

Posted by dragonking on March 06, 2009 - 00:34:
Author: dragonking
Date: Fri Mar  6 00:34:17 2009
New Revision: 33363

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33363&view=rev
Log:
Made shortest_path formula function return empty array if destination is 
unreachable, use simplest_path if you want to get some result no matter what

Modified:
    trunk/src/formula_ai.cpp

Modified: trunk/src/formula_ai.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/formula_ai.cpp?rev=33363&r1=33362&r2=33363&view=diff
==============================================================================
--- trunk/src/formula_ai.cpp (original)
+++ trunk/src/formula_ai.cpp Fri Mar  6 00:34:17 2009
@@ -493,21 +493,12 @@
 
                 paths::route route = ai_.shortest_path_calculator( src, dst, 
unit_it, allowed_teleports );
 
-                if( route.steps.size() == 0 ) {
-                    emergency_path_calculator em_calc(unit_it->second, 
ai_.get_info().map);
-
-                    route = a_star_search(src, dst, 1000.0, &em_calc, 
ai_.get_info().map.w(), ai_.get_info().map.h(), &allowed_teleports);
-
-                    if( route.steps.size() < 2 ) {
-                        return variant(&locations);
-                    }
+                if( route.steps.size() < 2 ) {
+                    return variant(&locations);
                 }
 
                 for (std::vector<map_location>::const_iterator loc_iter = 
route.steps.begin() + 1 ; loc_iter !=route.steps.end(); ++loc_iter) {
-                    if( 
unit_it->second.movement_cost(ai_.get_info().map[*loc_iter]) < 99 )
-                        locations.push_back( variant( new 
location_callable(*loc_iter) ));
-                    else
-                        break;
+                    locations.push_back( variant( new 
location_callable(*loc_iter) ));
                 }
 
                return variant(&locations);




Related Messages


Powered by MHonArc, Updated Fri Mar 06 06:00:11 2009