@@ -714,32 +714,44 @@ struct BuildRoadToolbarWindow : Window {
/**
* Handler for global hotkeys of the BuildRoadToolbarWindow.
* @param hotkey Hotkey
* @param last_build Last build road type
* @return ES_HANDLED if hotkey was accepted.
*/
static EventState RoadTramToolbarGlobalHotkeys(int hotkey, RoadType last_build)
static EventState RoadTramToolbarGlobalHotkeys(int hotkey, RoadType last_build, RoadTramType rtt)
{
Window *w = (_game_mode == GM_NORMAL) ? ShowBuildRoadToolbar(last_build) : ShowBuildRoadScenToolbar(last_build);
Window* w = nullptr;
switch (_game_mode) {
case GM_NORMAL:
if (!CanBuildVehicleInfrastructure(VEH_ROAD, rtt)) return ES_NOT_HANDLED;
w = ShowBuildRoadToolbar(last_build);
break;
case GM_EDITOR:
if ((GetRoadTypes(true) & ((rtt == RTT_ROAD) ? ~_roadtypes_type : _roadtypes_type)) == ROADTYPES_NONE) return ES_NOT_HANDLED;
w = ShowBuildRoadScenToolbar(last_build);
default:
}
if (w == nullptr) return ES_NOT_HANDLED;
return w->OnHotkey(hotkey);
static EventState RoadToolbarGlobalHotkeys(int hotkey)
if (_game_mode == GM_NORMAL && !CanBuildVehicleInfrastructure(VEH_ROAD, RTT_ROAD)) return ES_NOT_HANDLED;
extern RoadType _last_built_roadtype;
return RoadTramToolbarGlobalHotkeys(hotkey, _last_built_roadtype);
return RoadTramToolbarGlobalHotkeys(hotkey, _last_built_roadtype, RTT_ROAD);
static EventState TramToolbarGlobalHotkeys(int hotkey)
if (_game_mode != GM_NORMAL || !CanBuildVehicleInfrastructure(VEH_ROAD, RTT_TRAM)) return ES_NOT_HANDLED;
extern RoadType _last_built_tramtype;
return RoadTramToolbarGlobalHotkeys(hotkey, _last_built_tramtype);
return RoadTramToolbarGlobalHotkeys(hotkey, _last_built_tramtype, RTT_TRAM);
static Hotkey roadtoolbar_hotkeys[] = {
Hotkey('1', "build_x", WID_ROT_ROAD_X),
Hotkey('2', "build_y", WID_ROT_ROAD_Y),
Hotkey('3', "autoroad", WID_ROT_AUTOROAD),
Status change: