author | truebrain |
Wed, 26 Mar 2008 15:17:40 +0000 | |
branch | noai |
changeset 9823 | 0b7f816cf46f |
parent 9801 | 03a3eebd7fb7 |
child 9829 | 80fbe02a4184 |
permissions | -rw-r--r-- |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
2 |
|
9595
91423dbb6f5f
(svn r9628) [NoAI] -Fix: missing svn:eol-style and svn:keywords
rubidium
parents:
9594
diff
changeset
|
3 |
/** @file ai_road.hpp Everything to query and build roads */ |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
4 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
5 |
#ifndef AI_ROAD_HPP |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
6 |
#define AI_ROAD_HPP |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
7 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
8 |
#include "ai_object.hpp" |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
9 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
10 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
11 |
* Class that handles all road related functions. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
12 |
*/ |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
13 |
class AIRoad : public AIObject { |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
14 |
public: |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
15 |
/** |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
16 |
* The name of the class, needed by several sub-processes. |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
17 |
*/ |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
18 |
static const char *GetClassName() { return "AIRoad"; } |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
19 |
|
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
20 |
/** |
9556
65417763fa24
(svn r9494) [NoAI] -Fix: IsRoadTile returns true for all tiles that can be used to traverse a tile. This includes drive through road stops and excluded 'normal' road stations and road depots.
rubidium
parents:
9551
diff
changeset
|
21 |
* Checks whether the given tile is actually a tile with road that |
65417763fa24
(svn r9494) [NoAI] -Fix: IsRoadTile returns true for all tiles that can be used to traverse a tile. This includes drive through road stops and excluded 'normal' road stations and road depots.
rubidium
parents:
9551
diff
changeset
|
22 |
* can be used to traverse a tile. This excludes road depots and |
65417763fa24
(svn r9494) [NoAI] -Fix: IsRoadTile returns true for all tiles that can be used to traverse a tile. This includes drive through road stops and excluded 'normal' road stations and road depots.
rubidium
parents:
9551
diff
changeset
|
23 |
* 'normal' road stations, but includes drive through stations. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
24 |
* @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:
9764
diff
changeset
|
25 |
* @pre AIMap::IsValidTile(tile). |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
26 |
* @return true if and only if the tile has road. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
27 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
28 |
static bool IsRoadTile(TileIndex tile); |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
29 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
30 |
/** |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
31 |
* Checks whether the given tile is actually a tile with a road depot. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
32 |
* @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:
9764
diff
changeset
|
33 |
* @pre AIMap::IsValidTile(tile). |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
34 |
* @return true if and only if the tile has a road depot. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
35 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
36 |
static bool IsRoadDepotTile(TileIndex tile); |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
37 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
38 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
39 |
* Checks whether the given tile is actually a tile with a road station. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
40 |
* @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:
9764
diff
changeset
|
41 |
* @pre AIMap::IsValidTile(tile). |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
42 |
* @return true if and only if the tile has a road station. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
43 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
44 |
static bool IsRoadStationTile(TileIndex tile); |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
45 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
46 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
47 |
* Checks whether the given tile is actually a tile with a drive through |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
48 |
* road station. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
49 |
* @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:
9764
diff
changeset
|
50 |
* @pre AIMap::IsValidTile(tile). |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
51 |
* @return true if and only if the tile has a drive through road station. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
52 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
53 |
static bool IsDriveThroughRoadStationTile(TileIndex tile); |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
54 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
55 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
56 |
* Checks whether the given tiles are directly connected, i.e. whether |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
57 |
* a road vehicle can travel from the center of the first tile to the |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
58 |
* center of the second tile. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
59 |
* @param t1 the source tile. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
60 |
* @param t2 the destination tile. |
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:
9764
diff
changeset
|
61 |
* @pre AIMap::IsValidTile(t1). |
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:
9764
diff
changeset
|
62 |
* @pre AIMap::IsValidTile(t2). |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
63 |
* @pre t1 and t2 are directly neighbouring tiles. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
64 |
* @return true if and only if a road vehicle can go from t1 to t2. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
65 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
66 |
static bool AreRoadTilesConnected(TileIndex t1, TileIndex t2); |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
67 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
68 |
/** |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
69 |
* Count how many neighbours are road. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
70 |
* @param tile the tile to check on. |
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:
9764
diff
changeset
|
71 |
* @pre AIMap::IsValidTile(tile). |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
72 |
* @return 0 means no neighbour road; max value is 4. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
73 |
*/ |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
74 |
static int32 GetNeighbourRoadCount(TileIndex tile); |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
75 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
76 |
/** |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
77 |
* Gets the tile in front of a road depot. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
78 |
* @param depot the road depot tile. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
79 |
* @pre IsRoadDepotTile(depot). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
80 |
* @return the tile in front of the depot. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
81 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
82 |
static TileIndex GetRoadDepotFrontTile(TileIndex depot); |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
83 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
84 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
85 |
* Gets the tile in front of a road station. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
86 |
* @param station the road station tile. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
87 |
* @pre IsRoadStationTile(station). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
88 |
* @return the tile in front of the road station. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
89 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
90 |
static TileIndex GetRoadStationFrontTile(TileIndex station); |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
91 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
92 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
93 |
* Gets the tile at the back of a drive through road station. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
94 |
* So, one side of the drive through station is retrieved with |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
95 |
* GetTileInFrontOfStation, the other with this function. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
96 |
* @param station the road station tile. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
97 |
* @pre IsDriveThroughRoadStationTile(station). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
98 |
* @return the tile at the back of the drive through road station. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
99 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
100 |
static TileIndex GetDriveThroughBackTile(TileIndex station); |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
101 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
102 |
/** |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
103 |
* Builds a road from the center of tile start to the |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
104 |
* center of tile end. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
105 |
* @param start the start tile of the road. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
106 |
* @param end the end tile of the road. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
107 |
* @pre start is not equal to end |
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:
9764
diff
changeset
|
108 |
* @pre AIMap::IsValidTile(start). |
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:
9764
diff
changeset
|
109 |
* @pre AIMap::IsValidTile(end). |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
110 |
* @pre start and end are in a straight line, i.e. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
111 |
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
112 |
* AIMap::GetTileY(start) == AIMap::GetTileY(end). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
113 |
* @return whether the road has been/can be build or not. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
114 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
115 |
static bool BuildRoad(TileIndex start, TileIndex end); |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
116 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
117 |
/** |
9659
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
118 |
* Builds a road from the edge of tile start to the |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
119 |
* edge of tile end (both included). |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
120 |
* @param start the start tile of the road. |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
121 |
* @param end the end tile of the road. |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
122 |
* @pre start is not equal to end |
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:
9764
diff
changeset
|
123 |
* @pre AIMap::IsValidTile(start). |
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:
9764
diff
changeset
|
124 |
* @pre AIMap::IsValidTile(end). |
9659
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
125 |
* @pre start and end are in a straight line, i.e. |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
126 |
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
127 |
* AIMap::GetTileY(start) == AIMap::GetTileY(end). |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
128 |
* @return whether the road has been/can be build or not. |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
129 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
130 |
static bool BuildRoadFull(TileIndex start, TileIndex end); |
9659
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
131 |
|
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
132 |
/** |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
133 |
* Builds a road depot. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
134 |
* @param tile place to build the depot. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
135 |
* @param front the tile exactly in front of the depot |
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:
9764
diff
changeset
|
136 |
* @pre AIMap::IsValidTile(tile). |
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:
9764
diff
changeset
|
137 |
* @pre AIMap::IsValidTile(front). |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
138 |
* @pre tile is not equal to front |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
139 |
* @return whether the road depot has been/can be build or not. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
140 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
141 |
static bool BuildRoadDepot(TileIndex tile, TileIndex front); |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
142 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
143 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
144 |
* Builds a road bus or truck station. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
145 |
* @param tile place to build the depot. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
146 |
* @param front the tile exactly in front of the station. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
147 |
* For drive-through stations either entrance side can be used. |
9503
821422c9ca59
(svn r9381) [NoAI] -Fix: inconsistency between documentation and actual behaviour (Zuu).
rubidium
parents:
9462
diff
changeset
|
148 |
* @param truck whether to build a truck (true) or bus (false) station. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
149 |
* @param drive_through whether to make the station drive through or not. |
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:
9764
diff
changeset
|
150 |
* @pre AIMap::IsValidTile(tile). |
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:
9764
diff
changeset
|
151 |
* @pre AIMap::IsValidTile(front). |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
152 |
* @pre tile is not equal to front |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
153 |
* @return whether the station has been/can be build or not. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
154 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
155 |
static bool BuildRoadStation(TileIndex tile, TileIndex front, bool truck, bool drive_through); |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
156 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
157 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
158 |
* Removes a road from the center of tile start to the |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
159 |
* center of tile end. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
160 |
* @param start the start tile of the road. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
161 |
* @param end the end tile of the road. |
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:
9764
diff
changeset
|
162 |
* @pre AIMap::IsValidTile(start). |
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:
9764
diff
changeset
|
163 |
* @pre AIMap::IsValidTile(end). |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
164 |
* @pre start and end are in a straight line, i.e. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
165 |
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
166 |
* AIMap::GetTileY(start) == AIMap::GetTileY(end). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
167 |
* @return whether the road has been/can be removed or not. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
168 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
169 |
static bool RemoveRoad(TileIndex start, TileIndex end); |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
170 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
171 |
/** |
9659
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
172 |
* Removes a road from the edge of tile start to the |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
173 |
* edge of tile end (both included). |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
174 |
* @param start the start tile of the road. |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
175 |
* @param end the end tile of the road. |
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:
9764
diff
changeset
|
176 |
* @pre AIMap::IsValidTile(start). |
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:
9764
diff
changeset
|
177 |
* @pre AIMap::IsValidTile(end). |
9659
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
178 |
* @pre start and end are in a straight line, i.e. |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
179 |
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
180 |
* AIMap::GetTileY(start) == AIMap::GetTileY(end). |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
181 |
* @return whether the road has been/can be removed or not. |
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
182 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
183 |
static bool RemoveRoadFull(TileIndex start, TileIndex end); |
9659
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
184 |
|
ff5908205170
(svn r10568) [NoAI] -Add: {Build|Remove}RoadFull(). These functions have the same behaviour as {Build|Remove}Road(), except road is built/removed on both halves of ending tiles (ie build a sloped road on sloped tile instead half road with fundations)
glx
parents:
9617
diff
changeset
|
185 |
/** |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
186 |
* Removes a road depot. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
187 |
* @param tile place to remove the depot from. |
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:
9764
diff
changeset
|
188 |
* @pre AIMap::IsValidTile(tile). |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
189 |
* @pre tile is a road depot. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
190 |
* @return whether the road depot has been/can be removed or not. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
191 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
192 |
static bool RemoveRoadDepot(TileIndex tile); |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
193 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
194 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
195 |
* Removes a road bus or truck station. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
196 |
* @param tile place to remove the station from. |
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:
9764
diff
changeset
|
197 |
* @pre AIMap::IsValidTile(tile). |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
198 |
* @pre tile is a road station. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
199 |
* @return whether the station has been/can be removed or not. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
200 |
*/ |
9737
ee408edf3851
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents:
9659
diff
changeset
|
201 |
static bool RemoveRoadStation(TileIndex tile); |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
202 |
}; |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
203 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
204 |
#endif /* AI_ROAD_HPP */ |