OpenTTD Source 20241224-master-gee860a5c8e
|
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 "error.h"
#include "depot_cmd.h"
#include "train_cmd.h"
#include "vehicle_cmd.h"
#include "core/geometry_func.hpp"
#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 (Commands, const CommandCost &result, VehicleID veh_id) |
This is the Callback method after the cloning attempt of a vehicle. | |
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. | |
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. | |
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 constexpr NWidgetPart | _nested_train_depot_widgets [] |
Nested widget definition for train depots. | |
static WindowDesc | _train_depot_desc (WDP_AUTO, "depot_train", 362, 123, WC_VEHICLE_DEPOT, WC_NONE, 0, _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) |
static WindowDesc | _ship_depot_desc (WDP_AUTO, "depot_ship", 306, 99, WC_VEHICLE_DEPOT, WC_NONE, 0, _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) |
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. | |
The GUI for depots.
Definition in file depot_gui.cpp.
void CcCloneVehicle | ( | Commands | cmd, |
const CommandCost & | result, | ||
VehicleID | veh_id | ||
) |
This is the Callback method after the cloning attempt of a vehicle.
result | the result of the cloning command |
veh_id | cloned vehicle ID |
Definition at line 123 of file depot_gui.cpp.
References CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Get(), and ShowVehicleViewWindow().
Referenced by VehicleViewWindow::OnClick(), and DepotWindow::OnVehicleSelect().
void DeleteDepotHighlightOfVehicle | ( | const Vehicle * | v | ) |
Removes the highlight of a vehicle in a depot window.
*v | Vehicle to remove all highlights from |
Definition at line 1181 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.
Referenced by Vehicle::PreDestructor().
|
static |
Definition at line 1149 of file depot_gui.cpp.
|
extern |
Definition at line 563 of file vehicle_gui.cpp.
VehicleCellSize GetVehicleImageCellSize | ( | VehicleType | type, |
EngineImageType | image_type | ||
) |
Get the GUI cell size for a vehicle image.
type | Vehicle type to get the size for. |
image_type | Image type to get size for. |
Definition at line 161 of file depot_gui.cpp.
References _base_block_sizes_depot, _base_block_sizes_purchase, EIT_IN_DEPOT, and EIT_PURCHASE.
Referenced by DrawEngineList(), NewGRFInspectWindow::DrawVehicleChainWidget(), GetEngineListHeight(), DepotWindow::OnInit(), BuildVehicleWindow::UpdateWidgetSize(), and NewGRFInspectWindow::UpdateWidgetSize().
|
static |
Definition at line 170 of file depot_gui.cpp.
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.
Definition at line 218 of file depot_gui.cpp.
References _consistent_train_width, EIT_IN_DEPOT, EIT_PURCHASE, Engine::IterateType(), VEH_COMPANY_END, and VEH_TRAIN.
Referenced by InitWindowSystem(), and ReInitAllWindows().
void ShowDepotWindow | ( | TileIndex | tile, |
VehicleType | type | ||
) |
Opens a depot window.
tile | The tile where the depot/hangar is located |
type | The type of vehicles in the depot |
Definition at line 1164 of file depot_gui.cpp.
References BringWindowToFrontById(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, and WC_VEHICLE_DEPOT.
|
static |
Definition at line 132 of file depot_gui.cpp.
|
static |
Cell size for vehicle images in the depot view.
Definition at line 150 of file depot_gui.cpp.
Referenced by GetVehicleImageCellSize().
|
static |
Cell size for vehicle images in the purchase list.
Definition at line 151 of file depot_gui.cpp.
Referenced by GetVehicleImageCellSize().
|
static |
Whether trains of all lengths are consistently scaled. Either TRAININFO_DEFAULT_VEHICLE_WIDTH, VEHICLEINFO_FULL_VEHICLE_WIDTH, or 0.
Definition at line 152 of file depot_gui.cpp.
Referenced by DepotWindow::DrawVehicleInDepot(), DepotWindow::DrawWidget(), and InitDepotWindowBlockSizes().
|
staticconstexpr |
Nested widget definition for train depots.
Definition at line 49 of file depot_gui.cpp.