diff options
author | rubidium <rubidium@openttd.org> | 2008-07-17 13:47:04 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-07-17 13:47:04 +0000 |
commit | ab234cf90cd0b31354fddb9ee1f562a3eb630cdc (patch) | |
tree | c5968a407194cba5120766750d96971df91cde2f /src/station_gui.cpp | |
parent | c913be73d8dc69910b67f095aa3820ba29e6bf51 (diff) | |
download | openttd-ab234cf90cd0b31354fddb9ee1f562a3eb630cdc.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.cpp | 10 |
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; |