Small cleaning of a function for possible future use.

No effect, fixed value is not used.
This commit is contained in:
Ali El Gariani 2009-04-03 15:13:56 +00:00
parent bb06c83047
commit 7929512392
2 changed files with 6 additions and 3 deletions

View file

@ -244,6 +244,7 @@ int route_turns_to_complete(const unit& u, paths::route& rt, const team &viewing
// 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 @@ int route_turns_to_complete(const unit& u, paths::route& rt, const team &viewing
movement = u.total_movement();
if(move_cost > movement) {
rt.move_left = -1;
return -1; //we can't reach destination
}
}
@ -270,7 +272,7 @@ int route_turns_to_complete(const unit& u, paths::route& rt, const team &viewing
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;

View file

@ -144,8 +144,9 @@ paths::route a_star_search(map_location const &src, map_location const &dst,
/**
* 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);