Merge branch 'running-costs-exploration' into jgrpp
This commit is contained in:
@@ -463,7 +463,18 @@ Money Aircraft::GetRunningCost() const
|
|||||||
{
|
{
|
||||||
const Engine *e = this->GetEngine();
|
const Engine *e = this->GetEngine();
|
||||||
uint cost_factor = GetVehicleProperty(this, PROP_AIRCRAFT_RUNNING_COST_FACTOR, e->u.air.running_cost);
|
uint cost_factor = GetVehicleProperty(this, PROP_AIRCRAFT_RUNNING_COST_FACTOR, e->u.air.running_cost);
|
||||||
return GetPrice(PR_RUNNING_AIRCRAFT, cost_factor, e->GetGRF());
|
Money cost = GetPrice(PR_RUNNING_AIRCRAFT, cost_factor, e->GetGRF());
|
||||||
|
|
||||||
|
if (this->cur_speed == 0) {
|
||||||
|
if (this->IsInDepot()) {
|
||||||
|
/* running costs if in depot */
|
||||||
|
cost = CeilDivT<Money>(cost, _settings_game.difficulty.vehicle_costs_in_depot);
|
||||||
|
} else {
|
||||||
|
/* running costs if stopped */
|
||||||
|
cost = CeilDivT<Money>(cost, _settings_game.difficulty.vehicle_costs_when_stopped);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aircraft::OnNewDay()
|
void Aircraft::OnNewDay()
|
||||||
|
@@ -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 :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_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 :Construction speed: {STRING2}
|
||||||
STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT :Limit the amount of construction actions for AIs
|
STR_CONFIG_SETTING_CONSTRUCTION_SPEED_HELPTEXT :Limit the amount of construction actions for AIs
|
||||||
|
|
||||||
|
@@ -2131,7 +2131,18 @@ Money RoadVehicle::GetRunningCost() const
|
|||||||
uint cost_factor = GetVehicleProperty(this, PROP_ROADVEH_RUNNING_COST_FACTOR, e->u.road.running_cost);
|
uint cost_factor = GetVehicleProperty(this, PROP_ROADVEH_RUNNING_COST_FACTOR, e->u.road.running_cost);
|
||||||
if (cost_factor == 0) return 0;
|
if (cost_factor == 0) return 0;
|
||||||
|
|
||||||
return GetPrice(e->u.road.running_cost_class, cost_factor, e->GetGRF());
|
Money cost = GetPrice(e->u.road.running_cost_class, cost_factor, e->GetGRF());
|
||||||
|
|
||||||
|
if (this->cur_speed == 0) {
|
||||||
|
if (this->IsInDepot()) {
|
||||||
|
/* running costs if in depot */
|
||||||
|
cost = CeilDivT<Money>(cost, _settings_game.difficulty.vehicle_costs_in_depot);
|
||||||
|
} else {
|
||||||
|
/* running costs if stopped */
|
||||||
|
cost = CeilDivT<Money>(cost, _settings_game.difficulty.vehicle_costs_when_stopped);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RoadVehicle::Tick()
|
bool RoadVehicle::Tick()
|
||||||
|
@@ -1930,6 +1930,8 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
accounting->Add(new SettingEntry("economy.feeder_payment_share"));
|
accounting->Add(new SettingEntry("economy.feeder_payment_share"));
|
||||||
accounting->Add(new SettingEntry("economy.infrastructure_maintenance"));
|
accounting->Add(new SettingEntry("economy.infrastructure_maintenance"));
|
||||||
accounting->Add(new SettingEntry("difficulty.vehicle_costs"));
|
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"));
|
accounting->Add(new SettingEntry("difficulty.construction_cost"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -78,6 +78,8 @@ struct DifficultySettings {
|
|||||||
uint32 max_loan; ///< the maximum initial loan
|
uint32 max_loan; ///< the maximum initial loan
|
||||||
byte initial_interest; ///< amount of interest (to pay over the loan)
|
byte initial_interest; ///< amount of interest (to pay over the loan)
|
||||||
byte vehicle_costs; ///< amount of money spent on vehicle running cost
|
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 competitor_speed; ///< the speed at which the AI builds
|
||||||
byte vehicle_breakdowns; ///< likelihood of vehicles breaking down
|
byte vehicle_breakdowns; ///< likelihood of vehicles breaking down
|
||||||
byte subsidy_multiplier; ///< payment multiplier for subsidized deliveries
|
byte subsidy_multiplier; ///< payment multiplier for subsidized deliveries
|
||||||
|
@@ -229,7 +229,18 @@ Money Ship::GetRunningCost() const
|
|||||||
{
|
{
|
||||||
const Engine *e = this->GetEngine();
|
const Engine *e = this->GetEngine();
|
||||||
uint cost_factor = GetVehicleProperty(this, PROP_SHIP_RUNNING_COST_FACTOR, e->u.ship.running_cost);
|
uint cost_factor = GetVehicleProperty(this, PROP_SHIP_RUNNING_COST_FACTOR, e->u.ship.running_cost);
|
||||||
return GetPrice(PR_RUNNING_SHIP, cost_factor, e->GetGRF());
|
Money cost = GetPrice(PR_RUNNING_SHIP, cost_factor, e->GetGRF());
|
||||||
|
|
||||||
|
if (this->cur_speed == 0) {
|
||||||
|
if (this->IsInDepot()) {
|
||||||
|
/* running costs if in depot */
|
||||||
|
cost = CeilDivT<Money>(cost, _settings_game.difficulty.vehicle_costs_in_depot);
|
||||||
|
} else {
|
||||||
|
/* running costs if stopped */
|
||||||
|
cost = CeilDivT<Money>(cost, _settings_game.difficulty.vehicle_costs_when_stopped);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::OnNewDay()
|
void Ship::OnNewDay()
|
||||||
|
@@ -272,6 +272,31 @@ strhelp = STR_CONFIG_SETTING_RUNNING_COSTS_HELPTEXT
|
|||||||
strval = STR_SEA_LEVEL_LOW
|
strval = STR_SEA_LEVEL_LOW
|
||||||
cat = SC_BASIC
|
cat = SC_BASIC
|
||||||
|
|
||||||
|
[SDT_VAR]
|
||||||
|
var = difficulty.vehicle_costs_in_depot
|
||||||
|
type = SLE_UINT8
|
||||||
|
from = SLV_97
|
||||||
|
def = 1
|
||||||
|
min = 1
|
||||||
|
max = 8
|
||||||
|
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
|
||||||
|
patxname = ""difficulty.vehicle_costs_in_depot""
|
||||||
|
|
||||||
|
[SDT_VAR]
|
||||||
|
var = difficulty.vehicle_costs_when_stopped
|
||||||
|
type = SLE_UINT8
|
||||||
|
from = SLV_97
|
||||||
|
def = 1
|
||||||
|
min = 1
|
||||||
|
max = 8
|
||||||
|
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
|
||||||
|
strval = STR_CONFIG_SETTING_RUNNING_COSTS_IN_DEPOT_VALUE
|
||||||
|
patxname = ""difficulty.vehicle_costs_when_stopped""
|
||||||
|
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
var = difficulty.competitor_speed
|
var = difficulty.competitor_speed
|
||||||
type = SLE_UINT8
|
type = SLE_UINT8
|
||||||
|
@@ -6481,6 +6481,16 @@ Money Train::GetRunningCost() const
|
|||||||
cost += GetPrice(e->u.rail.running_cost_class, cost_factor, e->GetGRF());
|
cost += GetPrice(e->u.rail.running_cost_class, cost_factor, e->GetGRF());
|
||||||
} while ((v = v->GetNextVehicle()) != nullptr);
|
} while ((v = v->GetNextVehicle()) != nullptr);
|
||||||
|
|
||||||
|
if (this->cur_speed == 0) {
|
||||||
|
if (this->IsInDepot()) {
|
||||||
|
/* running costs if in depot */
|
||||||
|
cost = CeilDivT<Money>(cost, _settings_game.difficulty.vehicle_costs_in_depot);
|
||||||
|
} else {
|
||||||
|
/* running costs if stopped */
|
||||||
|
cost = CeilDivT<Money>(cost, _settings_game.difficulty.vehicle_costs_when_stopped);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user