depot_func.h File Reference

Functions related to depots. More...

#include "tile_type.h"
#include "vehicle_type.h"
#include "direction_type.h"
#include "slope_type.h"

Go to the source code of this file.

Functions

void ShowDepotWindow (TileIndex tile, VehicleType type)
 Opens a depot window.
void InitializeDepots ()
void DeleteDepotHighlightOfVehicle (const Vehicle *v)
 Removes the highlight of a vehicle in a depot window.
static bool CanBuildDepotByTileh (DiagDirection direction, Slope tileh)
 Find out if the slope of the tile is suitable to build a depot of given direction.

Detailed Description

Functions related to depots.

Definition in file depot_func.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 40 of file depot_func.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 1001 of file depot_gui.cpp.

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

Referenced by Vehicle::PreDestructor().

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

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


Generated on Sat Jul 31 21:37:57 2010 for OpenTTD by  doxygen 1.6.1