author | rubidium |
Tue, 08 Apr 2008 07:24:23 +0000 | |
branch | noai |
changeset 10094 | e737405b06dd |
parent 10091 | e4feb2f9fedf |
child 10096 | 780921b39016 |
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 |
|
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
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" |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
9 |
#include "ai_error.hpp" |
9453
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 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
12 |
* 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
|
13 |
*/ |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
14 |
class AIRoad : public AIObject { |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
15 |
public: |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
16 |
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
|
17 |
|
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
18 |
enum ErrorMessages { |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
19 |
/** Base for road building / maintaining errors */ |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
20 |
ERR_ROAD_BASE = AIError::ERR_CAT_ROAD << AIError::ERR_CAT_BIT_SIZE, |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
21 |
|
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
22 |
/** Road works are in progress */ |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
23 |
ERR_ROAD_WORKS_IN_PROGRESS, // [STR_ROAD_WORKS_IN_PROGRESS] |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
24 |
|
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
25 |
/** Drive through is in the wrong direction */ |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
26 |
ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION, // [STR_DRIVE_THROUGH_ERROR_DIRECTION] |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
27 |
|
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
28 |
/** Drive through roads can't be build on town owned roads */ |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
29 |
ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD, // [STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD] |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
30 |
|
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
31 |
|
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
32 |
/** One way roads can't have junctions */ |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
33 |
ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS, // [STR_ERR_ONEWAY_ROADS_CAN_T_HAVE_JUNCTION] |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
34 |
}; |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
35 |
|
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
36 |
/** |
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
|
37 |
* Checks whether the given tile is actually a tile with road that can be |
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
|
38 |
* used to traverse a tile. This excludes road depots and 'normal' road |
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
|
39 |
* stations, but includes drive through stations. |
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
|
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). |
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
|
42 |
* @return True if and only if the tile has road. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
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 IsRoadTile(TileIndex tile); |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
45 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
46 |
/** |
9551
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 road depot. |
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
|
48 |
* @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
|
49 |
* @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
|
50 |
* @return True if and only if the tile has a road depot. |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
51 |
*/ |
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
|
52 |
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
|
53 |
|
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 |
* Checks whether the given tile is actually a tile with a road station. |
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
|
56 |
* @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
|
57 |
* @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
|
58 |
* @return True if and only if the tile has a road station. |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
59 |
*/ |
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
|
60 |
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
|
61 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
62 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
63 |
* Checks whether the given tile is actually a tile with a drive through |
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
|
64 |
* road station. |
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
|
65 |
* @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
|
66 |
* @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
|
67 |
* @return True if and only if the tile has a drive through road station. |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
68 |
*/ |
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
|
69 |
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
|
70 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
71 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
72 |
* Checks whether the given tiles are directly connected, i.e. whether |
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
|
73 |
* a road vehicle can travel from the center of the first tile to the |
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
|
74 |
* center of the second 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
|
75 |
* @param tile_from The source 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
|
76 |
* @param tile_to The destination 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
|
77 |
* @pre AIMap::IsValidTile(tile_from). |
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
|
78 |
* @pre AIMap::IsValidTile(tile_to). |
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
|
79 |
* @pre 'tile_from' and 'tile_to' are directly neighbouring tiles. |
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
|
80 |
* @return True if and only if a road vehicle can go from tile_from to tile_to. |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
81 |
*/ |
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
|
82 |
static bool AreRoadTilesConnected(TileIndex tile_from, TileIndex tile_to); |
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 |
/** |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
85 |
* Count how many neighbours are road. |
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
|
86 |
* @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
|
87 |
* @pre AIMap::IsValidTile(tile). |
9617
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
88 |
* @return 0 means no neighbour road; max value is 4. |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
89 |
*/ |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
90 |
static int32 GetNeighbourRoadCount(TileIndex tile); |
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
91 |
|
df9cedf12aab
(svn r9786) [NoAI] -Fix: NeighbourRoad -> NeighbourRoadCount
truelight
parents:
9596
diff
changeset
|
92 |
/** |
9551
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 in front of a road depot. |
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
|
94 |
* @param depot The road depot tile. |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
95 |
* @pre IsRoadDepotTile(depot). |
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
|
96 |
* @return The tile in front of the depot. |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
97 |
*/ |
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
|
98 |
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
|
99 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
100 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
101 |
* Gets the tile in front of a road station. |
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
|
102 |
* @param station The road station tile. |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
103 |
* @pre IsRoadStationTile(station). |
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
|
104 |
* @return The tile in front of the road station. |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
105 |
*/ |
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
|
106 |
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
|
107 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
108 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
109 |
* Gets the tile at the back of a drive through road station. |
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
|
110 |
* So, one side of the drive through station is retrieved with |
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
|
111 |
* GetTileInFrontOfStation, the other with this function. |
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
|
112 |
* @param station The road station tile. |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
113 |
* @pre IsDriveThroughRoadStationTile(station). |
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
|
114 |
* @return The tile at the back of the drive through road station. |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
115 |
*/ |
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
|
116 |
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
|
117 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
118 |
/** |
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
|
119 |
* Builds a road from the center of tile start to the center of tile end. |
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
|
120 |
* @param start The start tile of the road. |
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
|
121 |
* @param end The end tile of the road. |
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
|
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). |
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
|
125 |
* @pre 'start' and 'end' are in a straight line, i.e. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
126 |
* 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
|
127 |
* AIMap::GetTileY(start) == AIMap::GetTileY(end). |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
128 |
* @exception AIError::ERR_ALREADY_BUILT |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
129 |
* @exception AIError::ERR_LAND_SLOPED_WRONG |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
130 |
* @exception AIError::ERR_AREA_NOT_CLEAR |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
131 |
* @exception AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
132 |
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10091
diff
changeset
|
133 |
* @exception AIError::ERR_VEHICLE_IN_THE_WAY |
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
|
134 |
* @return Whether the road has been/can be build or not. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
135 |
*/ |
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
|
136 |
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
|
137 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
138 |
/** |
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
|
139 |
* Builds a road from the edge of tile start to the edge of tile end (both |
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
|
140 |
* included). |
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
|
141 |
* @param start The start tile of the road. |
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
|
142 |
* @param end The end tile of the road. |
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
|
143 |
* @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
|
144 |
* @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
|
145 |
* @pre AIMap::IsValidTile(end). |
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
|
146 |
* @pre 'start' and 'end' are in a straight line, i.e. |
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
|
147 |
* 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
|
148 |
* AIMap::GetTileY(start) == AIMap::GetTileY(end). |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
149 |
* @exception AIError::ERR_ALREADY_BUILT |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
150 |
* @exception AIError::ERR_LAND_SLOPED_WRONG |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
151 |
* @exception AIError::ERR_AREA_NOT_CLEAR |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
152 |
* @exception AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
153 |
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10091
diff
changeset
|
154 |
* @exception AIError::ERR_VEHICLE_IN_THE_WAY |
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
|
155 |
* @return Whether the road has been/can be build or not. |
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
|
156 |
*/ |
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
|
157 |
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
|
158 |
|
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
|
159 |
/** |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
160 |
* Builds a road depot. |
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
|
161 |
* @param tile Place to build the depot. |
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
|
162 |
* @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
|
163 |
* @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
|
164 |
* @pre AIMap::IsValidTile(front). |
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
|
165 |
* @pre Tile is not equal to front. |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
166 |
* @exception AIError::ERR_FLAT_LAND_REQUIRED |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
167 |
* @exception AIError::ERR_AREA_NOT_CLEAR |
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
|
168 |
* @return Whether the road depot has been/can be build or not. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
169 |
*/ |
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
|
170 |
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
|
171 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
172 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
173 |
* Builds a road bus or truck station. |
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
|
174 |
* @param tile Place to build the depot. |
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
|
175 |
* @param front The tile exactly in front of the station. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
176 |
* For drive-through stations either entrance side can be used. |
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
|
177 |
* @param truck Whether to build a truck (true) or bus (false) station. |
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
|
178 |
* @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
|
179 |
* @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
|
180 |
* @pre AIMap::IsValidTile(front). |
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
|
181 |
* @pre 'tile' is not equal to 'front'. |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
182 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
183 |
* @exception AIError::ERR_AREA_NOT_CLEAR |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
184 |
* @exception AIError::ERR_FLAT_LAND_REQUIRED |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
185 |
* @exception AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION |
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
186 |
* @exception AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10091
diff
changeset
|
187 |
* @exception AIError:ERR_VEHICLE_IN_THE_WAY |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10091
diff
changeset
|
188 |
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10091
diff
changeset
|
189 |
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS |
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10091
diff
changeset
|
190 |
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN |
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
|
191 |
* @return Whether the station has been/can be build or not. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
192 |
*/ |
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
|
193 |
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
|
194 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
195 |
/** |
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
|
196 |
* Removes a road from the center of tile start to the center of tile end. |
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
|
197 |
* @param start The start tile of the road. |
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
|
198 |
* @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
|
199 |
* @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
|
200 |
* @pre AIMap::IsValidTile(end). |
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
|
201 |
* @pre 'start' and 'end' are in a straight line, i.e. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
202 |
* 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
|
203 |
* AIMap::GetTileY(start) == AIMap::GetTileY(end). |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
204 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10091
diff
changeset
|
205 |
* @exception AIError::ERR_VEHICLE_IN_THE_WAY |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
206 |
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS |
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
|
207 |
* @return Whether the road has been/can be removed or not. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
208 |
*/ |
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
|
209 |
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
|
210 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
211 |
/** |
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
|
212 |
* Removes a road from the edge of tile start to the edge of tile end (both |
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
|
213 |
* included). |
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
|
214 |
* @param start The start tile of the road. |
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
|
215 |
* @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
|
216 |
* @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
|
217 |
* @pre AIMap::IsValidTile(end). |
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
|
218 |
* @pre 'start' and 'end' are in a straight line, i.e. |
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
|
219 |
* 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
|
220 |
* AIMap::GetTileY(start) == AIMap::GetTileY(end). |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
221 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10091
diff
changeset
|
222 |
* @exception AIError::ERR_VEHICLE_IN_THE_WAY |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
223 |
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS |
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
|
224 |
* @return Whether the road has been/can be removed or not. |
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
|
225 |
*/ |
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
|
226 |
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
|
227 |
|
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
|
228 |
/** |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
229 |
* Removes a road depot. |
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
|
230 |
* @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
|
231 |
* @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
|
232 |
* @pre Tile is a road depot. |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
233 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10091
diff
changeset
|
234 |
* @exception AIError::ERR_VEHICLE_IN_THE_WAY |
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
|
235 |
* @return Whether the road depot has been/can be removed or not. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
236 |
*/ |
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
|
237 |
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
|
238 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
239 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
240 |
* Removes a road bus or truck station. |
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
|
241 |
* @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
|
242 |
* @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
|
243 |
* @pre Tile is a road station. |
10091
e4feb2f9fedf
(svn r12621) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
9838
diff
changeset
|
244 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
10094
e737405b06dd
(svn r12625) [NoAI] -Add: support for GetLastError in AIRoad. Patch by Morloth.
rubidium
parents:
10091
diff
changeset
|
245 |
* @exception AIError::ERR_VEHICLE_IN_THE_WAY |
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
|
246 |
* @return Whether the station has been/can be removed or not. |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
247 |
*/ |
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
|
248 |
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
|
249 |
}; |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
250 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
251 |
#endif /* AI_ROAD_HPP */ |