summaryrefslogtreecommitdiff
path: root/src/signs_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-11 22:08:56 +0000
committerrubidium <rubidium@openttd.org>2008-08-11 22:08:56 +0000
commit6995365535370da08116d49a30ebd84d56e7d8ff (patch)
tree64cc604a5c6fdb994ac66d9a17d50caab8d78364 /src/signs_gui.cpp
parent3b4c3a3df690d5ec02ba2bf93a69aa6fe9908810 (diff)
downloadopenttd-6995365535370da08116d49a30ebd84d56e7d8ff.tar.xz
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
Diffstat (limited to 'src/signs_gui.cpp')
-rw-r--r--src/signs_gui.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 8759b960b..50b436ee6 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -188,7 +188,7 @@ enum QueryEditSignWidgets {
struct SignWindow : QueryStringBaseWindow, SignList {
SignID cur_sign;
- SignWindow(const WindowDesc *desc, const Sign *si) : QueryStringBaseWindow(desc)
+ SignWindow(const WindowDesc *desc, const Sign *si) : QueryStringBaseWindow(31, desc)
{
SetBit(_no_scroll, SCROLL_EDIT);
this->caption = STR_280B_EDIT_SIGN_TEXT;
@@ -206,17 +206,19 @@ struct SignWindow : QueryStringBaseWindow, SignList {
void UpdateSignEditWindow(const Sign *si)
{
+ char *last_of = &this->edit_str_buf[this->edit_str_size - 1];
+
/* Display an empty string when the sign hasnt been edited yet */
if (si->name != NULL) {
SetDParam(0, si->index);
- GetString(this->edit_str_buf, STR_SIGN_NAME, lastof(this->edit_str_buf));
+ GetString(this->edit_str_buf, STR_SIGN_NAME, last_of);
} else {
- GetString(this->edit_str_buf, STR_EMPTY, lastof(this->edit_str_buf));
+ GetString(this->edit_str_buf, STR_EMPTY, last_of);
}
- this->edit_str_buf[lengthof(this->edit_str_buf) - 1] = '\0';
+ *last_of = '\0';
this->cur_sign = si->index;
- InitializeTextBuffer(&this->text, this->edit_str_buf, 31, 255); // Allow 31 characters (including \0)
+ InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 255);
this->InvalidateWidget(QUERY_EDIT_SIGN_WIDGET_TEXT);
}