Auto timetables patch: save/load changes, document rationale for
moving addition to VehicleFlags
This commit is contained in:
@@ -45,6 +45,7 @@ std::vector<uint32> _sl_xv_discardable_chunk_ids; ///< list of chunks
|
|||||||
static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version os SLXI chunk
|
static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version os SLXI chunk
|
||||||
|
|
||||||
const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||||
|
{ XSLFI_AUTO_TIMETABLE, XSCF_NULL, 1, 1, "auto_timetables", NULL, NULL, NULL },
|
||||||
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
|
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
enum SlXvFeatureIndex {
|
enum SlXvFeatureIndex {
|
||||||
XSLFI_NULL = 0, ///< Unused value, to indicate that no extended feature test is in use
|
XSLFI_NULL = 0, ///< Unused value, to indicate that no extended feature test is in use
|
||||||
|
XSLFI_AUTO_TIMETABLE, ///< Auto timetables and separation patch
|
||||||
|
|
||||||
XSLFI_SIZE, ///< Total count of features, including null feature
|
XSLFI_SIZE, ///< Total count of features, including null feature
|
||||||
};
|
};
|
||||||
|
@@ -629,9 +629,6 @@ void CDECL NORETURN SlErrorCorruptFmt(const char *msg, ...) WARN_FORMAT(1, 2);
|
|||||||
|
|
||||||
bool SaveloadCrashWithMissingNewGRFs();
|
bool SaveloadCrashWithMissingNewGRFs();
|
||||||
|
|
||||||
/* Hack to change savegame version in only one place. Rmv and correct if trunk. */
|
|
||||||
const int TIMESEP_SV = 190;
|
|
||||||
|
|
||||||
extern char _savegame_format[8];
|
extern char _savegame_format[8];
|
||||||
extern bool _do_autosave;
|
extern bool _do_autosave;
|
||||||
|
|
||||||
|
@@ -692,8 +692,8 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
|||||||
SLE_CONDVAR(Vehicle, random_bits, SLE_UINT8, 2, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, random_bits, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Vehicle, waiting_triggers, SLE_UINT8, 2, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, waiting_triggers, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||||
|
|
||||||
SLE_CONDREF(Vehicle, ahead_separation, REF_VEHICLE, TIMESEP_SV, SL_MAX_VERSION),
|
SLE_CONDREF_X(Vehicle, ahead_separation, REF_VEHICLE, 0, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AUTO_TIMETABLE)),
|
||||||
SLE_CONDREF(Vehicle, behind_separation, REF_VEHICLE, TIMESEP_SV, SL_MAX_VERSION),
|
SLE_CONDREF_X(Vehicle, behind_separation, REF_VEHICLE, 0, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AUTO_TIMETABLE)),
|
||||||
|
|
||||||
SLE_CONDREF(Vehicle, next_shared, REF_VEHICLE, 2, SL_MAX_VERSION),
|
SLE_CONDREF(Vehicle, next_shared, REF_VEHICLE, 2, SL_MAX_VERSION),
|
||||||
SLE_CONDNULL(2, 2, 68),
|
SLE_CONDNULL(2, 2, 68),
|
||||||
@@ -702,7 +702,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
|||||||
SLE_CONDVAR(Vehicle, group_id, SLE_UINT16, 60, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, group_id, SLE_UINT16, 60, SL_MAX_VERSION),
|
||||||
|
|
||||||
SLE_CONDVAR(Vehicle, current_order_time, SLE_UINT32, 67, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, current_order_time, SLE_UINT32, 67, SL_MAX_VERSION),
|
||||||
SLE_CONDVAR(Vehicle, current_loading_time, SLE_UINT32, TIMESEP_SV, SL_MAX_VERSION),
|
SLE_CONDVAR_X(Vehicle, current_loading_time, SLE_UINT32, 0, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_AUTO_TIMETABLE)),
|
||||||
SLE_CONDVAR(Vehicle, lateness_counter, SLE_INT32, 67, SL_MAX_VERSION),
|
SLE_CONDVAR(Vehicle, lateness_counter, SLE_INT32, 67, SL_MAX_VERSION),
|
||||||
|
|
||||||
SLE_CONDNULL(10, 2, 143), // old reserved space
|
SLE_CONDNULL(10, 2, 143), // old reserved space
|
||||||
|
@@ -334,20 +334,22 @@ cat = SC_BASIC
|
|||||||
[SDT_BOOL]
|
[SDT_BOOL]
|
||||||
base = GameSettings
|
base = GameSettings
|
||||||
var = order.timetable_automated
|
var = order.timetable_automated
|
||||||
from = TIMESEP_SV
|
|
||||||
def = true
|
def = true
|
||||||
str = STR_CONFIG_SETTING_TIMETABLE_AUTOMATED
|
str = STR_CONFIG_SETTING_TIMETABLE_AUTOMATED
|
||||||
strhelp = STR_CONFIG_SETTING_TIMETABLE_AUTOMATED_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_TIMETABLE_AUTOMATED_HELPTEXT
|
||||||
cat = SC_EXPERT
|
cat = SC_EXPERT
|
||||||
|
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_AUTO_TIMETABLE)
|
||||||
|
patxname = ""auto_timetables.order.timetable_automated""
|
||||||
|
|
||||||
[SDT_BOOL]
|
[SDT_BOOL]
|
||||||
base = GameSettings
|
base = GameSettings
|
||||||
var = order.timetable_separation
|
var = order.timetable_separation
|
||||||
from = TIMESEP_SV
|
def = true
|
||||||
def = true
|
|
||||||
str = STR_CONFIG_SETTING_TIMETABLE_SEPARATION
|
str = STR_CONFIG_SETTING_TIMETABLE_SEPARATION
|
||||||
strhelp = STR_CONFIG_SETTING_TIMETABLE_SEPARATION_HELPTEXT
|
strhelp = STR_CONFIG_SETTING_TIMETABLE_SEPARATION_HELPTEXT
|
||||||
cat = SC_EXPERT
|
cat = SC_EXPERT
|
||||||
|
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_AUTO_TIMETABLE)
|
||||||
|
patxname = ""auto_timetables.order.timetable_separation""
|
||||||
|
|
||||||
; There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow
|
; There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow
|
||||||
; these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI.
|
; these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI.
|
||||||
|
@@ -50,7 +50,11 @@ enum VehicleFlags {
|
|||||||
VF_PATHFINDER_LOST, ///< Vehicle's pathfinder is lost.
|
VF_PATHFINDER_LOST, ///< Vehicle's pathfinder is lost.
|
||||||
VF_SERVINT_IS_CUSTOM, ///< Service interval is custom.
|
VF_SERVINT_IS_CUSTOM, ///< Service interval is custom.
|
||||||
VF_SERVINT_IS_PERCENT, ///< Service interval is percent.
|
VF_SERVINT_IS_PERCENT, ///< Service interval is percent.
|
||||||
VF_AUTOMATE_TIMETABLE, ///< Whether the vehicle should manage the timetable automatically.
|
|
||||||
|
// Additional flags not in trunk are added at the end to avoid clashing with any new
|
||||||
|
// flags which get added in future trunk, and to avoid re-ordering flags which are in trunk already,
|
||||||
|
// as this breaks savegame compatibility.
|
||||||
|
VF_AUTOMATE_TIMETABLE = 15, ///< Whether the vehicle should manage the timetable automatically.
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Bit numbers used to indicate which of the #NewGRFCache values are valid. */
|
/** Bit numbers used to indicate which of the #NewGRFCache values are valid. */
|
||||||
|
Reference in New Issue
Block a user