diff options
author | alberth <alberth@openttd.org> | 2013-10-01 20:16:44 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2013-10-01 20:16:44 +0000 |
commit | 5437a588a0ee819487ac6dd0da511d70d5824bff (patch) | |
tree | d8ff87fc2df21562edf24ff3c9fe475e18add326 /src/vehicle_gui.cpp | |
parent | 3efc999c009fc4c8be4ca93ed5ee606e07f419ca (diff) | |
download | openttd-5437a588a0ee819487ac6dd0da511d70d5824bff.tar.xz |
(svn r25803) -Fix[FS#5738]: Draw start/stop graphics of the vehicle bar at the right place in rtl mode (adf88).
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r-- | src/vehicle_gui.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index ff8719c07..17e9dcc96 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2619,9 +2619,15 @@ public: } } - /* draw the flag plus orders */ - DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP); - DrawString(r.left + WD_FRAMERECT_LEFT + 6, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_HOR_CENTER); + /* Draw the flag plus orders. */ + bool rtl = (_current_text_dir == TD_RTL); + uint text_offset = max(GetSpriteSize(SPR_FLAG_VEH_STOPPED).width, GetSpriteSize(SPR_FLAG_VEH_RUNNING).width) + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT; + int text_left = r.left + (rtl ? (uint)WD_FRAMERECT_LEFT : text_offset); + int text_right = r.right - (rtl ? text_offset : (uint)WD_FRAMERECT_RIGHT); + int image_left = (rtl ? text_right + 1 : r.left) + WD_IMGBTN_LEFT; + int image = ((v->vehstatus & VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING; + DrawSprite(image, PAL_NONE, image_left, r.top + WD_IMGBTN_TOP); + DrawString(text_left, text_right, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_HOR_CENTER); } virtual void OnClick(Point pt, int widget, int click_count) |