Change: replace per-AI "start_date" with a global "competitors_interval" (#10653)
The per-AI "start_date" is a lot of custom code, and was rarely used in the way it was meant. While at it, also ported this part over to the new timer system.
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
#include "../gfx_func.h"
|
||||
#include "../core/random_func.hpp"
|
||||
#include "../fios.h"
|
||||
#include "../timer/timer.h"
|
||||
#include "../timer/timer_game_tick.h"
|
||||
|
||||
#include "../safeguards.h"
|
||||
|
||||
@@ -67,6 +69,7 @@ void ResetViewportAfterLoadGame()
|
||||
}
|
||||
|
||||
byte _age_cargo_skip_counter; ///< Skip aging of cargo? Used before savegame version 162.
|
||||
extern TimeoutTimer<TimerGameTick> _new_competitor_timeout;
|
||||
|
||||
static const SaveLoad _date_desc[] = {
|
||||
SLEG_CONDVAR("date", _date, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),
|
||||
@@ -81,10 +84,14 @@ static const SaveLoad _date_desc[] = {
|
||||
SLEG_VAR("random_state[0]", _random.state[0], SLE_UINT32),
|
||||
SLEG_VAR("random_state[1]", _random.state[1], SLE_UINT32),
|
||||
SLEG_VAR("company_tick_counter", _cur_company_tick_index, SLE_FILE_U8 | SLE_VAR_U32),
|
||||
SLEG_CONDVAR("next_competitor_start", _next_competitor_start, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_109),
|
||||
SLEG_CONDVAR("next_competitor_start", _next_competitor_start, SLE_UINT32, SLV_109, SL_MAX_VERSION),
|
||||
SLEG_VAR("trees_tick_counter", _trees_tick_ctr, SLE_UINT8),
|
||||
SLEG_CONDVAR("pause_mode", _pause_mode, SLE_UINT8, SLV_4, SL_MAX_VERSION),
|
||||
/* For older savegames, we load the current value as the "period"; afterload will set the "fired" and "elapsed". */
|
||||
SLEG_CONDVAR("next_competitor_start", _new_competitor_timeout.period, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_109),
|
||||
SLEG_CONDVAR("next_competitor_start", _new_competitor_timeout.period, SLE_UINT32, SLV_109, SLV_AI_START_DATE),
|
||||
SLEG_CONDVAR("competitors_interval", _new_competitor_timeout.period, SLE_UINT32, SLV_AI_START_DATE, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR("competitors_interval_elapsed", _new_competitor_timeout.storage.elapsed, SLE_UINT32, SLV_AI_START_DATE, SL_MAX_VERSION),
|
||||
SLEG_CONDVAR("competitors_interval_fired", _new_competitor_timeout.fired, SLE_BOOL, SLV_AI_START_DATE, SL_MAX_VERSION),
|
||||
};
|
||||
|
||||
static const SaveLoad _date_check_desc[] = {
|
||||
|
Reference in New Issue
Block a user