Merge branch 'master' into jgrpp
# Conflicts: # src/ai/ai_gui.cpp # src/build_vehicle_gui.cpp # src/genworld_gui.cpp # src/lang/english.txt # src/lang/german.txt # src/lang/korean.txt # src/newgrf_sound.cpp # src/roadveh.h # src/sound.cpp # src/station_cmd.cpp # src/train.h # src/train_cmd.cpp # src/vehicle.cpp # src/vehicle_base.h # src/vehicle_gui.cpp
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include "zoom_func.h"
|
||||
#include "tracerestrict.h"
|
||||
#include "depot_base.h"
|
||||
#include "hotkeys.h"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
@@ -306,19 +307,19 @@ void BaseVehicleListWindow::SetCargoFilterArray()
|
||||
|
||||
/* Add item for disabling filtering. */
|
||||
this->cargo_filter[filter_items] = CF_ANY;
|
||||
this->cargo_filter_texts[filter_items] = STR_PURCHASE_INFO_ALL_TYPES;
|
||||
this->cargo_filter_texts[filter_items] = STR_CARGO_TYPE_FILTER_ALL;
|
||||
this->cargo_filter_criteria = filter_items;
|
||||
filter_items++;
|
||||
|
||||
/* Add item for freight (i.e. vehicles with cargo capacity and with no passenger capacity) */
|
||||
this->cargo_filter[filter_items] = CF_FREIGHT;
|
||||
this->cargo_filter_texts[filter_items] = STR_CARGO_TYPE_FREIGHT;
|
||||
this->cargo_filter_texts[filter_items] = STR_CARGO_TYPE_FILTER_FREIGHT;
|
||||
filter_items++;
|
||||
|
||||
/* Add item for vehicles not carrying anything, e.g. train engines.
|
||||
* This could also be useful for eyecandy vehicles of other types, but is likely too confusing for joe, */
|
||||
this->cargo_filter[filter_items] = CF_NONE;
|
||||
this->cargo_filter_texts[filter_items] = STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE;
|
||||
this->cargo_filter_texts[filter_items] = STR_CARGO_TYPE_FILTER_NONE;
|
||||
filter_items++;
|
||||
|
||||
/* Collect available cargo types for filtering. */
|
||||
@@ -3351,26 +3352,6 @@ static const NWidgetPart _nested_vehicle_view_widgets[] = {
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
/** Vehicle view window descriptor for all vehicles but trains. */
|
||||
static WindowDesc _vehicle_view_desc(
|
||||
WDP_AUTO, "view_vehicle", 250, 116,
|
||||
WC_VEHICLE_VIEW, WC_NONE,
|
||||
0,
|
||||
_nested_vehicle_view_widgets, lengthof(_nested_vehicle_view_widgets)
|
||||
);
|
||||
|
||||
/**
|
||||
* Vehicle view window descriptor for trains. Only minimum_height and
|
||||
* default_height are different for train view.
|
||||
*/
|
||||
static WindowDesc _train_view_desc(
|
||||
WDP_AUTO, "view_vehicle_train", 250, 134,
|
||||
WC_VEHICLE_VIEW, WC_NONE,
|
||||
0,
|
||||
_nested_vehicle_view_widgets, lengthof(_nested_vehicle_view_widgets)
|
||||
);
|
||||
|
||||
|
||||
/* Just to make sure, nobody has changed the vehicle type constants, as we are
|
||||
using them for array indexing in a number of places here. */
|
||||
static_assert(VEH_TRAIN == 0);
|
||||
@@ -3927,6 +3908,21 @@ public:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EventState OnHotkey(int hotkey) override
|
||||
{
|
||||
/* If the hotkey is not for any widget in the UI (i.e. for honking) */
|
||||
if (hotkey == WID_VV_HONK_HORN) {
|
||||
const Window* mainwindow = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||
const Vehicle* v = Vehicle::Get(window_number);
|
||||
/* Only play the sound if we're following this vehicle */
|
||||
if (mainwindow->viewport->follow_vehicle == v->index) {
|
||||
v->PlayLeaveStationSound(true);
|
||||
}
|
||||
}
|
||||
return Window::OnHotkey(hotkey);
|
||||
}
|
||||
|
||||
void OnQueryTextFinished(char *str) override
|
||||
{
|
||||
if (str == nullptr) return;
|
||||
@@ -4071,8 +4067,36 @@ public:
|
||||
{
|
||||
::ShowNewGRFInspectWindow(GetGrfSpecFeature(Vehicle::Get(this->window_number)->type), this->window_number);
|
||||
}
|
||||
|
||||
static HotkeyList hotkeys;
|
||||
};
|
||||
|
||||
static Hotkey vehicleview_hotkeys[] = {
|
||||
Hotkey('H', "honk", WID_VV_HONK_HORN),
|
||||
HOTKEY_LIST_END
|
||||
};
|
||||
HotkeyList VehicleViewWindow::hotkeys("vehicleview", vehicleview_hotkeys);
|
||||
|
||||
/** Vehicle view window descriptor for all vehicles but trains. */
|
||||
static WindowDesc _vehicle_view_desc(
|
||||
WDP_AUTO, "view_vehicle", 250, 116,
|
||||
WC_VEHICLE_VIEW, WC_NONE,
|
||||
0,
|
||||
_nested_vehicle_view_widgets, lengthof(_nested_vehicle_view_widgets),
|
||||
&VehicleViewWindow::hotkeys
|
||||
);
|
||||
|
||||
/**
|
||||
* Vehicle view window descriptor for trains. Only minimum_height and
|
||||
* default_height are different for train view.
|
||||
*/
|
||||
static WindowDesc _train_view_desc(
|
||||
WDP_AUTO, "view_vehicle_train", 250, 134,
|
||||
WC_VEHICLE_VIEW, WC_NONE,
|
||||
0,
|
||||
_nested_vehicle_view_widgets, lengthof(_nested_vehicle_view_widgets),
|
||||
&VehicleViewWindow::hotkeys
|
||||
);
|
||||
|
||||
/** Shows the vehicle view window of the given vehicle. */
|
||||
void ShowVehicleViewWindow(const Vehicle *v)
|
||||
|
Reference in New Issue
Block a user