|
OpenTTD
|
Engine GUI functions, used by build_vehicle_gui and autoreplace_gui More...
Go to the source code of this file.
Typedefs | |
|
typedef GUIList< EngineID, CargoID > | GUIEngineList |
| typedef int CDECL | EngList_SortTypeFunction (const EngineID *, const EngineID *) |
| argument type for EngList_Sort. | |
Functions | |
| void | EngList_Sort (GUIEngineList *el, EngList_SortTypeFunction compare) |
| Sort all items using quick sort and given 'CompareItems' function. | |
| void | EngList_SortPartial (GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items) |
| Sort selected range of items (on indices @ <begin, begin+num_items-1>) | |
| StringID | GetEngineCategoryName (EngineID engine) |
| Return the category of an engine. | |
| StringID | GetEngineInfoString (EngineID engine) |
| Get a multi-line string with some technical data, describing the engine. | |
| void | DrawVehicleEngine (int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type) |
| Draw an engine. | |
| void | DrawTrainEngine (int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type) |
| void | DrawRoadVehEngine (int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type) |
| Draw a road vehicle engine. | |
| void | DrawShipEngine (int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type) |
| void | DrawAircraftEngine (int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type) |
| uint | GetEngineListHeight (VehicleType type) |
| Get the height of a single 'entry' in the engine lists. | |
| void | DisplayVehicleSortDropDown (Window *w, VehicleType vehicle_type, int selected, int button) |
| Display the dropdown for the vehicle sort criteria. | |
Variables | |
| bool | _engine_sort_direction |
false = descending, true = ascending. | |
| byte | _engine_sort_last_criteria [] |
| Last set sort criteria, for each vehicle type. | |
| bool | _engine_sort_last_order [] |
| Last set direction of the sort order, for each vehicle type. | |
| bool | _engine_sort_show_hidden_engines [] |
| Last set 'show hidden engines' setting for each vehicle type. | |
| const StringID | _engine_sort_listing [][12] |
| Dropdown menu strings for the vehicle sort criteria. | |
| EngList_SortTypeFunction *const | _engine_sort_functions [][11] |
| Sort functions for the vehicle sort criteria, for each vehicle type. | |
Engine GUI functions, used by build_vehicle_gui and autoreplace_gui
Definition in file engine_gui.h.
| void DisplayVehicleSortDropDown | ( | Window * | w, |
| VehicleType | vehicle_type, | ||
| int | selected, | ||
| int | button | ||
| ) |
Display the dropdown for the vehicle sort criteria.
| w | Parent window (holds the dropdown button). |
| vehicle_type | Vehicle type being sorted. |
| selected | Currently selected sort criterium. |
| button | Widget button. |
Definition at line 956 of file build_vehicle_gui.cpp.
References _engine_sort_listing, _settings_game, VehicleSettings::roadveh_acceleration_model, SetBit(), ShowDropDownMenu(), VehicleSettings::train_acceleration_model, VEH_ROAD, VEH_TRAIN, and GameSettings::vehicle.
Referenced by ReplaceVehicleWindow::OnClick(), and BuildVehicleWindow::OnClick().
| void DrawRoadVehEngine | ( | int | left, |
| int | right, | ||
| int | preferred_x, | ||
| int | y, | ||
| EngineID | engine, | ||
| PaletteID | pal, | ||
| EngineImageType | image_type | ||
| ) |
Draw a road vehicle engine.
| left | Left edge to draw within. |
| right | Right edge to draw within. |
| preferred_x | Preferred position of the engine. |
| y | Vertical position of the engine. |
| engine | Engine to draw |
| pal | Palette to use. |
Definition at line 146 of file roadveh_cmd.cpp.
References Clamp(), VehicleSpriteSeq::Draw(), VehicleSpriteSeq::GetBounds(), PALETTE_CRASH, and UnScaleGUI().
Referenced by DrawVehicleEngine().
| void DrawVehicleEngine | ( | int | left, |
| int | right, | ||
| int | preferred_x, | ||
| int | y, | ||
| EngineID | engine, | ||
| PaletteID | pal, | ||
| EngineImageType | image_type | ||
| ) |
Draw an engine.
| left | Minimum horizontal position to use for drawing the engine |
| right | Maximum horizontal position to use for drawing the engine |
| preferred_x | Horizontal position to use for drawing the engine. |
| y | Vertical position to use for drawing the engine. |
| engine | Engine to draw. |
| pal | Palette to use for drawing. |
Definition at line 296 of file engine_gui.cpp.
References DrawRoadVehEngine(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), Engine::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by DrawEngineList(), EnginePreviewWindow::DrawWidget(), and NewsWindow::DrawWidget().
| void EngList_Sort | ( | GUIEngineList * | el, |
| EngList_SortTypeFunction | compare | ||
| ) |
Sort all items using quick sort and given 'CompareItems' function.
| el | list to be sorted |
| compare | function for evaluation of the quicksort |
Definition at line 326 of file engine_gui.cpp.
References SmallVector< T, S >::Begin(), SmallVector< T, S >::Length(), and QSortT().
Referenced by ReplaceVehicleWindow::GenerateReplaceVehList().
| void EngList_SortPartial | ( | GUIEngineList * | el, |
| EngList_SortTypeFunction | compare, | ||
| uint | begin, | ||
| uint | num_items | ||
| ) |
Sort selected range of items (on indices @ <begin, begin+num_items-1>)
| el | list to be sorted |
| compare | function for evaluation of the quicksort |
| begin | start of sorting |
| num_items | count of items to be sorted |
Definition at line 342 of file engine_gui.cpp.
References SmallVector< T, S >::Get(), and QSortT().
Return the category of an engine.
| engine | Engine to examine. |
Definition at line 39 of file engine_gui.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), GetRailTypeInfo(), RailtypeInfo::new_loco, RailtypeInfo::strings, Engine::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by EnginePreviewWindow::DrawWidget(), NewVehicleAvailable(), and EnginePreviewWindow::UpdateWidgetSize().
Get a multi-line string with some technical data, describing the engine.
| engine | Engine to describe. |
DParam array is set up for printing the string. Definition at line 266 of file engine_gui.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), Engine::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
Referenced by EnginePreviewWindow::DrawWidget(), NewsWindow::DrawWidget(), EnginePreviewWindow::UpdateWidgetSize(), and NewsWindow::UpdateWidgetSize().
| uint GetEngineListHeight | ( | VehicleType | type | ) |
Get the height of a single 'entry' in the engine lists.
| type | the vehicle type to get the height of |
Definition at line 47 of file build_vehicle_gui.cpp.
References EIT_PURCHASE, FONT_HEIGHT_NORMAL, GetVehicleImageCellSize(), VehicleCellSize::height, WD_MATRIX_BOTTOM, and WD_MATRIX_TOP.
Referenced by DrawEngineList(), ReplaceVehicleWindow::UpdateWidgetSize(), and BuildVehicleWindow::UpdateWidgetSize().
| EngList_SortTypeFunction* const _engine_sort_functions[][11] |
Sort functions for the vehicle sort criteria, for each vehicle type.
Definition at line 420 of file build_vehicle_gui.cpp.
Referenced by ReplaceVehicleWindow::GenerateReplaceVehList().
| const StringID _engine_sort_listing[][12] |
Dropdown menu strings for the vehicle sort criteria.
Definition at line 470 of file build_vehicle_gui.cpp.
Referenced by DisplayVehicleSortDropDown(), ReplaceVehicleWindow::SetStringParameters(), and BuildVehicleWindow::SetStringParameters().
1.8.1.2