# engine_gui.h File Reference

Engine GUI functions, used by build_vehicle_gui and autoreplace_gui. More...

`#include "engine_type.h"`
`#include "sortlist_type.h"`
`#include "gfx_type.h"`

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 of the engine list
void | EngList_SortPartial (GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items)
| sort of specified portion of the engine list
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)
| Draw an engine.
void | DrawTrainEngine (int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal)
void | DrawRoadVehEngine (int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal)
void | DrawShipEngine (int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal)
void | DrawAircraftEngine (int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal)

## Detailed Description

Engine GUI functions, used by build_vehicle_gui and autoreplace_gui.

Definition in file engine_gui.h.

## Function Documentation

void DrawVehicleEngine | ( | int | left,
|  | int | right,
|  | int | preferred_x,
|  | int | y,
|  | EngineID | engine,
|  | PaletteID | pal |
| ) |  |  |

Draw an engine.

Parameters:

  | 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 251 of file engine_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), Engine::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by DrawEngineList(), NewsWindow::DrawWidget(), and EnginePreviewWindow::DrawWidget().

void EngList_Sort | ( | GUIEngineList * | el,
|  | EngList_SortTypeFunction | compare |
| ) |  |  |

sort of the engine list

sort of the engine list

Parameters:

  | el | list to be sorted
  | compare | function for evaluation of the quicksort

Definition at line 280 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 of specified portion of the engine list

sort of specified portion of the engine list

Parameters:

  | 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 295 of file engine_gui.cpp.

References SmallVector< T, S >::Get(), and QSortT().

StringID GetEngineCategoryName | ( | EngineID | engine | ) |

Return the category of an engine.

Parameters:

  | engine | Engine to examine.

Returns:
  String describing the category ("road veh", "train". "airplane", or "ship") of the engine.

Definition at line 31 of file engine_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), GetRailTypeInfo(), Engine::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by EnginePreviewWindow::DrawWidget(), and EnginePreviewWindow::UpdateWidgetSize().

StringID GetEngineInfoString | ( | EngineID | engine | ) |

Get a multi-line string with some technical data, describing the engine.

Parameters:

  | engine | Engine to describe.

Returns:
  String describing the engine.

Postcondition:
  `DParam` array is set up for printing the string.

Definition at line 221 of file engine_gui.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), Engine::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by NewsWindow::DrawWidget(), EnginePreviewWindow::DrawWidget(), NewsWindow::UpdateWidgetSize(), and EnginePreviewWindow::UpdateWidgetSize().