OpenTTD
Data Structures | Functions | Variables
depot_gui.cpp File Reference

The GUI for depots. More...

#include "stdafx.h"
#include "train.h"
#include "roadveh.h"
#include "ship.h"
#include "aircraft.h"
#include "gui.h"
#include "textbuf_gui.h"
#include "viewport_func.h"
#include "command_func.h"
#include "depot_base.h"
#include "spritecache.h"
#include "strings_func.h"
#include "vehicle_func.h"
#include "company_func.h"
#include "tilehighlight_func.h"
#include "window_gui.h"
#include "vehiclelist.h"
#include "order_backup.h"
#include "zoom_func.h"
#include "widgets/depot_widget.h"
#include "table/strings.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

struct  DepotWindow
 
struct  DepotWindow::GetDepotVehiclePtData
 

Functions

void DepotSortList (VehicleList *list)
 
void CcCloneVehicle (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 This is the Callback method after the cloning attempt of a vehicle. More...
 
static void TrainDepotMoveVehicle (const Vehicle *wagon, VehicleID sel, const Vehicle *head)
 
VehicleCellSize GetVehicleImageCellSize (VehicleType type, EngineImageType image_type)
 Get the GUI cell size for a vehicle image. More...
 
static void InitBlocksizeForVehicles (VehicleType type, EngineImageType image_type)
 
void InitDepotWindowBlockSizes ()
 Set the size of the blocks in the window so we can be sure that they are big enough for the vehicle sprites in the current game. More...
 
static void DepotSellAllConfirmationCallback (Window *w, bool confirmed)
 
const SpriteGetAircraftSprite (EngineID engine)
 
void ShowDepotWindow (TileIndex tile, VehicleType type)
 Opens a depot window. More...
 
void DeleteDepotHighlightOfVehicle (const Vehicle *v)
 Removes the highlight of a vehicle in a depot window. More...
 

Variables

static const NWidgetPart _nested_train_depot_widgets []
 Nested widget definition for train depots. More...
 
static WindowDesc _train_depot_desc (WDP_AUTO, "depot_train", 362, 123, WC_VEHICLE_DEPOT, WC_NONE, 0, _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets))
 
static WindowDesc _road_depot_desc (WDP_AUTO, "depot_roadveh", 316, 97, WC_VEHICLE_DEPOT, WC_NONE, 0, _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets))
 
static WindowDesc _ship_depot_desc (WDP_AUTO, "depot_ship", 306, 99, WC_VEHICLE_DEPOT, WC_NONE, 0, _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets))
 
static WindowDesc _aircraft_depot_desc (WDP_AUTO, "depot_aircraft", 332, 99, WC_VEHICLE_DEPOT, WC_NONE, 0, _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets))
 
static VehicleCellSize _base_block_sizes_depot [VEH_COMPANY_END]
 Cell size for vehicle images in the depot view.
 
static VehicleCellSize _base_block_sizes_purchase [VEH_COMPANY_END]
 Cell size for vehicle images in the purchase list.
 
static uint _consistent_train_width
 Whether trains of all lengths are consistently scaled. Either TRAININFO_DEFAULT_VEHICLE_WIDTH, VEHICLEINFO_FULL_VEHICLE_WIDTH, or 0.
 

Detailed Description

The GUI for depots.

Definition in file depot_gui.cpp.

Function Documentation

◆ CcCloneVehicle()

void CcCloneVehicle ( const CommandCost result,
TileIndex  tile,
uint32  p1,
uint32  p2 
)

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

Parameters
resultthe result of the cloning command
tileunused
p1unused
p2unused

Definition at line 121 of file depot_gui.cpp.

References CommandCost::Failed(), and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get().

Referenced by DepotWindow::OnVehicleSelect().

◆ DeleteDepotHighlightOfVehicle()

void DeleteDepotHighlightOfVehicle ( const Vehicle v)

Removes the highlight of a vehicle in a depot window.

Parameters
*vVehicle to remove all highlights from

Definition at line 1112 of file depot_gui.cpp.

References _special_mouse_mode, FindWindowById(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, ResetObjectToPlace(), Vehicle::tile, WC_VEHICLE_DEPOT, and WSM_DRAGDROP.

◆ GetVehicleImageCellSize()

VehicleCellSize GetVehicleImageCellSize ( VehicleType  type,
EngineImageType  image_type 
)

Get the GUI cell size for a vehicle image.

Parameters
typeVehicle type to get the size for.
image_typeImage type to get size for.
Precondition
image_type == EIT_IN_DEPOT || image_type == EIT_PURCHASE
Returns
Cell dimensions for the vehicle and image type.

Definition at line 159 of file depot_gui.cpp.

References EIT_IN_DEPOT, and EIT_PURCHASE.

Referenced by GetEngineListHeight(), and BuildVehicleWindow::UpdateWidgetSize().

◆ InitDepotWindowBlockSizes()

void InitDepotWindowBlockSizes ( )

Set the size of the blocks in the window so we can be sure that they are big enough for the vehicle sprites in the current game.

Note
Calling this function once for each game is enough.

Definition at line 217 of file depot_gui.cpp.

Referenced by ReInitAllWindows().

◆ ShowDepotWindow()

void ShowDepotWindow ( TileIndex  tile,
VehicleType  type 
)

Opens a depot window.

Parameters
tileThe tile where the depot/hangar is located
typeThe type of vehicles in the depot

Definition at line 1092 of file depot_gui.cpp.

References BringWindowToFrontById(), and WC_VEHICLE_DEPOT.

Variable Documentation

◆ _nested_train_depot_widgets

const NWidgetPart _nested_train_depot_widgets[]
static

Nested widget definition for train depots.

Definition at line 45 of file depot_gui.cpp.