summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-21 09:59:10 +0000
committerrubidium <rubidium@openttd.org>2007-10-21 09:59:10 +0000
commitc5acd42ccc56f4d003b2d19e68a2d331524ad982 (patch)
tree76927d50b2b78f4244c75ed5a9b0283c512e2230 /src
parentfce4c5e2c2ab91109b5dbb2903feff2b9117b239 (diff)
downloadopenttd-c5acd42ccc56f4d003b2d19e68a2d331524ad982.tar.xz
(svn r11322) -Codechange: select an allowed station size when drag&drop is disabled. Patch by Wolf01.
Diffstat (limited to 'src')
-rw-r--r--src/rail_gui.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 14aa166b2..14077bde6 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -912,14 +912,36 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
break;
}
- case BRSW_PLATFORM_DRAG_N_DROP:
+ case BRSW_PLATFORM_DRAG_N_DROP: {
_railstation.dragdrop ^= true;
ToggleWidgetLoweredState(w, BRSW_PLATFORM_DRAG_N_DROP);
+
+ /* get the first allowed length/number of platforms */
+ const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
+ if (statspec != NULL && HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) {
+ for (uint i = 0; i < 7; i++) {
+ if (!HASBIT(statspec->disallowed_lengths, i)) {
+ RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN);
+ _railstation.platlength = i + 1;
+ break;
+ }
+ }
+ }
+ if (statspec != NULL && HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
+ for (uint i = 0; i < 7; i++) {
+ if (!HASBIT(statspec->disallowed_platforms, i)) {
+ RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN);
+ _railstation.numtracks = i + 1;
+ break;
+ }
+ }
+ }
+
SetWindowWidgetLoweredState(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN, !_railstation.dragdrop);
SetWindowWidgetLoweredState(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN, !_railstation.dragdrop);
SndPlayFx(SND_15_BEEP);
SetWindowDirty(w);
- break;
+ } break;
case BRSW_HIGHLIGHT_OFF:
case BRSW_HIGHLIGHT_ON: