depot.h File Reference

Header files for depots (not hangars). More...

#include "direction_type.h"
#include "oldpool.h"
#include "road_map.h"
#include "rail_map.h"
#include "water_map.h"
#include "station_map.h"

Go to the source code of this file.

Data Structures

struct  Depot

Defines

#define FOR_ALL_DEPOTS_FROM(d, start)   for (d = GetDepot(start); d != NULL; d = (d->index + 1U < GetDepotPoolSize()) ? GetDepot(d->index + 1U) : NULL) if (d->IsValid())
#define FOR_ALL_DEPOTS(d)   FOR_ALL_DEPOTS_FROM(d, 0)

Functions

static bool IsValidDepotID (DepotID index)
void ShowDepotWindow (TileIndex tile, VehicleType type)
 Opens a depot window.
static bool IsTileDepotType (TileIndex tile, TransportType type)
 Check if a tile is a depot of the given type.
static bool IsDepotTile (TileIndex tile)
 Is the given tile a tile with a depot on it?
static bool CanBuildDepotByTileh (DiagDirection direction, Slope tileh)
 Find out if the slope of the tile is suitable to build a depot of given direction.
Depot * GetDepotByTile (TileIndex tile)
 Gets a depot from a tile.
void InitializeDepots ()
void DeleteDepotHighlightOfVehicle (const Vehicle *v)
 Removes the highlight of a vehicle in a depot window.


Detailed Description

Header files for depots (not hangars).

Definition in file depot.h.


Function Documentation

static bool CanBuildDepotByTileh ( DiagDirection  direction,
Slope  tileh 
) [inline, static]

Find out if the slope of the tile is suitable to build a depot of given direction.

Parameters:
direction The direction in which the depot's exit points
tileh The slope of the tile in question
Returns:
true if the construction is possible
This is checked by the ugly 0x4C >> direction magic, which does the following: 0x4C is 0100 1100 and tileh has only bits 0..3 set (steep tiles are ruled out) So: for direction (only the significant bits are shown)

00 (exit towards NE) we need either bit 2 or 3 set in tileh: 0x4C >> 0 = 1100

01 (exit towards SE) we need either bit 1 or 2 set in tileh: 0x4C >> 1 = 0110

02 (exit towards SW) we need either bit 0 or 1 set in tileh: 0x4C >> 2 = 0011

03 (exit towards NW) we need either bit 0 or 4 set in tileh: 0x4C >> 3 = 1001

So ((0x4C >> direction) & tileh) determines whether the depot can be built on the current tileh

Definition at line 90 of file depot.h.

Referenced by AutoslopeCheckForEntranceEdge(), CmdBuildRoadDepot(), and CmdBuildTrainDepot().

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

Referenced by CmdSellRailWagon(), CmdSellRoadVeh(), and CmdSellShip().

Depot* GetDepotByTile ( TileIndex  tile  ) 

Gets a depot from a tile.

Returns:
Returns the depot if the tile had a depot, else it returns NULL

Definition at line 22 of file depot.cpp.

Referenced by CmdSendTrainToDepot(), and YapfFindNearestRoadDepot().

static bool IsDepotTile ( TileIndex  tile  )  [inline, static]

Is the given tile a tile with a depot on it?

Parameters:
tile the tile to check
Returns:
true if and only if there is a depot on the tile.

Definition at line 64 of file depot.h.

References GetRailTileType(), GetTileType(), IsHangar(), MP_RAILWAY, MP_ROAD, MP_STATION, MP_WATER, and RAIL_TILE_DEPOT.

Referenced by CmdDepotMassAutoReplace().

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

References AllocateWindowDescFront(), and GetTileOwner().


Generated on Wed Oct 1 17:03:26 2008 for openttd by  doxygen 1.5.6