diff options
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r-- | src/tunnelbridge_cmd.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index d883c650b..5d769053f 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -1385,7 +1385,7 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti DiagDirection vdir; if (v->type == VEH_TRAIN) { - Train *t = (Train *)v; + Train *t = Train::From(v); fc = (x & 0xF) + (y << 4); vdir = DirToDiagDir(t->direction); @@ -1414,7 +1414,7 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti return VETSB_ENTERED_WORMHOLE; } } else if (v->type == VEH_ROAD) { - RoadVehicle *rv = (RoadVehicle *)v; + RoadVehicle *rv = RoadVehicle::From(v); fc = (x & 0xF) + (y << 4); vdir = DirToDiagDir(v->direction); @@ -1464,18 +1464,18 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti } switch (v->type) { case VEH_TRAIN: { - Train *t = (Train *)v; + Train *t = Train::From(v); t->track = TRACK_BIT_WORMHOLE; ClrBit(t->flags, VRF_GOINGUP); ClrBit(t->flags, VRF_GOINGDOWN); } break; case VEH_ROAD: - ((RoadVehicle *)v)->state = RVSB_WORMHOLE; + RoadVehicle::From(v)->state = RVSB_WORMHOLE; break; case VEH_SHIP: - ((Ship *)v)->state = TRACK_BIT_WORMHOLE; + Ship::From(v)->state = TRACK_BIT_WORMHOLE; break; default: NOT_REACHED(); @@ -1485,7 +1485,7 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti v->tile = tile; switch (v->type) { case VEH_TRAIN: { - Train *t = (Train *)v; + Train *t = Train::From(v); if (t->track == TRACK_BIT_WORMHOLE) { t->track = (DiagDirToAxis(dir) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y); return VETSB_ENTERED_WORMHOLE; @@ -1493,7 +1493,7 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti } break; case VEH_ROAD: { - RoadVehicle *rv = (RoadVehicle *)v; + RoadVehicle *rv = RoadVehicle::From(v); if (rv->state == RVSB_WORMHOLE) { rv->state = _road_exit_tunnel_state[dir]; rv->frame = 0; @@ -1502,7 +1502,7 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti } break; case VEH_SHIP: { - Ship *ship = (Ship *)v; + Ship *ship = Ship::From(v); if (ship->state == TRACK_BIT_WORMHOLE) { ship->state = (DiagDirToAxis(dir) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y); return VETSB_ENTERED_WORMHOLE; |