diff src/vehicle.cpp @ 6562:b9e449cea4d8 draft

(svn r9764) -Codechange: replace some lookup tables by functions.
author rubidium <rubidium@openttd.org>
date Wed, 02 May 2007 09:29:41 +0000
parents a8c87091a6c6
children 547b0171c3a9
line wrap: on
line diff
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2970,13 +2970,9 @@
 	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]);
-
+	SET_EXPENSES_TYPE(this->GetExpenseType(true));
 	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);
-
+		InvalidateWindow(this->GetVehicleListWindowClass(), this->owner);
 		this->MarkDirty();
 	}
 	InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, STATUS_BAR);