Auto timetables patch: save/load changes, document rationale for

moving addition to VehicleFlags
This commit is contained in:
Jonathan G Rennison 2015-08-04 22:07:02 +01:00
parent 33854a138f
commit 2e45dac18a
6 changed files with 18 additions and 13 deletions

View File

@ -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
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
};

View File

@ -21,6 +21,7 @@
*/
enum SlXvFeatureIndex {
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
};

View File

@ -629,9 +629,6 @@ void CDECL NORETURN SlErrorCorruptFmt(const char *msg, ...) WARN_FORMAT(1, 2);
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 bool _do_autosave;

View File

@ -692,8 +692,8 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
SLE_CONDVAR(Vehicle, random_bits, 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(Vehicle, behind_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_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_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, 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_CONDNULL(10, 2, 143), // old reserved space

View File

@ -334,20 +334,22 @@ cat = SC_BASIC
[SDT_BOOL]
base = GameSettings
var = order.timetable_automated
from = TIMESEP_SV
def = true
str = STR_CONFIG_SETTING_TIMETABLE_AUTOMATED
str = STR_CONFIG_SETTING_TIMETABLE_AUTOMATED
strhelp = STR_CONFIG_SETTING_TIMETABLE_AUTOMATED_HELPTEXT
cat = SC_EXPERT
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_AUTO_TIMETABLE)
patxname = ""auto_timetables.order.timetable_automated""
[SDT_BOOL]
base = GameSettings
var = order.timetable_separation
from = TIMESEP_SV
def = true
base = GameSettings
var = order.timetable_separation
def = true
str = STR_CONFIG_SETTING_TIMETABLE_SEPARATION
strhelp = STR_CONFIG_SETTING_TIMETABLE_SEPARATION_HELPTEXT
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
; these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI.

View File

@ -50,7 +50,11 @@ enum VehicleFlags {
VF_PATHFINDER_LOST, ///< Vehicle's pathfinder is lost.
VF_SERVINT_IS_CUSTOM, ///< Service interval is custom.
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. */