summaryrefslogtreecommitdiff
path: root/src/station_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-07-17 13:47:04 +0000
committerrubidium <rubidium@openttd.org>2008-07-17 13:47:04 +0000
commit5a94972c2db660c9cc5fe5d79ea095af04456a21 (patch)
treec5968a407194cba5120766750d96971df91cde2f /src/station_gui.cpp
parent31d283c6c88464837dd57b78f75394367c4d40f7 (diff)
downloadopenttd-5a94972c2db660c9cc5fe5d79ea095af04456a21.tar.xz
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
-Codechange: remove all BindCString and related functions and replace it by RAW_STRING which prints the C-string raw pointer that is on the 'print stack'.
Diffstat (limited to 'src/station_gui.cpp')
-rw-r--r--src/station_gui.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 881ec021c..878a6308d 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -810,13 +810,14 @@ struct StationViewWindow : public Window {
}
if (this->widget[SVW_ACCEPTS].data == STR_3032_RATINGS) { // small window with list of accepted cargo
- char *b = _userstring;
+ char string[512];
+ char *b = string;
bool first = true;
b = InlineString(b, STR_000C_ACCEPTS);
for (CargoID i = 0; i < NUM_CARGO; i++) {
- if (b >= lastof(_userstring) - (1 + 2 * 4)) break; // ',' or ' ' and two calls to Utf8Encode()
+ if (b >= lastof(string) - (1 + 2 * 4)) break; // ',' or ' ' and two calls to Utf8Encode()
if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE)) {
if (first) {
first = false;
@@ -835,9 +836,10 @@ struct StationViewWindow : public Window {
*b = '\0';
/* Make sure we detect any buffer overflow */
- assert(b < endof(_userstring));
+ assert(b < endof(string));
- DrawStringMultiLine(2, this->widget[SVW_ACCEPTLIST].top + 1, STR_SPEC_USERSTRING, this->widget[SVW_ACCEPTLIST].right - this->widget[SVW_ACCEPTLIST].left);
+ SetDParamStr(0, string);
+ DrawStringMultiLine(2, this->widget[SVW_ACCEPTLIST].top + 1, STR_JUST_RAW_STRING, this->widget[SVW_ACCEPTLIST].right - this->widget[SVW_ACCEPTLIST].left);
} else { // extended window with list of cargo ratings
y = this->widget[SVW_RATINGLIST].top + 1;