summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-02-27 23:36:28 +0000
committerrubidium <rubidium@openttd.org>2007-02-27 23:36:28 +0000
commit490811535584e73888fe8177b385b29d08d46daa (patch)
tree201d8919a041bd0eb12b24c8ba055c4d47310c76 /src/openttd.cpp
parentfbd6a88d02035fad651a342f74221dc152342451 (diff)
downloadopenttd-490811535584e73888fe8177b385b29d08d46daa.tar.xz
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 3a8b10df6..e34c30825 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1467,6 +1467,34 @@ bool AfterLoadGame(void)
}
}
+ if (CheckSavegameVersion(48)) {
+ for (TileIndex t = 0; t < map_size; t++) {
+ switch (GetTileType(t)) {
+ case MP_RAILWAY:
+ if (IsPlainRailTile(t)) {
+ /* Swap ground type and signal type for plain rail tiles, so the
+ * ground type uses the same bits as for depots and waypoints. */
+ uint tmp = GB(_m[t].m4, 0, 4);
+ SB(_m[t].m4, 0, 4, GB(_m[t].m2, 0, 4));
+ SB(_m[t].m2, 0, 4, tmp);
+ } else if (HASBIT(_m[t].m5, 2)) {
+ /* Split waypoint and depot rail type and remove the subtype. */
+ CLRBIT(_m[t].m5, 2);
+ CLRBIT(_m[t].m5, 6);
+ }
+ break;
+
+ case MP_STREET:
+ /* Swap m3 and m4, so the track type for rail crossings is the
+ * same as for normal rail. */
+ Swap(_m[t].m3, _m[t].m4);
+ break;
+
+ default: break;
+ }
+ }
+ }
+
/* Elrails got added in rev 24 */
if (CheckSavegameVersion(24)) {
Vehicle *v;
@@ -1490,7 +1518,7 @@ bool AfterLoadGame(void)
case MP_STREET:
if (IsLevelCrossing(t)) {
- SetRailTypeCrossing(t, UpdateRailType(GetRailTypeCrossing(t), min_rail));
+ SetRailType(t, UpdateRailType(GetRailType(t), min_rail));
}
break;
@@ -1575,11 +1603,11 @@ bool AfterLoadGame(void)
case MP_RAILWAY:
if (HasSignals(t)) {
// convert PBS signals to combo-signals
- if (HASBIT(_m[t].m4, 2)) SetSignalType(t, SIGTYPE_COMBO);
+ if (HASBIT(_m[t].m2, 2)) SetSignalType(t, SIGTYPE_COMBO);
// move the signal variant back
- SetSignalVariant(t, HASBIT(_m[t].m4, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC);
- CLRBIT(_m[t].m4, 3);
+ SetSignalVariant(t, HASBIT(_m[t].m2, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC);
+ CLRBIT(_m[t].m2, 3);
}
// Clear PBS reservation on track