summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-06-12 22:29:42 +0000
committersmatz <smatz@openttd.org>2008-06-12 22:29:42 +0000
commit421a040e8919c95a431253b797a48c8f12b37343 (patch)
tree45b8578044e599868684d7df743926f0f72d7a91
parent79ad51867aa9551a8e9a85bdc3eff5ff760837b2 (diff)
downloadopenttd-421a040e8919c95a431253b797a48c8f12b37343.tar.xz
(svn r13501) -Feature(tte): ctrl+click on sign you own to remove it (Osai, planetmaker)
-rw-r--r--src/signs_func.h1
-rw-r--r--src/signs_gui.cpp10
-rw-r--r--src/viewport.cpp6
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;
}
}