diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index de467e0a5c..48b34bbd00 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -509,7 +509,7 @@ public: this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage); this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage); this->SetDirty(); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->UpdateSelectSize(); SetViewportCatchmentStation(nullptr, true); break; diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 68f3959e90..4e44efc3d9 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -469,7 +469,7 @@ public: 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); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); SetViewportCatchmentStation(nullptr, true); break; @@ -580,7 +580,7 @@ public: this->RaiseWidget(WID_BDD_X + _ship_depot_direction); _ship_depot_direction = (widget == WID_BDD_X ? AXIS_X : AXIS_Y); this->LowerWidget(WID_BDD_X + _ship_depot_direction); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); UpdateDocksDirection(); this->SetDirty(); break; diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index bcda461abe..52fb82a941 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -323,7 +323,7 @@ static void StartGeneratingLandscape(GenerateLandscapeWindowMode mode) MakeNewgameSettingsLive(); ResetGRFConfig(true); - if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP); + SndConfirmBeep(); switch (mode) { case GLWM_GENERATE: _switch_mode = (_game_mode == GM_EDITOR) ? SM_GENRANDLAND : SM_NEWGAME; break; case GLWM_HEIGHTMAP: _switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_HEIGHTMAP : SM_START_HEIGHTMAP; break; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 0c69a29927..a4f94228e2 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -3076,7 +3076,7 @@ struct IndustryCargoesWindow : public Window { case WID_IC_NOTIFY: this->ToggleWidgetLoweredState(WID_IC_NOTIFY); this->SetWidgetDirty(WID_IC_NOTIFY); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); if (this->IsWidgetLowered(WID_IC_NOTIFY)) { if (FindWindowByClass(WC_SMALLMAP) == nullptr) ShowSmallMap(); diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 57e991b3ad..841cd5b5b5 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -64,7 +64,7 @@ bool HandlePlacePushButton(Window *w, WidgetID widget, CursorID cursor, HighLigh { if (w->IsWidgetDisabled(widget)) return false; - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); w->SetDirty(); if (w->IsWidgetLowered(widget)) { diff --git a/src/object_gui.cpp b/src/object_gui.cpp index dc80fbc8c6..6f1207e585 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -319,7 +319,7 @@ public: if (_object_gui.sel_type != std::numeric_limits::max()) { _object_gui.sel_view = this->GetWidget(widget)->GetParentWidget()->GetCurrentElement(); this->InvalidateData(PickerInvalidation::Position); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); } break; diff --git a/src/picker_gui.cpp b/src/picker_gui.cpp index 196d5d7b9d..bad1956769 100644 --- a/src/picker_gui.cpp +++ b/src/picker_gui.cpp @@ -384,7 +384,7 @@ void PickerWindow::OnClick(Point pt, WidgetID widget, int) this->callbacks.SetSelectedClass(*it); this->InvalidateData({PickerInvalidation::Type, PickerInvalidation::Position, PickerInvalidation::Validate}); } - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); CloseWindowById(WC_SELECT_STATION, 0); break; } @@ -434,7 +434,7 @@ void PickerWindow::OnClick(Point pt, WidgetID widget, int) this->callbacks.SetSelectedType(item.index); this->InvalidateData(PickerInvalidation::Position); } - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); CloseWindowById(WC_SELECT_STATION, 0); break; } diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 291039204a..84fb88cd51 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -357,7 +357,7 @@ static void BuildRailClick_Remove(Window *w) { if (w->IsWidgetDisabled(WID_RAT_REMOVE)) return; ToggleRailButton_Remove(w); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); /* handle station builder */ if (w->IsWidgetLowered(WID_RAT_BUILD_STATION)) { @@ -1239,7 +1239,7 @@ public: this->RaiseWidget(WID_BRAS_PLATFORM_DIR_X + _station_gui.axis); _station_gui.axis = (Axis)(widget - WID_BRAS_PLATFORM_DIR_X); this->LowerWidget(WID_BRAS_PLATFORM_DIR_X + _station_gui.axis); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); CloseWindowById(WC_SELECT_STATION, 0); break; @@ -1271,7 +1271,7 @@ public: this->LowerWidget(_settings_client.gui.station_numtracks + WID_BRAS_PLATFORM_NUM_BEGIN); this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); CloseWindowById(WC_SELECT_STATION, 0); break; @@ -1304,7 +1304,7 @@ public: this->LowerWidget(_settings_client.gui.station_numtracks + WID_BRAS_PLATFORM_NUM_BEGIN); this->LowerWidget(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); CloseWindowById(WC_SELECT_STATION, 0); break; @@ -1338,7 +1338,7 @@ public: this->SetWidgetLoweredState(_settings_client.gui.station_numtracks + WID_BRAS_PLATFORM_NUM_BEGIN, !_settings_client.gui.station_dragdrop); this->SetWidgetLoweredState(_settings_client.gui.station_platlength + WID_BRAS_PLATFORM_LEN_BEGIN, !_settings_client.gui.station_dragdrop); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); CloseWindowById(WC_SELECT_STATION, 0); break; @@ -1350,7 +1350,7 @@ public: this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_OFF, !_settings_client.gui.station_show_coverage); this->SetWidgetLoweredState(WID_BRAS_HIGHLIGHT_ON, _settings_client.gui.station_show_coverage); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); SetViewportCatchmentStation(nullptr, true); break; @@ -1743,7 +1743,7 @@ struct BuildRailDepotWindow : public PickerWindowBase { this->RaiseWidget(WID_BRAD_DEPOT_NE + _build_depot_direction); _build_depot_direction = (DiagDirection)(widget - WID_BRAD_DEPOT_NE); this->LowerWidget(WID_BRAD_DEPOT_NE + _build_depot_direction); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); break; } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index d53b21668d..46c59c82c9 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -582,7 +582,7 @@ struct BuildRoadToolbarWindow : Window { CloseWindowById(WC_SELECT_STATION, 0); ToggleRoadButton_Remove(this); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); break; case WID_ROT_CONVERT_ROAD: @@ -1145,7 +1145,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase { this->RaiseWidget(WID_BROD_DEPOT_NE + _road_depot_orientation); _road_depot_orientation = (DiagDirection)(widget - WID_BROD_DEPOT_NE); this->LowerWidget(WID_BROD_DEPOT_NE + _road_depot_orientation); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); break; @@ -1477,7 +1477,7 @@ public: this->RaiseWidget(WID_BROS_STATION_NE + _roadstop_gui.orientation); _roadstop_gui.orientation = (DiagDirection)(widget - WID_BROS_STATION_NE); this->LowerWidget(WID_BROS_STATION_NE + _roadstop_gui.orientation); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); CloseWindowById(WC_SELECT_STATION, 0); break; @@ -1487,7 +1487,7 @@ public: this->RaiseWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF); _settings_client.gui.station_show_coverage = (widget != WID_BROS_LT_OFF); this->LowerWidget(_settings_client.gui.station_show_coverage + WID_BROS_LT_OFF); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); SetViewportCatchmentStation(nullptr, true); break; diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 9c4220c42a..8361bc1191 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1717,7 +1717,7 @@ public: const NWidgetBase *wid = this->GetWidget(WID_SM_MAP); Point zoom_pt = { (int)wid->current_x / 2, (int)wid->current_y / 2}; this->SetZoomLevel((widget == WID_SM_ZOOM_IN) ? ZLC_ZOOM_IN : ZLC_ZOOM_OUT, &zoom_pt); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); break; } @@ -1729,13 +1729,13 @@ public: case WID_SM_VEGETATION: // Show vegetation case WID_SM_OWNERS: // Show land owners this->SwitchMapType((SmallMapType)(widget - WID_SM_CONTOUR)); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); break; case WID_SM_CENTERMAP: // Center the smallmap again this->SmallMapCenterOnCurrentPos(); this->HandleButtonClick(WID_SM_CENTERMAP); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); break; case WID_SM_TOGGLETOWNNAME: // Toggle town names @@ -1743,7 +1743,7 @@ public: this->SetWidgetLoweredState(WID_SM_TOGGLETOWNNAME, this->show_towns); this->SetDirty(); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); break; case WID_SM_SHOW_IND_NAMES: // Toggle industry names @@ -1751,7 +1751,7 @@ public: this->SetWidgetLoweredState(WID_SM_SHOW_IND_NAMES, this->show_ind_names); this->SetDirty(); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); break; case WID_SM_LEGEND: // Legend diff --git a/src/sound.cpp b/src/sound.cpp index c56ff5cd91..49a3478a2d 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -247,6 +247,22 @@ void SndPlayFx(SoundID sound) StartSound(sound, 0.5, UINT8_MAX); } +/** + * Play a beep sound for a click event if enabled in settings. + */ +void SndClickBeep() +{ + if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); +} + +/** + * Play a beep sound for a confirm event if enabled in settings. + */ +void SndConfirmBeep() +{ + if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP); +} + /** Names corresponding to the sound set's files */ static const std::string_view _sound_file_names[] = { "samples" }; diff --git a/src/sound_func.h b/src/sound_func.h index 164df9fc24..9879c7c92e 100644 --- a/src/sound_func.h +++ b/src/sound_func.h @@ -21,4 +21,7 @@ void SndPlayVehicleFx(SoundID sound, const Vehicle *v); void SndPlayFx(SoundID sound); void SndCopyToPool(); +void SndClickBeep(); +void SndConfirmBeep(); + #endif /* SOUND_FUNC_H */ diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 346b728cc6..ada8b68918 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -621,7 +621,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { if (!IsInsideMM(size, 1, 8 + 1)) return; _terraform_size = size; - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); break; } diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index a82d581990..136cf7e303 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -117,7 +117,7 @@ public: static void PopupMainToolbarMenu(Window *w, WidgetID widget, DropDownList &&list, int def) { ShowDropDownList(w, std::move(list), def, widget, 0, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); } /** @@ -204,7 +204,7 @@ static CallBackFunction ToolbarPauseClick(Window *) if (_networking && !_network_server) return CBF_NONE; // only server can pause the game if (Command::Post(PauseMode::Normal, _pause_mode.None())) { - if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP); + SndConfirmBeep(); } return CBF_NONE; } @@ -220,7 +220,7 @@ static CallBackFunction ToolbarFastForwardClick(Window *) ChangeGameSpeed(_game_speed == 100); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -291,7 +291,7 @@ static CallBackFunction ToolbarOptionsClick(Window *w) list.push_back(MakeDropDownListCheckedItem(IsTransparencySet(TO_SIGNS), STR_SETTINGS_MENU_TRANSPARENT_SIGNS, OME_SHOW_STATIONSIGNS)); ShowDropDownList(w, std::move(list), 0, WID_TN_SETTINGS, 140, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -684,7 +684,7 @@ static CallBackFunction ToolbarGraphsClick(Window *w) if (_toolbar_mode != TB_NORMAL) AddDropDownLeagueTableOptions(list); ShowDropDownList(w, std::move(list), GRMN_OPERATING_PROFIT_GRAPH, WID_TN_GRAPHS, 140, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -697,7 +697,7 @@ static CallBackFunction ToolbarLeagueClick(Window *w) int selected = list[0]->result; ShowDropDownList(w, std::move(list), selected, WID_TN_LEAGUE, 140, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -857,7 +857,7 @@ static CallBackFunction ToolbarZoomInClick(Window *w) { if (DoZoomInOutWindow(ZOOM_IN, GetMainWindow())) { w->HandleButtonClick((_game_mode == GM_EDITOR) ? (WidgetID)WID_TE_ZOOM_IN : (WidgetID)WID_TN_ZOOM_IN); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); } return CBF_NONE; } @@ -868,7 +868,7 @@ static CallBackFunction ToolbarZoomOutClick(Window *w) { if (DoZoomInOutWindow(ZOOM_OUT, GetMainWindow())) { w->HandleButtonClick((_game_mode == GM_EDITOR) ? (WidgetID)WID_TE_ZOOM_OUT : (WidgetID)WID_TN_ZOOM_OUT); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); } return CBF_NONE; } @@ -878,7 +878,7 @@ static CallBackFunction ToolbarZoomOutClick(Window *w) static CallBackFunction ToolbarBuildRailClick(Window *w) { ShowDropDownList(w, GetRailTypeDropDownList(), _last_built_railtype, WID_TN_RAILS, 140, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -900,7 +900,7 @@ static CallBackFunction MenuClickBuildRail(int index) static CallBackFunction ToolbarBuildRoadClick(Window *w) { ShowDropDownList(w, GetRoadTypeDropDownList(RTTB_ROAD), _last_built_roadtype, WID_TN_ROADS, 140, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -922,7 +922,7 @@ static CallBackFunction MenuClickBuildRoad(int index) static CallBackFunction ToolbarBuildTramClick(Window *w) { ShowDropDownList(w, GetRoadTypeDropDownList(RTTB_TRAM), _last_built_tramtype, WID_TN_TRAMS, 140, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -946,7 +946,7 @@ static CallBackFunction ToolbarBuildWaterClick(Window *w) DropDownList list; list.push_back(MakeDropDownListIconItem(SPR_IMG_BUILD_CANAL, PAL_NONE, STR_WATERWAYS_MENU_WATERWAYS_CONSTRUCTION, 0)); ShowDropDownList(w, std::move(list), 0, WID_TN_WATER, 140, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -968,7 +968,7 @@ static CallBackFunction ToolbarBuildAirClick(Window *w) DropDownList list; list.push_back(MakeDropDownListIconItem(SPR_IMG_AIRPORT, PAL_NONE, STR_AIRCRAFT_MENU_AIRPORT_CONSTRUCTION, 0)); ShowDropDownList(w, std::move(list), 0, WID_TN_AIR, 140, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -992,7 +992,7 @@ static CallBackFunction ToolbarForestClick(Window *w) list.push_back(MakeDropDownListIconItem(SPR_IMG_PLANTTREES, PAL_NONE, STR_LANDSCAPING_MENU_PLANT_TREES, 1)); list.push_back(MakeDropDownListIconItem(SPR_IMG_SIGN, PAL_NONE, STR_LANDSCAPING_MENU_PLACE_SIGN, 2)); ShowDropDownList(w, std::move(list), 0, WID_TN_LANDSCAPE, 100, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -1188,7 +1188,7 @@ static CallBackFunction ToolbarSwitchClick(Window *w) w->ReInit(); w->SetWidgetLoweredState(_game_mode == GM_EDITOR ? (WidgetID)WID_TE_SWITCH_BAR : (WidgetID)WID_TN_SWITCH_BAR, _toolbar_mode == TB_LOWER); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -1232,7 +1232,7 @@ static CallBackFunction ToolbarScenDateForward(Window *w) static CallBackFunction ToolbarScenGenLand(Window *w) { w->HandleButtonClick(WID_TE_LAND_GENERATE); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); ShowEditorTerraformToolbar(); return CBF_NONE; @@ -1256,7 +1256,7 @@ static CallBackFunction ToolbarScenGenTown(int index) static CallBackFunction ToolbarScenGenIndustry(Window *w) { w->HandleButtonClick(WID_TE_INDUSTRY); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); ShowBuildIndustryWindow(); return CBF_NONE; } @@ -1264,7 +1264,7 @@ static CallBackFunction ToolbarScenGenIndustry(Window *w) static CallBackFunction ToolbarScenBuildRoadClick(Window *w) { ShowDropDownList(w, GetScenRoadTypeDropDownList(RTTB_ROAD), _last_built_roadtype, WID_TE_ROADS, 140, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -1284,7 +1284,7 @@ static CallBackFunction ToolbarScenBuildRoad(int index) static CallBackFunction ToolbarScenBuildTramClick(Window *w) { ShowDropDownList(w, GetScenRoadTypeDropDownList(RTTB_TRAM), _last_built_tramtype, WID_TE_TRAMS, 140, true); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return CBF_NONE; } @@ -1304,7 +1304,7 @@ static CallBackFunction ToolbarScenBuildTram(int index) static CallBackFunction ToolbarScenBuildDocks(Window *w) { w->HandleButtonClick(WID_TE_WATER); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); ShowBuildDocksScenToolbar(); return CBF_NONE; } @@ -1312,7 +1312,7 @@ static CallBackFunction ToolbarScenBuildDocks(Window *w) static CallBackFunction ToolbarScenPlantTrees(Window *w) { w->HandleButtonClick(WID_TE_TREES); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); ShowBuildTreesToolbar(); return CBF_NONE; } @@ -1320,7 +1320,7 @@ static CallBackFunction ToolbarScenPlantTrees(Window *w) static CallBackFunction ToolbarScenPlaceSign(Window *w) { w->HandleButtonClick(WID_TE_SIGNS); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); return SelectSignTool(); } @@ -2407,7 +2407,7 @@ struct ScenarioEditorToolbarWindow : Window { { CallBackFunction cbf = _scen_toolbar_dropdown_procs[widget](index); if (cbf != CBF_NONE) _last_started_action = cbf; - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); } EventState OnHotkey(int hotkey) override diff --git a/src/town_gui.cpp b/src/town_gui.cpp index e8904c03b4..1b3e2df675 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -1739,7 +1739,7 @@ struct BuildHouseWindow : public PickerWindow { this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !BuildHouseWindow::house_protected); this->SetWidgetLoweredState(WID_BH_PROTECT_ON, BuildHouseWindow::house_protected); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); this->SetDirty(); break; diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 889f73f58b..0c768f59ff 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -80,7 +80,7 @@ public: } else { /* toggle the bit of the transparencies variable and play a sound */ ToggleTransparency((TransparencyOption)(widget - WID_TT_BEGIN)); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); MarkWholeScreenDirty(); } } else if (widget == WID_TT_BUTTONS) { @@ -94,7 +94,7 @@ public: if (i == WID_TT_TEXT|| i == WID_TT_END) return; ToggleInvisibility((TransparencyOption)(i - WID_TT_BEGIN)); - if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); + SndClickBeep(); /* Redraw whole screen only if transparency is set */ if (IsTransparencySet((TransparencyOption)(i - WID_TT_BEGIN))) { diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index 79cf837db3..8bf4d15af3 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -102,7 +102,7 @@ class BuildTreesWindow : public Window if (this->tree_to_plant >= 0) { /* Activate placement */ - if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP); + SndConfirmBeep(); SetObjectToPlace(SPR_CURSOR_TREE, PAL_NONE, HT_RECT | HT_DIAGONAL, this->window_class, this->window_number); this->tree_to_plant = current_tree; // SetObjectToPlace may call ResetObjectToPlace which may reset tree_to_plant to -1 } else { @@ -180,7 +180,7 @@ public: break; case WID_BT_MANY_RANDOM: // place trees randomly over the landscape - if (_settings_client.sound.confirm) SndPlayFx(SND_15_BEEP); + SndConfirmBeep(); PlaceTreesRandomly(); MarkWholeScreenDirty(); break;