author | rubidium |
Sun, 25 Mar 2007 17:43:40 +0000 | |
branch | noai |
changeset 9532 | 539c48d64eea |
parent 9530 | 5b93bc87cc5e |
child 9541 | 4bb34cea7fad |
permissions | -rw-r--r-- |
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
2 |
|
9388
032008c3f6e3
(svn r9180) [NoAI] -Fix: copy/pasting can be nasty: wrong @file headers
truelight
parents:
9387
diff
changeset
|
3 |
/** @file ai_map.hpp Everything to query map metadata */ |
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
4 |
|
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
5 |
#ifndef AI_MAP_HPP |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
6 |
#define AI_MAP_HPP |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
7 |
|
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
8 |
#include "ai_object.hpp" |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
9 |
|
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
10 |
/** |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
11 |
* Class that handles all map related functions. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
12 |
*/ |
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
13 |
class AIMap : public AIObject { |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
14 |
public: |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
15 |
/** |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
16 |
* The name of the class, needed by several sub-processes. |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
17 |
*/ |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
18 |
static const char *GetClassName() { return "AIMap"; } |
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
19 |
|
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
20 |
/** |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
21 |
* Checks whether the given tile is valid. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
22 |
* @param t the tile to check. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
23 |
* @return true is the tile it within the boundaries of the map. |
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
24 |
*/ |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
25 |
bool IsValidTile(TileIndex t); |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
26 |
|
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
27 |
/** |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
28 |
* Gets the number of tiles in the map. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
29 |
* @return the size of the map in tiles. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
30 |
* @post return value is always positive. |
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
31 |
*/ |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
32 |
TileIndex GetMapSize(); |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
33 |
|
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
34 |
/** |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
35 |
* Gets the amount of tiles along the SW and NE border. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
36 |
* @return the length along the SW and NE borders. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
37 |
* @post return value is always positive. |
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
38 |
*/ |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
39 |
uint32 GetMapSizeX(); |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
40 |
|
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
41 |
/** |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
42 |
* Gets the amount of tiles along the SE and NW border. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
43 |
* @return the length along the SE and NW borders. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
44 |
* @post return value is always positive. |
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
45 |
*/ |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
46 |
uint32 GetMapSizeY(); |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
47 |
|
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
48 |
/** |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
49 |
* Gets the place along the SW/NE border (X-value). |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
50 |
* @param t the tile to get the X-value of. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
51 |
* @pre t has to be valid (use IsValidTile(t)). |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
52 |
* @return the X-value. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
53 |
* @post return value is lower than GetMapSizeX(). |
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
54 |
*/ |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
55 |
uint32 GetTileX(TileIndex t); |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
56 |
|
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
57 |
/** |
9448
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
58 |
* Gets the place along the SE/NW border (Y-value). |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
59 |
* @param t the tile to get the Y-value of. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
60 |
* @pre t has to be valid (use IsValidTile(t)). |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
61 |
* @return the Y-value. |
2a4c4340233d
(svn r9273) [NoAI] -Documentation: finished documenting the last few files; they should now be readable for any non-programmer.
truelight
parents:
9427
diff
changeset
|
62 |
* @post return value is lower than GetMapSizeY(). |
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
63 |
*/ |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
64 |
uint32 GetTileY(TileIndex t); |
9489
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
65 |
|
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
66 |
/** |
9502
5eb285182114
(svn r9379) [NoAI] -Add: function to get the TileIndex from an (X, Y) coordinate.
rubidium
parents:
9489
diff
changeset
|
67 |
* Gets the TileIndex given a x,y-coordinate. |
5eb285182114
(svn r9379) [NoAI] -Add: function to get the TileIndex from an (X, Y) coordinate.
rubidium
parents:
9489
diff
changeset
|
68 |
* @param x the X coordinate. |
5eb285182114
(svn r9379) [NoAI] -Add: function to get the TileIndex from an (X, Y) coordinate.
rubidium
parents:
9489
diff
changeset
|
69 |
* @param y the Y coordinate. |
5eb285182114
(svn r9379) [NoAI] -Add: function to get the TileIndex from an (X, Y) coordinate.
rubidium
parents:
9489
diff
changeset
|
70 |
* @pre x has to be lower than GetMapSizeX(). |
5eb285182114
(svn r9379) [NoAI] -Add: function to get the TileIndex from an (X, Y) coordinate.
rubidium
parents:
9489
diff
changeset
|
71 |
* @pre y has to be lower than GetMapSizeY(). |
5eb285182114
(svn r9379) [NoAI] -Add: function to get the TileIndex from an (X, Y) coordinate.
rubidium
parents:
9489
diff
changeset
|
72 |
* @return the TileIndex for the given x,y coordinate. |
5eb285182114
(svn r9379) [NoAI] -Add: function to get the TileIndex from an (X, Y) coordinate.
rubidium
parents:
9489
diff
changeset
|
73 |
*/ |
5eb285182114
(svn r9379) [NoAI] -Add: function to get the TileIndex from an (X, Y) coordinate.
rubidium
parents:
9489
diff
changeset
|
74 |
TileIndex GetTileIndex(uint32 x, uint32 y); |
5eb285182114
(svn r9379) [NoAI] -Add: function to get the TileIndex from an (X, Y) coordinate.
rubidium
parents:
9489
diff
changeset
|
75 |
|
5eb285182114
(svn r9379) [NoAI] -Add: function to get the TileIndex from an (X, Y) coordinate.
rubidium
parents:
9489
diff
changeset
|
76 |
/** |
9489
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
77 |
* Calculates the Manhattan distance; the difference of |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
78 |
* the X and Y added together. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
79 |
* @param t1 the start. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
80 |
* @param t2 the destination. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
81 |
* @pre t1 has to be valid (use IsValidTile(t1)). |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
82 |
* @pre t2 has to be valid (use IsValidTile(t2)). |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
83 |
* @return the Manhattan distance. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
84 |
*/ |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
85 |
uint32 DistanceManhattan(TileIndex t1, TileIndex t2); |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
86 |
|
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
87 |
/** |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
88 |
* Calculates the distance between xy1 and xy2 via 1D calculation. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
89 |
* (so the distance between X or the distance between Y, depending |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
90 |
* on which one is bigger). |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
91 |
* @param t1 the start. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
92 |
* @param t2 the destination. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
93 |
* @pre t1 has to be valid (use IsValidTile(t1)). |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
94 |
* @pre t2 has to be valid (use IsValidTile(t2)). |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
95 |
* @return the maximum distance of X and Y. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
96 |
*/ |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
97 |
uint32 DistanceMax(TileIndex t1, TileIndex t2); |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
98 |
|
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
99 |
/** |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
100 |
* The squared distance between the two tiles. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
101 |
* This is the distance is the length of the shortest straight |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
102 |
* line between both points. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
103 |
* @param t1 the start. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
104 |
* @param t2 the destination. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
105 |
* @pre t1 has to be valid (use IsValidTile(t1)). |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
106 |
* @pre t2 has to be valid (use IsValidTile(t2)). |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
107 |
* @return the distance. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
108 |
*/ |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
109 |
uint32 DistanceSquare(TileIndex t1, TileIndex t2); |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
110 |
|
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
111 |
/** |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
112 |
* Calculates the shortest distance to the edge. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
113 |
* @param t from where the distance has to be calculated. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
114 |
* @pre t has to be valid (use IsValidTile(t)). |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
115 |
* @return the distances to the closest edge. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
116 |
*/ |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
117 |
uint32 DistanceFromEdge(TileIndex t); |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
118 |
|
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
119 |
/** |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
120 |
* Destroy everything on the given tile. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
121 |
* @param t the tile to destroy the stuff of. |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
122 |
* @pre t has to be valid (use IsValidTile(t)). |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
123 |
* @return true if and only if the destruction succeeded |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
124 |
*/ |
d7ee0a65ead9
(svn r9359) [NoAI] -Add: function to determine distance and clear tiles.
rubidium
parents:
9448
diff
changeset
|
125 |
bool DemolishTile(TileIndex t); |
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
126 |
}; |
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
127 |
|
9425
8eec6d10844a
(svn r9227) [NoAI] -Change: renamed SQUIRREL_CLASS to DEFINE_SQUIRREL_CLASS
truelight
parents:
9422
diff
changeset
|
128 |
#ifdef DEFINE_SQUIRREL_CLASS |
9524
283d23931bb4
(svn r9444) [NoAI] -Codechange: allow all API-class-instances to be used as parameters in Squirrel.
rubidium
parents:
9521
diff
changeset
|
129 |
namespace SQConvert { |
283d23931bb4
(svn r9444) [NoAI] -Codechange: allow all API-class-instances to be used as parameters in Squirrel.
rubidium
parents:
9521
diff
changeset
|
130 |
/* Allow AIMap to be used as Squirrel parameter */ |
283d23931bb4
(svn r9444) [NoAI] -Codechange: allow all API-class-instances to be used as parameters in Squirrel.
rubidium
parents:
9521
diff
changeset
|
131 |
template <> AIMap *GetParam(ForceType<AIMap *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIMap *)instance; } |
283d23931bb4
(svn r9444) [NoAI] -Codechange: allow all API-class-instances to be used as parameters in Squirrel.
rubidium
parents:
9521
diff
changeset
|
132 |
}; // namespace SQConvert |
283d23931bb4
(svn r9444) [NoAI] -Codechange: allow all API-class-instances to be used as parameters in Squirrel.
rubidium
parents:
9521
diff
changeset
|
133 |
|
9422
33efcc5f1b09
(svn r9223) [NoAI] -Change: moved squirrel/engine.cpp to squirrel.cpp in root
truelight
parents:
9404
diff
changeset
|
134 |
void SQAIMapRegister(Squirrel *engine) { |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
9379
diff
changeset
|
135 |
DefSQClass <AIMap> SQAIMap("AIMap"); |
9397
d8f8db9c1a2e
(svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents:
9388
diff
changeset
|
136 |
SQAIMap.PreRegister(engine); |
9404
ef9e171617a3
(svn r9201) [NoAI] -Change: make adding a default-constructor for DefSQClass optional
truelight
parents:
9397
diff
changeset
|
137 |
SQAIMap.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
|
138 |
|
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
|
139 |
SQAIMap.DefSQStaticMethod(engine, &AIMap::GetClassName, "GetClassName"); |
539c48d64eea
(svn r9453) [NoAI] -Codechange: make a difference between static and non-static methods in the squirrel export script.
rubidium
parents:
9530
diff
changeset
|
140 |
|
9530
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
141 |
SQAIMap.DefSQMethod(engine, &AIMap::IsValidTile, "IsValidTile"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
142 |
SQAIMap.DefSQMethod(engine, &AIMap::GetMapSize, "GetMapSize"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
143 |
SQAIMap.DefSQMethod(engine, &AIMap::GetMapSizeX, "GetMapSizeX"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
144 |
SQAIMap.DefSQMethod(engine, &AIMap::GetMapSizeY, "GetMapSizeY"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
145 |
SQAIMap.DefSQMethod(engine, &AIMap::GetTileX, "GetTileX"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
146 |
SQAIMap.DefSQMethod(engine, &AIMap::GetTileY, "GetTileY"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
147 |
SQAIMap.DefSQMethod(engine, &AIMap::GetTileIndex, "GetTileIndex"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
148 |
SQAIMap.DefSQMethod(engine, &AIMap::DistanceManhattan, "DistanceManhattan"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
149 |
SQAIMap.DefSQMethod(engine, &AIMap::DistanceMax, "DistanceMax"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
150 |
SQAIMap.DefSQMethod(engine, &AIMap::DistanceSquare, "DistanceSquare"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
151 |
SQAIMap.DefSQMethod(engine, &AIMap::DistanceFromEdge, "DistanceFromEdge"); |
5b93bc87cc5e
(svn r9451) [NoAI] -Add: allow static and non-static members for SQ
truelight
parents:
9529
diff
changeset
|
152 |
SQAIMap.DefSQMethod(engine, &AIMap::DemolishTile, "DemolishTile"); |
9526
a4ad60ba03be
(svn r9446) [NoAI] -Add: simple script to make changing/adding classes to export a little simpler.
rubidium
parents:
9524
diff
changeset
|
153 |
|
9397
d8f8db9c1a2e
(svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
truelight
parents:
9388
diff
changeset
|
154 |
SQAIMap.PostRegister(engine); |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
9379
diff
changeset
|
155 |
} |
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:
9502
diff
changeset
|
156 |
#endif /* DEFINE_SQUIRREL_CLASS */ |
9387
4255a0a2d272
(svn r9179) [NoAI] -Add: added templates that makes adding classes to squirrel very easy
truelight
parents:
9379
diff
changeset
|
157 |
|
9379
6e89b780c2c9
(svn r9168) [NoAI] -Add: AI wrapper functions for some map related queries.
rubidium
parents:
diff
changeset
|
158 |
#endif /* AI_MAP_HPP */ |