diff src/train_cmd.cpp @ 6592:2a681ce5763a draft

(svn r9806) -Codechange: [NewGRF] Add callback 36 support for purchase cost, for all vehicle types.
author peter1138 <peter1138@openttd.org>
date Mon, 07 May 2007 13:26:10 +0000 (2007-05-07)
parents 12acb337dacb
children 431c5039b1f1
line wrap: on
line diff
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -566,7 +566,7 @@
 	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 
 	const RailVehicleInfo *rvi = RailVehInfo(engine);
-	int32 value = (rvi->base_cost * _price.build_railwagon) >> 8;
+	int32 value = (GetEngineProperty(engine, 0x17, rvi->base_cost) * _price.build_railwagon) >> 8;
 
 	uint num_vehicles = 1 + CountArticulatedParts(engine);
 
@@ -666,9 +666,9 @@
 	}
 }
 
-static int32 EstimateTrainCost(const RailVehicleInfo* rvi)
+static int32 EstimateTrainCost(EngineID engine, const RailVehicleInfo* rvi)
 {
-	return rvi->base_cost * (_price.build_railvehicle >> 3) >> 5;
+	return GetEngineProperty(engine, 0x17, rvi->base_cost) * (_price.build_railvehicle >> 3) >> 5;
 }
 
 static void AddRearEngineToMultiheadedTrain(Vehicle* v, Vehicle* u, bool building)
@@ -728,7 +728,7 @@
 
 	if (rvi->railveh_type == RAILVEH_WAGON) return CmdBuildRailWagon(p1, tile, flags);
 
-	int32 value = EstimateTrainCost(rvi);
+	int32 value = EstimateTrainCost(p1, rvi);
 
 	uint num_vehicles =
 		(rvi->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1) +