# 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, SpriteID pal)
| Draw an engine.
void | DrawTrainEngine (int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
void | DrawRoadVehEngine (int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
void | DrawShipEngine (int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
void | DrawAircraftEngine (int left, int right, int preferred_x, int y, EngineID engine, SpriteID 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,
|  | SpriteID | 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 VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by DrawEngineList(), and NewsWindow::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 GetRailTypeInfo(), RailtypeInfo::new_loco, RailtypeInfo::strings, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

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 VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

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