| 515 | } |
| 516 | |
| 517 | OpenLoco::TownId OpenLoco::Town::id() const |
| 518 | { |
| 519 | // TODO check if this is stored in Town structure |
| 520 | // otherwise add it when possible |
| 521 | auto index = static_cast<size_t>(this - &TownManager::rawTowns()[0]); |
| 522 | if (index > Limits::kMaxTowns) |
| 523 | { |
| 524 | return OpenLoco::TownId::null; |
| 525 | } |
| 526 | return OpenLoco::TownId(index); |
| 527 | } |
no test coverage detected