mirror of
https://github.com/OpenTTD/OpenTTD
synced 2025-12-14 00:42:22 +01:00
Codechange: Replace bitstuffed VehicleEnterTileStatus. (#14027)
VehicleEnterTileStatus was an bitset-style enum, but bitstuffed with a StationID. However the StationID part was only used by trains, and only in two locations. Instead, return just the enum bitset. The two places which require the StationID just call GetStationIndex() directly.
This commit is contained in:
@@ -2933,10 +2933,10 @@ int TicksToLeaveDepot(const Train *v)
|
||||
* Tile callback routine when vehicle enters tile
|
||||
* @see vehicle_enter_tile_proc
|
||||
*/
|
||||
static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *u, TileIndex tile, int x, int y)
|
||||
static VehicleEnterTileStates VehicleEnter_Track(Vehicle *u, TileIndex tile, int x, int y)
|
||||
{
|
||||
/* This routine applies only to trains in depot tiles. */
|
||||
if (u->type != VEH_TRAIN || !IsRailDepotTile(tile)) return VETSB_CONTINUE;
|
||||
if (u->type != VEH_TRAIN || !IsRailDepotTile(tile)) return {};
|
||||
|
||||
/* Depot direction. */
|
||||
DiagDirection dir = GetRailDepotDirection(tile);
|
||||
@@ -2944,7 +2944,7 @@ static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *u, TileIndex tile, int
|
||||
uint8_t fract_coord = (x & 0xF) + ((y & 0xF) << 4);
|
||||
|
||||
/* Make sure a train is not entering the tile from behind. */
|
||||
if (_fractcoords_behind[dir] == fract_coord) return VETSB_CANNOT_ENTER;
|
||||
if (_fractcoords_behind[dir] == fract_coord) return VehicleEnterTileState::CannotEnter;
|
||||
|
||||
Train *v = Train::From(u);
|
||||
|
||||
@@ -2976,10 +2976,10 @@ static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *u, TileIndex tile, int
|
||||
v->tile = tile;
|
||||
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||
return VETSB_ENTERED_WORMHOLE;
|
||||
return VehicleEnterTileState::EnteredWormhole;
|
||||
}
|
||||
|
||||
return VETSB_CONTINUE;
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user