diff options
author | rubidium <rubidium@openttd.org> | 2009-11-16 14:48:22 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-16 14:48:22 +0000 |
commit | ae799e7b1b77870e74449da90afb586d4f155a25 (patch) | |
tree | baba9e8a2402afaf29f18ae3b5df7b549bb312d5 /src | |
parent | b824b27fd64a953bd003f334e1aad5827e613cde (diff) | |
download | openttd-ae799e7b1b77870e74449da90afb586d4f155a25.tar.xz |
(svn r18116) -Change: make the station list support RTL when drawing the ratings
Diffstat (limited to 'src')
-rw-r--r-- | src/station_gui.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp index d0ee9d4d9..f9b304593 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -328,6 +328,7 @@ public: break; case SLW_LIST: { + bool rtl = _dynlang.text_dir == TD_RTL; int max = min(this->vscroll.GetPosition() + this->vscroll.GetCapacity(), this->stations.Length()); int y = r.top + WD_FRAMERECT_TOP; for (int i = this->vscroll.GetPosition(); i < max; ++i) { // do until max number of stations of owner @@ -340,13 +341,25 @@ public: SetDParam(0, st->index); SetDParam(1, st->facilities); - int x = DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_STATION_LIST_STATION) + 5; + int x = DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_STATION_LIST_STATION); + x += rtl ? -5 : 5; /* show cargo waiting and station ratings */ for (CargoID j = 0; j < NUM_CARGO; j++) { if (!st->goods[j].cargo.Empty()) { - StationsWndShowStationRating(x, r.right - WD_FRAMERECT_RIGHT, y, j, st->goods[j].cargo.Count(), st->goods[j].rating); - x += 20; + /* For RTL we work in exactly the opposite direction. So + * decrement the space needed first, then draw to the left + * instead of drawing to the left and then incrementing + * the space. */ + if (rtl) { + x -= 20; + if (x < r.left + WD_FRAMERECT_LEFT) break; + } + StationsWndShowStationRating(x, x + 16, y, j, st->goods[j].cargo.Count(), st->goods[j].rating); + if (!rtl) { + x += 20; + if (x > r.right - WD_FRAMERECT_RIGHT) break; + } } } y += FONT_HEIGHT_NORMAL; |