summaryrefslogtreecommitdiff
path: root/src/vehicle_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
commitab234cf90cd0b31354fddb9ee1f562a3eb630cdc (patch)
treec5968a407194cba5120766750d96971df91cde2f /src/vehicle_gui.cpp
parentc913be73d8dc69910b67f095aa3820ba29e6bf51 (diff)
downloadopenttd-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/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 404e82460..888f1d0e5 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -453,7 +453,8 @@ uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine)
uint32 cmask = EngInfo(engine)->refit_mask;
/* List of cargo types available in this climate */
uint32 lmask = _cargo_mask;
- char *b = _userstring;
+ char string[512];
+ char *b = string;
/* Draw nothing if the engine is not refittable */
if (CountBits(cmask) <= 1) return 0;
@@ -477,9 +478,9 @@ uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine)
for (CargoID cid = 0; cid < NUM_CARGO; cid++) {
if (!HasBit(cmask, cid)) continue;
- if (b >= lastof(_userstring) - (2 + 2 * 4)) break; // ", " and two calls to Utf8Encode()
+ if (b >= lastof(string) - (2 + 2 * 4)) break; // ", " and two calls to Utf8Encode()
- if (!first) b = strecpy(b, ", ", lastof(_userstring));
+ if (!first) b = strecpy(b, ", ", lastof(string));
first = false;
b = InlineString(b, GetCargo(cid)->name);
@@ -490,9 +491,9 @@ uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine)
*b = '\0';
/* Make sure we detect any buffer overflow */
- assert(b < endof(_userstring));
+ assert(b < endof(string));
- return DrawStringMultiLine(x, y, STR_SPEC_USERSTRING, w);
+ return DrawStringMultiLine(x, y, STR_JUST_RAW_STRING, w);
}