summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-04-29 22:33:51 +0000
committerrubidium <rubidium@openttd.org>2007-04-29 22:33:51 +0000
commitec9ac99d01c74f1cb63e8c934c8a13d8aca2422a (patch)
tree81c46786f55f9842ddb4b237507c86df8fd72924 /src/vehicle.cpp
parent202009522c3075e26b675ed0408075b8663b0859 (diff)
downloadopenttd-ec9ac99d01c74f1cb63e8c934c8a13d8aca2422a.tar.xz
(svn r9755) -Codechange: refactor some more of the begin loading stuff.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 5338bd554..5ec8c1c5f 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2980,6 +2980,17 @@ void Vehicle::BeginLoading()
current_order.type = OT_LOADING;
GetStation(this->last_station_visited)->loading_vehicles.push_back(this);
+
+ static const int expense_type[] = { EXPENSES_TRAIN_INC, EXPENSES_ROADVEH_INC, EXPENSES_SHIP_INC, EXPENSES_AIRCRAFT_INC };
+ SET_EXPENSES_TYPE(expense_type[this->type]);
+
+ if (LoadUnloadVehicle(this, true) != 0) {
+ static const WindowClass invalidate_windows[] = { WC_TRAINS_LIST, WC_ROADVEH_LIST, WC_SHIPS_LIST, WC_AIRCRAFT_LIST };
+ InvalidateWindow(invalidate_windows[this->type], this->owner);
+
+ this->MarkDirty();
+ }
+ InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, STATUS_BAR);
}
void Vehicle::LeaveStation()