(svn r26375) -Fix [FS#5929]: Station sizes > 8 were always allowed. (adf88)

This commit is contained in:
frosch 2014-02-24 19:57:18 +00:00
parent 62b22bfd2b
commit a9acaf7a5e
2 changed files with 12 additions and 8 deletions

View File

@ -894,23 +894,27 @@ private:
{
if (statspec == NULL || _settings_client.gui.station_dragdrop) return;
/* If current number of tracks is not allowed, make it as big as possible (which is always less than currently selected) */
/* If current number of tracks is not allowed, make it as big as possible */
if (HasBit(statspec->disallowed_platforms, _settings_client.gui.station_numtracks - 1)) {
this->RaiseWidget(_settings_client.gui.station_numtracks + WID_BRAS_PLATFORM_NUM_BEGIN);
_settings_client.gui.station_numtracks = 1;
while (HasBit(statspec->disallowed_platforms, _settings_client.gui.station_numtracks - 1)) {
_settings_client.gui.station_numtracks++;
if (statspec->disallowed_platforms != UINT8_MAX) {
while (HasBit(statspec->disallowed_platforms, _settings_client.gui.station_numtracks - 1)) {
_settings_client.gui.station_numtracks++;
}
this->LowerWidget(_settings_client.gui.station_numtracks + WID_BRAS_PLATFORM_NUM_BEGIN);
}
this->LowerWidget(_settings_client.gui.station_numtracks + WID_BRAS_PLATFORM_NUM_BEGIN);
}
if (HasBit(statspec->disallowed_lengths, _settings_client.gui.station_platlength - 1)) {
this->RaiseWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
_settings_client.gui.station_platlength = 1;
while (HasBit(statspec->disallowed_lengths, _settings_client.gui.station_platlength - 1)) {
_settings_client.gui.station_platlength++;
if (statspec->disallowed_lengths != UINT8_MAX) {
while (HasBit(statspec->disallowed_lengths, _settings_client.gui.station_platlength - 1)) {
_settings_client.gui.station_platlength++;
}
this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
}
this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN);
}
}

View File

@ -1213,7 +1213,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
/* Perform NewStation checks */
/* Check if the station size is permitted */
if (HasBit(statspec->disallowed_platforms, numtracks - 1) || HasBit(statspec->disallowed_lengths, plat_len - 1)) {
if (HasBit(statspec->disallowed_platforms, min(numtracks - 1, 7)) || HasBit(statspec->disallowed_lengths, min(plat_len - 1, 7))) {
return CMD_ERROR;
}