Codechange: make use of Tile in for all direct map accesses

This commit is contained in:
Rubidium
2023-01-21 16:40:28 +01:00
committed by rubidium42
parent 7a6452d3ef
commit 580d0a6343
30 changed files with 963 additions and 946 deletions

View File

@@ -15,7 +15,7 @@
/**
* Check if a tile is a depot and it is a depot of the given type.
*/
static inline bool IsDepotTypeTile(TileIndex tile, TransportType type)
static inline bool IsDepotTypeTile(Tile tile, TransportType type)
{
switch (type) {
default: NOT_REACHED();
@@ -38,7 +38,7 @@ static inline bool IsDepotTypeTile(TileIndex tile, TransportType type)
* @param tile the tile to check
* @return true if and only if there is a depot on the tile.
*/
static inline bool IsDepotTile(TileIndex tile)
static inline bool IsDepotTile(Tile tile)
{
return IsRailDepotTile(tile) || IsRoadDepotTile(tile) || IsShipDepotTile(tile) || IsHangarTile(tile);
}
@@ -49,11 +49,11 @@ static inline bool IsDepotTile(TileIndex tile)
* @pre IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t)
* @return DepotID
*/
static inline DepotID GetDepotIndex(TileIndex t)
static inline DepotID GetDepotIndex(Tile t)
{
/* Hangars don't have a Depot class, thus store no DepotID. */
assert(IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t));
return _m[t].m2;
return t.m2();
}
/**
@@ -62,7 +62,7 @@ static inline DepotID GetDepotIndex(TileIndex t)
* @pre IsDepotTile(t)
* @return the type of vehicles that can use the depot
*/
static inline VehicleType GetDepotVehicleType(TileIndex t)
static inline VehicleType GetDepotVehicleType(Tile t)
{
switch (GetTileType(t)) {
default: NOT_REACHED();