diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index ca20a66ca1..0ee62cc01f 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -35,6 +35,7 @@ #include "vehicle_func.h" #include "zoom_func.h" #include "rail_gui.h" +#include "toolbar_gui.h" #include "station_cmd.h" #include "tunnelbridge_cmd.h" #include "waypoint_cmd.h" @@ -838,7 +839,6 @@ struct BuildRailToolbarWindow : Window { static EventState RailToolbarGlobalHotkeys(int hotkey) { if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED; - extern RailType _last_built_railtype; Window *w = ShowBuildRailToolbar(_last_built_railtype); if (w == nullptr) return ES_NOT_HANDLED; return w->OnHotkey(hotkey); @@ -1929,7 +1929,6 @@ void InitializeRailGui() */ void ReinitGuiAfterToggleElrail(bool disable) { - extern RailType _last_built_railtype; if (disable && _last_built_railtype == RAILTYPE_ELECTRIC) { _last_built_railtype = _cur_railtype = RAILTYPE_RAIL; BuildRailToolbarWindow *w = dynamic_cast(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL)); @@ -1943,7 +1942,6 @@ static void SetDefaultRailGui() { if (_local_company == COMPANY_SPECTATOR || !Company::IsValidID(_local_company)) return; - extern RailType _last_built_railtype; RailType rt; switch (_settings_client.gui.default_rail_type) { case 2: { diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 475be95796..42fc2e08a9 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -27,6 +27,7 @@ #include "company_base.h" #include "hotkeys.h" #include "road_gui.h" +#include "toolbar_gui.h" #include "zoom_func.h" #include "dropdown_type.h" #include "dropdown_func.h" @@ -862,13 +863,11 @@ struct BuildRoadToolbarWindow : Window { static EventState RoadToolbarGlobalHotkeys(int hotkey) { - extern RoadType _last_built_roadtype; return RoadTramToolbarGlobalHotkeys(hotkey, _last_built_roadtype, RTT_ROAD); } static EventState TramToolbarGlobalHotkeys(int hotkey) { - extern RoadType _last_built_tramtype; return RoadTramToolbarGlobalHotkeys(hotkey, _last_built_tramtype, RTT_TRAM); } diff --git a/src/toolbar_gui.h b/src/toolbar_gui.h index 40d7f282cd..fdf941fbbe 100644 --- a/src/toolbar_gui.h +++ b/src/toolbar_gui.h @@ -10,6 +10,9 @@ #ifndef TOOLBAR_GUI_H #define TOOLBAR_GUI_H +#include "rail_type.h" +#include "road_type.h" + enum MainToolbarHotkeys : int32_t { MTHK_PAUSE, MTHK_FASTFORWARD, @@ -60,4 +63,8 @@ void ToggleWidgetOutlines(); extern uint _toolbar_width; +extern RailType _last_built_railtype; ///< The most recently used type of rail. +extern RoadType _last_built_roadtype; ///< The most recently used type of road. +extern RoadType _last_built_tramtype; ///< The most recently used type of tram track. + #endif /* TOOLBAR_GUI_H */