diff options
-rw-r--r-- | src/signs_func.h | 1 | ||||
-rw-r--r-- | src/signs_gui.cpp | 10 | ||||
-rw-r--r-- | src/viewport.cpp | 6 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/signs_func.h b/src/signs_func.h index 5a38ba748..519a47096 100644 --- a/src/signs_func.h +++ b/src/signs_func.h @@ -15,6 +15,7 @@ void PlaceProc_Sign(TileIndex tile); /* signs_gui.cpp */ void ShowRenameSignWindow(const Sign *si); +void HandleClickOnSign(const Sign *si); void ShowSignList(); diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 8a9aae241..7a0e9c44b 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -8,6 +8,7 @@ #include "textbuf_gui.h" #include "window_gui.h" #include "player_gui.h" +#include "player_func.h" #include "signs_base.h" #include "signs_func.h" #include "debug.h" @@ -301,6 +302,15 @@ static const WindowDesc _query_sign_edit_desc = { _query_sign_edit_widgets, }; +void HandleClickOnSign(const Sign *si) +{ + if (_ctrl_pressed && si->owner == _local_player) { + RenameSign(si->index, ""); + return; + } + ShowRenameSignWindow(si); +} + void ShowRenameSignWindow(const Sign *si) { /* Delete all other edit windows and the save window */ diff --git a/src/viewport.cpp b/src/viewport.cpp index 68e14942a..fa37bcfb9 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1870,7 +1870,7 @@ static bool CheckClickOnSign(const ViewPort *vp, int x, int y) y < si->sign.top + 12 && x >= si->sign.left && x < si->sign.left + si->sign.width_1) { - ShowRenameSignWindow(si); + HandleClickOnSign(si); return true; } } @@ -1884,7 +1884,7 @@ static bool CheckClickOnSign(const ViewPort *vp, int x, int y) y < si->sign.top + 24 && x >= si->sign.left && x < si->sign.left + si->sign.width_1 * 2) { - ShowRenameSignWindow(si); + HandleClickOnSign(si); return true; } } @@ -1900,7 +1900,7 @@ static bool CheckClickOnSign(const ViewPort *vp, int x, int y) y < si->sign.top + ScaleByZoom(12, vp->zoom) && x >= si->sign.left && x < si->sign.left + ScaleByZoom(si->sign.width_2, vp->zoom)) { - ShowRenameSignWindow(si); + HandleClickOnSign(si); return true; } } |