# engine_gui.cpp File Reference

GUI to show engine related information. More...

`#include "stdafx.h"`
`#include "window_gui.h"`
`#include "gfx_func.h"`
`#include "engine_func.h"`
`#include "engine_base.h"`
`#include "command_func.h"`
`#include "news_type.h"`
`#include "newgrf_engine.h"`
`#include "strings_func.h"`
`#include "engine_gui.h"`
`#include "articulated_vehicles.h"`
`#include "rail.h"`
`#include "aircraft.h"`
`#include "table/strings.h"`
`#include "table/sprites.h"`

Go to the source code of this file.

## Data Structures
struct | DrawEngineInfo
struct | EnginePreviewWindow
## Typedefs
typedef void | DrawEngineProc (int x, int y, EngineID engine, SpriteID pal)
typedef void | DrawEngineInfoProc (EngineID, int x, int y, int maxw)
## Functions
StringID | GetEngineCategoryName (EngineID engine)
static void | DrawTrainEngineInfo (EngineID engine, int x, int y, int maxw)
static void | DrawRoadVehEngineInfo (EngineID engine, int x, int y, int maxw)
static void | DrawShipEngineInfo (EngineID engine, int x, int y, int maxw)
static void | DrawAircraftEngineInfo (EngineID engine, int x, int y, int maxw)
void | ShowEnginePreviewWindow (EngineID engine)
uint | GetTotalCapacityOfArticulatedParts (EngineID engine, VehicleType type)
void | DrawNewsNewVehicleAvail (Window *w, const NewsItem *ni)
void | EngList_Sort (GUIEngineList *el, EngList_SortTypeFunction compare)
| Sort all items using qsort() 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>).
## Variables
static const Widget | _engine_preview_widgets []
static const DrawEngineInfo | _draw_engine_list [4]
static const WindowDesc | _engine_preview_desc (WDP_CENTER, WDP_CENTER, 300, 192, 300, 192, WC_ENGINE_PREVIEW, WC_NONE, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_CONSTRUCTION, _engine_preview_widgets)

## Detailed Description

GUI to show engine related information.

Definition in file engine_gui.cpp.

## Function Documentation

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

Sort all items using qsort() and given 'CompareItems' function.

qsort of the engine list

Parameters:

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

Definition at line 224 of file engine_gui.cpp.

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>).

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

## Variable Documentation

const DrawEngineInfo _draw_engine_list[4]`[static]`

Initial value:

     {
      { DrawTrainEngine,    DrawTrainEngineInfo    },
      { DrawRoadVehEngine,  DrawRoadVehEngineInfo  },
      { DrawShipEngine,     DrawShipEngineInfo     },
      { DrawAircraftEngine, DrawAircraftEngineInfo },
    }

Definition at line 56 of file engine_gui.cpp.

const Widget _engine_preview_widgets[]`[static]`

Initial value:

     {
    {   WWT_CLOSEBOX,  RESIZE_NONE,  COLOUR_LIGHT_BLUE,    0,   10,    0,   13, STR_00C5,                                  STR_018B_CLOSE_WINDOW},
    {    WWT_CAPTION,  RESIZE_NONE,  COLOUR_LIGHT_BLUE,   11,  299,    0,   13, STR_8100_MESSAGE_FROM_VEHICLE_MANUFACTURE, STR_018C_WINDOW_TITLE_DRAG_THIS},
    {      WWT_PANEL,  RESIZE_NONE,  COLOUR_LIGHT_BLUE,    0,  299,   14,  191, 0x0,                                       STR_NULL},
    { WWT_PUSHTXTBTN,  RESIZE_NONE,  COLOUR_LIGHT_BLUE,   85,  144,  172,  183, STR_00C9_NO,                               STR_NULL},
    { WWT_PUSHTXTBTN,  RESIZE_NONE,  COLOUR_LIGHT_BLUE,  155,  214,  172,  183, STR_00C8_YES,                              STR_NULL},
    {   WIDGETS_END},
    }

Definition at line 34 of file engine_gui.cpp.