author | truebrain |
Mon, 31 Mar 2008 08:42:20 +0000 | |
branch | noai |
changeset 9838 | 0839682a601b |
parent 9835 | 2541c2d325ed |
child 9867 | b7d9ffe24f81 |
permissions | -rw-r--r-- |
9792
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
1 |
/* $Id$ */ |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
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_bridge.hpp Everything to query and build bridges. */ |
9792
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
4 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
5 |
#ifndef AI_BRIDGE_HPP |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
6 |
#define AI_BRIDGE_HPP |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
7 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
8 |
#include "ai_object.hpp" |
9793
c5fb53240401
(svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents:
9792
diff
changeset
|
9 |
#include "ai_vehicle.hpp" |
9792
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
10 |
#include "../../bridge.h" |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
11 |
|
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
12 |
/** In OpenTTD Core 'BridgeID' is called 'BridgeType', so map it to make this API more logic. */ |
9792
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
13 |
typedef BridgeType BridgeID; |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
14 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
15 |
/** |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
16 |
* Class that handles all bridge related functions. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
17 |
*/ |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
18 |
class AIBridge : public AIObject { |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
19 |
public: |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
20 |
static const char *GetClassName() { return "AIBridge"; } |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
21 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
22 |
/** |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
23 |
* Checks whether the given bridge type is valid. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
24 |
* @param bridge_id The bridge to check. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
25 |
* @return True if and only if the bridge type is valid. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
26 |
*/ |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
27 |
static bool IsValidBridge(BridgeID bridge_id); |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
28 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
29 |
/** |
9793
c5fb53240401
(svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents:
9792
diff
changeset
|
30 |
* Checks whether the given tile is actually a bridge start or end tile. |
9835
2541c2d325ed
(svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents:
9829
diff
changeset
|
31 |
* @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:
9793
diff
changeset
|
32 |
* @pre AIMap::IsValidTile(tile). |
9835
2541c2d325ed
(svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents:
9829
diff
changeset
|
33 |
* @return True if and only if the tile is the beginning or end of a bridge. |
9793
c5fb53240401
(svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents:
9792
diff
changeset
|
34 |
*/ |
c5fb53240401
(svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents:
9792
diff
changeset
|
35 |
static bool IsBridgeTile(TileIndex tile); |
c5fb53240401
(svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents:
9792
diff
changeset
|
36 |
|
c5fb53240401
(svn r12297) [NoAI] -Add: added AIBridge.BuildBridge and friends
truebrain
parents:
9792
diff
changeset
|
37 |
/** |
9792
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
38 |
* Get the name of a bridge. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
39 |
* @param bridge_id The bridge to get the name of. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
40 |
* @pre IsValidBridge(bridge_id). |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
41 |
* @return The name the bridge has. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
42 |
*/ |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
43 |
static char *GetName(BridgeID bridge_id); |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
44 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
45 |
/** |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
46 |
* Get the maximum speed of a bridge (in km/h). |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
47 |
* @param bridge_id The bridge to get the maximum speed of. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
48 |
* @pre IsValidBridge(bridge_id). |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
49 |
* @return The maximum speed the bridge has. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
50 |
*/ |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
51 |
static uint32 GetMaxSpeed(BridgeID bridge_id); |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
52 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
53 |
/** |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
54 |
* Get the new cost of a bridge. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
55 |
* @param bridge_id The bridge to get the new cost of. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
56 |
* @param length The length of the bridge. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
57 |
* @pre IsValidBridge(bridge_id). |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
58 |
* @return The new cost the bridge has. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
59 |
*/ |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
60 |
static uint32 GetPrice(BridgeID bridge_id, uint length); |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
61 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
62 |
/** |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
63 |
* Get the maximum length of a bridge. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
64 |
* @param bridge_id The bridge to get the maximum length of. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
65 |
* @pre IsValidBridge(bridge_id). |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
66 |
* @returns The maximum length the bridge has. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
67 |
*/ |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
68 |
static uint32 GetMaxLength(BridgeID bridge_id); |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
69 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
70 |
/** |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
71 |
* Get the minimum length of a bridge. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
72 |
* @param bridge_id The bridge to get the minimum length of. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
73 |
* @pre IsValidBridge(bridge_id). |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
74 |
* @returns The minimum length the bridge has. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
75 |
*/ |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
76 |
static uint32 GetMinLength(BridgeID bridge_id); |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
77 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
78 |
/** |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
79 |
* Get the year in which a bridge becomes available. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
80 |
* @param bridge_id The bridge to get the year of availability of. |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
81 |
* @pre IsValidBridge(bridge_id). |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
82 |
* @returns The year of availability the bridge has. |
9835
2541c2d325ed
(svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents:
9829
diff
changeset
|
83 |
* @note Years are like 2010, -10 (10 B.C.), 1950, .. |
9792
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
84 |
*/ |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
85 |
static int32 GetYearAvailable(BridgeID bridge_id); |
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
86 |
|
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
87 |
/** |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
88 |
* Build a bridge from one tile to the other. |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
89 |
* @param vehicle_type The vehicle-type of bridge to build. |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
90 |
* @param bridge_id The bridge-type to build. |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
91 |
* @param start Where to start the bridge. |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
92 |
* @param end Where to end the bridge. |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
93 |
* @pre AIMap::IsValidTile(start). |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
94 |
* @pre AIMap::IsValidTile(end). |
9835
2541c2d325ed
(svn r12500) [NoAI] -Documentation: many comment changes, mostly Capitals and lines end with a dot. Makes doxygen look pretty :)
truebrain
parents:
9829
diff
changeset
|
95 |
* @pre 'start' and 'end' are in a straight line, i.e. |
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
96 |
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
97 |
* AIMap::GetTileY(start) == AIMap::GetTileY(end). |
9838
0839682a601b
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents:
9835
diff
changeset
|
98 |
* @pre 'vehicle_type' is either AIVehicle::VEHICLE_RAIL or AIVEHICLE::VEHICLE_ROAD. |
9829
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
99 |
* @return Whether the bridge has been/can be build or not. |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
100 |
*/ |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
101 |
static bool BuildBridge(AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end); |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
102 |
|
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
103 |
/** |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
104 |
* Removes a bridge, by executing it on either the start or end tile. |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
105 |
* @param tile An end or start tile of the bridge. |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
106 |
* @pre AIMap::IsValidTile(tile). |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
107 |
* @return Whether the bridge has been/can be removed or not. |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
108 |
*/ |
80fbe02a4184
(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents:
9801
diff
changeset
|
109 |
static bool RemoveBridge(TileIndex tile); |
9792
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
110 |
}; |
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
111 |
|
e1222f4674c2
(svn r12294) [NoAI] -Add: added AIBridge(List), which lists all available bridges (no build yet)
truebrain
parents:
diff
changeset
|
112 |
#endif /* AI_BRIDGE_HPP */ |