Fix #12591: Give descriptive error when station construction fails due to wrong layout (#12678)

This commit is contained in:
Tyler Trahan 2024-05-22 17:56:03 -04:00 committed by GitHub
parent b2f1a06def
commit 8f6e21617f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -5052,6 +5052,8 @@ STR_ERROR_CAN_T_BUILD_AIRPORT_HERE :{WHITE}Can't bu
STR_ERROR_ADJOINS_MORE_THAN_ONE_EXISTING :{WHITE}Adjoins more than one existing station/loading area
STR_ERROR_STATION_TOO_SPREAD_OUT :{WHITE}... station too spread out
STR_ERROR_STATION_DISALLOWED_NUMBER_TRACKS :{WHITE}... unsupported number of tracks
STR_ERROR_STATION_DISALLOWED_LENGTH :{WHITE}... unsupported length
STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Too many stations/loading areas
STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Too many railway station parts
STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Too many bus stops

View File

@ -1389,9 +1389,8 @@ CommandCost CmdBuildRailStation(DoCommandFlag flags, TileIndex tile_org, RailTyp
/* Perform NewStation checks */
/* Check if the station size is permitted */
if (HasBit(statspec->disallowed_platforms, std::min(numtracks - 1, 7)) || HasBit(statspec->disallowed_lengths, std::min(plat_len - 1, 7))) {
return CMD_ERROR;
}
if (HasBit(statspec->disallowed_platforms, std::min(numtracks - 1, 7))) return_cmd_error(STR_ERROR_STATION_DISALLOWED_NUMBER_TRACKS);
if (HasBit(statspec->disallowed_lengths, std::min(plat_len - 1, 7))) return_cmd_error(STR_ERROR_STATION_DISALLOWED_LENGTH);
/* Check if the station is buildable */
if (HasBit(statspec->callback_mask, CBM_STATION_AVAIL)) {