From 5a94972c2db660c9cc5fe5d79ea095af04456a21 Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 17 Jul 2008 13:47:04 +0000 Subject: (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'. --- src/station_gui.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/station_gui.cpp') 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; -- cgit v1.2.3-54-g00ecf