src/depot_map.h
author rubidium
Thu, 17 Apr 2008 19:10:30 +0000
changeset 8962 1b263c69799d
parent 8954 src/depot.h@3993bae3bfb8
permissions -rw-r--r--
(svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2153
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2153
diff changeset
     2
8962
1b263c69799d (svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium
parents: 8954
diff changeset
     3
/** @file depot_map.h Map related accessors for depots. */
6125
a6fff965707c (svn r8862) -Cleanup: doxygen changes, again. Mostly @files missing tags and a few comments style.
belugas
parents: 5475
diff changeset
     4
8962
1b263c69799d (svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium
parents: 8954
diff changeset
     5
#ifndef DEPOT_MAP_H
1b263c69799d (svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium
parents: 8954
diff changeset
     6
#define DEPOT_MAP_H
1313
f1013ec3d318 (svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
diff changeset
     7
6182
7337aca829f1 (svn r8954) -Codechange: remove direct map accesses from non-map-accessor headers.
rubidium
parents: 6134
diff changeset
     8
#include "road_map.h"
7337aca829f1 (svn r8954) -Codechange: remove direct map accesses from non-map-accessor headers.
rubidium
parents: 6134
diff changeset
     9
#include "rail_map.h"
7337aca829f1 (svn r8954) -Codechange: remove direct map accesses from non-map-accessor headers.
rubidium
parents: 6134
diff changeset
    10
#include "water_map.h"
7512
dd5d439e1337 (svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents: 7496
diff changeset
    11
#include "station_map.h"
1313
f1013ec3d318 (svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
diff changeset
    12
1330
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1313
diff changeset
    13
/**
8954
3993bae3bfb8 (svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents: 8768
diff changeset
    14
 * Check if a tile is a depot and it is a depot of the given type.
1330
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1313
diff changeset
    15
 */
8954
3993bae3bfb8 (svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents: 8768
diff changeset
    16
static inline bool IsDepotTypeTile(TileIndex tile, TransportType type)
1330
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1313
diff changeset
    17
{
4000
4009d092b306 (svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents: 3957
diff changeset
    18
	switch (type) {
8954
3993bae3bfb8 (svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents: 8768
diff changeset
    19
		default: NOT_REACHED();
1330
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1313
diff changeset
    20
		case TRANSPORT_RAIL:
8954
3993bae3bfb8 (svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents: 8768
diff changeset
    21
			return IsRailDepotTile(tile);
1959
c2c3a9850c2e (svn r2465) Remove some unreachable code
tron
parents: 1944
diff changeset
    22
1330
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1313
diff changeset
    23
		case TRANSPORT_ROAD:
8563
13b1a41e46f1 (svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents: 8211
diff changeset
    24
			return IsRoadDepotTile(tile);
1959
c2c3a9850c2e (svn r2465) Remove some unreachable code
tron
parents: 1944
diff changeset
    25
1330
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1313
diff changeset
    26
		case TRANSPORT_WATER:
8954
3993bae3bfb8 (svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents: 8768
diff changeset
    27
			return IsShipDepotTile(tile);
1330
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1313
diff changeset
    28
	}
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1313
diff changeset
    29
}
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1313
diff changeset
    30
7512
dd5d439e1337 (svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents: 7496
diff changeset
    31
/**
dd5d439e1337 (svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents: 7496
diff changeset
    32
 * Is the given tile a tile with a depot on it?
dd5d439e1337 (svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents: 7496
diff changeset
    33
 * @param tile the tile to check
dd5d439e1337 (svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents: 7496
diff changeset
    34
 * @return true if and only if there is a depot on the tile.
dd5d439e1337 (svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents: 7496
diff changeset
    35
 */
dd5d439e1337 (svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents: 7496
diff changeset
    36
static inline bool IsDepotTile(TileIndex tile)
dd5d439e1337 (svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents: 7496
diff changeset
    37
{
8954
3993bae3bfb8 (svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents: 8768
diff changeset
    38
	return IsRailDepotTile(tile) || IsRoadDepotTile(tile) || IsShipDepotTile(tile) || IsHangarTile(tile);
7512
dd5d439e1337 (svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents: 7496
diff changeset
    39
}
1650
4a5141e10b72 (svn r2154) - Fix: [NPF] Vehicles should no longer try to drive through the back of depots and road stations.
matthijs
parents: 1330
diff changeset
    40
8962
1b263c69799d (svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium
parents: 8954
diff changeset
    41
#endif /* DEPOT_MAP_H */