diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/airport_gui.cpp | 12 | ||||
-rw-r--r-- | src/dock_gui.cpp | 10 | ||||
-rw-r--r-- | src/rail_gui.cpp | 126 | ||||
-rw-r--r-- | src/road_gui.cpp | 10 | ||||
-rw-r--r-- | src/settings.cpp | 4 | ||||
-rw-r--r-- | src/settings_type.h | 4 | ||||
-rw-r--r-- | src/station_gui.cpp | 2 | ||||
-rw-r--r-- | src/station_gui.h | 2 |
8 files changed, 87 insertions, 83 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 39e600402..b55a86b67 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -175,8 +175,8 @@ public: AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) { - this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_station_show_coverage); - this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage); + this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage); + this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage); this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT); if (_settings_game.economy.station_noise_level) { @@ -214,7 +214,7 @@ public: int rad = _settings_game.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED; - if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); + if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); this->DrawWidgets(); @@ -250,9 +250,9 @@ public: break; case BAW_BTN_DONTHILIGHT: case BAW_BTN_DOHILIGHT: - _station_show_coverage = (widget != BAW_BTN_DONTHILIGHT); - this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_station_show_coverage); - this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage); + _settings_client.gui.station_show_coverage = (widget != BAW_BTN_DONTHILIGHT); + this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage); + this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage); SndPlayFx(SND_15_BEEP); this->SetDirty(); break; diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 943568af6..1de5899b0 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -330,7 +330,7 @@ private: public: BuildDocksStationWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) { - this->LowerWidget(_station_show_coverage + BDSW_LT_OFF); + this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF); this->FindWindowPlacementAndResize(desc); } @@ -340,7 +340,7 @@ public: this->DrawWidgets(); - if (_station_show_coverage) { + if (_settings_client.gui.station_show_coverage) { SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); } else { SetTileSelectSize(1, 1); @@ -360,9 +360,9 @@ public: switch (widget) { case BDSW_LT_OFF: case BDSW_LT_ON: - this->RaiseWidget(_station_show_coverage + BDSW_LT_OFF); - _station_show_coverage = (widget != BDSW_LT_OFF); - this->LowerWidget(_station_show_coverage + BDSW_LT_OFF); + this->RaiseWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF); + _settings_client.gui.station_show_coverage = (widget != BDSW_LT_OFF); + this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF); SndPlayFx(SND_15_BEEP); this->SetDirty(); break; diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 713a0ab93..c6fd07b8a 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -57,9 +57,6 @@ static const SignalType _default_signal_type[] = {SIGTYPE_NORMAL, SIGTYPE_PBS, S 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 bool newstations; ///< Are custom station definitions available? StationClassIDByte station_class; ///< Currently selected custom station class (if newstations is \c true ) @@ -187,12 +184,12 @@ static void PlaceRail_Station(TileIndex tile) if (_remove_button_clicked) { VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_REMOVE_STATION); VpSetPlaceSizingLimit(-1); - } else if (_railstation.dragdrop) { + } else if (_settings_client.gui.station_dragdrop) { VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION); VpSetPlaceSizingLimit(_settings_game.station.station_spread); } else { DoCommandP(tile, - _railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16) | (_ctrl_pressed << 24), + _railstation.orientation | (_settings_client.gui.station_numtracks << 8) | (_settings_client.gui.station_platlength << 16) | (_ctrl_pressed << 24), _cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION), CcStation); } @@ -482,16 +479,16 @@ static void BuildRailClick_Remove(Window *w) if (w->IsWidgetLowered(RTW_BUILD_STATION)) { if (_remove_button_clicked) { /* starting drag & drop remove */ - if (!_railstation.dragdrop) { + if (!_settings_client.gui.station_dragdrop) { SetTileSelectSize(1, 1); } else { VpSetPlaceSizingLimit(-1); } } else { /* starting station build mode */ - if (!_railstation.dragdrop) { - int x = _railstation.numtracks; - int y = _railstation.platlength; + if (!_settings_client.gui.station_dragdrop) { + int x = _settings_client.gui.station_numtracks; + int y = _settings_client.gui.station_platlength; if (_railstation.orientation == 0) Swap(x, y); SetTileSelectSize(x, y); } else { @@ -925,30 +922,30 @@ private: /** * Verify whether the currently selected station size is allowed after selecting a new station class/type. - * If not, change the station size variables ( _railstation.numtracks and _railstation.platlength ). + * If not, change the station size variables ( _settings_client.gui.station_numtracks and _settings_client.gui.station_platlength ). * @param statspec Specification of the new station class/type */ void CheckSelectedSize(const StationSpec *statspec) { - if (statspec == NULL || _railstation.dragdrop) return; + 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 (HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { - this->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); - _railstation.numtracks = 1; - while (HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { - _railstation.numtracks++; + if (HasBit(statspec->disallowed_platforms, _settings_client.gui.station_numtracks - 1)) { + this->RaiseWidget(_settings_client.gui.station_numtracks + BRSW_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++; } - this->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); + this->LowerWidget(_settings_client.gui.station_numtracks + BRSW_PLATFORM_NUM_BEGIN); } - if (HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { - this->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); - _railstation.platlength = 1; - while (HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) { - _railstation.platlength++; + if (HasBit(statspec->disallowed_lengths, _settings_client.gui.station_platlength - 1)) { + this->RaiseWidget(_settings_client.gui.station_platlength + BRSW_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++; } - this->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + this->LowerWidget(_settings_client.gui.station_platlength + BRSW_PLATFORM_LEN_BEGIN); } } @@ -974,14 +971,14 @@ public: BuildRailStationWindow(const WindowDesc *desc, Window *parent, bool newstation) : PickerWindowBase(desc, parent) { this->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X); - if (_railstation.dragdrop) { + if (_settings_client.gui.station_dragdrop) { this->LowerWidget(BRSW_PLATFORM_DRAG_N_DROP); } else { - this->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); - this->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + this->LowerWidget(_settings_client.gui.station_numtracks + BRSW_PLATFORM_NUM_BEGIN); + this->LowerWidget(_settings_client.gui.station_platlength + BRSW_PLATFORM_LEN_BEGIN); } - this->SetWidgetLoweredState(BRSW_HIGHLIGHT_OFF, !_station_show_coverage); - this->SetWidgetLoweredState(BRSW_HIGHLIGHT_ON, _station_show_coverage); + this->SetWidgetLoweredState(BRSW_HIGHLIGHT_OFF, !_settings_client.gui.station_show_coverage); + this->SetWidgetLoweredState(BRSW_HIGHLIGHT_ON, _settings_client.gui.station_show_coverage); this->FindWindowPlacementAndResize(desc); @@ -1002,11 +999,11 @@ public: DrawPixelInfo tmp_dpi, *old_dpi; const StationSpec *statspec = newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL; - if (_railstation.dragdrop) { + if (_settings_client.gui.station_dragdrop) { SetTileSelectSize(1, 1); } else { - int x = _railstation.numtracks; - int y = _railstation.platlength; + int x = _settings_client.gui.station_numtracks; + int y = _settings_client.gui.station_platlength; if (_railstation.orientation == AXIS_X) Swap(x, y); if (!_remove_button_clicked) SetTileSelectSize(x, y); @@ -1014,7 +1011,7 @@ public: int rad = (_settings_game.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED; - if (_station_show_coverage) + if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); for (uint bits = 0; bits < 7; bits++) { @@ -1106,26 +1103,28 @@ public: case BRSW_PLATFORM_NUM_5: case BRSW_PLATFORM_NUM_6: case BRSW_PLATFORM_NUM_7: { - this->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); + this->RaiseWidget(_settings_client.gui.station_numtracks + BRSW_PLATFORM_NUM_BEGIN); this->RaiseWidget(BRSW_PLATFORM_DRAG_N_DROP); - _railstation.numtracks = widget - BRSW_PLATFORM_NUM_BEGIN; - _railstation.dragdrop = false; + _settings_client.gui.station_numtracks = widget - BRSW_PLATFORM_NUM_BEGIN; + _settings_client.gui.station_dragdrop = false; + + _settings_client.gui.station_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)) { + if (statspec != NULL && HasBit(statspec->disallowed_lengths, _settings_client.gui.station_platlength - 1)) { /* The previously selected number of platforms in invalid */ for (uint i = 0; i < 7; i++) { if (!HasBit(statspec->disallowed_lengths, i)) { - this->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); - _railstation.platlength = i + 1; + this->RaiseWidget(_settings_client.gui.station_platlength + BRSW_PLATFORM_LEN_BEGIN); + _settings_client.gui.station_platlength = i + 1; break; } } } - this->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); - this->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + this->LowerWidget(_settings_client.gui.station_numtracks + BRSW_PLATFORM_NUM_BEGIN); + this->LowerWidget(_settings_client.gui.station_platlength + BRSW_PLATFORM_LEN_BEGIN); SndPlayFx(SND_15_BEEP); this->SetDirty(); break; @@ -1138,67 +1137,71 @@ public: case BRSW_PLATFORM_LEN_5: case BRSW_PLATFORM_LEN_6: case BRSW_PLATFORM_LEN_7: { - this->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + this->RaiseWidget(_settings_client.gui.station_platlength + BRSW_PLATFORM_LEN_BEGIN); this->RaiseWidget(BRSW_PLATFORM_DRAG_N_DROP); - _railstation.platlength = widget - BRSW_PLATFORM_LEN_BEGIN; - _railstation.dragdrop = false; + _settings_client.gui.station_platlength = widget - BRSW_PLATFORM_LEN_BEGIN; + _settings_client.gui.station_dragdrop = false; + + _settings_client.gui.station_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)) { + if (statspec != NULL && HasBit(statspec->disallowed_platforms, _settings_client.gui.station_numtracks - 1)) { /* The previously selected number of tracks in invalid */ for (uint i = 0; i < 7; i++) { if (!HasBit(statspec->disallowed_platforms, i)) { - this->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); - _railstation.numtracks = i + 1; + this->RaiseWidget(_settings_client.gui.station_numtracks + BRSW_PLATFORM_NUM_BEGIN); + _settings_client.gui.station_numtracks = i + 1; break; } } } - this->LowerWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); - this->LowerWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); + this->LowerWidget(_settings_client.gui.station_numtracks + BRSW_PLATFORM_NUM_BEGIN); + this->LowerWidget(_settings_client.gui.station_platlength + BRSW_PLATFORM_LEN_BEGIN); SndPlayFx(SND_15_BEEP); this->SetDirty(); break; } case BRSW_PLATFORM_DRAG_N_DROP: { - _railstation.dragdrop ^= true; + _settings_client.gui.station_dragdrop ^= true; + this->ToggleWidgetLoweredState(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)) { + if (statspec != NULL && HasBit(statspec->disallowed_lengths, _settings_client.gui.station_platlength - 1)) { for (uint i = 0; i < 7; i++) { if (!HasBit(statspec->disallowed_lengths, i)) { - this->RaiseWidget(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN); - _railstation.platlength = i + 1; + this->RaiseWidget(_settings_client.gui.station_platlength + BRSW_PLATFORM_LEN_BEGIN); + _settings_client.gui.station_platlength = i + 1; break; } } } - if (statspec != NULL && HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) { + if (statspec != NULL && HasBit(statspec->disallowed_platforms, _settings_client.gui.station_numtracks - 1)) { for (uint i = 0; i < 7; i++) { if (!HasBit(statspec->disallowed_platforms, i)) { - this->RaiseWidget(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN); - _railstation.numtracks = i + 1; + this->RaiseWidget(_settings_client.gui.station_numtracks + BRSW_PLATFORM_NUM_BEGIN); + _settings_client.gui.station_numtracks = i + 1; break; } } } - this->SetWidgetLoweredState(_railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN, !_railstation.dragdrop); - this->SetWidgetLoweredState(_railstation.platlength + BRSW_PLATFORM_LEN_BEGIN, !_railstation.dragdrop); + this->SetWidgetLoweredState(_settings_client.gui.station_numtracks + BRSW_PLATFORM_NUM_BEGIN, !_settings_client.gui.station_dragdrop); + this->SetWidgetLoweredState(_settings_client.gui.station_platlength + BRSW_PLATFORM_LEN_BEGIN, !_settings_client.gui.station_dragdrop); SndPlayFx(SND_15_BEEP); this->SetDirty(); } break; case BRSW_HIGHLIGHT_OFF: case BRSW_HIGHLIGHT_ON: - _station_show_coverage = (widget != BRSW_HIGHLIGHT_OFF); - this->SetWidgetLoweredState(BRSW_HIGHLIGHT_OFF, !_station_show_coverage); - this->SetWidgetLoweredState(BRSW_HIGHLIGHT_ON, _station_show_coverage); + _settings_client.gui.station_show_coverage = (widget != BRSW_HIGHLIGHT_OFF); + + this->SetWidgetLoweredState(BRSW_HIGHLIGHT_OFF, !_settings_client.gui.station_show_coverage); + this->SetWidgetLoweredState(BRSW_HIGHLIGHT_ON, _settings_client.gui.station_show_coverage); SndPlayFx(SND_15_BEEP); this->SetDirty(); break; @@ -1691,9 +1694,6 @@ static void ShowBuildWaypointPicker(Window *parent) void InitializeRailGui() { _build_depot_direction = DIAGDIR_NW; - _railstation.numtracks = 1; - _railstation.platlength = 1; - _railstation.dragdrop = true; } /** diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 938adc10f..7d3f79825 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -831,7 +831,7 @@ public: for (uint i = BRSW_STATION_NE; i < BRSW_LT_OFF; i++) this->widget[i].tooltips = _road_type_infos[_cur_roadtype].picker_tooltip[rs]; this->LowerWidget(_road_station_picker_orientation + BRSW_STATION_NE); - this->LowerWidget(_station_show_coverage + BRSW_LT_OFF); + this->LowerWidget(_settings_client.gui.station_show_coverage + BRSW_LT_OFF); this->FindWindowPlacementAndResize(desc); } @@ -839,7 +839,7 @@ public: { this->DrawWidgets(); - if (_station_show_coverage) { + if (_settings_client.gui.station_show_coverage) { int rad = _settings_game.station.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED; SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); } else { @@ -887,9 +887,9 @@ public: case BRSW_LT_OFF: case BRSW_LT_ON: - this->RaiseWidget(_station_show_coverage + BRSW_LT_OFF); - _station_show_coverage = (widget != BRSW_LT_OFF); - this->LowerWidget(_station_show_coverage + BRSW_LT_OFF); + this->RaiseWidget(_settings_client.gui.station_show_coverage + BRSW_LT_OFF); + _settings_client.gui.station_show_coverage = (widget != BRSW_LT_OFF); + this->LowerWidget(_settings_client.gui.station_show_coverage + BRSW_LT_OFF); SndPlayFx(SND_15_BEEP); this->SetDirty(); break; diff --git a/src/settings.cpp b/src/settings.cpp index fe8715f18..115616b68 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1461,6 +1461,10 @@ const SettingDesc _patch_settings[] = { SDTC_BOOL(gui.show_track_reservation, S, 0, false, STR_CONFIG_PATCHES_SHOW_TRACK_RESERVATION, RedrawScreen), SDTC_VAR(gui.default_signal_type, SLE_UINT8, S, MS, 0, 0, 2, 1, STR_CONFIG_PATCHES_DEFAULT_SIGNAL_TYPE, NULL), SDTC_VAR(gui.cycle_signal_types, SLE_UINT8, S, MS, 0, 0, 2, 1, STR_CONFIG_PATCHES_CYCLE_SIGNAL_TYPES, NULL), + SDTC_VAR(gui.station_numtracks, SLE_UINT8, S, 0, 1, 1, 7, 0, STR_NULL, NULL), + SDTC_VAR(gui.station_platlength, SLE_UINT8, S, 0, 5, 1, 7, 0, STR_NULL, NULL), + SDTC_BOOL(gui.station_dragdrop, S, 0, true, STR_NULL, NULL), + SDTC_BOOL(gui.station_show_coverage, S, 0, false, STR_NULL, NULL), SDTC_VAR(gui.console_backlog_timeout, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL), SDTC_VAR(gui.console_backlog_length, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL), diff --git a/src/settings_type.h b/src/settings_type.h index 3cb58e960..5d7504053 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -83,6 +83,10 @@ struct GUISettings { bool show_track_reservation; ///< highlight reserved tracks. uint8 default_signal_type; ///< the signal type to build by default. uint8 cycle_signal_types; ///< what signal types to cycle with the build signal tool. + byte station_numtracks; ///< the number of platforms to default on for rail stations + byte station_platlength; ///< the platform length, in tiles, for rail stations + bool station_dragdrop; ///< whether drag and drop is enabled for stations + bool station_show_coverage; ///< whether to highlight coverage area uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity. uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed. diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 471173f13..2873b13be 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -32,8 +32,6 @@ #include "table/strings.h" #include "table/sprites.h" -bool _station_show_coverage; - /** * Draw small boxes of cargo amount and ratings data at the given * coordinates. If amount exceeds 576 units, it is shown 'full', same diff --git a/src/station_gui.h b/src/station_gui.h index 3435ff16d..a2e108268 100644 --- a/src/station_gui.h +++ b/src/station_gui.h @@ -57,6 +57,4 @@ enum StationCoverageType { int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad, bool supplies); void CheckRedrawStationCoverage(const Window *w); -extern bool _station_show_coverage; - #endif /* STATION_GUI_H */ |