Whiteboard: arrow gets properly reset when selecting a new unit

This commit is contained in:
Gabriel Morin 2010-06-16 05:44:53 +00:00
parent d1a5aa8668
commit 9e02d534bb
3 changed files with 11 additions and 2 deletions

View file

@ -158,7 +158,7 @@ void mouse_handler::mouse_motion(int x, int y, const bool browse, bool update)
const unit_map::iterator selected_unit = find_unit(selected_hex_);
const unit_map::iterator mouseover_unit = find_unit(new_hex);
if (resources::whiteboard) {
if (resources::whiteboard->active()) {
if (update) {
resources::whiteboard->remove_highlight();
if (mouseover_unit != units_.end()) {

View file

@ -105,6 +105,7 @@ void manager::remove_highlight()
void manager::select_unit(unit& unit)
{
erase_temp_move();
selected_unit_ = &unit;
DBG_WB << "Selected unit " << selected_unit_->name() << " [" << selected_unit_->id() << "]\n";
}
@ -147,6 +148,12 @@ void manager::create_temp_move(const std::vector<map_location> &steps)
}
}
bool manager::has_temp_move()
{
bool has_it = move_arrow_;
return has_it;
}
void manager::erase_temp_move()
{
if (move_arrow_)

View file

@ -69,8 +69,10 @@ public:
void select_unit(unit& unit);
void deselect_unit();
/** Set the route for move creation purposes */
/** Creates a temporary visual arrow, that follows the cursor, for move creation purposes */
void create_temp_move(const std::vector<map_location> &steps);
/** Informs whether an arrow is being displayed for move creation purposes */
bool has_temp_move();
void erase_temp_move();