author | rubidium |
Wed, 07 May 2008 21:45:27 +0000 | |
changeset 10457 | ea18877d8eba |
parent 10222 | b6919c94cc77 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10222
b6919c94cc77
(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:
10213
diff
changeset
|
3 |
/** @file depot_map.h Map related accessors for depots. */ |
6451
7baba06b4b85
(svn r8862) -Cleanup: doxygen changes, again. Mostly @files missing tags and a few comments style.
belugas
parents:
5726
diff
changeset
|
4 |
|
10222
b6919c94cc77
(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:
10213
diff
changeset
|
5 |
#ifndef DEPOT_MAP_H |
b6919c94cc77
(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:
10213
diff
changeset
|
6 |
#define DEPOT_MAP_H |
1313
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
diff
changeset
|
7 |
|
6508
8bd54af67f0b
(svn r8954) -Codechange: remove direct map accesses from non-map-accessor headers.
rubidium
parents:
6460
diff
changeset
|
8 |
#include "road_map.h" |
8bd54af67f0b
(svn r8954) -Codechange: remove direct map accesses from non-map-accessor headers.
rubidium
parents:
6460
diff
changeset
|
9 |
#include "rail_map.h" |
8bd54af67f0b
(svn r8954) -Codechange: remove direct map accesses from non-map-accessor headers.
rubidium
parents:
6460
diff
changeset
|
10 |
#include "water_map.h" |
8008
82de75c83c3e
(svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents:
7992
diff
changeset
|
11 |
#include "station_map.h" |
1313
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
diff
changeset
|
12 |
|
1330
8a67d04016ce
(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 |
/** |
10213
23cfd330ccac
(svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents:
9264
diff
changeset
|
14 |
* Check if a tile is a depot and it is a depot of the given type. |
1330
8a67d04016ce
(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 |
*/ |
10213
23cfd330ccac
(svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents:
9264
diff
changeset
|
16 |
static inline bool IsDepotTypeTile(TileIndex tile, TransportType type) |
1330
8a67d04016ce
(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
bab1ebc37da0
(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) { |
10213
23cfd330ccac
(svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents:
9264
diff
changeset
|
19 |
default: NOT_REACHED(); |
1330
8a67d04016ce
(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: |
10213
23cfd330ccac
(svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents:
9264
diff
changeset
|
21 |
return IsRailDepotTile(tile); |
1959 | 22 |
|
1330
8a67d04016ce
(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: |
9059
04edde3eb0c6
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8707
diff
changeset
|
24 |
return IsRoadDepotTile(tile); |
1959 | 25 |
|
1330
8a67d04016ce
(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: |
10213
23cfd330ccac
(svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents:
9264
diff
changeset
|
27 |
return IsShipDepotTile(tile); |
1330
8a67d04016ce
(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 |
} |
8a67d04016ce
(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 |
} |
8a67d04016ce
(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 |
|
8008
82de75c83c3e
(svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents:
7992
diff
changeset
|
31 |
/** |
82de75c83c3e
(svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents:
7992
diff
changeset
|
32 |
* Is the given tile a tile with a depot on it? |
82de75c83c3e
(svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents:
7992
diff
changeset
|
33 |
* @param tile the tile to check |
82de75c83c3e
(svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents:
7992
diff
changeset
|
34 |
* @return true if and only if there is a depot on the tile. |
82de75c83c3e
(svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents:
7992
diff
changeset
|
35 |
*/ |
82de75c83c3e
(svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents:
7992
diff
changeset
|
36 |
static inline bool IsDepotTile(TileIndex tile) |
82de75c83c3e
(svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents:
7992
diff
changeset
|
37 |
{ |
10213
23cfd330ccac
(svn r12745) -Codechange: a bit of naming conventions, introduce Is*DepotTile()
smatz
parents:
9264
diff
changeset
|
38 |
return IsRailDepotTile(tile) || IsRoadDepotTile(tile) || IsShipDepotTile(tile) || IsHangarTile(tile); |
8008
82de75c83c3e
(svn r11027) -Fix: do not unconditionally assume that a tile has a depot.
rubidium
parents:
7992
diff
changeset
|
39 |
} |
1650
12a20779af79
(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 |
|
10222
b6919c94cc77
(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:
10213
diff
changeset
|
41 |
#endif /* DEPOT_MAP_H */ |