summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-05-22 22:22:46 +0000
committerrubidium <rubidium@openttd.org>2009-05-22 22:22:46 +0000
commit80e94b9bb15f846189e98f1f457afe2b96ba2b58 (patch)
treeb623c3e1cc75771986452340a138bd3ac60d4cbc /src/saveload
parent7a37220881c995f317bf5bd0f3077fa6c9e9d098 (diff)
downloadopenttd-80e94b9bb15f846189e98f1f457afe2b96ba2b58.tar.xz
(svn r16391) -Codechange: use Train instead of Vehicle where appropriate.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp13
-rw-r--r--src/saveload/oldloader_sl.cpp2
-rw-r--r--src/saveload/vehicle_sl.cpp10
3 files changed, 13 insertions, 12 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 088aef84f..3e0309ac1 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -912,7 +912,7 @@ bool AfterLoadGame()
continue;
}
if (v->type == VEH_TRAIN) {
- v->u.rail.track = TRACK_BIT_WORMHOLE;
+ ((Train *)v)->u.rail.track = TRACK_BIT_WORMHOLE;
} else {
((RoadVehicle *)v)->state = RVSB_WORMHOLE;
}
@@ -928,7 +928,7 @@ bool AfterLoadGame()
if (v->type == VEH_TRAIN) {
RailType rt = RailVehInfo(v->engine_type)->railtype;
- v->u.rail.railtype = rt;
+ ((Train *)v)->u.rail.railtype = rt;
if (rt == RAILTYPE_ELECTRIC) min_rail = RAILTYPE_RAIL;
}
}
@@ -964,7 +964,7 @@ bool AfterLoadGame()
}
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v))) TrainConsistChanged(v, true);
+ if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v))) TrainConsistChanged((Train *)v, true);
}
}
@@ -1700,9 +1700,10 @@ bool AfterLoadGame()
/* Reserve all tracks trains are currently on. */
if (CheckSavegameVersion(101)) {
- Vehicle *v;
- FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_TRAIN) {
+ Vehicle *u;
+ FOR_ALL_VEHICLES(u) {
+ if (u->type == VEH_TRAIN) {
+ Train *v = (Train *)u;
if ((v->u.rail.track & TRACK_BIT_WORMHOLE) == TRACK_BIT_WORMHOLE) {
TryReserveRailTrack(v->tile, DiagDirToDiagTrack(GetTunnelBridgeDirection(v->tile)));
} else if ((v->u.rail.track & TRACK_BIT_MASK) != TRACK_BIT_NONE) {
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index 842db05df..e95748807 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -1315,7 +1315,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
};
if (v->spritenum / 2 >= lengthof(spriteset_rail)) return false;
v->spritenum = spriteset_rail[v->spritenum / 2]; // adjust railway sprite set offset
- v->u.rail.railtype = type == 0x25 ? 1 : 0; // monorail / rail
+ ((Train *)v)->u.rail.railtype = type == 0x25 ? 1 : 0; // monorail / rail
break;
}
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index 10b7f3614..6901bef4f 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -24,7 +24,7 @@ void ConnectMultiheadedTrains()
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_TRAIN) {
- v->u.rail.other_multiheaded_part = NULL;
+ ((Train *)v)->u.rail.other_multiheaded_part = NULL;
}
}
@@ -45,7 +45,7 @@ void ConnectMultiheadedTrains()
bool sequential_matching = IsFrontEngine(v);
- for (Vehicle *u = v; u != NULL; u = GetNextVehicle(u)) {
+ for (Train *u = (Train *)v; u != NULL; u = (Train *)GetNextVehicle(u)) {
if (u->u.rail.other_multiheaded_part != NULL) continue; // we already linked this one
if (IsMultiheaded(u)) {
@@ -57,7 +57,7 @@ void ConnectMultiheadedTrains()
/* Find a matching back part */
EngineID eid = u->engine_type;
- Vehicle *w;
+ Train *w;
if (sequential_matching) {
for (w = GetNextVehicle(u); w != NULL; w = GetNextVehicle(w)) {
if (w->engine_type != eid || w->u.rail.other_multiheaded_part != NULL || !IsMultiheaded(w)) continue;
@@ -318,8 +318,8 @@ void AfterLoadVehicles(bool part_of_load)
assert(v->first != NULL);
if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v))) {
- if (IsFrontEngine(v)) v->u.rail.last_speed = v->cur_speed; // update displayed train speed
- TrainConsistChanged(v, false);
+ if (IsFrontEngine(v)) ((Train *)v)->u.rail.last_speed = v->cur_speed; // update displayed train speed
+ TrainConsistChanged((Train *)v, false);
} else if (v->type == VEH_ROAD && IsRoadVehFront(v)) {
RoadVehUpdateCache((RoadVehicle *)v);
}