diff options
author | frosch <frosch@openttd.org> | 2012-11-07 21:23:26 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-11-07 21:23:26 +0000 |
commit | 3e367cd0875b036e51789fb77cfbc9a4af06714f (patch) | |
tree | 0f07e4570f35b43579cb606cdb93efc538e612de /src/station_gui.cpp | |
parent | 28c98de6d9d48afa94fd148dddb6802309b28dec (diff) | |
download | openttd-3e367cd0875b036e51789fb77cfbc9a4af06714f.tar.xz |
(svn r24668) -Feature(ette) [FS#5311]: Draw cargo labels in the station list black or white depending on the background colour. (sbr)
Diffstat (limited to 'src/station_gui.cpp')
-rw-r--r-- | src/station_gui.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 4a1fd10aa..32aadbae7 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -109,6 +109,7 @@ static void StationsWndShowStationRating(int left, int right, int y, CargoID typ if (!cs->IsValid()) return; int colour = cs->rating_colour; + TextColour tc = GetContrastColour(colour); uint w = (minu(amount, units_full) + 5) / 36; int height = GetCharacterHeight(FS_SMALL); @@ -126,7 +127,7 @@ static void StationsWndShowStationRating(int left, int right, int y, CargoID typ } } - DrawString(left + 1, right, y, cs->abbrev, TC_BLACK); + DrawString(left + 1, right, y, cs->abbrev, tc); /* Draw green/red ratings bar (fits into 14 pixels) */ y += height + 2; @@ -455,7 +456,8 @@ public: const CargoSpec *cs = _sorted_cargo_specs[widget - WID_STL_CARGOSTART]; int cg_ofst = HasBit(this->cargo_filter, cs->Index()) ? 2 : 1; GfxFillRect(r.left + cg_ofst, r.top + cg_ofst, r.right - 2 + cg_ofst, r.bottom - 2 + cg_ofst, cs->rating_colour); - DrawString(r.left + cg_ofst, r.right + cg_ofst, r.top + cg_ofst, cs->abbrev, TC_BLACK, SA_HOR_CENTER); + TextColour tc = GetContrastColour(cs->rating_colour); + DrawString(r.left + cg_ofst, r.right + cg_ofst, r.top + cg_ofst, cs->abbrev, tc, SA_HOR_CENTER); } break; } |