summaryrefslogtreecommitdiff
path: root/src/ship_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-17 11:36:36 +0000
committerrubidium <rubidium@openttd.org>2009-11-17 11:36:36 +0000
commit9bfcf2b6150d59187a6071943608218a793bbe0b (patch)
treeab04eeb0c4da4283b350ebb8141c903f67a57da6 /src/ship_gui.cpp
parent5fdff78c4290e0fd3bfcd552e76bb11f4cb9b312 (diff)
downloadopenttd-9bfcf2b6150d59187a6071943608218a793bbe0b.tar.xz
(svn r18136) -Codechange: support RTL in the vehicle lists
Diffstat (limited to 'src/ship_gui.cpp')
-rw-r--r--src/ship_gui.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp
index 64a2157d3..b76d5fd86 100644
--- a/src/ship_gui.cpp
+++ b/src/ship_gui.cpp
@@ -16,6 +16,7 @@
#include "vehicle_gui.h"
#include "strings_func.h"
#include "vehicle_func.h"
+#include "spritecache.h"
#include "table/strings.h"
@@ -29,10 +30,19 @@
*/
void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selection)
{
- DrawSprite(v->GetImage(DIR_W), GetVehiclePalette(v), left + 32, y + 10);
+ bool rtl = _dynlang.text_dir == TD_RTL;
+
+ SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W);
+ const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
+
+ int x = rtl ? right - real_sprite->width - real_sprite->x_offs : left - real_sprite->x_offs;
+
+ DrawSprite(sprite, GetVehiclePalette(v), x, y + 10);
if (v->index == selection) {
- DrawFrameRect(left - 5, y - 1, left + 67, y + 21, COLOUR_WHITE, FR_BORDERONLY);
+ x += real_sprite->x_offs;
+ y += real_sprite->y_offs + 10;
+ DrawFrameRect(x - 1, y - 1, x + real_sprite->width + 1, y + real_sprite->height + 1, COLOUR_WHITE, FR_BORDERONLY);
}
}