Whiteboard: experiment with allowing units to plan moves...

...in spaces left by other units. The visuals don't work yet. Since
move validation is not yet in, this can crash the whiteboard if you
try weird move combinations
This commit is contained in:
Gabriel Morin 2010-06-16 05:45:01 +00:00
parent 9e02d534bb
commit 178982bdb5
2 changed files with 16 additions and 7 deletions

View file

@ -107,6 +107,10 @@ void mouse_handler::mouse_motion(int x, int y, const bool browse, bool update)
const map_location new_hex = gui().hex_clicked_on(x,y);
if (resources::whiteboard->active() && resources::whiteboard->has_temp_move()) {
resources::whiteboard->apply_temp_modifiers();
}
if(new_hex != last_hex_) {
update = true;
if (last_hex_.valid()) {
@ -227,13 +231,9 @@ void mouse_handler::mouse_motion(int x, int y, const bool browse, bool update)
// the movement_reset is active only if it's not the unit's turn
unit_movement_resetter move_reset(*selected_unit,
selected_unit->side() != side_num_);
if (resources::whiteboard->active()) {
resources::whiteboard->apply_temp_modifiers();
}
current_route_ = get_route(selected_unit, dest, waypoints_, viewing_team());
if (resources::whiteboard->active()) {
resources::whiteboard->remove_temp_modifiers();
}
if(!browse) {
gui().set_route(&current_route_);
if (resources::whiteboard->active()) {
@ -268,6 +268,9 @@ void mouse_handler::mouse_motion(int x, int y, const bool browse, bool update)
}
}
}
if (resources::whiteboard->active() && resources::whiteboard->has_temp_move()) {
resources::whiteboard->remove_temp_modifiers();
}
}
unit_map::iterator mouse_handler::selected_unit()
@ -437,7 +440,13 @@ bool mouse_handler::left_click(int x, int y, const bool browse)
waypoints_.clear();
}
if (resources::whiteboard->active() && resources::whiteboard->has_temp_move()) {
resources::whiteboard->apply_temp_modifiers();
}
unit_map::iterator clicked_u = find_unit(hex);
if (resources::whiteboard->active() && resources::whiteboard->has_temp_move()) {
resources::whiteboard->remove_temp_modifiers();
}
const map_location src = selected_hex_;
pathfind::paths orig_paths = current_paths_;

View file

@ -150,7 +150,7 @@ void manager::create_temp_move(const std::vector<map_location> &steps)
bool manager::has_temp_move()
{
bool has_it = move_arrow_;
bool has_it = selected_unit_ != NULL;
return has_it;
}