* Check whether we can expand the rail part of the given station. * @param st the station to expand * @param new_ta the current (and if all is fine new) tile area of the rail part of the station * @return Succeeded or failed command. */
| 1190 | * @return Succeeded or failed command. |
| 1191 | */ |
| 1192 | CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta) |
| 1193 | { |
| 1194 | TileArea cur_ta = st->train_station; |
| 1195 | |
| 1196 | /* determine new size of train station region.. */ |
| 1197 | int x = std::min(TileX(cur_ta.tile), TileX(new_ta.tile)); |
| 1198 | int y = std::min(TileY(cur_ta.tile), TileY(new_ta.tile)); |
| 1199 | new_ta.w = std::max(TileX(cur_ta.tile) + cur_ta.w, TileX(new_ta.tile) + new_ta.w) - x; |
| 1200 | new_ta.h = std::max(TileY(cur_ta.tile) + cur_ta.h, TileY(new_ta.tile) + new_ta.h) - y; |
| 1201 | new_ta.tile = TileXY(x, y); |
| 1202 | |
| 1203 | /* make sure the final size is not too big. */ |
| 1204 | if (new_ta.w > _settings_game.station.station_spread || new_ta.h > _settings_game.station.station_spread) { |
| 1205 | return CommandCost(STR_ERROR_STATION_TOO_SPREAD_OUT); |
| 1206 | } |
| 1207 | |
| 1208 | return CommandCost(); |
| 1209 | } |
| 1210 | |
| 1211 | RailStationTileLayout::RailStationTileLayout(const StationSpec *spec, uint8_t platforms, uint8_t length) : platforms(platforms), length(length) |
| 1212 | { |
no test coverage detected