MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / BeforeAddRect

Method BeforeAddRect

src/station.cpp:609–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607}
608
609CommandCost StationRect::BeforeAddRect(TileIndex tile, int w, int h, StationRectMode mode)
610{
611 if (mode == ADD_FORCE || (w <= _settings_game.station.station_spread && h <= _settings_game.station.station_spread)) {
612 /* Important when the old rect is completely inside the new rect, resp. the old one was empty. */
613 CommandCost ret = this->BeforeAddTile(tile, mode);
614 if (ret.Succeeded()) ret = this->BeforeAddTile(TileAddXY(tile, w - 1, h - 1), mode);
615 return ret;
616 }
617 return CommandCost();
618}
619
620/**
621 * Check whether station tiles of the given station id exist in the given rectangle

Callers 7

CmdBuildRailWaypointFunction · 0.80
CmdBuildRoadWaypointFunction · 0.80
BuildStationPartFunction · 0.80
CmdBuildRailStationFunction · 0.80
CmdBuildAirportFunction · 0.80
CmdBuildDockFunction · 0.80
AddNearbyStationFunction · 0.80

Calls 4

BeforeAddTileMethod · 0.95
TileAddXYFunction · 0.85
CommandCostClass · 0.85
SucceededMethod · 0.80

Tested by

no test coverage detected