(svn r16527) -Codechange: use static member functions instead of simple casts when converting Vehicle to specialised vehicle types. Includes safety check

This commit is contained in:
smatz
2009-06-06 16:54:22 +00:00
parent 6cf1610a08
commit af85994f7f
36 changed files with 185 additions and 161 deletions

View File

@@ -912,9 +912,9 @@ bool AfterLoadGame()
continue;
}
if (v->type == VEH_TRAIN) {
((Train *)v)->track = TRACK_BIT_WORMHOLE;
Train::From(v)->track = TRACK_BIT_WORMHOLE;
} else {
((RoadVehicle *)v)->state = RVSB_WORMHOLE;
RoadVehicle::From(v)->state = RVSB_WORMHOLE;
}
}
}