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:
Jonathan G Rennison
2015-08-19 18:55:02 +01:00
parent ba8d8d99b8
commit 96ccd9333a
5 changed files with 37 additions and 3 deletions

View File

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