summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-11-24 22:15:42 +0000
committerfrosch <frosch@openttd.org>2009-11-24 22:15:42 +0000
commit830231e2bda3a2a68d3e8cc466059d8b5fcadb63 (patch)
tree24750800d52789ced0c719b59afa832fbc5a91cc
parent8da21d58a9e50d1e08a94bb7cba83fec040f741b (diff)
downloadopenttd-830231e2bda3a2a68d3e8cc466059d8b5fcadb63.tar.xz
(svn r18283) -Feature: [NewGRF] Add new price bases for removing industries, building/removing unmovables (new objects), building/removing rail-waypoints/buoys, interacting with town-authority, building foundations, funding primary industries (when not prospecting) and towns.
If a GRF does not set price multipliers for these new prices, but for the previously used ones, the old modifiers will be propagated to the new bases.
-rw-r--r--src/economy_type.h12
-rw-r--r--src/industry_cmd.cpp12
-rw-r--r--src/newgrf.cpp15
-rw-r--r--src/rail_cmd.cpp8
-rw-r--r--src/road_cmd.cpp14
-rw-r--r--src/station_cmd.cpp10
-rw-r--r--src/table/pricebase.h109
-rw-r--r--src/town_cmd.cpp9
-rw-r--r--src/town_gui.cpp4
-rw-r--r--src/tunnelbridge_cmd.cpp6
-rw-r--r--src/unmovable.h4
-rw-r--r--src/unmovable_cmd.cpp2
-rw-r--r--src/waypoint_cmd.cpp6
13 files changed, 123 insertions, 88 deletions
diff --git a/src/economy_type.h b/src/economy_type.h
index ed4d457a2..24c8ca575 100644
--- a/src/economy_type.h
+++ b/src/economy_type.h
@@ -114,6 +114,17 @@ enum Price {
PR_RUNNING_ROADVEH,
PR_RUNNING_SHIP,
PR_BUILD_INDUSTRY,
+ PR_CLEAR_INDUSTRY,
+ PR_BUILD_UNMOVABLE,
+ PR_CLEAR_UNMOVABLE,
+ PR_BUILD_WAYPOINT_RAIL,
+ PR_CLEAR_WAYPOINT_RAIL,
+ PR_BUILD_WAYPOINT_BUOY,
+ PR_CLEAR_WAYPOINT_BUOY,
+ PR_TOWN_ACTION,
+ PR_BUILD_FOUNDATION,
+ PR_BUILD_INDUSTRY_RAW,
+ PR_BUILD_TOWN,
PR_END,
INVALID_PRICE = 0xFF
@@ -157,6 +168,7 @@ 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.
+ Price fallback_price; ///< Fallback price multiplier for new prices but old grfs.
};
/** The "steps" in loan size, in British Pounds! */
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index e76d324ef..f148a789e 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -2425,14 +2425,14 @@ bool IndustrySpec::IsRawIndustry() const
Money IndustrySpec::GetConstructionCost() const
{
- /* Building raw industries like secondary is more expensive */
- return (_price[PR_BUILD_INDUSTRY] * this->cost_multiplier) >>
- ((_settings_game.construction.raw_industry_construction == 1 && this->IsRawIndustry()) ? 5 : 8);
+ /* Building raw industries like secondary uses different price base */
+ return (_price[(_settings_game.construction.raw_industry_construction == 1 && this->IsRawIndustry()) ?
+ PR_BUILD_INDUSTRY_RAW : PR_BUILD_INDUSTRY] * this->cost_multiplier) >> 8;
}
Money IndustrySpec::GetRemovalCost() const
{
- return (_price[PR_CLEAR_HOUSE] * this->removal_cost_multiplier) >> 8;
+ return (_price[PR_CLEAR_INDUSTRY] * this->removal_cost_multiplier) >> 8;
}
static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
@@ -2454,10 +2454,10 @@ static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, u
if (HasBit(itspec->callback_mask, CBM_INDT_AUTOSLOPE)) {
/* If the callback fails, allow autoslope. */
uint16 res = GetIndustryTileCallback(CBID_INDUSTRY_AUTOSLOPE, 0, 0, gfx, Industry::GetByTile(tile), tile);
- if ((res == 0) || (res == CALLBACK_FAILED)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ if ((res == 0) || (res == CALLBACK_FAILED)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
} else {
/* allow autoslope */
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
}
}
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index f481235f4..54c26de72 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -6217,11 +6217,24 @@ static void FinalisePriceBaseMultipliers()
}
}
- /* Decide local/global scope of price base multipliers */
+ /* Apply fallback prices */
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++) {
+ Price fallback_price = _price_base_specs[p].fallback_price;
+ if (fallback_price != INVALID_PRICE && (byte)price_base_multipliers[p] == 0x80) {
+ /* No price multiplier has been set.
+ * So copy the multiplier from the fallback price, maybe a multiplier was set there. */
+ price_base_multipliers[p] = price_base_multipliers[fallback_price];
+ }
+ }
+ }
+
+ /* Decide local/global scope of price base multipliers */
+ 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;
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 855ee1afa..2e8f89c3c 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -297,7 +297,7 @@ static CommandCost CheckRailSlope(Slope tileh, TrackBits rail_bits, TrackBits ex
}
Foundation f_old = GetRailFoundation(tileh, existing);
- return CommandCost(EXPENSES_CONSTRUCTION, f_new != f_old ? _price[PR_TERRAFORM] : (Money)0);
+ return CommandCost(EXPENSES_CONSTRUCTION, f_new != f_old ? _price[PR_BUILD_FOUNDATION] : (Money)0);
}
/* Validate functions for rail building */
@@ -2490,7 +2490,7 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_ol
case TRACK_BIT_UPPER: track_corner = CORNER_N; break;
/* Surface slope must not be changed */
- default: return (((z_old != z_new) || (tileh_old != tileh_new)) ? CMD_ERROR : CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]));
+ default: return (((z_old != z_new) || (tileh_old != tileh_new)) ? CMD_ERROR : CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]));
}
/* The height of the track_corner must not be changed. The rest ensures GetRailFoundation() already. */
@@ -2498,7 +2498,7 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_ol
z_new += GetSlopeZInCorner(RemoveHalftileSlope(tileh_new), track_corner);
if (z_old != z_new) return CMD_ERROR;
- CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
/* Make the ground dirty, if surface slope has changed */
if (tileh_old != tileh_new) {
/* If there is flat water on the lower halftile add the cost for clearing it */
@@ -2550,7 +2550,7 @@ static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, uint
return CommandCost(EXPENSES_CONSTRUCTION, was_water ? _price[PR_CLEAR_WATER] : (Money)0);
} else if (_settings_game.construction.build_on_slopes && AutoslopeEnabled() &&
AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, GetRailDepotDirection(tile))) {
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
}
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 9b5915589..a824fd21d 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -313,7 +313,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
/* If we change the foundation we have to pay for it. */
return CommandCost(EXPENSES_CONSTRUCTION, CountBits(pieces) * _price[PR_CLEAR_ROAD] +
- ((GetRoadFoundation(tileh, present) != f) ? _price[PR_TERRAFORM] : (Money)0));
+ ((GetRoadFoundation(tileh, present) != f) ? _price[PR_BUILD_FOUNDATION] : (Money)0));
}
case ROAD_TILE_CROSSING: {
@@ -401,7 +401,7 @@ static CommandCost CheckRoadSlope(Slope tileh, RoadBits *pieces, RoadBits existi
existing |= other;
if ((existing == ROAD_NONE || existing == *pieces) && IsStraightRoad(*pieces)) {
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
return CMD_ERROR;
}
@@ -433,12 +433,12 @@ static CommandCost CheckRoadSlope(Slope tileh, RoadBits *pieces, RoadBits existi
if (_settings_game.construction.build_on_slopes) {
/* If we add foundation we've got to pay for it */
- if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
return CommandCost();
}
} else {
- if (CountBits(existing) == 1) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ if (CountBits(existing) == 1) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
return CommandCost();
}
}
@@ -1608,11 +1608,11 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint
if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
switch (GetRoadTileType(tile)) {
case ROAD_TILE_CROSSING:
- if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
break;
case ROAD_TILE_DEPOT:
- if (AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, GetRoadDepotDirection(tile))) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ if (AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, GetRoadDepotDirection(tile))) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
break;
case ROAD_TILE_NORMAL: {
@@ -1630,7 +1630,7 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint
z_new += ApplyFoundationToSlope(GetRoadFoundation(tileh_new, bits), &tileh_new);
/* The surface slope must not be changed */
- if ((z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ if ((z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
}
break;
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index d17d0dc49..1d22af006 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -699,7 +699,7 @@ CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, DoCommandFlag fla
(HasBit(invalid_dirs, DIAGDIR_NW) && !(tileh & SLOPE_NW))) {
return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
}
- cost.AddCost(_price[PR_TERRAFORM]);
+ cost.AddCost(_price[PR_BUILD_FOUNDATION]);
flat_z += TILE_HEIGHT;
}
@@ -1375,7 +1375,7 @@ CommandCost CmdRemoveFromRailWaypoint(TileIndex start, DoCommandFlag flags, uint
TileArea ta(start, end);
SmallVector<Waypoint *, 4> affected_stations;
- return RemoveFromRailBaseStation(ta, affected_stations, flags, _price[PR_CLEAR_DEPOT_TRAIN], HasBit(p2, 0));
+ return RemoveFromRailBaseStation(ta, affected_stations, flags, _price[PR_CLEAR_WAYPOINT_RAIL], HasBit(p2, 0));
}
@@ -3257,11 +3257,11 @@ static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, ui
DiagDirection direction = AxisToDiagDir(GetRailStationAxis(tile));
if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, direction)) break;
if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, ReverseDiagDir(direction))) break;
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
case STATION_AIRPORT:
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
case STATION_TRUCK:
case STATION_BUS: {
@@ -3270,7 +3270,7 @@ static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, ui
if (IsDriveThroughStopTile(tile)) {
if (!AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, ReverseDiagDir(direction))) break;
}
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
default: break;
diff --git a/src/table/pricebase.h b/src/table/pricebase.h
index 7b20c7326..ab71dec96 100644
--- a/src/table/pricebase.h
+++ b/src/table/pricebase.h
@@ -10,54 +10,65 @@
/** @file pricebase.h Price Bases */
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
+ { 100, PCAT_NONE, GSF_END, INVALID_PRICE }, ///< PR_STATION_VALUE
+ { 100, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_RAIL
+ { 95, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_ROAD
+ { 65, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_SIGNALS
+ { 275, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_BRIDGE
+ { 600, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_DEPOT_TRAIN
+ { 500, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_DEPOT_ROAD
+ { 700, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_DEPOT_SHIP
+ { 450, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_TUNNEL
+ { 200, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_STATION_RAIL
+ { 180, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_STATION_RAIL_LENGTH
+ { 600, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_STATION_AIRPORT
+ { 200, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_STATION_BUS
+ { 200, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_STATION_TRUCK
+ { 350, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_STATION_DOCK
+ { 400000, PCAT_CONSTRUCTION, GSF_TRAIN, INVALID_PRICE }, ///< PR_BUILD_VEHICLE_TRAIN
+ { 2000, PCAT_CONSTRUCTION, GSF_TRAIN, INVALID_PRICE }, ///< PR_BUILD_VEHICLE_WAGON
+ { 700000, PCAT_CONSTRUCTION, GSF_AIRCRAFT, INVALID_PRICE }, ///< PR_BUILD_VEHICLE_AIRCRAFT
+ { 14000, PCAT_CONSTRUCTION, GSF_ROAD, INVALID_PRICE }, ///< PR_BUILD_VEHICLE_ROAD
+ { 65000, PCAT_CONSTRUCTION, GSF_SHIP, INVALID_PRICE }, ///< PR_BUILD_VEHICLE_SHIP
+ { 20, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_TREES
+ { 250, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_TERRAFORM
+ { 20, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_GRASS
+ { 40, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_ROUGH
+ { 200, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_ROCKS
+ { 500, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_FILEDS
+ { 20, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_TREES
+ { -70, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_RAIL
+ { 10, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_SIGNALS
+ { 50, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_BRIDGE
+ { 80, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_DEPOT_TRAIN
+ { 80, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_DEPOT_ROAD
+ { 90, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_DEPOT_SHIP
+ { 30, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_TUNNEL
+ { 10000, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_WATER
+ { 50, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_STATION_RAIL
+ { 30, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_STATION_AIRPORT
+ { 50, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_STATION_BUS
+ { 50, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_STATION_TRUCK
+ { 55, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_STATION_DOCK
+ { 1600, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_HOUSE
+ { 40, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_CLEAR_ROAD
+ { 5600, PCAT_RUNNING, GSF_TRAIN, INVALID_PRICE }, ///< PR_RUNNING_TRAIN_STEAM
+ { 5200, PCAT_RUNNING, GSF_TRAIN, INVALID_PRICE }, ///< PR_RUNNING_TRAIN_DIESEL
+ { 4800, PCAT_RUNNING, GSF_TRAIN, INVALID_PRICE }, ///< PR_RUNNING_TRAIN_ELECTRIC
+ { 9600, PCAT_RUNNING, GSF_AIRCRAFT, INVALID_PRICE }, ///< PR_RUNNING_AIRCRAFT
+ { 1600, PCAT_RUNNING, GSF_ROAD, INVALID_PRICE }, ///< PR_RUNNING_ROADVEH
+ { 5600, PCAT_RUNNING, GSF_SHIP, INVALID_PRICE }, ///< PR_RUNNING_SHIP
+ {1000000, PCAT_CONSTRUCTION, GSF_END, INVALID_PRICE }, ///< PR_BUILD_INDUSTRY
+ { 1600, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_HOUSE }, ///< PR_CLEAR_INDUSTRY
+ { 40, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_ROUGH }, ///< PR_BUILD_UNMOVABLE
+ { 40, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_ROUGH }, ///< PR_CLEAR_UNMOVABLE
+ { 600, PCAT_CONSTRUCTION, GSF_END, PR_BUILD_DEPOT_TRAIN }, ///< PR_BUILD_WAYPOINT_RAIL
+ { 80, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_DEPOT_TRAIN }, ///< PR_CLEAR_WAYPOINT_RAIL
+ { 350, PCAT_CONSTRUCTION, GSF_END, PR_BUILD_STATION_DOCK }, ///< PR_BUILD_WAYPOINT_BUOY
+ { 50, PCAT_CONSTRUCTION, GSF_END, PR_CLEAR_STATION_TRUCK}, ///< PR_CLEAR_WAYPOINT_BUOY
+ {1000000, PCAT_CONSTRUCTION, GSF_END, PR_BUILD_INDUSTRY }, ///< PR_TOWN_ACTION
+ { 250, PCAT_CONSTRUCTION, GSF_END, PR_TERRAFORM }, ///< PR_BUILD_FOUNDATION
+ {8000000, PCAT_CONSTRUCTION, GSF_END, PR_BUILD_INDUSTRY }, ///< PR_BUILD_INDUSTRY_RAW
+ {1000000, PCAT_CONSTRUCTION, GSF_END, PR_BUILD_INDUSTRY }, ///< PR_BUILD_TOWN
};
assert_compile(lengthof(_price_base_specs) == PR_END);
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 3257ef54f..957cc2197 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1570,7 +1570,7 @@ CommandCost CmdFoundTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* multidimensional arrays have to have defined length of non-first dimension */
assert_compile(lengthof(price_mult[0]) == 4);
- CommandCost cost(EXPENSES_OTHER, _price[PR_BUILD_INDUSTRY]);
+ CommandCost cost(EXPENSES_OTHER, _price[PR_BUILD_TOWN]);
byte mult = price_mult[city][size];
cost.MultiplyCost(mult);
@@ -2511,7 +2511,6 @@ uint GetMaskOfTownActions(int *nump, CompanyID cid, const Town *t)
/* Things worth more than this are not shown */
Money avail = Company::Get(cid)->money + _price[PR_STATION_VALUE] * 200;
- Money ref = _price[PR_BUILD_INDUSTRY] >> 8;
/* Check the action bits for validity and
* if they are valid add them */
@@ -2530,7 +2529,7 @@ uint GetMaskOfTownActions(int *nump, CompanyID cid, const Town *t)
if (cur == TACT_BUILD_STATUE && HasBit(t->statues, cid))
continue;
- if (avail >= _town_action_costs[i] * ref) {
+ if (avail >= _town_action_costs[i] * _price[PR_TOWN_ACTION] >> 8) {
buttons |= cur;
num++;
}
@@ -2558,7 +2557,7 @@ CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
if (!HasBit(GetMaskOfTownActions(NULL, _current_company, t), p2)) return CMD_ERROR;
- CommandCost cost(EXPENSES_OTHER, (_price[PR_BUILD_INDUSTRY] >> 8) * _town_action_costs[p2]);
+ CommandCost cost(EXPENSES_OTHER, _price[PR_TOWN_ACTION] * _town_action_costs[p2] >> 8);
if (flags & DC_EXEC) {
_town_action_proc[p2](t);
@@ -2894,7 +2893,7 @@ static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlag flags, uint
if ((res != 0) && (res != CALLBACK_FAILED)) allow_terraform = false;
}
- if (allow_terraform) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ if (allow_terraform) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
}
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index b1fea3616..90f62a61c 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -184,7 +184,7 @@ public:
switch (widget) {
case TWA_ACTION_INFO:
if (this->sel_index != -1) {
- SetDParam(1, (_price[PR_BUILD_INDUSTRY] >> 8) * _town_action_costs[this->sel_index]);
+ SetDParam(1, _price[PR_TOWN_ACTION] * _town_action_costs[this->sel_index] >> 8);
SetDParam(0, STR_LOCAL_AUTHORITY_ACTION_SMALL_ADVERTISING_CAMPAIGN + this->sel_index);
DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, r.bottom - WD_FRAMERECT_BOTTOM,
STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_SMALL_ADVERTISING + this->sel_index);
@@ -223,7 +223,7 @@ public:
size->height -= WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
Dimension d = {0, 0};
for (int i = 0; i < TACT_COUNT; i++) {
- SetDParam(1, (_price[PR_BUILD_INDUSTRY] >> 8) * _town_action_costs[i]);
+ SetDParam(1, _price[PR_TOWN_ACTION] * _town_action_costs[i] >> 8);
SetDParam(0, STR_LOCAL_AUTHORITY_ACTION_SMALL_ADVERTISING_CAMPAIGN + i);
d = maxdim(d, GetStringMultiLineBoundingBox(STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_SMALL_ADVERTISING + i, *size));
}
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 637f78260..3715962c1 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -133,7 +133,7 @@ static CommandCost CheckBridgeSlopeNorth(Axis axis, Slope *tileh, uint *z)
if (f == FOUNDATION_NONE) return CommandCost();
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
/**
@@ -154,7 +154,7 @@ static CommandCost CheckBridgeSlopeSouth(Axis axis, Slope *tileh, uint *z)
if (f == FOUNDATION_NONE) return CommandCost();
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags)
@@ -1506,7 +1506,7 @@ static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flag
}
/* Surface slope is valid and remains unchanged? */
- if (!CmdFailed(res) && (z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ if (!CmdFailed(res) && (z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
diff --git a/src/unmovable.h b/src/unmovable.h
index 8e99cff11..8709bdc43 100644
--- a/src/unmovable.h
+++ b/src/unmovable.h
@@ -23,8 +23,8 @@ struct UnmovableSpec {
uint8 buy_cost_multiplier;
uint8 sell_cost_multiplier;
- Money GetRemovalCost() const { return (_price[PR_CLEAR_ROUGH] * this->sell_cost_multiplier); }
- Money GetBuildingCost() const { return (_price[PR_CLEAR_ROUGH] * this->buy_cost_multiplier); }
+ Money GetRemovalCost() const { return (_price[PR_CLEAR_UNMOVABLE] * this->sell_cost_multiplier); }
+ Money GetBuildingCost() const { return (_price[PR_BUILD_UNMOVABLE] * this->buy_cost_multiplier); }
};
diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp
index 931d2d7c9..0434fe75b 100644
--- a/src/unmovable_cmd.cpp
+++ b/src/unmovable_cmd.cpp
@@ -502,7 +502,7 @@ static CommandCost TerraformTile_Unmovable(TileIndex tile, DoCommandFlag flags,
if (IsOwnedLand(tile) && CheckTileOwnership(tile)) return CommandCost();
if (AutoslopeEnabled() && (IsStatue(tile) || IsCompanyHQ(tile))) {
- if (!IsSteepSlope(tileh_new) && (z_new + GetSlopeMaxZ(tileh_new) == GetTileMaxZ(tile))) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_TERRAFORM]);
+ if (!IsSteepSlope(tileh_new) && (z_new + GetSlopeMaxZ(tileh_new) == GetTileMaxZ(tile))) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp
index 9d1366360..07e816df4 100644
--- a/src/waypoint_cmd.cpp
+++ b/src/waypoint_cmd.cpp
@@ -319,7 +319,7 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint
}
}
- return CommandCost(EXPENSES_CONSTRUCTION, count * _price[PR_BUILD_DEPOT_TRAIN]);
+ return CommandCost(EXPENSES_CONSTRUCTION, count * _price[PR_BUILD_WAYPOINT_RAIL]);
}
/** Build a buoy.
@@ -366,7 +366,7 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
InvalidateWindowData(WC_WAYPOINT_VIEW, wp->index);
}
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_STATION_DOCK]);
+ return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_WAYPOINT_BUOY]);
}
/**
@@ -404,7 +404,7 @@ CommandCost RemoveBuoy(TileIndex tile, DoCommandFlag flags)
wp->delete_ctr = 0;
}
- return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_STATION_TRUCK]);
+ return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_WAYPOINT_BUOY]);
}