=== modified file 'src/rail_gui.cpp' --- src/rail_gui.cpp 2008-04-22 18:46:05 +0000 +++ src/rail_gui.cpp 2008-04-22 18:56:49 +0000 @@ -3,6 +3,7 @@ /** @file rail_gui.cpp File for dealing with rail construction user interface */ #include "stdafx.h" +#include "direction_type.h" #include "openttd.h" #include "tile_cmd.h" #include "landscape.h" @@ -50,8 +51,8 @@ static SignalVariant _cur_signal_variant; ///< set the signal variant (for signal GUI) static SignalType _cur_signal_type; ///< set the signal type (for signal GUI) -static struct { - byte orientation; ///< Currently selected rail station orientation +struct RailStationGUISettings { + Axis orientation; ///< Currently selected rail station orientation byte numtracks; ///< Currently selected number of tracks in station (if not \c dragdrop ) byte platlength; ///< Currently selected platform length of station (if not \c dragdrop ) bool dragdrop; ///< Use drag & drop to place a station @@ -60,7 +61,8 @@ StationClassIDByte station_class; ///< Currently selected custom station class (if newstations is \c true ) byte station_type; ///< Station type within the currently selected custom station class (if newstations is \c true ) byte station_count; ///< Number of custom stations (if newstations is \c true ) -} _railstation; +}; +static RailStationGUISettings _railstation; ///< Settings of the station builder GUI static void HandleStationPlacement(TileIndex start, TileIndex end); @@ -911,7 +913,7 @@ if (sy > ey) Swap(sy, ey); w = ex - sx + 1; h = ey - sy + 1; - if (!_railstation.orientation) Swap(w, h); + if (_railstation.orientation == AXIS_X) Swap(w, h); DoCommandP(TileXY(sx, sy), _railstation.orientation | (w << 8) | (h << 16) | (_ctrl_pressed << 24), @@ -996,7 +998,7 @@ } else { int x = _railstation.numtracks; int y = _railstation.platlength; - if (_railstation.orientation == 0) Swap(x, y); + if (_railstation.orientation == AXIS_X) Swap(x, y); if (!_remove_button_clicked) SetTileSelectSize(x, y); } @@ -1081,7 +1083,7 @@ case BRSW_PLATFORM_DIR_X: case BRSW_PLATFORM_DIR_Y: w->RaiseWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); - _railstation.orientation = e->we.click.widget - BRSW_PLATFORM_DIR_X; + _railstation.orientation = (Axis)(e->we.click.widget - BRSW_PLATFORM_DIR_X); w->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); SndPlayFx(SND_15_BEEP); SetWindowDirty(w);