author | rubidium |
Sat, 14 Apr 2007 21:01:44 +0000 | |
branch | noai |
changeset 9595 | 91423dbb6f5f |
parent 9594 | 5009a30f320a |
child 9596 | 8af5a1399842 |
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 |
* Roads are always build from tile center to tile center. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
14 |
* Furthermore stations and depots need to be build on tiles |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
15 |
* that already have road on them. For depots and non-drive |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
16 |
* through stations that means that only one roadbit may be |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
17 |
* built at the location. The advantage of this method is |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
18 |
* that the AI does not need to think about pointing the |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
19 |
* exit of the depots and roadstations towards the correct |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
20 |
* direction. For drive-through roadstops this works about |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
21 |
* the same, though they have to be built on straight roads. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
22 |
*/ |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
23 |
class AIRoad : public AIObject { |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
24 |
public: |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
25 |
/** |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
26 |
* 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
|
27 |
*/ |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
28 |
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
|
29 |
|
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
30 |
/** |
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
|
31 |
* 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
|
32 |
* 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
|
33 |
* '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
|
34 |
* @param tile the tile to check. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
35 |
* @pre tile is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
36 |
* @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
|
37 |
*/ |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
38 |
bool IsRoadTile(TileIndex tile); |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
39 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
40 |
/** |
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
41 |
* 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
|
42 |
* @param tile the tile to check. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
43 |
* @pre tile is always positive and smaller than AIMap::GetMapSize(). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
44 |
* @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
|
45 |
*/ |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
46 |
bool IsRoadDepotTile(TileIndex tile); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
47 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
48 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
49 |
* 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
|
50 |
* @param tile the tile to check. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
51 |
* @pre tile is always positive and smaller than AIMap::GetMapSize(). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
52 |
* @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
|
53 |
*/ |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
54 |
bool IsRoadStationTile(TileIndex tile); |
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 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
57 |
* 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
|
58 |
* road station. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
59 |
* @param tile the tile to check. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
60 |
* @pre tile is always positive and smaller than AIMap::GetMapSize(). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
61 |
* @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
|
62 |
*/ |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
63 |
bool IsDriveThroughRoadStationTile(TileIndex tile); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
64 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
65 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
66 |
* 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
|
67 |
* 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
|
68 |
* 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
|
69 |
* @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
|
70 |
* @param t2 the destination tile. |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
71 |
* @pre t1 is always positive and smaller than AIMap::GetMapSize(). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
72 |
* @pre t2 is always positive and smaller than AIMap::GetMapSize(). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
73 |
* @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
|
74 |
* @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
|
75 |
*/ |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
76 |
bool AreRoadTilesConnected(TileIndex t1, TileIndex t2); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
77 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
78 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
79 |
* 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
|
80 |
* @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
|
81 |
* @pre IsRoadDepotTile(depot). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
82 |
* @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
|
83 |
*/ |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
84 |
TileIndex GetRoadDepotFrontTile(TileIndex depot); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
85 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
86 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
87 |
* 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
|
88 |
* @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
|
89 |
* @pre IsRoadStationTile(station). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
90 |
* @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
|
91 |
*/ |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
92 |
TileIndex GetRoadStationFrontTile(TileIndex station); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
93 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
94 |
/** |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
95 |
* 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
|
96 |
* 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
|
97 |
* 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
|
98 |
* @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
|
99 |
* @pre IsDriveThroughRoadStationTile(station). |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
100 |
* @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
|
101 |
*/ |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
102 |
TileIndex GetDriveThroughBackTile(TileIndex station); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
103 |
|
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
104 |
/** |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
105 |
* 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
|
106 |
* center of tile end. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
107 |
* @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
|
108 |
* @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
|
109 |
* @pre start is not equal to end |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
110 |
* @pre start is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
111 |
* @pre end is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
112 |
* @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
|
113 |
* 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
|
114 |
* 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
|
115 |
* @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
|
116 |
*/ |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
117 |
bool BuildRoad(TileIndex start, TileIndex end); |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
118 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
119 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
120 |
* Builds a road depot. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
121 |
* @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
|
122 |
* @param front the tile exactly in front of the depot |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
123 |
* @pre tile is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
124 |
* @pre front is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
125 |
* @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
|
126 |
* @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
|
127 |
*/ |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
128 |
bool BuildRoadDepot(TileIndex tile, TileIndex front); |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
129 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
130 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
131 |
* 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
|
132 |
* @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
|
133 |
* @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
|
134 |
* 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
|
135 |
* @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
|
136 |
* @param drive_through whether to make the station drive through or not. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
137 |
* @pre tile is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
138 |
* @pre front is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
139 |
* @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
|
140 |
* @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
|
141 |
*/ |
9503
821422c9ca59
(svn r9381) [NoAI] -Fix: inconsistency between documentation and actual behaviour (Zuu).
rubidium
parents:
9462
diff
changeset
|
142 |
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
|
143 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
144 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
145 |
* 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
|
146 |
* center of tile end. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
147 |
* @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
|
148 |
* @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
|
149 |
* @pre start is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
150 |
* @pre end is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
151 |
* @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
|
152 |
* 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
|
153 |
* 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
|
154 |
* @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
|
155 |
*/ |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
156 |
bool RemoveRoad(TileIndex start, TileIndex end); |
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 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
159 |
* Removes a road depot. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
160 |
* @param tile place to remove the depot from. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
161 |
* @pre tile is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
162 |
* @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
|
163 |
* @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
|
164 |
*/ |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
165 |
bool RemoveRoadDepot(TileIndex tile); |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
166 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
167 |
/** |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
168 |
* 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
|
169 |
* @param tile place to remove the station from. |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
170 |
* @pre tile is always positive and smaller than AIMap::GetMapSize(). |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
171 |
* @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
|
172 |
* @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
|
173 |
*/ |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
174 |
bool RemoveRoadStation(TileIndex tile); |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
175 |
}; |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
176 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
177 |
#ifdef DEFINE_SQUIRREL_CLASS |
9524
283d23931bb4
(svn r9444) [NoAI] -Codechange: allow all API-class-instances to be used as parameters in Squirrel.
rubidium
parents:
9520
diff
changeset
|
178 |
namespace SQConvert { |
283d23931bb4
(svn r9444) [NoAI] -Codechange: allow all API-class-instances to be used as parameters in Squirrel.
rubidium
parents:
9520
diff
changeset
|
179 |
/* Allow AIRoad to be used as Squirrel parameter */ |
9594
5009a30f320a
(svn r9627) [NoAI] -Fix: let the squirrel export script export all needed (and a few more) types of references to structs and classes.
rubidium
parents:
9556
diff
changeset
|
180 |
template <> AIRoad *GetParam(ForceType<AIRoad *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIRoad *)instance; } |
5009a30f320a
(svn r9627) [NoAI] -Fix: let the squirrel export script export all needed (and a few more) types of references to structs and classes.
rubidium
parents:
9556
diff
changeset
|
181 |
template <> AIRoad &GetParam(ForceType<AIRoad &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIRoad *)instance; } |
5009a30f320a
(svn r9627) [NoAI] -Fix: let the squirrel export script export all needed (and a few more) types of references to structs and classes.
rubidium
parents:
9556
diff
changeset
|
182 |
template <> const AIRoad *GetParam(ForceType<const AIRoad *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIRoad *)instance; } |
5009a30f320a
(svn r9627) [NoAI] -Fix: let the squirrel export script export all needed (and a few more) types of references to structs and classes.
rubidium
parents:
9556
diff
changeset
|
183 |
template <> const AIRoad &GetParam(ForceType<const AIRoad &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIRoad *)instance; } |
9524
283d23931bb4
(svn r9444) [NoAI] -Codechange: allow all API-class-instances to be used as parameters in Squirrel.
rubidium
parents:
9520
diff
changeset
|
184 |
}; // namespace SQConvert |
283d23931bb4
(svn r9444) [NoAI] -Codechange: allow all API-class-instances to be used as parameters in Squirrel.
rubidium
parents:
9520
diff
changeset
|
185 |
|
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
186 |
void SQAIRoadRegister(Squirrel *engine) { |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
187 |
DefSQClass <AIRoad> SQAIRoad("AIRoad"); |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
188 |
SQAIRoad.PreRegister(engine); |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
189 |
SQAIRoad.AddConstructor(engine); |
9526
a4ad60ba03be
(svn r9446) [NoAI] -Add: simple script to make changing/adding classes to export a little simpler.
rubidium
parents:
9524
diff
changeset
|
190 |
|
9541
4bb34cea7fad
(svn r9463) [NoAI] -Codechange: update squirrel export script to generate the correct amount and type of parameters, so that can be checked.
rubidium
parents:
9532
diff
changeset
|
191 |
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetClassName, "GetClassName", 1, "x"); |
9532
539c48d64eea
(svn r9453) [NoAI] -Codechange: make a difference between static and non-static methods in the squirrel export script.
rubidium
parents:
9530
diff
changeset
|
192 |
|
9551
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
193 |
SQAIRoad.DefSQMethod(engine, &AIRoad::IsRoadTile, "IsRoadTile", 2, "xi"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
194 |
SQAIRoad.DefSQMethod(engine, &AIRoad::IsRoadDepotTile, "IsRoadDepotTile", 2, "xi"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
195 |
SQAIRoad.DefSQMethod(engine, &AIRoad::IsRoadStationTile, "IsRoadStationTile", 2, "xi"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
196 |
SQAIRoad.DefSQMethod(engine, &AIRoad::IsDriveThroughRoadStationTile, "IsDriveThroughRoadStationTile", 2, "xi"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
197 |
SQAIRoad.DefSQMethod(engine, &AIRoad::AreRoadTilesConnected, "AreRoadTilesConnected", 3, "xii"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
198 |
SQAIRoad.DefSQMethod(engine, &AIRoad::GetRoadDepotFrontTile, "GetRoadDepotFrontTile", 2, "xi"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
199 |
SQAIRoad.DefSQMethod(engine, &AIRoad::GetRoadStationFrontTile, "GetRoadStationFrontTile", 2, "xi"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
200 |
SQAIRoad.DefSQMethod(engine, &AIRoad::GetDriveThroughBackTile, "GetDriveThroughBackTile", 2, "xi"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
201 |
SQAIRoad.DefSQMethod(engine, &AIRoad::BuildRoad, "BuildRoad", 3, "xii"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
202 |
SQAIRoad.DefSQMethod(engine, &AIRoad::BuildRoadDepot, "BuildRoadDepot", 3, "xii"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
203 |
SQAIRoad.DefSQMethod(engine, &AIRoad::BuildRoadStation, "BuildRoadStation", 5, "xiibb"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
204 |
SQAIRoad.DefSQMethod(engine, &AIRoad::RemoveRoad, "RemoveRoad", 3, "xii"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
205 |
SQAIRoad.DefSQMethod(engine, &AIRoad::RemoveRoadDepot, "RemoveRoadDepot", 2, "xi"); |
d015a5b4b0a8
(svn r9489) [NoAI] -Add: functions to query existance and direction of road stations and depots.
rubidium
parents:
9541
diff
changeset
|
206 |
SQAIRoad.DefSQMethod(engine, &AIRoad::RemoveRoadStation, "RemoveRoadStation", 2, "xi"); |
9526
a4ad60ba03be
(svn r9446) [NoAI] -Add: simple script to make changing/adding classes to export a little simpler.
rubidium
parents:
9524
diff
changeset
|
207 |
|
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
208 |
SQAIRoad.PostRegister(engine); |
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
209 |
} |
9520
f7cf8bea10db
(svn r9440) [NoAI] -Codechange: use the identifier used for the #ifdef in the #endif not something that looks like the identifier.
rubidium
parents:
9503
diff
changeset
|
210 |
#endif /* DEFINE_SQUIRREL_CLASS */ |
9453
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
211 |
|
727ff178a582
(svn r9283) [NoAI] -Add: API for adding/removing road, road depots and road stations.
rubidium
parents:
diff
changeset
|
212 |
#endif /* AI_ROAD_HPP */ |