mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r12788) -Codechange: unduplicate some vehicle GUI code. Patch by Alberth.
This commit is contained in:
parent
c84fe27ca9
commit
1dcf912f06
@ -35,7 +35,6 @@
|
|||||||
#include "settings_type.h"
|
#include "settings_type.h"
|
||||||
#include "widgets/dropdown_func.h"
|
#include "widgets/dropdown_func.h"
|
||||||
#include "order_func.h"
|
#include "order_func.h"
|
||||||
#include "depot_base.h"
|
|
||||||
|
|
||||||
#include "table/sprites.h"
|
#include "table/sprites.h"
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
@ -103,7 +102,11 @@ const StringID _vehicle_sort_listing[] = {
|
|||||||
INVALID_STRING_ID
|
INVALID_STRING_ID
|
||||||
};
|
};
|
||||||
|
|
||||||
void RebuildVehicleLists()
|
/**
|
||||||
|
* Set sort list flag for all vehicle list windows
|
||||||
|
* @param sl_flag Sort list flag to set
|
||||||
|
*/
|
||||||
|
static void SetVehicleListsFlag(SortListFlags sl_flag)
|
||||||
{
|
{
|
||||||
Window* const *wz;
|
Window* const *wz;
|
||||||
|
|
||||||
@ -115,7 +118,7 @@ void RebuildVehicleLists()
|
|||||||
case WC_ROADVEH_LIST:
|
case WC_ROADVEH_LIST:
|
||||||
case WC_SHIPS_LIST:
|
case WC_SHIPS_LIST:
|
||||||
case WC_AIRCRAFT_LIST:
|
case WC_AIRCRAFT_LIST:
|
||||||
WP(w, vehiclelist_d).l.flags |= VL_REBUILD;
|
WP(w, vehiclelist_d).l.flags |= sl_flag;
|
||||||
SetWindowDirty(w);
|
SetWindowDirty(w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -124,25 +127,20 @@ void RebuildVehicleLists()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rebuild all vehicle list windows
|
||||||
|
*/
|
||||||
|
void RebuildVehicleLists()
|
||||||
|
{
|
||||||
|
SetVehicleListsFlag(VL_REBUILD);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resort all vehicle list windows
|
||||||
|
*/
|
||||||
void ResortVehicleLists()
|
void ResortVehicleLists()
|
||||||
{
|
{
|
||||||
Window* const *wz;
|
SetVehicleListsFlag(VL_RESORT);
|
||||||
|
|
||||||
FOR_ALL_WINDOWS(wz) {
|
|
||||||
Window *w = *wz;
|
|
||||||
|
|
||||||
switch (w->window_class) {
|
|
||||||
case WC_TRAINS_LIST:
|
|
||||||
case WC_ROADVEH_LIST:
|
|
||||||
case WC_SHIPS_LIST:
|
|
||||||
case WC_AIRCRAFT_LIST:
|
|
||||||
WP(w, vehiclelist_d).l.flags |= VL_RESORT;
|
|
||||||
SetWindowDirty(w);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildVehicleList(vehiclelist_d *vl, PlayerID owner, uint16 index, uint16 window_type)
|
void BuildVehicleList(vehiclelist_d *vl, PlayerID owner, uint16 index, uint16 window_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user