Clear PAX stations/signals and traffic lights on load.
This clears the tracerestrict bit if there are no mappings on a tile.
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
#include "../order_backup.h"
|
||||
#include "../error.h"
|
||||
#include "../disaster_vehicle.h"
|
||||
#include "../tracerestrict.h"
|
||||
|
||||
|
||||
#include "saveload_internal.h"
|
||||
@@ -3121,6 +3122,36 @@ bool AfterLoadGame()
|
||||
}
|
||||
}
|
||||
|
||||
if (SlXvIsFeaturePresent(XSLFI_MIGHT_USE_PAX_SIGNALS) || SlXvIsFeatureMissing(XSLFI_TRACE_RESTRICT)) {
|
||||
for (TileIndex t = 0; t < map_size; t++) {
|
||||
if (HasStationTileRail(t)) {
|
||||
/* clear station PAX bit */
|
||||
ClrBit(_me[t].m6, 6);
|
||||
}
|
||||
if (IsTileType(t, MP_RAILWAY) && HasSignals(t)) {
|
||||
/*
|
||||
* tracerestrict uses same bit as 1st PAX signals bit
|
||||
* only conditionally clear the bit, don't bother checking for whether to set it
|
||||
*/
|
||||
if (IsRestrictedSignal(t)) {
|
||||
TraceRestrictSetIsSignalRestrictedBit(t);
|
||||
}
|
||||
|
||||
/* clear 2nd signal PAX bit */
|
||||
ClrBit(_m[t].m2, 13);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SlXvIsFeaturePresent(XSLFI_TRAFFIC_LIGHTS)) {
|
||||
/* remove traffic lights */
|
||||
for (TileIndex t = 0; t < map_size; t++) {
|
||||
if (IsTileType(t, MP_ROAD) && (GetRoadTileType(t) == ROAD_TILE_NORMAL)) {
|
||||
ClrBit(_me[t].m7, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Station acceptance is some kind of cache */
|
||||
if (IsSavegameVersionBefore(127)) {
|
||||
Station *st;
|
||||
|
@@ -161,6 +161,7 @@ void SlXvCheckSpecialSavegameVersions()
|
||||
_sl_xv_feature_versions[XSLFI_RIFF_HEADER_60_BIT] = 1;
|
||||
_sl_xv_feature_versions[XSLFI_HEIGHT_8_BIT] = 1;
|
||||
_sl_xv_feature_versions[XSLFI_MIGHT_USE_PAX_SIGNALS] = 1;
|
||||
_sl_xv_feature_versions[XSLFI_TRAFFIC_LIGHTS] = 1;
|
||||
|
||||
_sl_xv_feature_versions[XSLFI_TIMETABLES_START_TICKS] = 1;
|
||||
_sl_xv_feature_versions[XSLFI_VEHICLE_REPAIR_COST] = 1;
|
||||
|
@@ -40,6 +40,7 @@ enum SlXvFeatureIndex {
|
||||
XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit
|
||||
XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk
|
||||
XSLFI_MIGHT_USE_PAX_SIGNALS, ///< This save game might use the pax-signals feature
|
||||
XSLFI_TRAFFIC_LIGHTS, ///< This save game uses road traffic lights
|
||||
XSLFI_SPRINGPP, ///< This is a SpringPP game, use this for loading some settings
|
||||
|
||||
XSLFI_SIZE, ///< Total count of features, including null feature
|
||||
|
@@ -560,7 +560,7 @@ void SetTraceRestrictTypeAndNormalise(TraceRestrictItem &item, TraceRestrictItem
|
||||
* Sets the "signal has a trace restrict mapping" bit
|
||||
* This looks for mappings with that tile index
|
||||
*/
|
||||
void SetIsSignalRestrictedBit(TileIndex t)
|
||||
void TraceRestrictSetIsSignalRestrictedBit(TileIndex t)
|
||||
{
|
||||
// First mapping for this tile, or later
|
||||
TraceRestrictMapping::iterator lower_bound = _tracerestrictprogram_mapping.lower_bound(MakeTraceRestrictRefId(t, static_cast<Track>(0)));
|
||||
@@ -591,7 +591,7 @@ void TraceRestrictCreateProgramMapping(TraceRestrictRefId ref, TraceRestrictProg
|
||||
|
||||
TileIndex tile = GetTraceRestrictRefIdTileIndex(ref);
|
||||
Track track = GetTraceRestrictRefIdTrack(ref);
|
||||
SetIsSignalRestrictedBit(tile);
|
||||
TraceRestrictSetIsSignalRestrictedBit(tile);
|
||||
MarkTileDirtyByTile(tile);
|
||||
YapfNotifyTrackLayoutChange(tile, track);
|
||||
}
|
||||
@@ -609,7 +609,7 @@ void TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref)
|
||||
|
||||
TileIndex tile = GetTraceRestrictRefIdTileIndex(ref);
|
||||
Track track = GetTraceRestrictRefIdTrack(ref);
|
||||
SetIsSignalRestrictedBit(tile);
|
||||
TraceRestrictSetIsSignalRestrictedBit(tile);
|
||||
MarkTileDirtyByTile(tile);
|
||||
YapfNotifyTrackLayoutChange(tile, track);
|
||||
}
|
||||
|
@@ -489,6 +489,7 @@ static inline Track GetTraceRestrictRefIdTrack(TraceRestrictRefId ref)
|
||||
return static_cast<Track>(ref & 7);
|
||||
}
|
||||
|
||||
void TraceRestrictSetIsSignalRestrictedBit(TileIndex t);
|
||||
void TraceRestrictCreateProgramMapping(TraceRestrictRefId ref, TraceRestrictProgram *prog);
|
||||
void TraceRestrictRemoveProgramMapping(TraceRestrictRefId ref);
|
||||
|
||||
|
Reference in New Issue
Block a user