summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-09-07 16:22:55 +0000
committersmatz <smatz@openttd.org>2008-09-07 16:22:55 +0000
commit60773026604745ef9585cc53d07c98777e85fcc7 (patch)
tree6d345769a76aaf5050f0575c5d44bfb1ef244d65
parent3f42080e1af73a05bf9342a46a531d0d8f294c0d (diff)
downloadopenttd-60773026604745ef9585cc53d07c98777e85fcc7.tar.xz
(svn r14263) -Codechange: give a better error message when removing a sign fails
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/signs_gui.cpp5
2 files changed, 4 insertions, 2 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 07f42e249..01ba05662 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1881,6 +1881,7 @@ STR_2809_CAN_T_PLACE_SIGN_HERE :{WHITE}Can't pl
STR_280A_SIGN :Sign
STR_280B_EDIT_SIGN_TEXT :{WHITE}Edit sign text
STR_280C_CAN_T_CHANGE_SIGN_NAME :{WHITE}Can't change sign name...
+STR_CAN_T_DELETE_SIGN :{WHITE}Can't delete sign...
STR_280D_SELECT_TREE_TYPE_TO_PLANT :{BLACK}Select tree type to plant
STR_280E_TREES :Trees
STR_280F_RAINFOREST :Rainforest
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 04089bd4e..ec89f5ebc 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -22,6 +22,7 @@
#include "viewport_func.h"
#include "querystring_gui.h"
#include "sortlist_type.h"
+#include "string_func.h"
#include "table/strings.h"
#include "table/sprites.h"
@@ -173,7 +174,7 @@ void ShowSignList()
static void RenameSign(SignID index, const char *text)
{
_cmd_text = text;
- DoCommandP(0, index, 0, NULL, CMD_RENAME_SIGN | CMD_MSG(STR_280C_CAN_T_CHANGE_SIGN_NAME));
+ DoCommandP(0, index, 0, NULL, CMD_RENAME_SIGN | (StrEmpty(text) ? CMD_MSG(STR_CAN_T_DELETE_SIGN) : CMD_MSG(STR_280C_CAN_T_CHANGE_SIGN_NAME)));
}
enum QueryEditSignWidgets {
@@ -343,7 +344,7 @@ static const WindowDesc _query_sign_edit_desc = {
void HandleClickOnSign(const Sign *si)
{
if (_ctrl_pressed && si->owner == _local_player) {
- RenameSign(si->index, "");
+ RenameSign(si->index, NULL);
return;
}
ShowRenameSignWindow(si);