summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-01-13 22:58:03 +0000
committersmatz <smatz@openttd.org>2009-01-13 22:58:03 +0000
commitca45774160670c787ba81b3c09ff418c1e1bc772 (patch)
tree30732aa7126b9196722d14cee835443a82b9688b /src/vehicle_gui.cpp
parent5b4da28594828bd784dadbb670444be79caf2bce (diff)
downloadopenttd-ca45774160670c787ba81b3c09ff418c1e1bc772.tar.xz
(svn r15077) -Codechange: enumify DAYS_IN_YEAR and DAYS_IN_LEAP_YEAR
-Change: when computing daily running cost, divide by 365 (instead of 364). Since r12134, the rounding errors don't need this correction anymore
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 1a02167d8..b0f91f937 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -124,7 +124,7 @@ void DrawVehicleProfitButton(const Vehicle *v, int x, int y)
SpriteID pal;
/* draw profit-based colored icons */
- if (v->age <= 365 * 2) {
+ if (v->age <= DAYS_IN_YEAR * 2) {
pal = PALETTE_TO_GREY;
} else if (v->GetDisplayProfitLastYear() < 0) {
pal = PALETTE_TO_RED;
@@ -783,7 +783,7 @@ void BaseVehicleListWindow::DrawVehicleListItems(int x, VehicleID selected_vehic
if (v->IsInDepot()) {
str = STR_021F;
} else {
- str = (v->age > v->max_age - 366) ? STR_00E3 : STR_00E2;
+ str = (v->age > v->max_age - DAYS_IN_LEAP_YEAR) ? STR_00E3 : STR_00E2;
}
SetDParam(0, v->unitnumber);
@@ -1412,9 +1412,9 @@ struct VehicleDetailsWindow : Window {
this->DrawWidgets();
/* Draw running cost */
- SetDParam(1, v->age / 366);
- SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED);
- SetDParam(2, v->max_age / 366);
+ SetDParam(1, v->age / DAYS_IN_LEAP_YEAR);
+ SetDParam(0, (v->age + DAYS_IN_YEAR < v->max_age) ? STR_AGE : STR_AGE_RED);
+ SetDParam(2, v->max_age / DAYS_IN_LEAP_YEAR);
SetDParam(3, v->GetDisplayRunningCost());
DrawString(2, 15, _vehicle_translation_table[VST_VEHICLE_AGE_RUNNING_COST_YR][v->type], TC_FROMSTRING);