summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-16 13:19:39 +0000
committerrubidium <rubidium@openttd.org>2009-11-16 13:19:39 +0000
commitb824b27fd64a953bd003f334e1aad5827e613cde (patch)
tree2af35d8935b8afd9af2045cba00f820107707610
parentf9feac86072174c2b011e6c3bd96e6f5337e9054 (diff)
downloadopenttd-b824b27fd64a953bd003f334e1aad5827e613cde.tar.xz
(svn r18115) -Codechange: prevent RTL glitch with refitting and cargo suffix
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/vehicle_gui.cpp10
2 files changed, 8 insertions, 3 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 0a4ad51c6..8695acdd1 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -3982,6 +3982,7 @@ STR_JUST_DATE_SHORT :{DATE_SHORT}
STR_JUST_DATE_LONG :{DATE_LONG}
STR_JUST_DATE_ISO :{DATE_ISO}
STR_JUST_STRING :{STRING}
+STR_JUST_STRING_SPACE_STRING :{STRING} {STRING}
STR_JUST_RAW_STRING :{RAW_STRING}
# Slightly 'raw' stringcodes with colour or size
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index abcd56acb..63a944c14 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -251,13 +251,17 @@ static void DrawVehicleRefitWindow(const RefitList *list, int sel, uint pos, uin
TextColour colour = (sel == (int)i) ? TC_WHITE : TC_BLACK;
RefitOption *refit = &list->items[i];
- /* Draw the cargo name */
- int last_x = DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y, CargoSpec::Get(refit->cargo)->name, colour);
+ /* Get the cargo name */
+ SetDParam(0, CargoSpec::Get(refit->cargo)->name);
/* If the callback succeeded, draw the cargo suffix */
if (refit->value != CALLBACK_FAILED) {
- DrawString(last_x + 1, r.right - WD_MATRIX_RIGHT, y, GetGRFStringID(GetEngineGRFID(refit->engine), 0xD000 + refit->value), colour);
+ SetDParam(1, GetGRFStringID(GetEngineGRFID(refit->engine), 0xD000 + refit->value));
+ DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y, STR_JUST_STRING_SPACE_STRING, colour);
+ } else {
+ DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y, STR_JUST_STRING, colour);
}
+
y += delta;
}
}