|
@@ -39,12 +39,13 @@
|
|
|
#include "waypoint_base.h"
|
|
|
#include "economy_base.h"
|
|
|
#include "core/pool_func.hpp"
|
|
|
|
|
|
#include "table/strings.h"
|
|
|
#include "table/sprites.h"
|
|
|
#include "table/pricebase.h"
|
|
|
|
|
|
|
|
|
/* Initialize the cargo payment-pool */
|
|
|
CargoPaymentPool _cargo_payment_pool("CargoPayment");
|
|
|
INSTANTIATE_POOL_METHODS(CargoPayment)
|
|
|
|
|
@@ -680,73 +681,12 @@ static void HandleEconomyFluctuations()
|
|
|
} else if (_economy.fluct == -12) {
|
|
|
_economy.fluct = GB(Random(), 0, 8) + 312;
|
|
|
AddNewsItem(STR_NEWS_END_OF_RECESSION, NS_ECONOMY);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static byte _price_category[NUM_PRICES] = {
|
|
|
0, 2, 2, 2, 2, 2, 2, 2,
|
|
|
2, 2, 2, 2, 2, 2, 2, 2,
|
|
|
2, 2, 2, 2, 2, 2, 2, 2,
|
|
|
2, 2, 2, 2, 2, 2, 2, 2,
|
|
|
2, 2, 2, 2, 2, 2, 2, 2,
|
|
|
2, 2, 1, 1, 1, 1, 1, 1,
|
|
|
2,
|
|
|
};
|
|
|
|
|
|
static const Money _price_base[NUM_PRICES] = {
|
|
|
100, ///< station_value
|
|
|
100, ///< build_rail
|
|
|
95, ///< build_road
|
|
|
65, ///< build_signals
|
|
|
275, ///< build_bridge
|
|
|
600, ///< build_train_depot
|
|
|
500, ///< build_road_depot
|
|
|
700, ///< build_ship_depot
|
|
|
450, ///< build_tunnel
|
|
|
200, ///< train_station_track
|
|
|
180, ///< train_station_length
|
|
|
600, ///< build_airport
|
|
|
200, ///< build_bus_station
|
|
|
200, ///< build_truck_station
|
|
|
350, ///< build_dock
|
|
|
400000, ///< build_railvehicle
|
|
|
2000, ///< build_railwagon
|
|
|
700000, ///< aircraft_base
|
|
|
14000, ///< roadveh_base
|
|
|
65000, ///< ship_base
|
|
|
20, ///< build_trees
|
|
|
250, ///< terraform
|
|
|
20, ///< clear_grass
|
|
|
40, ///< clear_roughland
|
|
|
200, ///< clear_rocks
|
|
|
500, ///< clear_fields
|
|
|
20, ///< remove_trees
|
|
|
-70, ///< remove_rail
|
|
|
10, ///< remove_signals
|
|
|
50, ///< clear_bridge
|
|
|
80, ///< remove_train_depot
|
|
|
80, ///< remove_road_depot
|
|
|
90, ///< remove_ship_depot
|
|
|
30, ///< clear_tunnel
|
|
|
10000, ///< clear_water
|
|
|
50, ///< remove_rail_station
|
|
|
30, ///< remove_airport
|
|
|
50, ///< remove_bus_station
|
|
|
50, ///< remove_truck_station
|
|
|
55, ///< remove_dock
|
|
|
1600, ///< remove_house
|
|
|
40, ///< remove_road
|
|
|
5600, ///< running_rail[0] steam
|
|
|
5200, ///< running_rail[1] diesel
|
|
|
4800, ///< running_rail[2] electric
|
|
|
9600, ///< aircraft_running
|
|
|
1600, ///< roadveh_running
|
|
|
5600, ///< ship_running
|
|
|
1000000, ///< build_industry
|
|
|
};
|
|
|
|
|
|
static byte price_base_multiplier[NUM_PRICES];
|
|
|
|
|
|
/**
|
|
|
* Reset changes to the price base multipliers.
|
|
|
*/
|
|
@@ -796,27 +736,43 @@ void StartupIndustryDailyChanges(bool in
|
|
|
void StartupEconomy()
|
|
|
{
|
|
|
int i;
|
|
|
|
|
|
assert(sizeof(_price) == NUM_PRICES * sizeof(Money));
|
|
|
|
|
|
for (i = 0; i != NUM_PRICES; i++) {
|
|
|
Money price = _price_base[i];
|
|
|
if (_price_category[i] != 0) {
|
|
|
uint mod = _price_category[i] == 1 ? _settings_game.difficulty.vehicle_costs : _settings_game.difficulty.construction_cost;
|
|
|
if (mod < 1) {
|
|
|
price = price * 3 >> 2;
|
|
|
} else if (mod > 1) {
|
|
|
price = price * 9 >> 3;
|
|
|
}
|
|
|
/* Setup price bases */
|
|
|
for (i = 0; i < NUM_PRICES; i++) {
|
|
|
Money price = _price_base_specs[i].start_price;
|
|
|
|
|
|
/* Apply difficulty settings */
|
|
|
uint mod = 1;
|
|
|
switch (_price_base_specs[i].category) {
|
|
|
case PC_RUNNING:
|
|
|
mod = _settings_game.difficulty.vehicle_costs;
|
|
|
break;
|
|
|
|
|
|
case PC_CONSTRUCTION:
|
|
|
mod = _settings_game.difficulty.construction_cost;
|
|
|
break;
|
|
|
|
|
|
default: break;
|
|
|
}
|
|
|
if (mod < 1) {
|
|
|
price = price * 3 >> 2;
|
|
|
} else if (mod > 1) {
|
|
|
price = price * 9 >> 3;
|
|
|
}
|
|
|
|
|
|
/* Apply newgrf modifiers */
|
|
|
if (price_base_multiplier[i] > 8) {
|
|
|
price <<= price_base_multiplier[i] - 8;
|
|
|
} else {
|
|
|
price >>= 8 - price_base_multiplier[i];
|
|
|
}
|
|
|
|
|
|
/* Store start value */
|
|
|
((Money*)&_price)[i] = price;
|
|
|
_price_frac[i] = 0;
|
|
|
}
|
|
|
|
|
|
_economy.interest_rate = _settings_game.difficulty.initial_interest;
|
|
|
_economy.infl_amount = _settings_game.difficulty.initial_interest;
|