depot_gui.cpp File Reference

The GUI for depots. More...

#include "train.h"
#include "ship.h"
#include "aircraft.h"
#include "roadveh.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_CAPTION, 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
}

Functions

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 InitBlocksizeForShipAircraft (VehicleType 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 SpriteGetAircraftSprite (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 NWidgetPart _nested_train_depot_widgets []
 Nested widget definition for train depots.
static const WindowDesc _train_depot_desc (WDP_AUTO, 362, 123, WC_VEHICLE_DEPOT, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets))
static const WindowDesc _road_depot_desc (WDP_AUTO, 316, 97, WC_VEHICLE_DEPOT, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets))
static const WindowDesc _ship_depot_desc (WDP_AUTO, 306, 99, WC_VEHICLE_DEPOT, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets))
static const WindowDesc _aircraft_depot_desc (WDP_AUTO, 332, 99, WC_VEHICLE_DEPOT, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets))
static Dimension _base_block_sizes [4]
 Array containing the cell size in pixels of the DEPOT_WIDGET_MATRIX widget for each vehicle type.


Detailed Description

The GUI for depots.

Definition in file depot_gui.cpp.


Enumeration Type Documentation

Enumerator:
DEPOT_WIDGET_V_SCROLL  Vertical scrollbar.
DEPOT_WIDGET_H_SCROLL  Horizontal scrollbar.

Definition at line 43 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 129 of file depot_gui.cpp.

References ShowVehicleViewWindow().

Referenced by VehicleViewWindow::OnClick().

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 1000 of file depot_gui.cpp.

References FindWindowById().

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 193 of file depot_gui.cpp.

References GetVehicleHeight(), Dimension::height, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, and Dimension::width.

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 981 of file depot_gui.cpp.

References BringWindowToFrontById(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.


Variable Documentation

Array containing the cell size in pixels of the DEPOT_WIDGET_MATRIX widget for each vehicle type.

Note:
The train vehicle type uses the entire row for each train.

Definition at line 158 of file depot_gui.cpp.

Initial value:

 {
  NWidget(NWID_HORIZONTAL),
    NWidget(WWT_CLOSEBOX, COLOUR_GREY),
    NWidget(WWT_CAPTION, COLOUR_GREY, DEPOT_WIDGET_CAPTION),
    NWidget(WWT_SHADEBOX, COLOUR_GREY),
    NWidget(WWT_STICKYBOX, COLOUR_GREY),
  EndContainer(),
  NWidget(NWID_HORIZONTAL),
    NWidget(NWID_VERTICAL),
      NWidget(WWT_MATRIX, COLOUR_GREY, DEPOT_WIDGET_MATRIX), SetDataTip(0x0, STR_NULL), SetResize(1, 1),
      NWidget(WWT_HSCROLLBAR, COLOUR_GREY, DEPOT_WIDGET_H_SCROLL),
    EndContainer(),
    NWidget(NWID_VERTICAL),
      NWidget(WWT_IMGBTN, COLOUR_GREY, DEPOT_WIDGET_SELL), SetDataTip(0x0, STR_NULL), SetResize(0, 1), SetFill(0, 1),
      NWidget(WWT_IMGBTN, COLOUR_GREY, DEPOT_WIDGET_SELL_CHAIN), SetDataTip(SPR_SELL_CHAIN_TRAIN, STR_DEPOT_DRAG_WHOLE_TRAIN_TO_SELL_TOOLTIP), SetResize(0, 1), SetFill(0, 1),
      NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_SELL_ALL), SetDataTip(0x0, STR_NULL),
      NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_AUTOREPLACE), SetDataTip(0x0, STR_NULL),
    EndContainer(),
    NWidget(WWT_SCROLLBAR, COLOUR_GREY, DEPOT_WIDGET_V_SCROLL),
  EndContainer(),
  NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
    NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_BUILD), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0),
    NWidget(WWT_TEXTBTN, COLOUR_GREY, DEPOT_WIDGET_CLONE), SetDataTip(0x0, STR_NULL), SetFill(1, 1), SetResize(1, 0),
    NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_LOCATION), SetDataTip(STR_BUTTON_LOCATION, STR_NULL), SetFill(1, 1), SetResize(1, 0),
    NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, DEPOT_WIDGET_VEHICLE_LIST), SetDataTip(0x0, STR_NULL), SetFill(0, 1),
    NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_STOP_ALL), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_NULL), SetFill(0, 1),
    NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, DEPOT_WIDGET_START_ALL), SetDataTip(SPR_FLAG_VEH_RUNNING, STR_NULL), SetFill(0, 1),
    NWidget(WWT_RESIZEBOX, COLOUR_GREY),
  EndContainer(),
}
Nested widget definition for train depots.

Definition at line 61 of file depot_gui.cpp.


Generated on Tue Jan 5 21:03:02 2010 for OpenTTD by  doxygen 1.5.6