summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-11-24 13:15:58 +0000
committerfrosch <frosch@openttd.org>2009-11-24 13:15:58 +0000
commitd507136e04432c420bbf48bb322c22335bc0dbfa (patch)
tree0d3f50287b352572dfd8a735a6f87a83568a4baa
parent5e247b6e439f8e717991d1bc5df27ddb732b1865 (diff)
downloadopenttd-d507136e04432c420bbf48bb322c22335bc0dbfa.tar.xz
(svn r18268) -Feature: [NewGRF] Make price base multipliers related to vehicles only apply to the GRF locally, if it defines engines of that type itself.
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/economy.cpp6
-rw-r--r--src/economy_func.h2
-rw-r--r--src/economy_type.h2
-rw-r--r--src/engine.cpp4
-rw-r--r--src/newgrf.cpp122
-rw-r--r--src/newgrf.h3
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/ship_cmd.cpp2
-rw-r--r--src/table/pricebase.h101
-rw-r--r--src/train_cmd.cpp2
-rw-r--r--src/vehicle_cmd.cpp2
12 files changed, 186 insertions, 64 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 159033199..12315894e 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -542,7 +542,7 @@ Money Aircraft::GetRunningCost() const
{
const Engine *e = Engine::Get(this->engine_type);
uint cost_factor = GetVehicleProperty(this, PROP_AIRCRAFT_RUNNING_COST_FACTOR, e->u.air.running_cost);
- return GetPrice(PR_RUNNING_AIRCRAFT, cost_factor);
+ return GetPrice(PR_RUNNING_AIRCRAFT, cost_factor, e->grffile);
}
void Aircraft::OnNewDay()
diff --git a/src/economy.cpp b/src/economy.cpp
index b8f4f6197..094c836a8 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -109,7 +109,7 @@ int _score_part[MAX_COMPANIES][SCORE_END];
Economy _economy;
Prices _price;
Money _additional_cash_required;
-static int8 _price_base_multiplier[PR_END];
+static PriceMultipliers _price_base_multiplier;
Money CalculateCompanyValue(const Company *c)
{
@@ -791,14 +791,16 @@ void InitializeEconomy()
* Determine a certain price
* @param index Price base
* @param cost_factor Price factor
+ * @param grf_file NewGRF to use local price multipliers from.
* @param shift Extra bit shifting after the computation
* @return Price
*/
-Money GetPrice(Price index, uint cost_factor, int shift)
+Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift)
{
if (index >= PR_END) return 0;
Money cost = _price[index] * cost_factor;
+ if (grf_file != NULL) shift += grf_file->price_base_multipliers[index];
if (shift >= 0) {
cost <<= shift;
diff --git a/src/economy_func.h b/src/economy_func.h
index ad50971eb..e03d05778 100644
--- a/src/economy_func.h
+++ b/src/economy_func.h
@@ -41,7 +41,7 @@ uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, Sourc
void PrepareUnload(Vehicle *front_v);
void LoadUnloadStation(Station *st);
-Money GetPrice(Price index, uint cost_factor, int shift = 0);
+Money GetPrice(Price index, uint cost_factor, const struct GRFFile *grf_file, int shift = 0);
void InitializeEconomy();
void RecomputePrices();
diff --git a/src/economy_type.h b/src/economy_type.h
index ccaf9de4a..ed4d457a2 100644
--- a/src/economy_type.h
+++ b/src/economy_type.h
@@ -121,6 +121,7 @@ enum Price {
DECLARE_POSTFIX_INCREMENT(Price)
typedef Money Prices[PR_END];
+typedef int8 PriceMultipliers[PR_END];
enum ExpensesType {
EXPENSES_CONSTRUCTION = 0,
@@ -155,6 +156,7 @@ enum PriceCategory {
struct PriceBaseSpec {
Money start_price; ///< Default value at game start, before adding multipliers.
PriceCategory category; ///< Price is affected by certain difficulty settings.
+ uint grf_feature; ///< GRF Feature, that decides whether price multipliers apply locally or globally. GSF_END if none.
};
/** The "steps" in loan size, in British Pounds! */
diff --git a/src/engine.cpp b/src/engine.cpp
index 1d0ea1b0b..07c69091e 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -232,7 +232,7 @@ Money Engine::GetRunningCost() const
default: NOT_REACHED();
}
- return GetPrice(base_price, cost_factor, -8);
+ return GetPrice(base_price, cost_factor, this->grffile, -8);
}
Money Engine::GetCost() const
@@ -268,7 +268,7 @@ Money Engine::GetCost() const
default: NOT_REACHED();
}
- return GetPrice(base_price, cost_factor, -8);
+ return GetPrice(base_price, cost_factor, this->grffile, -8);
}
/**
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 9a8c32831..f481235f4 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -1668,7 +1668,7 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, by
uint price = gvid + i;
if (price < PR_END) {
- SetPriceBaseMultiplier((Price)price, factor - 8);
+ _cur_grffile->price_base_multipliers[price] = min<int>(factor - 8, MAX_PRICE_MODIFIER);
} else {
grfmsg(1, "GlobalVarChangeInfo: Price %d out of range, ignoring", price);
}
@@ -2480,8 +2480,7 @@ static void FeatureChangeInfo(byte *buf, size_t len)
/* <00> <feature> <num-props> <num-info> <id> (<property <new-info>)...
*
- * B feature 0, 1, 2 or 3 for trains, road vehicles, ships or planes
- * 4 for defining new train station sets
+ * B feature
* B num-props how many properties to change per vehicle/station
* B num-info how many vehicles/stations to change
* E id ID of first vehicle/station to change, if num-info is
@@ -2489,7 +2488,6 @@ static void FeatureChangeInfo(byte *buf, size_t len)
* vehicles/stations will be changed
* B property what property to change, depends on the feature
* V new-info new bytes of info (variable size; depends on properties) */
- /* TODO: Bridges, town houses. */
static const VCI_Handler handler[] = {
/* GSF_TRAIN */ RailVehicleChangeInfo,
@@ -2522,6 +2520,9 @@ static void FeatureChangeInfo(byte *buf, size_t len)
return;
}
+ /* Mark the feature as used by the grf */
+ SetBit(_cur_grffile->grf_features, feature);
+
while (numprops-- && buf < bufend) {
uint8 prop = grf_load_byte(&buf);
@@ -3348,6 +3349,9 @@ static void FeatureMapSpriteGroup(byte *buf, size_t len)
return;
}
+ /* Mark the feature as used by the grf (generic callbacks do not count) */
+ SetBit(_cur_grffile->grf_features, feature);
+
grfmsg(6, "FeatureMapSpriteGroup: Feature %d, %d ids", feature, idcount);
switch (feature) {
@@ -5677,6 +5681,11 @@ static void InitNewGRFFile(const GRFConfig *config, int sprite_offset)
newfile->traininfo_vehicle_pitch = 0;
newfile->traininfo_vehicle_width = TRAININFO_DEFAULT_VEHICLE_WIDTH;
+ /* Mark price_base_multipliers as 'not set' */
+ for (Price i = PR_BEGIN; i < PR_END; i++) {
+ newfile->price_base_multipliers[i] = 0x80;
+ }
+
/* Copy the initial parameter list */
assert_compile(lengthof(newfile->param) == lengthof(config->param) && lengthof(config->param) == 0x80);
newfile->param_end = config->num_params;
@@ -6128,6 +6137,109 @@ static void ActivateOldShore()
}
}
+/**
+ * Decide whether price base multipliers of grfs shall apply globally or only to the grf specifying them
+ */
+static void FinalisePriceBaseMultipliers()
+{
+ extern const PriceBaseSpec _price_base_specs[];
+ static const uint32 override_features = (1 << GSF_TRAIN) | (1 << GSF_ROAD) | (1 << GSF_SHIP) | (1 << GSF_AIRCRAFT);
+
+ /* Evaluate grf overrides */
+ int num_grfs = _grf_files.Length();
+ int *grf_overrides = AllocaM(int, num_grfs);
+ for (int i = 0; i < num_grfs; i++) {
+ grf_overrides[i] = -1;
+
+ GRFFile *source = _grf_files[i];
+ uint32 override = _grf_id_overrides[source->grfid];
+ if (override == 0) continue;
+
+ GRFFile *dest = GetFileByGRFID(override);
+ if (dest == NULL) continue;
+
+ grf_overrides[i] = _grf_files.FindIndex(dest);
+ assert(grf_overrides[i] >= 0);
+ }
+
+ /* Override features and price base multipliers of earlier loaded grfs */
+ for (int i = 0; i < num_grfs; i++) {
+ if (grf_overrides[i] < 0 || grf_overrides[i] >= i) continue;
+ GRFFile *source = _grf_files[i];
+ GRFFile *dest = _grf_files[grf_overrides[i]];
+
+ uint32 features = (source->grf_features | dest->grf_features) & override_features;
+ source->grf_features |= features;
+ dest->grf_features |= features;
+
+ for (Price p = PR_BEGIN; p < PR_END; p++) {
+ /* No price defined -> nothing to do */
+ if (!HasBit(features, _price_base_specs[p].grf_feature) || (byte)source->price_base_multipliers[p] == 0x80) continue;
+ DEBUG(grf, 3, "'%s' overrides price base multiplier %d of '%s'", source->filename, p, dest->filename);
+ dest->price_base_multipliers[p] = source->price_base_multipliers[p];
+ }
+ }
+
+ /* Propagate features and price base multipliers of afterwards loaded grfs, if none is present yet */
+ for (int i = num_grfs - 1; i >= 0; i--) {
+ if (grf_overrides[i] < 0 || grf_overrides[i] <= i) continue;
+ GRFFile *source = _grf_files[i];
+ GRFFile *dest = _grf_files[grf_overrides[i]];
+
+ uint32 features = (source->grf_features | dest->grf_features) & override_features;
+ source->grf_features |= features;
+ dest->grf_features |= features;
+
+ for (Price p = PR_BEGIN; p < PR_END; p++) {
+ /* Already a price defined -> nothing to do */
+ if (!HasBit(features, _price_base_specs[p].grf_feature) || (byte)dest->price_base_multipliers[p] != 0x80) continue;
+ DEBUG(grf, 3, "Price base multiplier %d from '%s' propagated to '%s'", p, source->filename, dest->filename);
+ dest->price_base_multipliers[p] = source->price_base_multipliers[p];
+ }
+ }
+
+ /* The 'master grf' now have the correct multipliers. Assign them to the 'addon grfs' to make everything consistent. */
+ for (int i = 0; i < num_grfs; i++) {
+ if (grf_overrides[i] < 0) continue;
+ GRFFile *source = _grf_files[i];
+ GRFFile *dest = _grf_files[grf_overrides[i]];
+
+ uint32 features = (source->grf_features | dest->grf_features) & override_features;
+ source->grf_features |= features;
+ dest->grf_features |= features;
+
+ for (Price p = PR_BEGIN; p < PR_END; p++) {
+ if (!HasBit(features, _price_base_specs[p].grf_feature)) continue;
+ if (source->price_base_multipliers[p] != dest->price_base_multipliers[p]) {
+ DEBUG(grf, 3, "Price base multiplier %d from '%s' propagated to '%s'", p, dest->filename, source->filename);
+ }
+ source->price_base_multipliers[p] = dest->price_base_multipliers[p];
+ }
+ }
+
+ /* Decide local/global scope of price base multipliers */
+ const GRFFile * const *end = _grf_files.End();
+ for (GRFFile **file = _grf_files.Begin(); file != end; file++) {
+ PriceMultipliers &price_base_multipliers = (*file)->price_base_multipliers;
+ for (Price p = PR_BEGIN; p < PR_END; p++) {
+ if ((byte)price_base_multipliers[p] == 0x80) {
+ /* No multiplier was set; set it to a neutral value */
+ price_base_multipliers[p] = 0;
+ } else {
+ if (!HasBit((*file)->grf_features, _price_base_specs[p].grf_feature)) {
+ /* The grf does not define any objects of the feature,
+ * so it must be a difficulty setting. Apply it globally */
+ DEBUG(grf, 3, "'%s' sets global price base multiplier %d", (*file)->filename, p);
+ SetPriceBaseMultiplier(p, price_base_multipliers[p]);
+ price_base_multipliers[p] = 0;
+ } else {
+ DEBUG(grf, 3, "'%s' sets local price base multiplier %d", (*file)->filename, p);
+ }
+ }
+ }
+ }
+}
+
void InitDepotWindowBlockSizes();
extern void InitGRFTownGeneratorNames();
@@ -6179,6 +6291,8 @@ static void AfterLoadGRFs()
SetYearEngineAgingStops();
+ FinalisePriceBaseMultipliers();
+
/* Deallocate temporary loading data */
free(_gted);
_grm_sprites.clear();
diff --git a/src/newgrf.h b/src/newgrf.h
index 271e1bf34..b9009c4fe 100644
--- a/src/newgrf.h
+++ b/src/newgrf.h
@@ -115,6 +115,9 @@ struct GRFFile {
int traininfo_vehicle_pitch; ///< Vertical offset for draing train images in depot GUI and vehicle details
int traininfo_vehicle_width; ///< Width (in pixels) of a 8/8 train vehicle in depot GUI and vehicle details
+
+ uint32 grf_features; ///< Bitset of GrfSpecFeature the grf uses
+ PriceMultipliers price_base_multipliers; ///< Price base multipliers as set by the grf.
};
enum ShoreReplacement {
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index bc69349c3..ca7d89913 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1833,7 +1833,7 @@ Money RoadVehicle::GetRunningCost() const
uint cost_factor = GetVehicleProperty(this, PROP_ROADVEH_RUNNING_COST_FACTOR, e->u.road.running_cost);
if (cost_factor == 0) return 0;
- return GetPrice(e->u.road.running_cost_class, cost_factor);
+ return GetPrice(e->u.road.running_cost_class, cost_factor, e->grffile);
}
bool RoadVehicle::Tick()
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index fc579fc48..27049a78f 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -161,7 +161,7 @@ Money Ship::GetRunningCost() const
{
const Engine *e = Engine::Get(this->engine_type);
uint cost_factor = GetVehicleProperty(this, PROP_SHIP_RUNNING_COST_FACTOR, e->u.ship.running_cost);
- return GetPrice(PR_RUNNING_SHIP, cost_factor);
+ return GetPrice(PR_RUNNING_SHIP, cost_factor, e->grffile);
}
void Ship::OnNewDay()
diff --git a/src/table/pricebase.h b/src/table/pricebase.h
index 1eeba1231..7b20c7326 100644
--- a/src/table/pricebase.h
+++ b/src/table/pricebase.h
@@ -9,54 +9,55 @@
/** @file pricebase.h Price Bases */
-static const PriceBaseSpec _price_base_specs[PR_END] = {
- { 100, PCAT_NONE }, ///< PR_STATION_VALUE
- { 100, PCAT_CONSTRUCTION}, ///< PR_BUILD_RAIL
- { 95, PCAT_CONSTRUCTION}, ///< PR_BUILD_ROAD
- { 65, PCAT_CONSTRUCTION}, ///< PR_BUILD_SIGNALS
- { 275, PCAT_CONSTRUCTION}, ///< PR_BUILD_BRIDGE
- { 600, PCAT_CONSTRUCTION}, ///< PR_BUILD_DEPOT_TRAIN
- { 500, PCAT_CONSTRUCTION}, ///< PR_BUILD_DEPOT_ROAD
- { 700, PCAT_CONSTRUCTION}, ///< PR_BUILD_DEPOT_SHIP
- { 450, PCAT_CONSTRUCTION}, ///< PR_BUILD_TUNNEL
- { 200, PCAT_CONSTRUCTION}, ///< PR_BUILD_STATION_RAIL
- { 180, PCAT_CONSTRUCTION}, ///< PR_BUILD_STATION_RAIL_LENGTH
- { 600, PCAT_CONSTRUCTION}, ///< PR_BUILD_STATION_AIRPORT
- { 200, PCAT_CONSTRUCTION}, ///< PR_BUILD_STATION_BUS
- { 200, PCAT_CONSTRUCTION}, ///< PR_BUILD_STATION_TRUCK
- { 350, PCAT_CONSTRUCTION}, ///< PR_BUILD_STATION_DOCK
- { 400000, PCAT_CONSTRUCTION}, ///< PR_BUILD_VEHICLE_TRAIN
- { 2000, PCAT_CONSTRUCTION}, ///< PR_BUILD_VEHICLE_WAGON
- { 700000, PCAT_CONSTRUCTION}, ///< PR_BUILD_VEHICLE_AIRCRAFT
- { 14000, PCAT_CONSTRUCTION}, ///< PR_BUILD_VEHICLE_ROAD
- { 65000, PCAT_CONSTRUCTION}, ///< PR_BUILD_VEHICLE_SHIP
- { 20, PCAT_CONSTRUCTION}, ///< PR_BUILD_TREES
- { 250, PCAT_CONSTRUCTION}, ///< PR_TERRAFORM
- { 20, PCAT_CONSTRUCTION}, ///< PR_CLEAR_GRASS
- { 40, PCAT_CONSTRUCTION}, ///< PR_CLEAR_ROUGH
- { 200, PCAT_CONSTRUCTION}, ///< PR_CLEAR_ROCKS
- { 500, PCAT_CONSTRUCTION}, ///< PR_CLEAR_FILEDS
- { 20, PCAT_CONSTRUCTION}, ///< PR_CLEAR_TREES
- { -70, PCAT_CONSTRUCTION}, ///< PR_CLEAR_RAIL
- { 10, PCAT_CONSTRUCTION}, ///< PR_CLEAR_SIGNALS
- { 50, PCAT_CONSTRUCTION}, ///< PR_CLEAR_BRIDGE
- { 80, PCAT_CONSTRUCTION}, ///< PR_CLEAR_DEPOT_TRAIN
- { 80, PCAT_CONSTRUCTION}, ///< PR_CLEAR_DEPOT_ROAD
- { 90, PCAT_CONSTRUCTION}, ///< PR_CLEAR_DEPOT_SHIP
- { 30, PCAT_CONSTRUCTION}, ///< PR_CLEAR_TUNNEL
- { 10000, PCAT_CONSTRUCTION}, ///< PR_CLEAR_WATER
- { 50, PCAT_CONSTRUCTION}, ///< PR_CLEAR_STATION_RAIL
- { 30, PCAT_CONSTRUCTION}, ///< PR_CLEAR_STATION_AIRPORT
- { 50, PCAT_CONSTRUCTION}, ///< PR_CLEAR_STATION_BUS
- { 50, PCAT_CONSTRUCTION}, ///< PR_CLEAR_STATION_TRUCK
- { 55, PCAT_CONSTRUCTION}, ///< PR_CLEAR_STATION_DOCK
- { 1600, PCAT_CONSTRUCTION}, ///< PR_CLEAR_HOUSE
- { 40, PCAT_CONSTRUCTION}, ///< PR_CLEAR_ROAD
- { 5600, PCAT_RUNNING }, ///< PR_RUNNING_TRAIN_STEAM
- { 5200, PCAT_RUNNING }, ///< PR_RUNNING_TRAIN_DIESEL
- { 4800, PCAT_RUNNING }, ///< PR_RUNNING_TRAIN_ELECTRIC
- { 9600, PCAT_RUNNING }, ///< PR_RUNNING_AIRCRAFT
- { 1600, PCAT_RUNNING }, ///< PR_RUNNING_ROADVEH
- { 5600, PCAT_RUNNING }, ///< PR_RUNNING_SHIP
- {1000000, PCAT_CONSTRUCTION}, ///< PR_BUILD_INDUSTRY
+extern const PriceBaseSpec _price_base_specs[] = {
+ { 100, PCAT_NONE, GSF_END }, ///< PR_STATION_VALUE
+ { 100, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_RAIL
+ { 95, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_ROAD
+ { 65, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_SIGNALS
+ { 275, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_BRIDGE
+ { 600, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_DEPOT_TRAIN
+ { 500, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_DEPOT_ROAD
+ { 700, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_DEPOT_SHIP
+ { 450, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_TUNNEL
+ { 200, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_STATION_RAIL
+ { 180, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_STATION_RAIL_LENGTH
+ { 600, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_STATION_AIRPORT
+ { 200, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_STATION_BUS
+ { 200, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_STATION_TRUCK
+ { 350, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_STATION_DOCK
+ { 400000, PCAT_CONSTRUCTION, GSF_TRAIN }, ///< PR_BUILD_VEHICLE_TRAIN
+ { 2000, PCAT_CONSTRUCTION, GSF_TRAIN }, ///< PR_BUILD_VEHICLE_WAGON
+ { 700000, PCAT_CONSTRUCTION, GSF_AIRCRAFT }, ///< PR_BUILD_VEHICLE_AIRCRAFT
+ { 14000, PCAT_CONSTRUCTION, GSF_ROAD }, ///< PR_BUILD_VEHICLE_ROAD
+ { 65000, PCAT_CONSTRUCTION, GSF_SHIP }, ///< PR_BUILD_VEHICLE_SHIP
+ { 20, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_TREES
+ { 250, PCAT_CONSTRUCTION, GSF_END }, ///< PR_TERRAFORM
+ { 20, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_GRASS
+ { 40, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_ROUGH
+ { 200, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_ROCKS
+ { 500, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_FILEDS
+ { 20, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_TREES
+ { -70, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_RAIL
+ { 10, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_SIGNALS
+ { 50, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_BRIDGE
+ { 80, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_DEPOT_TRAIN
+ { 80, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_DEPOT_ROAD
+ { 90, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_DEPOT_SHIP
+ { 30, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_TUNNEL
+ { 10000, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_WATER
+ { 50, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_STATION_RAIL
+ { 30, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_STATION_AIRPORT
+ { 50, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_STATION_BUS
+ { 50, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_STATION_TRUCK
+ { 55, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_STATION_DOCK
+ { 1600, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_HOUSE
+ { 40, PCAT_CONSTRUCTION, GSF_END }, ///< PR_CLEAR_ROAD
+ { 5600, PCAT_RUNNING, GSF_TRAIN }, ///< PR_RUNNING_TRAIN_STEAM
+ { 5200, PCAT_RUNNING, GSF_TRAIN }, ///< PR_RUNNING_TRAIN_DIESEL
+ { 4800, PCAT_RUNNING, GSF_TRAIN }, ///< PR_RUNNING_TRAIN_ELECTRIC
+ { 9600, PCAT_RUNNING, GSF_AIRCRAFT }, ///< PR_RUNNING_AIRCRAFT
+ { 1600, PCAT_RUNNING, GSF_ROAD }, ///< PR_RUNNING_ROADVEH
+ { 5600, PCAT_RUNNING, GSF_SHIP }, ///< PR_RUNNING_SHIP
+ {1000000, PCAT_CONSTRUCTION, GSF_END }, ///< PR_BUILD_INDUSTRY
};
+assert_compile(lengthof(_price_base_specs) == PR_END);
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 3022045d4..b1615f17d 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -4452,7 +4452,7 @@ Money Train::GetRunningCost() const
/* Halve running cost for multiheaded parts */
if (v->IsMultiheaded()) cost_factor /= 2;
- cost += GetPrice(e->u.rail.running_cost_class, cost_factor);
+ cost += GetPrice(e->u.rail.running_cost_class, cost_factor, e->grffile);
} while ((v = v->GetNextVehicle()) != NULL);
return cost;
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index 9460d2f56..27d1e859e 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -290,7 +290,7 @@ static CommandCost GetRefitCost(EngineID engine_type)
default: NOT_REACHED();
}
- return CommandCost(expense_type, GetPrice(base_price, cost_factor, -10));
+ return CommandCost(expense_type, GetPrice(base_price, cost_factor, e->grffile, -10));
}
/**