Typedefs | Functions

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"
#include "vehicle_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 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)

Detailed Description

Engine GUI functions, used by build_vehicle_gui and autoreplace_gui

Definition in file engine_gui.h.


Function Documentation

void DrawRoadVehEngine ( int  left,
int  right,
int  preferred_x,
int  y,
EngineID  engine,
PaletteID  pal,
EngineImageType  image_type 
)

Draw a road vehicle engine.

Parameters:
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 159 of file roadveh_cmd.cpp.

References Clamp(), DrawSprite(), ST_NORMAL, UnScaleByZoom(), Sprite::width, Sprite::x_offs, and ZOOM_LVL_GUI.

Referenced by DrawVehicleEngine().

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

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 273 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(), NewsWindow::DrawWidget(), and EnginePreviewWindow::DrawWidget().

void EngList_Sort ( GUIEngineList el,
EngList_SortTypeFunction  compare 
)

Sort all items using quick sort and given 'CompareItems' function.

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

Definition at line 303 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>).

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

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

Referenced by EnginePreviewWindow::DrawWidget(), NewVehicleAvailable(), 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 243 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 NewsWindow::DrawWidget(), EnginePreviewWindow::DrawWidget(), NewsWindow::UpdateWidgetSize(), and EnginePreviewWindow::UpdateWidgetSize().