0x0048F43A
| 1249 | |
| 1250 | // 0x0048F43A |
| 1251 | void removeTileFromStation(const StationId stationId, const World::Pos3& pos, uint8_t rotation) |
| 1252 | { |
| 1253 | auto* station = StationManager::get(stationId); |
| 1254 | auto findPos = pos; |
| 1255 | findPos.z |= rotation; |
| 1256 | |
| 1257 | // Find tile to remove |
| 1258 | auto foundTilePos = std::find(std::begin(station->stationTiles), std::end(station->stationTiles), findPos); |
| 1259 | if (foundTilePos == std::end(station->stationTiles)) |
| 1260 | { |
| 1261 | // Bug mitigation: ensure stationTileSize does not exceed the actual array length |
| 1262 | station->stationTileSize = std::clamp<int16_t>(station->stationTileSize - 1, 0, static_cast<uint16_t>(std::size(station->stationTiles))); |
| 1263 | return; |
| 1264 | } |
| 1265 | |
| 1266 | // Remove tile by moving the remaining tiles over the one to remove |
| 1267 | std::rotate(foundTilePos, foundTilePos + 1, std::end(station->stationTiles)); |
| 1268 | station->stationTileSize--; |
| 1269 | station->stationTiles[std::size(station->stationTiles) - 1] = World::Pos3{}; |
| 1270 | } |
| 1271 | |
| 1272 | // 0x0048F482 |
| 1273 | void removeTileFromStationAndRecalcCargo(const StationId stationId, const World::Pos3& pos, uint8_t rotation) |