mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-02 12:24:15 +00:00
(svn r16586) -Codechange: don't store lifelength in the savegame; it can easily be calculated, it isn't used often and now changing extend_vehicle_life in game has some effect.
This commit is contained in:
parent
d09d3566dd
commit
35aabc1d4c
@ -322,7 +322,7 @@ uint Engine::GetDisplayMaxTractiveEffort() const
|
|||||||
Date Engine::GetLifeLengthInDays() const
|
Date Engine::GetLifeLengthInDays() const
|
||||||
{
|
{
|
||||||
/* Assume leap years; this gives the player a bit more than the given amount of years, but never less. */
|
/* Assume leap years; this gives the player a bit more than the given amount of years, but never less. */
|
||||||
return this->lifelength * DAYS_IN_LEAP_YEAR;
|
return (this->info.lifelength + _settings_game.vehicle.extend_vehicle_life) * DAYS_IN_LEAP_YEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -516,8 +516,6 @@ void StartupOneEngine(Engine *e, Date aging_date)
|
|||||||
|
|
||||||
CalcEngineReliability(e);
|
CalcEngineReliability(e);
|
||||||
|
|
||||||
e->lifelength = ei->lifelength + _settings_game.vehicle.extend_vehicle_life;
|
|
||||||
|
|
||||||
/* prevent certain engines from ever appearing. */
|
/* prevent certain engines from ever appearing. */
|
||||||
if (!HasBit(ei->climates, _settings_game.game_creation.landscape)) {
|
if (!HasBit(ei->climates, _settings_game.game_creation.landscape)) {
|
||||||
e->flags |= ENGINE_AVAILABLE;
|
e->flags |= ENGINE_AVAILABLE;
|
||||||
|
@ -21,7 +21,6 @@ struct Engine : EnginePool::PoolItem<&_engine_pool> {
|
|||||||
uint16 reliability_spd_dec;
|
uint16 reliability_spd_dec;
|
||||||
uint16 reliability_start, reliability_max, reliability_final;
|
uint16 reliability_start, reliability_max, reliability_final;
|
||||||
uint16 duration_phase_1, duration_phase_2, duration_phase_3;
|
uint16 duration_phase_1, duration_phase_2, duration_phase_3;
|
||||||
byte lifelength;
|
|
||||||
byte flags;
|
byte flags;
|
||||||
uint8 preview_company_rank;
|
uint8 preview_company_rank;
|
||||||
byte preview_wait;
|
byte preview_wait;
|
||||||
|
@ -8,30 +8,30 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
static const SaveLoad _engine_desc[] = {
|
static const SaveLoad _engine_desc[] = {
|
||||||
SLE_CONDVAR(Engine, intro_date, SLE_FILE_U16 | SLE_VAR_I32, 0, 30),
|
SLE_CONDVAR(Engine, intro_date, SLE_FILE_U16 | SLE_VAR_I32, 0, 30),
|
||||||
SLE_CONDVAR(Engine, intro_date, SLE_INT32, 31, SL_MAX_VERSION),
|
SLE_CONDVAR(Engine, intro_date, SLE_INT32, 31, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Engine, age, SLE_FILE_U16 | SLE_VAR_I32, 0, 30),
|
SLE_CONDVAR(Engine, age, SLE_FILE_U16 | SLE_VAR_I32, 0, 30),
|
||||||
SLE_CONDVAR(Engine, age, SLE_INT32, 31, SL_MAX_VERSION),
|
SLE_CONDVAR(Engine, age, SLE_INT32, 31, SL_MAX_VERSION),
|
||||||
SLE_VAR(Engine, reliability, SLE_UINT16),
|
SLE_VAR(Engine, reliability, SLE_UINT16),
|
||||||
SLE_VAR(Engine, reliability_spd_dec, SLE_UINT16),
|
SLE_VAR(Engine, reliability_spd_dec, SLE_UINT16),
|
||||||
SLE_VAR(Engine, reliability_start, SLE_UINT16),
|
SLE_VAR(Engine, reliability_start, SLE_UINT16),
|
||||||
SLE_VAR(Engine, reliability_max, SLE_UINT16),
|
SLE_VAR(Engine, reliability_max, SLE_UINT16),
|
||||||
SLE_VAR(Engine, reliability_final, SLE_UINT16),
|
SLE_VAR(Engine, reliability_final, SLE_UINT16),
|
||||||
SLE_VAR(Engine, duration_phase_1, SLE_UINT16),
|
SLE_VAR(Engine, duration_phase_1, SLE_UINT16),
|
||||||
SLE_VAR(Engine, duration_phase_2, SLE_UINT16),
|
SLE_VAR(Engine, duration_phase_2, SLE_UINT16),
|
||||||
SLE_VAR(Engine, duration_phase_3, SLE_UINT16),
|
SLE_VAR(Engine, duration_phase_3, SLE_UINT16),
|
||||||
|
|
||||||
SLE_VAR(Engine, lifelength, SLE_UINT8),
|
SLE_CONDNULL(1, 0, 120),
|
||||||
SLE_VAR(Engine, flags, SLE_UINT8),
|
SLE_VAR(Engine, flags, SLE_UINT8),
|
||||||
SLE_VAR(Engine, preview_company_rank,SLE_UINT8),
|
SLE_VAR(Engine, preview_company_rank,SLE_UINT8),
|
||||||
SLE_VAR(Engine, preview_wait, SLE_UINT8),
|
SLE_VAR(Engine, preview_wait, SLE_UINT8),
|
||||||
SLE_CONDNULL(1, 0, 44),
|
SLE_CONDNULL(1, 0, 44),
|
||||||
SLE_CONDVAR(Engine, company_avail, SLE_FILE_U8 | SLE_VAR_U16, 0, 103),
|
SLE_CONDVAR(Engine, company_avail, SLE_FILE_U8 | SLE_VAR_U16, 0, 103),
|
||||||
SLE_CONDVAR(Engine, company_avail, SLE_UINT16, 104, SL_MAX_VERSION),
|
SLE_CONDVAR(Engine, company_avail, SLE_UINT16, 104, SL_MAX_VERSION),
|
||||||
SLE_CONDSTR(Engine, name, SLE_STR, 0, 84, SL_MAX_VERSION),
|
SLE_CONDSTR(Engine, name, SLE_STR, 0, 84, SL_MAX_VERSION),
|
||||||
|
|
||||||
/* reserve extra space in savegame here. (currently 16 bytes) */
|
/* reserve extra space in savegame here. (currently 16 bytes) */
|
||||||
SLE_CONDNULL(16, 2, SL_MAX_VERSION),
|
SLE_CONDNULL(16, 2, SL_MAX_VERSION),
|
||||||
|
|
||||||
SLE_END()
|
SLE_END()
|
||||||
};
|
};
|
||||||
@ -84,7 +84,6 @@ void CopyTempEngineData()
|
|||||||
e->duration_phase_1 = se->duration_phase_1;
|
e->duration_phase_1 = se->duration_phase_1;
|
||||||
e->duration_phase_2 = se->duration_phase_2;
|
e->duration_phase_2 = se->duration_phase_2;
|
||||||
e->duration_phase_3 = se->duration_phase_3;
|
e->duration_phase_3 = se->duration_phase_3;
|
||||||
e->lifelength = se->lifelength;
|
|
||||||
e->flags = se->flags;
|
e->flags = se->flags;
|
||||||
e->preview_company_rank= se->preview_company_rank;
|
e->preview_company_rank= se->preview_company_rank;
|
||||||
e->preview_wait = se->preview_wait;
|
e->preview_wait = se->preview_wait;
|
||||||
|
@ -406,7 +406,6 @@ static bool FixTTOEngines()
|
|||||||
e->duration_phase_1 = oe->duration_phase_1;
|
e->duration_phase_1 = oe->duration_phase_1;
|
||||||
e->duration_phase_2 = oe->duration_phase_2;
|
e->duration_phase_2 = oe->duration_phase_2;
|
||||||
e->duration_phase_3 = oe->duration_phase_3;
|
e->duration_phase_3 = oe->duration_phase_3;
|
||||||
e->lifelength = oe->lifelength;
|
|
||||||
e->flags = oe->flags;
|
e->flags = oe->flags;
|
||||||
|
|
||||||
e->company_avail = 0;
|
e->company_avail = 0;
|
||||||
@ -1439,7 +1438,7 @@ static const OldChunks engine_chunk[] = {
|
|||||||
OCL_SVAR( OC_UINT16, Engine, duration_phase_2 ),
|
OCL_SVAR( OC_UINT16, Engine, duration_phase_2 ),
|
||||||
OCL_SVAR( OC_UINT16, Engine, duration_phase_3 ),
|
OCL_SVAR( OC_UINT16, Engine, duration_phase_3 ),
|
||||||
|
|
||||||
OCL_SVAR( OC_UINT8, Engine, lifelength ),
|
OCL_NULL( 1 ), // lifelength
|
||||||
OCL_SVAR( OC_UINT8, Engine, flags ),
|
OCL_SVAR( OC_UINT8, Engine, flags ),
|
||||||
OCL_SVAR( OC_UINT8, Engine, preview_company_rank ),
|
OCL_SVAR( OC_UINT8, Engine, preview_company_rank ),
|
||||||
OCL_SVAR( OC_UINT8, Engine, preview_wait ),
|
OCL_SVAR( OC_UINT8, Engine, preview_wait ),
|
||||||
|
Loading…
Reference in New Issue
Block a user