Add reverse at waypoint orders.
The train will reverse when its tail is within the waypoint tile. This is useful for reversing on train en-route, without creating dedicated reversing sidings or platforms.
This commit is contained in:
@@ -2951,6 +2951,13 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
if (SlXvIsFeatureMissing(XSLFI_REVERSE_AT_WAYPOINT)) {
|
||||
Train *t;
|
||||
FOR_ALL_TRAINS(t) {
|
||||
t->reverse_distance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Only keep order-backups for network clients (and when replaying).
|
||||
* If we are a network server or not networking, then we just loaded a previously
|
||||
|
@@ -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_REVERSE_AT_WAYPOINT, XSCF_NULL, 1, 1, "reverse_at_waypoint", NULL, NULL, NULL },
|
||||
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
|
||||
};
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
enum SlXvFeatureIndex {
|
||||
XSLFI_NULL = 0, ///< Unused value, to indicate that no extended feature test is in use
|
||||
XSLFI_REVERSE_AT_WAYPOINT, ///< Reverse at waypoint orders
|
||||
|
||||
XSLFI_SIZE, ///< Total count of features, including null feature
|
||||
};
|
||||
|
@@ -724,6 +724,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
||||
SLE_CONDNULL(2, 2, 19),
|
||||
SLE_CONDVAR(Train, gv_flags, SLE_UINT16, 139, SL_MAX_VERSION),
|
||||
SLE_CONDNULL(11, 2, 143), // old reserved space
|
||||
SLE_CONDVAR_X(Train, reverse_distance, SLE_UINT16, 0, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_REVERSE_AT_WAYPOINT)),
|
||||
|
||||
SLE_END()
|
||||
};
|
||||
|
Reference in New Issue
Block a user