mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r8999) -Fix [FS#450]: do not select a disabled platform length/number of track count when going out of drag-drop mode.
This commit is contained in:
parent
e33a8d3caa
commit
2061d6af27
|
@ -796,16 +796,31 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
|
||||||
case 8:
|
case 8:
|
||||||
case 9:
|
case 9:
|
||||||
case 10:
|
case 10:
|
||||||
case 11:
|
case 11: {
|
||||||
RaiseWindowWidget(w, _railstation.numtracks + 4);
|
RaiseWindowWidget(w, _railstation.numtracks + 4);
|
||||||
RaiseWindowWidget(w, 19);
|
RaiseWindowWidget(w, 19);
|
||||||
|
|
||||||
_railstation.numtracks = (e->we.click.widget - 5) + 1;
|
_railstation.numtracks = (e->we.click.widget - 5) + 1;
|
||||||
_railstation.dragdrop = false;
|
_railstation.dragdrop = false;
|
||||||
|
|
||||||
|
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
|
||||||
|
if (statspec != NULL && HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) {
|
||||||
|
/* The previously selected number of platforms in invalid */
|
||||||
|
for (uint i = 0; i < 7; i++) {
|
||||||
|
if (!HASBIT(statspec->disallowed_lengths, i)) {
|
||||||
|
RaiseWindowWidget(w, _railstation.platlength + 11);
|
||||||
|
_railstation.platlength = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LowerWindowWidget(w, _railstation.platlength + 11);
|
LowerWindowWidget(w, _railstation.platlength + 11);
|
||||||
LowerWindowWidget(w, _railstation.numtracks + 4);
|
LowerWindowWidget(w, _railstation.numtracks + 4);
|
||||||
SndPlayFx(SND_15_BEEP);
|
SndPlayFx(SND_15_BEEP);
|
||||||
SetWindowDirty(w);
|
SetWindowDirty(w);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 12:
|
case 12:
|
||||||
case 13:
|
case 13:
|
||||||
|
@ -813,16 +828,31 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
|
||||||
case 15:
|
case 15:
|
||||||
case 16:
|
case 16:
|
||||||
case 17:
|
case 17:
|
||||||
case 18:
|
case 18: {
|
||||||
RaiseWindowWidget(w, _railstation.platlength + 11);
|
RaiseWindowWidget(w, _railstation.platlength + 11);
|
||||||
RaiseWindowWidget(w, 19);
|
RaiseWindowWidget(w, 19);
|
||||||
|
|
||||||
_railstation.platlength = (e->we.click.widget - 12) + 1;
|
_railstation.platlength = (e->we.click.widget - 12) + 1;
|
||||||
_railstation.dragdrop = false;
|
_railstation.dragdrop = false;
|
||||||
|
|
||||||
|
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
|
||||||
|
if (statspec != NULL && HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
|
||||||
|
/* The previously selected number of tracks in invalid */
|
||||||
|
for (uint i = 0; i < 7; i++) {
|
||||||
|
if (!HASBIT(statspec->disallowed_platforms, i)) {
|
||||||
|
RaiseWindowWidget(w, _railstation.numtracks + 4);
|
||||||
|
_railstation.numtracks = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LowerWindowWidget(w, _railstation.platlength + 11);
|
LowerWindowWidget(w, _railstation.platlength + 11);
|
||||||
LowerWindowWidget(w, _railstation.numtracks + 4);
|
LowerWindowWidget(w, _railstation.numtracks + 4);
|
||||||
SndPlayFx(SND_15_BEEP);
|
SndPlayFx(SND_15_BEEP);
|
||||||
SetWindowDirty(w);
|
SetWindowDirty(w);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 19:
|
case 19:
|
||||||
_railstation.dragdrop ^= true;
|
_railstation.dragdrop ^= true;
|
||||||
|
|
Loading…
Reference in New Issue