MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OnHotkey

Method OnHotkey

src/vehicle_gui.cpp:3308–3320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3306 }
3307
3308 EventState OnHotkey(int hotkey) override
3309 {
3310 /* If the hotkey is not for any widget in the UI (i.e. for honking) */
3311 if (hotkey == WID_VV_HONK_HORN) {
3312 const Window *mainwindow = GetMainWindow();
3313 const Vehicle *v = Vehicle::Get(window_number);
3314 /* Only play the sound if we're following this vehicle */
3315 if (mainwindow->viewport->follow_vehicle == v->index) {
3316 v->PlayLeaveStationSound(true);
3317 }
3318 }
3319 return Window::OnHotkey(hotkey);
3320 }
3321
3322 void OnQueryTextFinished(std::optional<std::string> str) override
3323 {

Callers

nothing calls this directly

Calls 2

GetMainWindowFunction · 0.85
PlayLeaveStationSoundMethod · 0.45

Tested by

no test coverage detected