1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-01 19:09:09 +00:00

(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 c90819ff6d
commit 0c10006907
36 changed files with 185 additions and 161 deletions

View File

@@ -184,7 +184,7 @@ static SmallSet<DiagDirection, SIG_GLOB_SIZE> _globset("_globset"); ///< set of
/** Check whether there is a train on rail, not in a depot */
static Vehicle *TrainOnTileEnum(Vehicle *v, void *)
{
if (v->type != VEH_TRAIN || ((Train *)v)->track == TRACK_BIT_DEPOT) return NULL;
if (v->type != VEH_TRAIN || Train::From(v)->track == TRACK_BIT_DEPOT) return NULL;
return v;
}