Skip to content

Commit

Permalink
wb: fix incorrect handling of skirmisher.
Browse files Browse the repository at this point in the history
fixes #3014
  • Loading branch information
gfgtdf committed May 13, 2018
1 parent 6a9e2c2 commit eaabf16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/whiteboard/manager.cpp
Expand Up @@ -796,7 +796,9 @@ void manager::save_temp_move()
//either switch over to a plain route for planned moves, or mark it correctly
pathfind::marked_route route;
route.steps = move_arrow->get_path();
route.move_cost = path_cost(route.steps,*u);
// path_cost() is incomplete as it for example doesn't handle skirmisher, we let the move action generate the costs on it own.
// route.move_cost = path_cost(route.steps,*u);
route.move_cost = -1;

sa.queue_move(turn, *u, route, move_arrow, std::move(fake_units_[i]));
}
Expand Down
4 changes: 4 additions & 0 deletions src/whiteboard/move.cpp
Expand Up @@ -352,6 +352,10 @@ void move::apply_temp_modifier(unit_map& unit_map)
unit = &*unit_it;
}

if (route_->move_cost == -1) {
// TODO: check_validity also calls pathfind::mark_route(get_route().route), optimize/refactor this to only call that once.
route_->move_cost = pathfind::mark_route(get_route().route).move_cost;
}
//Modify movement points
DBG_WB <<"Move: Changing movement points for unit " << unit->name() << " [" << unit->id()
<< "] from " << unit->movement_left() << " to "
Expand Down

0 comments on commit eaabf16

Please sign in to comment.