summaryrefslogtreecommitdiff
path: root/src/train_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-17 15:05:12 +0000
committerrubidium <rubidium@openttd.org>2009-11-17 15:05:12 +0000
commitcbc12fdd8695301814b27554cb1146ebc867ea26 (patch)
treeb72d8f16ac514837ce7b70c1b2c6444461533d16 /src/train_gui.cpp
parent36a20894aa5a5311fff74d1167d83a584c56ab62 (diff)
downloadopenttd-cbc12fdd8695301814b27554cb1146ebc867ea26.tar.xz
(svn r18142) -Codechange: make the vehicle details RTL (and huge ship/aircraft) aware
Diffstat (limited to 'src/train_gui.cpp')
-rw-r--r--src/train_gui.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index a28decbc9..f13b6c0db 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -236,8 +236,10 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
{
/* draw the first 3 details tabs */
if (det_tab != TDW_TAB_TOTALS) {
+ bool rtl = _dynlang.text_dir == TD_RTL;
+ Direction dir = rtl ? DIR_E : DIR_W;
const Train *u = v;
- int x = 1;
+ int x = rtl ? right : left;
for (;;) {
if (--vscroll_pos < 0 && vscroll_pos >= -vscroll_cap) {
int px = x;
@@ -247,29 +249,29 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
Point offset;
int width = u->GetDisplayImageWidth(&offset);
SpriteID pal = (u->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(u);
- DrawSprite(u->GetImage(DIR_W), pal, px + offset.x, y + 4 + offset.y);
- px += width;
+ DrawSprite(u->GetImage(dir), pal, px + (rtl ? -offset.x : offset.x), y + 4 + offset.y);
+ px += rtl ? -width : width;
u = u->Next();
} while (u != NULL && u->IsArticulatedPart() && u->cargo_cap == 0);
- px += 2;
+ px += rtl ? -2 : 2;
int py = y;
switch (det_tab) {
default: NOT_REACHED();
case TDW_TAB_CARGO:
- TrainDetailsCargoTab(v, px, right, py);
+ TrainDetailsCargoTab(v, rtl ? left : px, rtl ? px : right, py);
break;
case TDW_TAB_INFO:
/* Only show name and value for the 'real' part */
if (!v->IsArticulatedPart()) {
- TrainDetailsInfoTab(v, px, right, py);
+ TrainDetailsInfoTab(v, rtl ? left : px, rtl ? px : right, py);
}
break;
case TDW_TAB_CAPACITY:
- TrainDetailsCapacityTab(v, px, right, py);
+ TrainDetailsCapacityTab(v, rtl ? left : px, rtl ? px : right, py);
break;
}
y += WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM;