From 702d49cd0f44fcd6b514df775bd3069ec2288c15 Mon Sep 17 00:00:00 2001 From: Simon Forsyth Date: Sat, 14 Jan 2012 22:49:39 +0000 Subject: [PATCH] Make gold hex cursor appear above all terrain when no unit visible Fixes one of the issues identified in http://forums.wesnoth.org/viewtopic.php?f=4&t=35886 --- src/display.cpp | 7 ------- src/editor/editor_display.cpp | 4 ++++ src/game_display.cpp | 11 +++++++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index c730341ccc8..d893afd0e76 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -2080,13 +2080,6 @@ void display::draw_hex(const map_location& loc) { drawing_buffer_add(LAYER_FOG_SHROUD, loc, xpos, ypos, get_fog_shroud_images(loc, image_type)); } - if(on_map && loc == mouseoverHex_) { - drawing_buffer_add(LAYER_MOUSEOVER_TOP, - loc, xpos, ypos, image::get_image("misc/hover-hex-top.png", image::SCALED_TO_HEX)); - drawing_buffer_add(LAYER_MOUSEOVER_BOTTOM, - loc, xpos, ypos, image::get_image("misc/hover-hex-bottom.png", image::SCALED_TO_HEX)); - } - if (on_map) { if (draw_coordinates_) { int off_x = xpos + hex_size()/2; diff --git a/src/editor/editor_display.cpp b/src/editor/editor_display.cpp index 385f2dc397b..0c37f40290c 100644 --- a/src/editor/editor_display.cpp +++ b/src/editor/editor_display.cpp @@ -85,6 +85,10 @@ void editor_display::draw_hex(const map_location& loc) drawing_buffer_add(LAYER_SELECTED_HEX, loc, xpos, ypos, image::get_image(brush, image::SCALED_TO_HEX)); } + if (map().on_board(loc) && loc == mouseoverHex_) { + drawing_buffer_add(LAYER_MOUSEOVER_BOTTOM, loc, xpos, ypos, + image::get_image("misc/hover-hex.png", image::SCALED_TO_HEX)); + } } } diff --git a/src/game_display.cpp b/src/game_display.cpp index e1a945069b6..152fc8779d5 100644 --- a/src/game_display.cpp +++ b/src/game_display.cpp @@ -321,6 +321,17 @@ void game_display::draw_hex(const map_location& loc) image::TYPE image_type = get_image_type(loc); display::draw_hex(loc); + + if(on_map && loc == mouseoverHex_) { + tdrawing_layer hex_top_layer = LAYER_MOUSEOVER_BOTTOM; + if( get_visible_unit(loc, teams_[viewing_team()] ) != NULL ) { + hex_top_layer = LAYER_MOUSEOVER_TOP; + } + drawing_buffer_add( hex_top_layer, + loc, xpos, ypos, image::get_image("misc/hover-hex-top.png", image::SCALED_TO_HEX)); + drawing_buffer_add(LAYER_MOUSEOVER_BOTTOM, + loc, xpos, ypos, image::get_image("misc/hover-hex-bottom.png", image::SCALED_TO_HEX)); + } if(!is_shrouded) { typedef overlay_map::const_iterator Itor;