summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ai/api/ai_company.cpp6
-rw-r--r--src/ai/api/ai_group.cpp2
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/autoreplace_cmd.cpp2
-rw-r--r--src/autoreplace_gui.cpp4
-rw-r--r--src/company_base.h6
-rw-r--r--src/company_cmd.cpp42
-rw-r--r--src/openttd.cpp8
-rw-r--r--src/saveload/afterload.cpp14
-rw-r--r--src/saveload/company_sl.cpp11
-rw-r--r--src/settings.cpp6
-rw-r--r--src/settings_gui.cpp6
-rw-r--r--src/settings_type.h12
-rw-r--r--src/table/settings.h6
-rw-r--r--src/vehicle.cpp10
15 files changed, 68 insertions, 69 deletions
diff --git a/src/ai/api/ai_company.cpp b/src/ai/api/ai_company.cpp
index 32e13caef..89ad2d728 100644
--- a/src/ai/api/ai_company.cpp
+++ b/src/ai/api/ai_company.cpp
@@ -156,7 +156,7 @@
company = ResolveCompanyID(company);
if (company == COMPANY_INVALID) return false;
- return ::GetCompany((CompanyID)company)->engine_renew;
+ return ::GetCompany((CompanyID)company)->settings.engine_renew;
}
/* static */ bool AICompany::SetAutoRenewMonths(int16 months)
@@ -169,7 +169,7 @@
company = ResolveCompanyID(company);
if (company == COMPANY_INVALID) return 0;
- return ::GetCompany((CompanyID)company)->engine_renew_months;
+ return ::GetCompany((CompanyID)company)->settings.engine_renew_months;
}
/* static */ bool AICompany::SetAutoRenewMoney(uint32 money)
@@ -182,5 +182,5 @@
company = ResolveCompanyID(company);
if (company == COMPANY_INVALID) return 0;
- return ::GetCompany((CompanyID)company)->engine_renew_money;
+ return ::GetCompany((CompanyID)company)->settings.engine_renew_money;
}
diff --git a/src/ai/api/ai_group.cpp b/src/ai/api/ai_group.cpp
index 23846d815..71df52a43 100644
--- a/src/ai/api/ai_group.cpp
+++ b/src/ai/api/ai_group.cpp
@@ -100,7 +100,7 @@
/* static */ bool AIGroup::HasWagonRemoval()
{
- return ::GetCompany(_current_company)->renew_keep_length;
+ return ::GetCompany(_current_company)->settings.renew_keep_length;
}
/* static */ bool AIGroup::SetAutoReplace(GroupID group_id, EngineID engine_id_old, EngineID engine_id_new)
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index c46d1ff69..e195eea11 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1448,7 +1448,7 @@ static inline bool CheckSendAircraftToHangarForReplacement(const Vehicle *v)
return false;
}
- if (c->money < (c->engine_renew_money + (2 * DoCommand(0, new_engine, 0, DC_QUERY_COST, CMD_BUILD_AIRCRAFT).GetCost()))) {
+ if (c->money < (c->settings.engine_renew_money + (2 * DoCommand(0, new_engine, 0, DC_QUERY_COST, CMD_BUILD_AIRCRAFT).GetCost()))) {
/* We lack enough money to request the replacement right away.
* We want 2*(the price of the new vehicle) and not looking at the value of the vehicle we are going to sell.
* The reason is that we don't want to send a whole lot of vehicles to the hangars when we only have enough money to replace a single one.
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index e8e85b643..1453a2a9a 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -624,7 +624,7 @@ CommandCost CmdAutoreplaceVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1
}
const Company *c = GetCompany(_current_company);
- bool wagon_removal = c->renew_keep_length;
+ bool wagon_removal = c->settings.renew_keep_length;
/* Test whether any replacement is set, before issuing a whole lot of commands that would end in nothing changed */
Vehicle *w = v;
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index f447987ec..92f48960d 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -267,7 +267,7 @@ public:
if (this->window_number == VEH_TRAIN) {
/* set on/off for renew_keep_length */
- SetDParam(1, c->renew_keep_length ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
+ SetDParam(1, c->settings.renew_keep_length ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
/* set wagon/engine button */
SetDParam(2, this->wagon_btnstate ? STR_ENGINES : STR_WAGONS);
@@ -347,7 +347,7 @@ public:
}
case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: // toggle renew_keep_length
- DoCommandP(0, 5, GetCompany(_local_company)->renew_keep_length ? 0 : 1, CMD_SET_AUTOREPLACE);
+ DoCommandP(0, 5, GetCompany(_local_company)->settings.renew_keep_length ? 0 : 1, CMD_SET_AUTOREPLACE);
break;
case RVW_WIDGET_START_REPLACE: { // Start replacing
diff --git a/src/company_base.h b/src/company_base.h
index 4c053efa9..02efa3ddb 100644
--- a/src/company_base.h
+++ b/src/company_base.h
@@ -15,6 +15,7 @@
#include "autoreplace_type.h"
#include "economy_type.h"
#include "tile_type.h"
+#include "settings_type.h"
struct CompanyEconomyEntry {
Money income;
@@ -78,10 +79,7 @@ struct Company : PoolItem<Company, CompanyByte, &_Company_pool> {
CompanyEconomyEntry cur_economy;
CompanyEconomyEntry old_economy[24];
EngineRenewList engine_renew_list; ///< Defined later
- bool engine_renew;
- bool renew_keep_length;
- int16 engine_renew_months;
- uint32 engine_renew_money;
+ CompanySettings settings; ///< settings specific for each company
uint16 *num_engines; ///< caches the number of engines of each type the company owns (no need to save this)
inline bool IsValid() const { return this->name_1 != 0; }
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index e5f31029f..77e8ddeb3 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -78,9 +78,7 @@ void SetLocalCompany(CompanyID new_company)
/* Do not update the settings if we are in the intro GUI */
if (IsValidCompanyID(new_company) && _game_mode != GM_MENU) {
const Company *c = GetCompany(new_company);
- _settings_client.gui.autorenew = c->engine_renew;
- _settings_client.gui.autorenew_months = c->engine_renew_months;
- _settings_client.gui.autorenew_money = c->engine_renew_money;
+ _settings_client.company = c->settings;
InvalidateWindow(WC_GAME_OPTIONS, 0);
}
@@ -568,12 +566,12 @@ CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
Company *c = GetCompany(_current_company);
switch (GB(p1, 0, 3)) {
case 0:
- if (c->engine_renew == HasBit(p2, 0)) return CMD_ERROR;
+ if (c->settings.engine_renew == HasBit(p2, 0)) return CMD_ERROR;
if (flags & DC_EXEC) {
- c->engine_renew = HasBit(p2, 0);
+ c->settings.engine_renew = HasBit(p2, 0);
if (IsLocalCompany()) {
- _settings_client.gui.autorenew = c->engine_renew;
+ _settings_client.company.engine_renew = c->settings.engine_renew;
InvalidateWindow(WC_GAME_OPTIONS, 0);
}
}
@@ -581,12 +579,12 @@ CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
case 1:
if (Clamp((int16)p2, -12, 12) != (int16)p2) return CMD_ERROR;
- if (c->engine_renew_months == (int16)p2) return CMD_ERROR;
+ if (c->settings.engine_renew_months == (int16)p2) return CMD_ERROR;
if (flags & DC_EXEC) {
- c->engine_renew_months = (int16)p2;
+ c->settings.engine_renew_months = (int16)p2;
if (IsLocalCompany()) {
- _settings_client.gui.autorenew_months = c->engine_renew_months;
+ _settings_client.company.engine_renew_months = c->settings.engine_renew_months;
InvalidateWindow(WC_GAME_OPTIONS, 0);
}
}
@@ -594,12 +592,12 @@ CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
case 2:
if (ClampU(p2, 0, 2000000) != p2) return CMD_ERROR;
- if (c->engine_renew_money == p2) return CMD_ERROR;
+ if (c->settings.engine_renew_money == p2) return CMD_ERROR;
if (flags & DC_EXEC) {
- c->engine_renew_money = p2;
+ c->settings.engine_renew_money = p2;
if (IsLocalCompany()) {
- _settings_client.gui.autorenew_money = c->engine_renew_money;
+ _settings_client.company.engine_renew_money = c->settings.engine_renew_money;
InvalidateWindow(WC_GAME_OPTIONS, 0);
}
}
@@ -630,24 +628,24 @@ CommandCost CmdSetAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
if (ClampU(p2, 0, 2000000) != p2) return CMD_ERROR;
if (flags & DC_EXEC) {
- c->engine_renew = HasBit(p1, 15);
- c->engine_renew_months = (int16)GB(p1, 16, 16);
- c->engine_renew_money = p2;
+ c->settings.engine_renew = HasBit(p1, 15);
+ c->settings.engine_renew_months = (int16)GB(p1, 16, 16);
+ c->settings.engine_renew_money = p2;
if (IsLocalCompany()) {
- _settings_client.gui.autorenew = c->engine_renew;
- _settings_client.gui.autorenew_months = c->engine_renew_months;
- _settings_client.gui.autorenew_money = c->engine_renew_money;
+ _settings_client.company.engine_renew = c->settings.engine_renew;
+ _settings_client.company.engine_renew_months = c->settings.engine_renew_months;
+ _settings_client.company.engine_renew_money = c->settings.engine_renew_money;
InvalidateWindow(WC_GAME_OPTIONS, 0);
}
}
break;
case 5:
- if (c->renew_keep_length == HasBit(p2, 0)) return CMD_ERROR;
+ if (c->settings.renew_keep_length == HasBit(p2, 0)) return CMD_ERROR;
if (flags & DC_EXEC) {
- c->renew_keep_length = HasBit(p2, 0);
+ c->settings.renew_keep_length = HasBit(p2, 0);
if (IsLocalCompany()) {
InvalidateWindow(WC_REPLACE_VEHICLE, VEH_TRAIN);
}
@@ -750,8 +748,8 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
/* This is the client (or non-dedicated server) who wants a new company */
if (cid == _network_own_client_id) {
/* Create p1 and p2 here because SetLocalCompany resets the gui.autorenew* settings. */
- uint32 p1 = (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4;
- uint32 p2 = _settings_client.gui.autorenew_money;
+ uint32 p1 = (_settings_client.company.engine_renew << 15 ) | (_settings_client.company.engine_renew_months << 16) | 4;
+ uint32 p2 = _settings_client.company.engine_renew_money;
assert(_local_company == COMPANY_SPECTATOR);
SetLocalCompany(c->index);
if (!StrEmpty(_settings_client.network.default_company_pass)) {
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 1aed1c566..ad3babbe4 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -755,15 +755,12 @@ static void MakeNewGameDone()
DoStartupNewCompany(false);
Company *c = GetCompany(COMPANY_FIRST);
- c->engine_renew = _settings_client.gui.autorenew;
- c->engine_renew_months = _settings_client.gui.autorenew_months;
- c->engine_renew_money = _settings_client.gui.autorenew_money;
+ c->settings = _settings_client.company;
IConsoleCmdExec("exec scripts/game_start.scr 0");
SetLocalCompany(COMPANY_FIRST);
_current_company = _local_company;
- DoCommandP(0, (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4, _settings_client.gui.autorenew_money, CMD_SET_AUTOREPLACE);
InitializeRailGUI();
@@ -854,7 +851,8 @@ static void StartScenario()
SetLocalCompany(COMPANY_FIRST);
_current_company = _local_company;
- DoCommandP(0, (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4, _settings_client.gui.autorenew_money, CMD_SET_AUTOREPLACE);
+ Company *c = GetCompany(COMPANY_FIRST);
+ c->settings = _settings_client.company;
MarkWholeScreenDirty();
}
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 87a5c9910..cc982485e 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -661,10 +661,10 @@ bool AfterLoadGame()
* of course, we do need to initialize them for older savegames. */
if (CheckSavegameVersion(16)) {
FOR_ALL_COMPANIES(c) {
- c->engine_renew_list = NULL;
- c->engine_renew = false;
- c->engine_renew_months = -6;
- c->engine_renew_money = 100000;
+ c->engine_renew_list = NULL;
+ c->settings.engine_renew = false;
+ c->settings.engine_renew_months = 6;
+ c->settings.engine_renew_money = 100000;
}
/* When loading a game, _local_company is not yet set to the correct value.
@@ -675,9 +675,7 @@ bool AfterLoadGame()
*/
if (!_network_dedicated && IsValidCompanyID(COMPANY_FIRST)) {
c = GetCompany(COMPANY_FIRST);
- c->engine_renew = _settings_client.gui.autorenew;
- c->engine_renew_months = _settings_client.gui.autorenew_months;
- c->engine_renew_money = _settings_client.gui.autorenew_money;
+ c->settings = _settings_client.company;
}
}
@@ -950,7 +948,7 @@ bool AfterLoadGame()
* replaced, shall keep their old length. In all prior versions, just default
* to false */
if (CheckSavegameVersionOldStyle(16, 1)) {
- FOR_ALL_COMPANIES(c) c->renew_keep_length = false;
+ FOR_ALL_COMPANIES(c) c->settings.renew_keep_length = false;
}
/* In version 17, ground type is moved from m2 to m4 for depots and
diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp
index 39d252427..0e242422f 100644
--- a/src/saveload/company_sl.cpp
+++ b/src/saveload/company_sl.cpp
@@ -6,6 +6,7 @@
#include "../company_base.h"
#include "../company_func.h"
#include "../company_manager_face.h"
+#include "../settings_type.h"
#include "saveload.h"
@@ -133,11 +134,11 @@ static const SaveLoad _company_desc[] = {
/* Engine renewal settings */
SLE_CONDNULL(512, 16, 18),
- SLE_CONDREF(Company, engine_renew_list, REF_ENGINE_RENEWS, 19, SL_MAX_VERSION),
- SLE_CONDVAR(Company, engine_renew, SLE_BOOL, 16, SL_MAX_VERSION),
- SLE_CONDVAR(Company, engine_renew_months, SLE_INT16, 16, SL_MAX_VERSION),
- SLE_CONDVAR(Company, engine_renew_money, SLE_UINT32, 16, SL_MAX_VERSION),
- SLE_CONDVAR(Company, renew_keep_length, SLE_BOOL, 2, SL_MAX_VERSION), // added with 16.1, but was blank since 2
+ SLE_CONDREF(Company, engine_renew_list, REF_ENGINE_RENEWS, 19, SL_MAX_VERSION),
+ SLE_CONDVAR(Company, settings.engine_renew, SLE_BOOL, 16, SL_MAX_VERSION),
+ SLE_CONDVAR(Company, settings.engine_renew_months, SLE_INT16, 16, SL_MAX_VERSION),
+ SLE_CONDVAR(Company, settings.engine_renew_money, SLE_UINT32, 16, SL_MAX_VERSION),
+ SLE_CONDVAR(Company, settings.renew_keep_length, SLE_BOOL, 2, SL_MAX_VERSION),
/* Reserve extra space in savegame here. (currently 63 bytes) */
SLE_CONDNULL(63, 2, SL_MAX_VERSION),
diff --git a/src/settings.cpp b/src/settings.cpp
index cae88d189..83db910ce 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -726,19 +726,19 @@ static bool CheckInterval(int32 p1)
static bool EngineRenewUpdate(int32 p1)
{
- DoCommandP(0, 0, _settings_client.gui.autorenew, CMD_SET_AUTOREPLACE);
+ DoCommandP(0, 0, _settings_client.company.engine_renew, CMD_SET_AUTOREPLACE);
return true;
}
static bool EngineRenewMonthsUpdate(int32 p1)
{
- DoCommandP(0, 1, _settings_client.gui.autorenew_months, CMD_SET_AUTOREPLACE);
+ DoCommandP(0, 1, _settings_client.company.engine_renew_months, CMD_SET_AUTOREPLACE);
return true;
}
static bool EngineRenewMoneyUpdate(int32 p1)
{
- DoCommandP(0, 2, _settings_client.gui.autorenew_money, CMD_SET_AUTOREPLACE);
+ DoCommandP(0, 2, _settings_client.company.engine_renew_money, CMD_SET_AUTOREPLACE);
return true;
}
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 70dfb70bb..0c8a50236 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1254,9 +1254,9 @@ static SettingEntry _settings_vehicles_routing[] = {
static SettingsPage _settings_vehicles_routing_page = {_settings_vehicles_routing, lengthof(_settings_vehicles_routing)};
static SettingEntry _settings_vehicles_autorenew[] = {
- SettingEntry("gui.autorenew"),
- SettingEntry("gui.autorenew_months"),
- SettingEntry("gui.autorenew_money"),
+ SettingEntry("company.engine_renew"),
+ SettingEntry("company.engine_renew_months"),
+ SettingEntry("company.engine_renew_money"),
};
/** Autorenew sub-page */
static SettingsPage _settings_vehicles_autorenew_page = {_settings_vehicles_autorenew, lengthof(_settings_vehicles_autorenew)};
diff --git a/src/settings_type.h b/src/settings_type.h
index e02ca606f..d4f4137bb 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -78,9 +78,6 @@ struct GUISettings {
bool auto_euro; ///< automatically switch to euro in 2002
byte drag_signals_density; ///< many signals density
Year semaphore_build_before; ///< build semaphore signals automatically before this year
- bool autorenew; ///< should autorenew be enabled for new companies?
- int16 autorenew_months; ///< how many months from EOL of vehicles should autorenew trigger for new companies?
- int32 autorenew_money; ///< how much money before autorenewing for new companies?
byte news_message_timeout; ///< how much longer than the news message "age" should we keep the message in the history
bool show_track_reservation; ///< highlight reserved tracks.
uint8 default_signal_type; ///< the signal type to build by default.
@@ -341,6 +338,14 @@ struct StationSettings {
byte station_spread; ///< amount a station may spread
};
+/** Settings that can be set per company. */
+struct CompanySettings {
+ bool engine_renew; ///< is autorenew enabled
+ int16 engine_renew_months; ///< months before/after the maximum vehicle age a vehicle should be renewed
+ uint32 engine_renew_money; ///< minimum amount of money before autorenew is used
+ bool renew_keep_length; ///< sell some wagons if after autoreplace the train is longer than before
+};
+
/** All settings together for the game. */
struct GameSettings {
DifficultySettings difficulty; ///< settings related to the difficulty
@@ -360,6 +365,7 @@ struct GameSettings {
struct ClientSettings {
GUISettings gui; ///< settings related to the GUI
NetworkSettings network; ///< settings related to the network
+ CompanySettings company; ///< default values for per-company settings
};
/** The current settings for this game. */
diff --git a/src/table/settings.h b/src/table/settings.h
index b5320245e..5fe05dba3 100644
--- a/src/table/settings.h
+++ b/src/table/settings.h
@@ -547,9 +547,9 @@ const SettingDesc _settings[] = {
SDTC_BOOL(gui.vehicle_income_warn, S, 0, true, STR_CONFIG_SETTING_WARN_INCOME_LESS, NULL),
SDTC_VAR(gui.order_review_system, SLE_UINT8, S, MS, 2, 0, 2, 0, STR_CONFIG_SETTING_ORDER_REVIEW, NULL),
SDTC_BOOL(gui.lost_train_warn, S, 0, true, STR_CONFIG_SETTING_WARN_LOST_TRAIN, NULL),
- SDTC_BOOL(gui.autorenew, S, 0, false, STR_CONFIG_SETTING_AUTORENEW_VEHICLE, EngineRenewUpdate),
- SDTC_VAR(gui.autorenew_months, SLE_INT16, S, 0, 6, -12, 12, 0, STR_CONFIG_SETTING_AUTORENEW_MONTHS, EngineRenewMonthsUpdate),
- SDTC_VAR(gui.autorenew_money, SLE_UINT, S, CR,100000, 0, 2000000, 0, STR_CONFIG_SETTING_AUTORENEW_MONEY, EngineRenewMoneyUpdate),
+ SDTC_BOOL(company.engine_renew, S, 0, false, STR_CONFIG_SETTING_AUTORENEW_VEHICLE, EngineRenewUpdate),
+ SDTC_VAR(company.engine_renew_months, SLE_INT16, S, 0, 6, -12, 12, 0, STR_CONFIG_SETTING_AUTORENEW_MONTHS, EngineRenewMonthsUpdate),
+ SDTC_VAR(company.engine_renew_money, SLE_UINT, S, CR,100000, 0, 2000000, 0, STR_CONFIG_SETTING_AUTORENEW_MONEY, EngineRenewMoneyUpdate),
SDTC_BOOL(gui.always_build_infrastructure, S, 0, false, STR_CONFIG_SETTING_ALWAYS_BUILD_INFRASTRUCTURE, RedrawScreen),
SDTC_BOOL(gui.new_nonstop, S, 0, false, STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT, NULL),
SDTC_VAR(gui.stop_location, SLE_UINT8, S, MS, 2, 0, 2, 1, STR_CONFIG_SETTING_STOP_LOCATION, NULL),
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 0abfa1376..454a7bb84 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -64,8 +64,8 @@ bool Vehicle::NeedsAutorenewing(const Company *c) const
* argument rather than finding it again. */
assert(c == GetCompany(this->owner));
- if (!c->engine_renew) return false;
- if (this->age - this->max_age < (c->engine_renew_months * 30)) return false;
+ if (!c->settings.engine_renew) return false;
+ if (this->age - this->max_age < (c->settings.engine_renew_months * 30)) return false;
if (this->age == 0) return false; // rail cars don't age and lacks a max age
return true;
@@ -642,9 +642,9 @@ void CallVehicleTicks()
int z = v->z_pos;
const Company *c = GetCompany(_current_company);
- SubtractMoneyFromCompany(CommandCost(EXPENSES_NEW_VEHICLES, (Money)c->engine_renew_money));
+ SubtractMoneyFromCompany(CommandCost(EXPENSES_NEW_VEHICLES, (Money)c->settings.engine_renew_money));
CommandCost res = DoCommand(0, v->index, 0, DC_EXEC, CMD_AUTOREPLACE_VEHICLE);
- SubtractMoneyFromCompany(CommandCost(EXPENSES_NEW_VEHICLES, -(Money)c->engine_renew_money));
+ SubtractMoneyFromCompany(CommandCost(EXPENSES_NEW_VEHICLES, -(Money)c->settings.engine_renew_money));
if (!IsLocalCompany()) continue;
@@ -906,7 +906,7 @@ void AgeVehicle(Vehicle *v)
if (v->Previous() != NULL || v->owner != _local_company || (v->vehstatus & VS_CRASHED) != 0) return;
/* Don't warn if a renew is active */
- if (GetCompany(v->owner)->engine_renew && GetEngine(v->engine_type)->company_avail != 0) return;
+ if (GetCompany(v->owner)->settings.engine_renew && GetEngine(v->engine_type)->company_avail != 0) return;
StringID str;
if (age == -DAYS_IN_LEAP_YEAR) {