Fix with a little tricky
This commit is contained in:
parent
ee2bbc40cc
commit
0c2b035cc5
3 changed files with 9 additions and 5 deletions
|
@ -62,7 +62,7 @@ mouse_handler::mouse_handler(game_display* gui, play_controller& pc)
|
|||
, pc_(pc)
|
||||
, previous_hex_()
|
||||
, previous_free_hex_()
|
||||
, selected_hex_()
|
||||
, selected_hex_(map_location::null_location())
|
||||
, next_unit_()
|
||||
, current_route_()
|
||||
, current_paths_()
|
||||
|
@ -1091,8 +1091,10 @@ void mouse_handler::touch_action(const map_location touched_hex, bool browse)
|
|||
}
|
||||
}
|
||||
|
||||
void mouse_handler::select_hex(const map_location& hex, const bool browse, const bool highlight, const bool fire_event)
|
||||
void mouse_handler::select_hex(const map_location& hex, const bool browse, const bool highlight, const bool fire_event, const bool force_unhighlight)
|
||||
{
|
||||
bool unhighlight = selected_hex_.valid() && force_unhighlight;
|
||||
|
||||
selected_hex_ = hex;
|
||||
|
||||
gui().select_hex(selected_hex_);
|
||||
|
@ -1168,7 +1170,8 @@ void mouse_handler::select_hex(const map_location& hex, const bool browse, const
|
|||
|
||||
gui_->highlight_another_reach(reaching_unit_locations);
|
||||
} else {
|
||||
if(!pc_.get_units().find(last_hex_)) {
|
||||
// unhighlight is needed because the highlight_reach here won't be reset with highlight assigned false.
|
||||
if(!pc_.get_units().find(last_hex_) || unhighlight) {
|
||||
unselected_reach_ = gui_->unhighlight_reach();
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@ public:
|
|||
|
||||
void select_hex(const map_location& hex, const bool browse,
|
||||
const bool highlight = true,
|
||||
const bool fire_event = true);
|
||||
const bool fire_event = true,
|
||||
const bool force_unhighlight = false);
|
||||
|
||||
void move_action(bool browse) override;
|
||||
void teleport_action();
|
||||
|
|
|
@ -3564,7 +3564,7 @@ int game_lua_kernel::intf_select_unit(lua_State *L)
|
|||
{
|
||||
events::command_disabler command_disabler;
|
||||
if(lua_isnoneornil(L, 1)) {
|
||||
play_controller_.get_mouse_handler_base().select_hex(map_location::null_location(), false, false, false);
|
||||
play_controller_.get_mouse_handler_base().select_hex(map_location::null_location(), false, false, false, true);
|
||||
return 0;
|
||||
}
|
||||
const map_location loc = luaW_checklocation(L, 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue