| 15 | #include "../../safeguards.h" |
| 16 | |
| 17 | ScriptDepotList::ScriptDepotList(ScriptTile::TransportType transport_type) |
| 18 | { |
| 19 | EnforceDeityOrCompanyModeValid_Void(); |
| 20 | ::TileType tile_type; |
| 21 | switch (transport_type) { |
| 22 | default: return; |
| 23 | |
| 24 | case ScriptTile::TRANSPORT_ROAD: tile_type = ::MP_ROAD; break; |
| 25 | case ScriptTile::TRANSPORT_RAIL: tile_type = ::MP_RAILWAY; break; |
| 26 | case ScriptTile::TRANSPORT_WATER: tile_type = ::MP_WATER; break; |
| 27 | |
| 28 | case ScriptTile::TRANSPORT_AIR: { |
| 29 | /* Hangars are not seen as real depots by the depot code. */ |
| 30 | bool is_deity = ScriptCompanyMode::IsDeity(); |
| 31 | ::CompanyID owner = ScriptObject::GetCompany(); |
| 32 | for (const Station *st : Station::Iterate()) { |
| 33 | if (is_deity || st->owner == owner) { |
| 34 | for (uint i = 0; i < st->airport.GetNumHangars(); i++) { |
| 35 | this->AddItem(st->airport.GetHangarTile(i).base()); |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | return; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /* Handle 'standard' depots. */ |
| 44 | bool is_deity = ScriptCompanyMode::IsDeity(); |
| 45 | ::CompanyID owner = ScriptObject::GetCompany(); |
| 46 | for (const Depot *depot : Depot::Iterate()) { |
| 47 | if ((is_deity || ::GetTileOwner(depot->xy) == owner) && ::IsTileType(depot->xy, tile_type)) this->AddItem(depot->xy.base()); |
| 48 | } |
| 49 | } |
nothing calls this directly
no test coverage detected