Changeset - r28590:f23835253cb5
[Not reviewed]
master
0 4 0
frosch - 10 months ago 2024-01-24 21:31:19
frosch@openttd.org
Codechange: Remove TKM from vehicle list sorting dropdowns.
4 files changed with 65 insertions and 25 deletions:
0 comments (0 inline, 0 general)
src/group_gui.cpp
Show inline comments
 
@@ -418,8 +418,10 @@ public:
 
				break;
 

	
 
			case WID_GL_SORT_BY_DROPDOWN:
 
				size->width = GetStringListWidth(this->vehicle_group_none_sorter_names);
 
				size->width = std::max(size->width, GetStringListWidth(this->vehicle_group_shared_orders_sorter_names));
 
				size->width = GetStringListWidth(this->vehicle_group_none_sorter_names_calendar);
 
				size->width = std::max(size->width, GetStringListWidth(this->vehicle_group_none_sorter_names_wallclock));
 
				size->width = std::max(size->width, GetStringListWidth(this->vehicle_group_shared_orders_sorter_names_calendar));
 
				size->width = std::max(size->width, GetStringListWidth(this->vehicle_group_shared_orders_sorter_names_wallclock));
 
				size->width += padding.width;
 
				break;
 

	
src/lang/english.txt
Show inline comments
 
@@ -331,8 +331,10 @@ STR_SORT_BY_PRODUCTION                  
 
STR_SORT_BY_TYPE                                                :Type
 
STR_SORT_BY_TRANSPORTED                                         :Transported
 
STR_SORT_BY_NUMBER                                              :Number
 
STR_SORT_BY_PROFIT_LAST_YEAR                                    :Profit last {TKM year period}
 
STR_SORT_BY_PROFIT_THIS_YEAR                                    :Profit this {TKM year period}
 
STR_SORT_BY_PROFIT_LAST_YEAR                                    :Profit last year
 
STR_SORT_BY_PROFIT_LAST_PERIOD                                  :Profit last period
 
STR_SORT_BY_PROFIT_THIS_YEAR                                    :Profit this year
 
STR_SORT_BY_PROFIT_THIS_PERIOD                                  :Profit this period
 
STR_SORT_BY_AGE                                                 :Age
 
STR_SORT_BY_RELIABILITY                                         :Reliability
 
STR_SORT_BY_TOTAL_CAPACITY_PER_CARGOTYPE                        :Total capacity per cargo type
 
@@ -359,10 +361,14 @@ STR_SORT_BY_RANGE                       
 
STR_SORT_BY_POPULATION                                          :Population
 
STR_SORT_BY_RATING                                              :Rating
 
STR_SORT_BY_NUM_VEHICLES                                        :Number of vehicles
 
STR_SORT_BY_TOTAL_PROFIT_LAST_YEAR                              :Total profit last {TKM year period}
 
STR_SORT_BY_TOTAL_PROFIT_THIS_YEAR                              :Total profit this {TKM year period}
 
STR_SORT_BY_AVERAGE_PROFIT_LAST_YEAR                            :Average profit last {TKM year period}
 
STR_SORT_BY_AVERAGE_PROFIT_THIS_YEAR                            :Average profit this {TKM year period}
 
STR_SORT_BY_TOTAL_PROFIT_LAST_YEAR                              :Total profit last year
 
STR_SORT_BY_TOTAL_PROFIT_LAST_PERIOD                            :Total profit last period
 
STR_SORT_BY_TOTAL_PROFIT_THIS_YEAR                              :Total profit this year
 
STR_SORT_BY_TOTAL_PROFIT_THIS_PERIOD                            :Total profit this period
 
STR_SORT_BY_AVERAGE_PROFIT_LAST_YEAR                            :Average profit last year
 
STR_SORT_BY_AVERAGE_PROFIT_LAST_PERIOD                          :Average profit last period
 
STR_SORT_BY_AVERAGE_PROFIT_THIS_YEAR                            :Average profit this year
 
STR_SORT_BY_AVERAGE_PROFIT_THIS_PERIOD                          :Average profit this period
 

	
 
# Group by options for vehicle list
 
STR_GROUP_BY_NONE                                               :None
src/vehicle_gui.cpp
Show inline comments
 
@@ -93,7 +93,7 @@ BaseVehicleListWindow::VehicleGroupSortF
 
	&VehicleIndividualToGroupSorterWrapper<VehicleTimetableDelaySorter>,
 
};
 

	
 
const StringID BaseVehicleListWindow::vehicle_group_none_sorter_names[] = {
 
const StringID BaseVehicleListWindow::vehicle_group_none_sorter_names_calendar[] = {
 
	STR_SORT_BY_NUMBER,
 
	STR_SORT_BY_NAME,
 
	STR_SORT_BY_AGE,
 
@@ -110,6 +110,23 @@ const StringID BaseVehicleListWindow::ve
 
	INVALID_STRING_ID
 
};
 

	
 
const StringID BaseVehicleListWindow::vehicle_group_none_sorter_names_wallclock[] = {
 
	STR_SORT_BY_NUMBER,
 
	STR_SORT_BY_NAME,
 
	STR_SORT_BY_AGE,
 
	STR_SORT_BY_PROFIT_THIS_PERIOD,
 
	STR_SORT_BY_PROFIT_LAST_PERIOD,
 
	STR_SORT_BY_TOTAL_CAPACITY_PER_CARGOTYPE,
 
	STR_SORT_BY_RELIABILITY,
 
	STR_SORT_BY_MAX_SPEED,
 
	STR_SORT_BY_MODEL,
 
	STR_SORT_BY_VALUE,
 
	STR_SORT_BY_LENGTH,
 
	STR_SORT_BY_LIFE_TIME,
 
	STR_SORT_BY_TIMETABLE_DELAY,
 
	INVALID_STRING_ID
 
};
 

	
 
BaseVehicleListWindow::VehicleGroupSortFunction * const BaseVehicleListWindow::vehicle_group_shared_orders_sorter_funcs[] = {
 
	&VehicleGroupLengthSorter,
 
	&VehicleGroupTotalProfitThisYearSorter,
 
@@ -118,7 +135,7 @@ BaseVehicleListWindow::VehicleGroupSortF
 
	&VehicleGroupAverageProfitLastYearSorter,
 
};
 

	
 
const StringID BaseVehicleListWindow::vehicle_group_shared_orders_sorter_names[] = {
 
const StringID BaseVehicleListWindow::vehicle_group_shared_orders_sorter_names_calendar[] = {
 
	STR_SORT_BY_NUM_VEHICLES,
 
	STR_SORT_BY_TOTAL_PROFIT_THIS_YEAR,
 
	STR_SORT_BY_TOTAL_PROFIT_LAST_YEAR,
 
@@ -127,6 +144,15 @@ const StringID BaseVehicleListWindow::ve
 
	INVALID_STRING_ID
 
};
 

	
 
const StringID BaseVehicleListWindow::vehicle_group_shared_orders_sorter_names_wallclock[] = {
 
	STR_SORT_BY_NUM_VEHICLES,
 
	STR_SORT_BY_TOTAL_PROFIT_THIS_PERIOD,
 
	STR_SORT_BY_TOTAL_PROFIT_LAST_PERIOD,
 
	STR_SORT_BY_AVERAGE_PROFIT_THIS_PERIOD,
 
	STR_SORT_BY_AVERAGE_PROFIT_LAST_PERIOD,
 
	INVALID_STRING_ID
 
};
 

	
 
const StringID BaseVehicleListWindow::vehicle_group_by_names[] = {
 
	STR_GROUP_BY_NONE,
 
	STR_GROUP_BY_SHARED_ORDERS,
 
@@ -147,6 +173,18 @@ BaseVehicleListWindow::BaseVehicleListWi
 
	this->UpdateSortingFromGrouping();
 
}
 

	
 
const StringID *BaseVehicleListWindow::GetVehicleSorterNames()
 
{
 
	switch (this->grouping) {
 
		case GB_NONE:
 
			return TimerGameEconomy::UsingWallclockUnits() ? vehicle_group_none_sorter_names_wallclock : vehicle_group_none_sorter_names_calendar;
 
		case GB_SHARED_ORDERS:
 
			return TimerGameEconomy::UsingWallclockUnits() ? vehicle_group_shared_orders_sorter_names_wallclock : vehicle_group_shared_orders_sorter_names_calendar;
 
		default:
 
			NOT_REACHED();
 
	}
 
}
 

	
 
/**
 
 * Get the number of digits of space required for the given number.
 
 * @param number The number.
 
@@ -1885,8 +1923,10 @@ public:
 
				break;
 

	
 
			case WID_VL_SORT_BY_PULLDOWN:
 
				size->width = GetStringListWidth(this->vehicle_group_none_sorter_names);
 
				size->width = std::max(size->width, GetStringListWidth(this->vehicle_group_shared_orders_sorter_names));
 
				size->width = GetStringListWidth(this->vehicle_group_none_sorter_names_calendar);
 
				size->width = std::max(size->width, GetStringListWidth(this->vehicle_group_none_sorter_names_wallclock));
 
				size->width = std::max(size->width, GetStringListWidth(this->vehicle_group_shared_orders_sorter_names_calendar));
 
				size->width = std::max(size->width, GetStringListWidth(this->vehicle_group_shared_orders_sorter_names_wallclock));
 
				size->width += padding.width;
 
				break;
 

	
src/vehicle_gui_base.h
Show inline comments
 
@@ -99,8 +99,10 @@ struct BaseVehicleListWindow : public Wi
 

	
 
	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[];
 

	
 
@@ -122,17 +124,7 @@ struct BaseVehicleListWindow : public Wi
 
	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()
 
	{
0 comments (0 inline, 0 general)