Update to 14.0-beta1

This commit is contained in:
dP
2024-02-04 02:18:17 +05:30
parent 79037e2c65
commit 33ef333b57
1325 changed files with 138465 additions and 70987 deletions

View File

@@ -10,9 +10,8 @@
#ifndef VEHICLE_GUI_BASE_H
#define VEHICLE_GUI_BASE_H
#include "core/smallvec_type.hpp"
#include "cargo_type.h"
#include "date_type.h"
#include "timer/timer_game_calendar.h"
#include "economy_type.h"
#include "sortlist_type.h"
#include "vehicle_base.h"
@@ -20,10 +19,7 @@
#include "window_gui.h"
#include "widgets/dropdown_type.h"
#include <iterator>
#include <numeric>
typedef GUIList<const Vehicle*, CargoID> GUIVehicleList;
typedef GUIList<const Vehicle*, std::nullptr_t, CargoID> GUIVehicleList;
struct GUIVehicleGroup {
VehicleList::const_iterator vehicles_begin; ///< Pointer to beginning element of this vehicle group.
@@ -57,7 +53,7 @@ struct GUIVehicleGroup {
});
}
Date GetOldestVehicleAge() const
TimerGameCalendar::Date GetOldestVehicleAge() const
{
const Vehicle *oldest = *std::max_element(this->vehicles_begin, this->vehicles_end, [](const Vehicle *v_a, const Vehicle *v_b) {
return v_a->age < v_b->age;
@@ -66,7 +62,7 @@ struct GUIVehicleGroup {
}
};
typedef GUIList<GUIVehicleGroup, CargoID> GUIVehicleGroupList;
typedef GUIList<GUIVehicleGroup, std::nullptr_t, CargoID> GUIVehicleGroupList;
struct BaseVehicleListWindow : public Window {
@@ -77,13 +73,6 @@ struct BaseVehicleListWindow : public Window {
GB_END,
};
/** Special cargo filter criteria */
enum CargoFilterSpecialType {
CF_NONE = CT_INVALID, ///< Show only vehicles which do not carry cargo (e.g. train engines)
CF_ANY = CT_NO_REFIT, ///< Show all vehicles independent of carried cargo (i.e. no filtering)
CF_FREIGHT = CT_AUTO_REFIT, ///< Show only vehicles which carry any freight (non-passenger) cargo
};
GroupBy grouping; ///< How we want to group the list.
VehicleList vehicles; ///< List of vehicles. This is the buffer for `vehgroups` to point into; if this is structurally modified, `vehgroups` must be rebuilt.
GUIVehicleGroupList vehgroups; ///< List of (groups of) vehicles. This stores iterators of `vehicles`, and should be rebuilt if `vehicles` is structurally changed.
@@ -92,10 +81,9 @@ struct BaseVehicleListWindow : public Window {
Scrollbar *vscroll;
VehicleListIdentifier vli; ///< Identifier of the vehicle list we want to currently show.
VehicleID vehicle_sel; ///< Selected vehicle
CargoID cargo_filter[NUM_CARGO + 3]; ///< Available cargo filters; CargoID or CF_ANY or CF_FREIGHT or CF_NONE
StringID cargo_filter_texts[NUM_CARGO + 4]; ///< Texts for filter_cargo, terminated by INVALID_STRING_ID
byte cargo_filter_criteria; ///< Selected cargo filter index
CargoID cargo_filter_criteria; ///< Selected cargo filter index
uint order_arrow_width; ///< Width of the arrow in the small order list.
CargoTypes used_cargoes;
typedef GUIVehicleGroupList::SortFunction VehicleGroupSortFunction;
typedef GUIVehicleList::SortFunction VehicleIndividualSortFunction;
@@ -106,12 +94,15 @@ struct BaseVehicleListWindow : public Window {
ADI_DEPOT,
ADI_ADD_SHARED,
ADI_REMOVE_ALL,
ADI_CREATE_GROUP,
};
static const StringID vehicle_depot_name[];
static const StringID vehicle_group_by_names[];
static const StringID vehicle_group_none_sorter_names[];
static const StringID vehicle_group_shared_orders_sorter_names[];
static const StringID vehicle_group_none_sorter_names_calendar[];
static const StringID vehicle_group_none_sorter_names_wallclock[];
static const StringID vehicle_group_shared_orders_sorter_names_calendar[];
static const StringID vehicle_group_shared_orders_sorter_names_wallclock[];
static VehicleGroupSortFunction * const vehicle_group_none_sorter_funcs[];
static VehicleGroupSortFunction * const vehicle_group_shared_orders_sorter_funcs[];
@@ -125,23 +116,15 @@ struct BaseVehicleListWindow : public Window {
void UpdateVehicleGroupBy(GroupBy group_by);
void SortVehicleList();
void BuildVehicleList();
void SetCargoFilterIndex(byte index);
void SetCargoFilter(byte index);
void SetCargoFilterArray();
void FilterVehicleList();
Dimension GetActionDropdownSize(bool show_autoreplace, bool show_group);
DropDownList BuildActionDropdownList(bool show_autoreplace, bool show_group);
StringID GetCargoFilterLabel(CargoID cid) const;
DropDownList BuildCargoDropDownList(bool full) const;
Dimension GetActionDropdownSize(bool show_autoreplace, bool show_group, bool show_create);
DropDownList BuildActionDropdownList(bool show_autoreplace, bool show_group, bool show_create);
const StringID *GetVehicleSorterNames()
{
switch (this->grouping) {
case GB_NONE:
return vehicle_group_none_sorter_names;
case GB_SHARED_ORDERS:
return vehicle_group_shared_orders_sorter_names;
default:
NOT_REACHED();
}
}
const StringID *GetVehicleSorterNames();
VehicleGroupSortFunction * const *GetVehicleSorterFuncs()
{