Import vehicle lifetime profit patch v3
http://www.tt-forums.net/viewtopic.php?p=1161735#p1161735
This commit is contained in:

committed by
Jonathan G Rennison

parent
137ecd5377
commit
71be17729e
@@ -48,6 +48,7 @@ static GUIVehicleList::SortFunction VehicleNumberSorter;
|
||||
static GUIVehicleList::SortFunction VehicleNameSorter;
|
||||
static GUIVehicleList::SortFunction VehicleAgeSorter;
|
||||
static GUIVehicleList::SortFunction VehicleProfitThisYearSorter;
|
||||
static GUIVehicleList::SortFunction VehicleProfitLifetimeSorter;
|
||||
static GUIVehicleList::SortFunction VehicleProfitLastYearSorter;
|
||||
static GUIVehicleList::SortFunction VehicleCargoSorter;
|
||||
static GUIVehicleList::SortFunction VehicleReliabilitySorter;
|
||||
@@ -64,6 +65,7 @@ GUIVehicleList::SortFunction * const BaseVehicleListWindow::vehicle_sorter_funcs
|
||||
&VehicleAgeSorter,
|
||||
&VehicleProfitThisYearSorter,
|
||||
&VehicleProfitLastYearSorter,
|
||||
&VehicleProfitLifetimeSorter,
|
||||
&VehicleCargoSorter,
|
||||
&VehicleReliabilitySorter,
|
||||
&VehicleMaxSpeedSorter,
|
||||
@@ -80,6 +82,7 @@ const StringID BaseVehicleListWindow::vehicle_sorter_names[] = {
|
||||
STR_SORT_BY_AGE,
|
||||
STR_SORT_BY_PROFIT_THIS_YEAR,
|
||||
STR_SORT_BY_PROFIT_LAST_YEAR,
|
||||
STR_SORT_BY_PROFIT_LIFETIME,
|
||||
STR_SORT_BY_TOTAL_CAPACITY_PER_CARGOTYPE,
|
||||
STR_SORT_BY_RELIABILITY,
|
||||
STR_SORT_BY_MAX_SPEED,
|
||||
@@ -1132,6 +1135,13 @@ static int CDECL VehicleProfitLastYearSorter(const Vehicle * const *a, const Veh
|
||||
return (r != 0) ? r : VehicleNumberSorter(a, b);
|
||||
}
|
||||
|
||||
/** Sort vehicles by lifetime profit */
|
||||
static int CDECL VehicleProfitLifetimeSorter(const Vehicle * const *a, const Vehicle * const *b)
|
||||
{
|
||||
int r = ClampToI32((*a)->GetDisplayProfitLifetime() - (*b)->GetDisplayProfitLifetime());
|
||||
return (r != 0) ? r : VehicleNumberSorter(a, b);
|
||||
}
|
||||
|
||||
/** Sort vehicles by their cargo */
|
||||
static int CDECL VehicleCargoSorter(const Vehicle * const *a, const Vehicle * const *b)
|
||||
{
|
||||
@@ -2082,6 +2092,7 @@ struct VehicleDetailsWindow : Window {
|
||||
/* Draw profit */
|
||||
SetDParam(0, v->GetDisplayProfitThisYear());
|
||||
SetDParam(1, v->GetDisplayProfitLastYear());
|
||||
SetDParam(2, v->GetDisplayProfitLifetime());
|
||||
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR);
|
||||
y += FONT_HEIGHT_NORMAL;
|
||||
|
||||
|
Reference in New Issue
Block a user