diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 0b273e6519..6668b9caf2 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -463,6 +463,14 @@ Money Aircraft::GetRunningCost() const { const Engine *e = this->GetEngine(); uint cost_factor = GetVehicleProperty(this, PROP_AIRCRAFT_RUNNING_COST_FACTOR, e->u.air.running_cost); + + /* running costs if in depot -- I haven't gotten this one working yet, can't figure out how to tell if plane is in the depot */ + if (this->current_order.IsType(OT_GOTO_DEPOT)) cost_factor /= _settings_game.difficulty.vehicle_costs_in_depot; + + /* running costs if stopped */ + if ((this->cur_speed == 0) && !(this->current_order.IsType(OT_GOTO_DEPOT))) cost_factor /= _settings_game.difficulty.vehicle_costs_when_stopped; + + return GetPrice(PR_RUNNING_AIRCRAFT, cost_factor, e->GetGRF()); } diff --git a/src/lang/english.txt b/src/lang/english.txt index 6fc7c7ae0c..9643d69fa8 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1265,6 +1265,14 @@ STR_CONFIG_SETTING_INTEREST_RATE_HELPTEXT :Loan interest r STR_CONFIG_SETTING_RUNNING_COSTS :Running costs: {STRING2} STR_CONFIG_SETTING_RUNNING_COSTS_HELPTEXT :Set level of maintenance and running costs of vehicles and infrastructure +STR_CONFIG_SETTING_RUNNING_COSTS_IN_DEPOT :Running costs of Vehicles in Depot: {STRING2} +STR_CONFIG_SETTING_RUNNING_COSTS_IN_DEPOT_HELPTEXT :Set level of maintenance and running costs of vehicles while waiting in depots (not stopped) +STR_CONFIG_SETTING_RUNNING_COSTS_IN_DEPOT_VALUE :1 / {COMMA} + +STR_CONFIG_SETTING_RUNNING_COSTS_WHEN_STOPPED :Running costs of Stationary Vehicles: {STRING2} +STR_CONFIG_SETTING_RUNNING_COSTS_WHEN_STOPPED_HELPTEXT :Set level of maintenance and running costs of vehicles while stationary and not in a depot +STR_CONFIG_SETTING_RUNNING_COSTS_WHEN_STOPPED_VALUE :1 / {COMMA} + STR_CONFIG_SETTING_CONSTRUCTION_SPEED :Construction speed: {STRING2} STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT :Limit the amount of construction actions for AIs diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 131d8d76ea..eb2d746f41 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -2131,6 +2131,12 @@ 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; + /* running costs if in depot */ + if (IsRoadDepotTile(this->tile)) cost_factor /= _settings_game.difficulty.vehicle_costs_in_depot; + + /* running costs if stopped */ + if ((this->cur_speed == 0) && !(IsRoadDepotTile(this->tile))) cost_factor /= _settings_game.difficulty.vehicle_costs_when_stopped; + return GetPrice(e->u.road.running_cost_class, cost_factor, e->GetGRF()); } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index f98f7fe16e..2e92d5f3a4 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1930,6 +1930,8 @@ static SettingsContainer &GetSettingsTree() accounting->Add(new SettingEntry("economy.feeder_payment_share")); accounting->Add(new SettingEntry("economy.infrastructure_maintenance")); accounting->Add(new SettingEntry("difficulty.vehicle_costs")); + accounting->Add(new SettingEntry("difficulty.vehicle_costs_in_depot")); + accounting->Add(new SettingEntry("difficulty.vehicle_costs_when_stopped")); accounting->Add(new SettingEntry("difficulty.construction_cost")); } diff --git a/src/settings_type.h b/src/settings_type.h index 28a11053e3..97b76f6631 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -78,6 +78,8 @@ struct DifficultySettings { uint32 max_loan; ///< the maximum initial loan byte initial_interest; ///< amount of interest (to pay over the loan) byte vehicle_costs; ///< amount of money spent on vehicle running cost + uint8 vehicle_costs_in_depot; ///< amount of money spent on vehicle running cost when in depot + uint8 vehicle_costs_when_stopped; ///< amount of money spent on vehicle running cost when vehicle is stopped byte competitor_speed; ///< the speed at which the AI builds byte vehicle_breakdowns; ///< likelihood of vehicles breaking down byte subsidy_multiplier; ///< payment multiplier for subsidized deliveries diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 30d208ac3d..8c1aa7135e 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -229,6 +229,13 @@ Money Ship::GetRunningCost() const { const Engine *e = this->GetEngine(); uint cost_factor = GetVehicleProperty(this, PROP_SHIP_RUNNING_COST_FACTOR, e->u.ship.running_cost); + + /* running costs if in depot */ + if (IsShipDepotTile(this->tile)) cost_factor /= _settings_game.difficulty.vehicle_costs_in_depot; + + /* running costs if stopped */ + if ((this->cur_speed == 0) && !(IsShipDepotTile(this->tile))) cost_factor /= _settings_game.difficulty.vehicle_costs_when_stopped; + return GetPrice(PR_RUNNING_SHIP, cost_factor, e->GetGRF()); } diff --git a/src/table/settings/settings.ini b/src/table/settings/settings.ini index c0bcc26ab8..1625a9b791 100644 --- a/src/table/settings/settings.ini +++ b/src/table/settings/settings.ini @@ -272,6 +272,30 @@ strhelp = STR_CONFIG_SETTING_RUNNING_COSTS_HELPTEXT strval = STR_SEA_LEVEL_LOW cat = SC_BASIC +[SDT_VAR] +var = difficulty.vehicle_costs_in_depot +type = SLE_UINT8 +from = SLV_97 +flags = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO +def = 1 +min = 1 +max = 4 +str = STR_CONFIG_SETTING_RUNNING_COSTS_IN_DEPOT +strhelp = STR_CONFIG_SETTING_RUNNING_COSTS_IN_DEPOT_HELPTEXT +strval = STR_CONFIG_SETTING_RUNNING_COSTS_IN_DEPOT_VALUE + +[SDT_VAR] +var = difficulty.vehicle_costs_when_stopped +type = SLE_UINT8 +from = SLV_97 +flags = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO +def = 1 +min = 1 +max = 4 +str = STR_CONFIG_SETTING_RUNNING_COSTS_WHEN_STOPPED +strhelp = STR_CONFIG_SETTING_RUNNING_COSTS_WHEN_STOPPED_HELPTEXT +strval = STR_CONFIG_SETTING_RUNNING_COSTS_WHEN_STOPPED_VALUE + [SDT_VAR] var = difficulty.competitor_speed type = SLE_UINT8 diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index a7d4055a61..9e8039880a 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -6456,6 +6456,12 @@ Money Train::GetRunningCost() const /* Halve running cost for multiheaded parts */ if (v->IsMultiheaded()) cost_factor /= 2; + /* running costs if in depot */ + if (v->track == TRACK_BIT_DEPOT) cost_factor /= _settings_game.difficulty.vehicle_costs_in_depot; + + /* running costs if stopped */ + if ((v->cur_speed == 0) && !(v->track == TRACK_BIT_DEPOT)) cost_factor /= _settings_game.difficulty.vehicle_costs_when_stopped; + cost += GetPrice(e->u.rail.running_cost_class, cost_factor, e->GetGRF()); } while ((v = v->GetNextVehicle()) != nullptr);