# depot_gui.cpp File Reference

The GUI for depots. More...

`#include "train.h"`
`#include "ship.h"`
`#include "aircraft.h"`
`#include "gui.h"`
`#include "textbuf_gui.h"`
`#include "viewport_func.h"`
`#include "gfx_func.h"`
`#include "command_func.h"`
`#include "depot_base.h"`
`#include "vehicle_gui.h"`
`#include "newgrf_engine.h"`
`#include "spritecache.h"`
`#include "strings_func.h"`
`#include "window_func.h"`
`#include "vehicle_func.h"`
`#include "company_func.h"`
`#include "tilehighlight_func.h"`
`#include "window_gui.h"`
`#include "vehiclelist.h"`
`#include "table/strings.h"`
`#include "table/sprites.h"`

Go to the source code of this file.

## Data Structures
struct | DepotWindow
struct | DepotWindow::GetDepotVehiclePtData
## Enumerations
enum | DepotWindowWidgets { DEPOT_WIDGET_CLOSEBOX = 0, DEPOT_WIDGET_CAPTION, DEPOT_WIDGET_STICKY, DEPOT_WIDGET_SELL, DEPOT_WIDGET_SELL_CHAIN, DEPOT_WIDGET_SELL_ALL, DEPOT_WIDGET_AUTOREPLACE, DEPOT_WIDGET_MATRIX, DEPOT_WIDGET_V_SCROLL, DEPOT_WIDGET_H_SCROLL, DEPOT_WIDGET_BUILD, DEPOT_WIDGET_CLONE, DEPOT_WIDGET_LOCATION, DEPOT_WIDGET_VEHICLE_LIST, DEPOT_WIDGET_STOP_ALL, DEPOT_WIDGET_START_ALL, DEPOT_WIDGET_RESIZE }
## Functions
int | WagonLengthToPixels (int len)
| Get the number of pixels for the given wagon length.
void | DepotSortList (VehicleList *list)
void | CcCloneVehicle (bool success, TileIndex tile, uint32 p1, uint32 p2)
| This is the Callback method after the cloning attempt of a vehicle.
static void | TrainDepotMoveVehicle (const Vehicle *wagon, VehicleID sel, const Vehicle *head)
static void | ResizeDefaultWindowSizeForTrains ()
static void | ResizeDefaultWindowSizeForRoadVehicles ()
static void | ResizeDefaultWindowSize (VehicleType type)
void | InitDepotWindowBlockSizes ()
static void | DepotSellAllConfirmationCallback (Window *w, bool confirmed)
const Sprite * | GetAircraftSprite (EngineID engine)
void | ShowDepotWindow (TileIndex tile, VehicleType type)
| Opens a depot window.
void | DeleteDepotHighlightOfVehicle (const Vehicle *v)
| Removes the highlight of a vehicle in a depot window.
## Variables
static const Widget | _depot_widgets []
static const WindowDesc | _train_depot_desc
static const WindowDesc | _road_depot_desc
static const WindowDesc | _ship_depot_desc
static const WindowDesc | _aircraft_depot_desc
uint | _block_sizes [4][2]
const uint | _resize_cap [][2]

## Detailed Description

The GUI for depots.

Definition in file depot_gui.cpp.

## Enumeration Type Documentation

enum DepotWindowWidgets

Enumerator:

  DEPOT_WIDGET_V_SCROLL | Vertical scrollbar.
  DEPOT_WIDGET_H_SCROLL | Horizontal scrollbar.

Definition at line 35 of file depot_gui.cpp.

## Function Documentation

void CcCloneVehicle | ( | bool | success,
|  | TileIndex | tile,
|  | uint32 | p1,
|  | uint32 | p2 |
| ) |  |  |

This is the Callback method after the cloning attempt of a vehicle.

Parameters:

  | success | indicates completion (or not) of the operation
  | tile | unused
  | p1 | unused
  | p2 | unused

Definition at line 138 of file depot_gui.cpp.

References ShowVehicleViewWindow().

void DeleteDepotHighlightOfVehicle | ( | const Vehicle * | v | ) |

Removes the highlight of a vehicle in a depot window.

Parameters:

  | *v | Vehicle to remove all highlights from

Definition at line 1059 of file depot_gui.cpp.

References FindWindowById().

void ShowDepotWindow | ( | TileIndex | tile,
|  | VehicleType | type |
| ) |  |  |

Opens a depot window.

Parameters:

  | tile | The tile where the depot/hangar is located
  | type | The type of vehicles in the depot

Definition at line 1040 of file depot_gui.cpp.

References BringWindowToFrontById().

int WagonLengthToPixels | ( | int | len | ) |

Get the number of pixels for the given wagon length.

Parameters:

  | len | Length measured in 1/8ths of a standard wagon.

Returns:
  Number of pixels across.

Definition at line 63 of file train_gui.cpp.

## Variable Documentation

const WindowDesc _aircraft_depot_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 36, 27, 332, 99,
      WC_VEHICLE_DEPOT, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _depot_widgets,
    }

Definition at line 121 of file depot_gui.cpp.

const Widget _depot_widgets[]`[static]`

Initial value:

     {
      {   WWT_CLOSEBOX,   RESIZE_NONE,  COLOUR_GREY,     0,    10,     0,    13, STR_00C5,            STR_018B_CLOSE_WINDOW},
      {    WWT_CAPTION,  RESIZE_RIGHT,  COLOUR_GREY,    11,    23,     0,    13, 0x0,                 STR_018C_WINDOW_TITLE_DRAG_THIS},
      {  WWT_STICKYBOX,     RESIZE_LR,  COLOUR_GREY,    24,    35,     0,    13, 0x0,                 STR_STICKY_BUTTON},

      {     WWT_IMGBTN,    RESIZE_LRB,  COLOUR_GREY,     1,    23,    14,   -32, 0x0,                 STR_NULL},
      {     WWT_IMGBTN,   RESIZE_LRTB,  COLOUR_GREY,     1,    23,   -55,   -32, SPR_SELL_CHAIN_TRAIN,STR_DRAG_WHOLE_TRAIN_TO_SELL_TIP},
      { WWT_PUSHIMGBTN,   RESIZE_LRTB,  COLOUR_GREY,     1,    23,   -31,    -9, 0x0,                 STR_NULL},
      { WWT_PUSHIMGBTN,   RESIZE_LRTB,  COLOUR_GREY,     1,    23,    -8,    14, 0x0,                 STR_NULL},

      {     WWT_MATRIX,     RESIZE_RB,  COLOUR_GREY,     0,     0,    14,    14, 0x0,                 STR_NULL},
      {  WWT_SCROLLBAR,    RESIZE_LRB,  COLOUR_GREY,    24,    35,    14,    14, 0x0,                 STR_0190_SCROLL_BAR_SCROLLS_LIST},

      { WWT_HSCROLLBAR,    RESIZE_RTB,  COLOUR_GREY,     0,     0,     3,    14, 0x0,                 STR_HSCROLL_BAR_SCROLLS_LIST},

      { WWT_PUSHTXTBTN,     RESIZE_TB,  COLOUR_GREY,     0,     0,    15,    26, 0x0,                 STR_NULL},
      {    WWT_TEXTBTN,     RESIZE_TB,  COLOUR_GREY,     0,     0,    15,    26, 0x0,                 STR_NULL},
      { WWT_PUSHTXTBTN,    RESIZE_RTB,  COLOUR_GREY,     0,   -12,    15,    26, STR_00E4_LOCATION,   STR_NULL},
      { WWT_PUSHTXTBTN,   RESIZE_LRTB,  COLOUR_GREY,   -11,     0,    15,    26, 0x0,                 STR_NULL},
      { WWT_PUSHIMGBTN,   RESIZE_LRTB,  COLOUR_GREY,     1,    11,    15,    26, SPR_FLAG_VEH_STOPPED,STR_NULL},
      { WWT_PUSHIMGBTN,   RESIZE_LRTB,  COLOUR_GREY,    12,    23,    15,    26, SPR_FLAG_VEH_RUNNING,STR_NULL},
      {  WWT_RESIZEBOX,   RESIZE_LRTB,  COLOUR_GREY,    24,    35,    15,    26, 0x0,                 STR_RESIZE_BUTTON},
      {   WIDGETS_END},
    }

Definition at line 71 of file depot_gui.cpp.

const uint _resize_cap[][2]

Initial value:

     {
        {6, 10 * 29},
         {5, 5},
         {3, 3},
     {3, 4},
    }

Definition at line 171 of file depot_gui.cpp.

const WindowDesc _road_depot_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 36, 27, 316, 97,
      WC_VEHICLE_DEPOT, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _depot_widgets,
    }

Definition at line 107 of file depot_gui.cpp.

const WindowDesc _ship_depot_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 36, 27, 306, 99,
      WC_VEHICLE_DEPOT, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _depot_widgets,
    }

Definition at line 114 of file depot_gui.cpp.

const WindowDesc _train_depot_desc`[static]`

Initial value:

     {
      WDP_AUTO, WDP_AUTO, 36, 27, 362, 123,
      WC_VEHICLE_DEPOT, WC_NONE,
      WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
      _depot_widgets,
    }

Definition at line 100 of file depot_gui.cpp.