diff options
author | yexo <yexo@openttd.org> | 2009-03-24 20:03:02 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2009-03-24 20:03:02 +0000 |
commit | 84fb615344af1d998ae607aea7801d74a3b90e4e (patch) | |
tree | 70b7dee14892374c8be6116a56e3cddf0ec43b54 /src/subsidy_gui.cpp | |
parent | 306239ee3e8376c1c85e80e5b7960e0ba488ad32 (diff) | |
download | openttd-84fb615344af1d998ae607aea7801d74a3b90e4e.tar.xz |
(svn r15835) -Codechange: Prevent using the return value of DrawString as much as possible.
Diffstat (limited to 'src/subsidy_gui.cpp')
-rw-r--r-- | src/subsidy_gui.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index a84737a68..6c5686fc3 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -118,17 +118,10 @@ struct SubsidyListWindow : Window { for (s = _subsidies; s != endof(_subsidies); s++) { if (s->cargo_type != CT_INVALID && s->age < 12) { - int x2; - /* Displays the two offered towns */ SetupSubsidyDecodeParam(s, 1); - x2 = DrawString(x + 2, right - 2, y, STR_2027_FROM_TO, TC_FROMSTRING); - - if (width - x2 > 10) { - /* Displays the deadline before voiding the proposal */ - SetDParam(0, _date - ymd.day + 384 - s->age * 32); - DrawString(x2, right, y, STR_2028_BY, TC_FROMSTRING); - } + SetDParam(7, _date - ymd.day + 384 - s->age * 32); + DrawString(x + 2, right - 2, y, STR_2027_FROM_TO, TC_FROMSTRING); y += 10; num++; @@ -147,20 +140,13 @@ struct SubsidyListWindow : Window { for (s = _subsidies; s != endof(_subsidies); s++) { if (s->cargo_type != CT_INVALID && s->age >= 12) { - int xt; - SetupSubsidyDecodeParam(s, 1); - SetDParam(3, GetStation(s->to)->owner); + SetDParam(4, _date - ymd.day + 768 - s->age * 32); /* Displays the two connected stations */ - xt = DrawString(x + 2, right - 2, y, STR_202C_FROM_TO, TC_FROMSTRING); + DrawString(x + 2, right - 2, y, STR_202C_FROM_TO, TC_FROMSTRING); - /* Displays the date where the granted subsidy will end */ - if ((xt > 3) && (width - xt) > 9 ) { // do not draw if previous drawing failed or if it will overlap on scrollbar - SetDParam(0, _date - ymd.day + 768 - s->age * 32); - DrawString(xt, right, y, STR_202D_UNTIL, TC_FROMSTRING); - } y += 10; num++; } |