From cae0b21534ea36ef5c9e671d8fcab382abb4cb86 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Wed, 5 Dec 2018 20:14:21 +0000 Subject: [PATCH] Trace restrict: Bump size of item type field Reserve value for TRIT_REVERSE --- src/saveload/extended_ver_sl.cpp | 2 +- src/tracerestrict.h | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/saveload/extended_ver_sl.cpp b/src/saveload/extended_ver_sl.cpp index b8d6c91017..a6aa384f37 100644 --- a/src/saveload/extended_ver_sl.cpp +++ b/src/saveload/extended_ver_sl.cpp @@ -45,7 +45,7 @@ std::vector _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_TRACE_RESTRICT, XSCF_NULL, 9, 9, "tracerestrict", NULL, NULL, "TRRM,TRRP,TRRS" }, + { XSLFI_TRACE_RESTRICT, XSCF_NULL, 10, 10, "tracerestrict", NULL, NULL, "TRRM,TRRP,TRRS" }, { XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker }; diff --git a/src/tracerestrict.h b/src/tracerestrict.h index 260644128f..3ab32af9fd 100644 --- a/src/tracerestrict.h +++ b/src/tracerestrict.h @@ -86,10 +86,10 @@ typedef uint32 TraceRestrictItem; * OFFSET values describe the field bit offset */ enum TraceRestrictItemFlagAllocation { - TRIFA_TYPE_COUNT = 5, + TRIFA_TYPE_COUNT = 6, TRIFA_TYPE_OFFSET = 0, - /* 3 bits reserved for future use */ + /* 2 bits reserved for future use */ TRIFA_COND_FLAGS_COUNT = 3, TRIFA_COND_FLAGS_OFFSET = 8, @@ -136,7 +136,11 @@ enum TraceRestrictItemType { TRIT_COND_TRAIN_IN_SLOT = 21, ///< Test train slot membership TRIT_COND_SLOT_OCCUPANCY = 22, ///< Test train slot occupancy state //TRIT_COND_TRAIN_OWNER = 24, ///< Test train owner: reserved for future use - /* space up to 31 */ + + TRIT_COND_END = 48, ///< End (exclusive) of conditional item types, note that this has the same value as TRIT_REVERSE + //TRIT_REVERSE = 48, ///< Reverse: reserved for future use + + /* space up to 63 */ }; /** @@ -468,7 +472,7 @@ static inline void SetTraceRestrictValue(TraceRestrictItem &item, uint16 value) /** Is TraceRestrictItemType a conditional type? */ static inline bool IsTraceRestrictTypeConditional(TraceRestrictItemType type) { - return type >= TRIT_COND_BEGIN; + return type >= TRIT_COND_BEGIN && type < TRIT_COND_END; } /** Is TraceRestrictItem type field a conditional type? */