Author: alink
Date: Fri Apr  3 17:13:56 2009
New Revision: 34436

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34436&view=rev
Log:
Small cleaning of a function for possible future use.
No effect, fixed value is not used.

Modified:
    trunk/src/pathfind.cpp
    trunk/src/pathfind.hpp

Modified: trunk/src/pathfind.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/pathfind.cpp?rev=34436&r1=34435&r2=34436&view=diff
==============================================================================
--- trunk/src/pathfind.cpp (original)
+++ trunk/src/pathfind.cpp Fri Apr  3 17:13:56 2009
@@ -244,6 +244,7 @@
                // move_cost of the next step is irrelevant for the last step
                assert(last_step || map.on_board(*(i+1)));
                const int move_cost = last_step ? 0 : 
u.movement_cost(map[*(i+1)]);
+               bool capture = false;
 
                if (last_step || zoc || move_cost > movement) {
                        // check if we stop an a village and so maybe capture it
@@ -263,6 +264,7 @@
 
                        movement = u.total_movement();
                        if(move_cost > movement) {
+                               rt.move_left = -1;
                                return -1; //we can't reach destination
                        }
                }
@@ -270,7 +272,7 @@
                zoc = enemy_zoc(map,units,teams, *(i+1), viewing_team,u.side())
                                        && !u.get_ability_bool("skirmisher", 
*(i+1));
 
-               if (zoc) {
+               if (zoc || capture) {
                        movement = 0;
                } else {
                        movement -= move_cost;

Modified: trunk/src/pathfind.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/pathfind.hpp?rev=34436&r1=34435&r2=34436&view=diff
==============================================================================
--- trunk/src/pathfind.hpp (original)
+++ trunk/src/pathfind.hpp Fri Apr  3 17:13:56 2009
@@ -144,8 +144,9 @@
 /**
  * Function which, given a unit and a route the unit can move on,
  * will return the number of turns it will take the unit to traverse the route.
- * adds "turn waypoints" to rt.turn_waypoints.
- * Note that "end of path" is also added.
+ * adds rt.turn_waypoints (and also one at "end of path").
+ * move_left is updated, but to 0 if not reachable in more than 1 turn
+ * and to -1 if never reachable.
  */
 int route_turns_to_complete(const unit& u, paths::route& rt, const team 
&viewing_team,
                                                        const unit_map& units, 
const std::vector<team>& teams, const gamemap& map);


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

Reply via email to