author | rubidium |
Sun, 06 Apr 2008 12:26:40 +0000 | |
branch | noai |
changeset 9867 | b7d9ffe24f81 |
parent 9838 | 0839682a601b |
child 10088 | 922c6e6a8d3e |
permissions | -rw-r--r-- |
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9807
diff
changeset
|
1 |
/* $Id$ */ |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9807
diff
changeset
|
2 |
|
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9807
diff
changeset
|
3 |
/** @file ai_tunnel.hpp Everything to query and build tunnels. */ |
9794 | 4 |
|
5 |
#ifndef AI_TUNNEL_HPP |
|
6 |
#define AI_TUNNEL_HPP |
|
7 |
||
8 |
#include "ai_object.hpp" |
|
9 |
#include "ai_vehicle.hpp" |
|
10 |
||
11 |
/** |
|
12 |
* Class that handles all tunnel related functions. |
|
13 |
*/ |
|
14 |
class AITunnel : public AIObject { |
|
15 |
public: |
|
16 |
static const char *GetClassName() { return "AITunnel"; } |
|
17 |
||
18 |
/** |
|
9807
5b3be41b3ce6
(svn r12315) [NoAI] -Fix: AITunnel::GetOtherTunnelEnd() now also works to estimate where a non-existing tunnel would end (Morloth / glx)
truebrain
parents:
9801
diff
changeset
|
19 |
* Check whether the tile is an entrance to a tunnel. |
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
20 |
* @param tile The tile to check. |
9801
03a3eebd7fb7
(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents:
9794
diff
changeset
|
21 |
* @pre AIMap::IsValidTile(tile). |
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
22 |
* @return True if and only if the tile is the beginning or end of a tunnel. |
9794 | 23 |
*/ |
24 |
static bool IsTunnelTile(TileIndex tile); |
|
25 |
||
26 |
/** |
|
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
27 |
* Get the tile that exits on the other end of a (would be) tunnel starting |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
28 |
* at tile. |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
29 |
* @param tile The tile that is an entrance to a tunnel or the tile where you may want to build a tunnel. |
9807
5b3be41b3ce6
(svn r12315) [NoAI] -Fix: AITunnel::GetOtherTunnelEnd() now also works to estimate where a non-existing tunnel would end (Morloth / glx)
truebrain
parents:
9801
diff
changeset
|
30 |
* @pre AIMap::IsValidTile(tile). |
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
31 |
* @return The TileIndex that is the other end of the (would be) tunnel, or |
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
32 |
* 'tile' if no other end was found (crossing tunnels). |
9794 | 33 |
*/ |
34 |
static TileIndex GetOtherTunnelEnd(TileIndex tile); |
|
35 |
||
36 |
/** |
|
37 |
* Builds a tunnel starting at start. The direction of the tunnel depends |
|
38 |
* on the slope of the start tile. Tunnels can be created for either |
|
39 |
* rails or roads; use the appropriate AIVehicle::VehicleType. |
|
40 |
* @param start Where to start the tunnel. |
|
41 |
* @param vehicle_type The vehicle-type of tunnel to build. |
|
9801
03a3eebd7fb7
(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents:
9794
diff
changeset
|
42 |
* @pre AIMap::IsValidTile(start). |
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
43 |
* @pre 'vehicle_type' is either AIVehicle::VEHICLE_RAIL or AIVEHICLE::VEHICLE_ROAD. |
9794 | 44 |
* @return Whether the tunnel has been/can be build or not. |
45 |
* @note The slope of a tile can be determined by AITile::GetSlope(TileIndex). |
|
46 |
*/ |
|
47 |
static bool BuildTunnel(AIVehicle::VehicleType vehicle_type, TileIndex start); |
|
48 |
||
49 |
/** |
|
50 |
* Remove the tunnel whose entrance is located at tile. |
|
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9829
diff
changeset
|
51 |
* @param tile The tile that is an entrance to a tunnel. |
9801
03a3eebd7fb7
(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
truebrain
parents:
9794
diff
changeset
|
52 |
* @pre AIMap::IsValidTile(tile) && IsTunnelTile(tile). |
9794 | 53 |
* @return Whether the tunnel has been/can be removed or not. |
54 |
*/ |
|
55 |
static bool RemoveTunnel(TileIndex tile); |
|
56 |
}; |
|
57 |
||
58 |
#endif /* AI_TUNNEL_HPP */ |