summaryrefslogtreecommitdiff
path: root/src/ship_cmd.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-02-01 22:02:14 +0000
committerglx <glx@openttd.org>2008-02-01 22:02:14 +0000
commit7ce12e50da88b1e56f9abfd022f644fad164f03f (patch)
tree85232d22f5526c6d36a56090c71361bfa9b43bb6 /src/ship_cmd.cpp
parentf725b795afb17bbc532bd39c45029dfddc19837f (diff)
downloadopenttd-7ce12e50da88b1e56f9abfd022f644fad164f03f.tar.xz
(svn r12037) -Codechange: replace OnNewDay_(Aircraft|RoadVeh|Ship|Train) with an OnNewDay method in the Vehicle class
Diffstat (limited to 'src/ship_cmd.cpp')
-rw-r--r--src/ship_cmd.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 11d7f572e..530512727 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -170,27 +170,27 @@ static void CheckIfShipNeedsService(Vehicle *v)
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
-void OnNewDay_Ship(Vehicle *v)
+void Ship::OnNewDay()
{
CommandCost cost(EXPENSES_SHIP_RUN);
- if ((++v->day_counter & 7) == 0)
- DecreaseVehicleValue(v);
+ if ((++this->day_counter & 7) == 0)
+ DecreaseVehicleValue(this);
- CheckVehicleBreakdown(v);
- AgeVehicle(v);
- CheckIfShipNeedsService(v);
+ CheckVehicleBreakdown(this);
+ AgeVehicle(this);
+ CheckIfShipNeedsService(this);
- CheckOrders(v);
+ CheckOrders(this);
- if (v->vehstatus & VS_STOPPED) return;
+ if (this->vehstatus & VS_STOPPED) return;
- cost.AddCost(GetVehicleProperty(v, 0x0F, ShipVehInfo(v->engine_type)->running_cost) * _price.ship_running / 364);
- v->profit_this_year -= cost.GetCost() >> 8;
+ cost.AddCost(GetVehicleProperty(this, 0x0F, ShipVehInfo(this->engine_type)->running_cost) * _price.ship_running / 364);
+ this->profit_this_year -= cost.GetCost() >> 8;
- SubtractMoneyFromPlayerFract(v->owner, cost);
+ SubtractMoneyFromPlayerFract(this->owner, cost);
- InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+ InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
/* we need this for the profit */
InvalidateWindowClasses(WC_SHIPS_LIST);
}