mirror of https://github.com/OpenTTD/OpenTTD
(svn r18857) -Codechange: don't rely on the fact that all airports are rectangular
parent
84bc831e32
commit
ab68f08886
|
@ -121,6 +121,11 @@ public:
|
||||||
return IsRailStationTile(tile) && GetStationIndex(tile) == this->index;
|
return IsRailStationTile(tile) && GetStationIndex(tile) == this->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* virtual */ FORCEINLINE bool TileBelongsToAirport(TileIndex tile) const
|
||||||
|
{
|
||||||
|
return IsAirportTile(tile) && GetStationIndex(tile) == this->index;
|
||||||
|
}
|
||||||
|
|
||||||
/* virtual */ uint32 GetNewGRFVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) const;
|
/* virtual */ uint32 GetNewGRFVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) const;
|
||||||
|
|
||||||
/* virtual */ void GetTileArea(TileArea *ta, StationType type) const;
|
/* virtual */ void GetTileArea(TileArea *ta, StationType type) const;
|
||||||
|
|
|
@ -2066,7 +2066,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
|
||||||
int w = as->size_x;
|
int w = as->size_x;
|
||||||
int h = as->size_y;
|
int h = as->size_y;
|
||||||
|
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION, w * h * _price[PR_CLEAR_STATION_AIRPORT]);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
|
|
||||||
const Aircraft *a;
|
const Aircraft *a;
|
||||||
FOR_ALL_AIRCRAFT(a) {
|
FOR_ALL_AIRCRAFT(a) {
|
||||||
|
@ -2077,6 +2077,10 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
|
||||||
TILE_LOOP(tile_cur, w, h, tile) {
|
TILE_LOOP(tile_cur, w, h, tile) {
|
||||||
if (!EnsureNoVehicleOnGround(tile_cur)) return CMD_ERROR;
|
if (!EnsureNoVehicleOnGround(tile_cur)) return CMD_ERROR;
|
||||||
|
|
||||||
|
if (!st->TileBelongsToAirport(tile_cur)) continue;
|
||||||
|
|
||||||
|
cost.AddCost(_price[PR_CLEAR_STATION_AIRPORT]);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
DeleteAnimatedTile(tile_cur);
|
DeleteAnimatedTile(tile_cur);
|
||||||
DoClearSquare(tile_cur);
|
DoClearSquare(tile_cur);
|
||||||
|
|
|
@ -184,6 +184,16 @@ static inline bool IsAirport(TileIndex t)
|
||||||
return GetStationType(t) == STATION_AIRPORT;
|
return GetStationType(t) == STATION_AIRPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this tile a station tile and an airport tile?
|
||||||
|
* @param t the tile to get the information from
|
||||||
|
* @return true if and only if the tile is an airport
|
||||||
|
*/
|
||||||
|
static inline bool IsAirportTile(TileIndex t)
|
||||||
|
{
|
||||||
|
return IsTileType(t, MP_STATION) && IsAirport(t);
|
||||||
|
}
|
||||||
|
|
||||||
bool IsHangar(TileIndex t);
|
bool IsHangar(TileIndex t);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue