author | Tero Marttila <terom@fixme.fi> |
Fri, 19 Dec 2008 02:25:44 +0200 | |
branch | terom-mini |
changeset 10442 | 7089fa402bfd |
parent 9592 | 835ccfd13653 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
8391
diff
changeset
|
3 |
/** @file map_func.h Functions related to maps. */ |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
4 |
|
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
5 |
#ifndef MAP_FUNC_H |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
6 |
#define MAP_FUNC_H |
679
04ca2cd69420
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
diff
changeset
|
7 |
|
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
8 |
#include "tile_type.h" |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
9 |
#include "map_type.h" |
8100
6bc08f98ec16
(svn r11661) -Codechange: some header reworks in order to try to reduce the compile time of OpenTTD by reduce the amount of circular-ish dependencies.
rubidium
parents:
7641
diff
changeset
|
10 |
#include "direction_func.h" |
1210 | 11 |
|
2051 | 12 |
extern uint _map_tile_mask; |
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
13 |
|
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
14 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
15 |
* 'Wraps' the given tile to it is within the map. It does |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
16 |
* this by masking the 'high' bits of. |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
17 |
* @param x the tile to 'wrap' |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
18 |
*/ |
2051 | 19 |
|
20 |
#define TILE_MASK(x) ((x) & _map_tile_mask) |
|
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
21 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
22 |
* Asserts when the tile is outside of the map. |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
23 |
* @param x the tile to check |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
24 |
*/ |
1394
79cb56d80a3a
(svn r1898) Remove some unused macros from macros.h and move some others to more appropriate headers
tron
parents:
1330
diff
changeset
|
25 |
#define TILE_ASSERT(x) assert(TILE_MASK(x) == (x)); |
926
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
26 |
|
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
27 |
/** |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
28 |
* Pointer to the tile-array. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
29 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
30 |
* This variable points to the tile-array which contains the tiles of |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
31 |
* the map. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
32 |
*/ |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6248
diff
changeset
|
33 |
extern Tile *_m; |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
34 |
|
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
35 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
36 |
* Pointer to the extended tile-array. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
37 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
38 |
* This variable points to the extended tile-array which contains the tiles |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
39 |
* of the map. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
40 |
*/ |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6248
diff
changeset
|
41 |
extern TileExtended *_me; |
1218 | 42 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
43 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
44 |
* Allocate a new map with the given size. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
45 |
*/ |
2051 | 46 |
void AllocateMap(uint size_x, uint size_y); |
47 |
||
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
48 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
49 |
* Logarithm of the map size along the X side. |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
50 |
* @note try to avoid using this one |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
51 |
* @return 2^"return value" == MapSizeX() |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
52 |
*/ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
53 |
static inline uint MapLogX() |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
54 |
{ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
55 |
extern uint _map_log_x; |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
56 |
return _map_log_x; |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
57 |
} |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
58 |
|
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
59 |
/** |
8391
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
60 |
* Logarithm of the map size along the y side. |
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
61 |
* @note try to avoid using this one |
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
62 |
* @return 2^"return value" == MapSizeY() |
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
63 |
*/ |
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
64 |
static inline uint MapLogY() |
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
65 |
{ |
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
66 |
extern uint _map_log_y; |
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
67 |
return _map_log_y; |
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
68 |
} |
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
69 |
|
193b256c681c
(svn r11961) -Feature[newGRF]: Add support for Action 0D, var 13: informations about current map size.
belugas
parents:
8380
diff
changeset
|
70 |
/** |
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
71 |
* Get the size of the map along the X |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
72 |
* @return the number of tiles along the X of the map |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
73 |
*/ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
74 |
static inline uint MapSizeX() |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
75 |
{ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
76 |
extern uint _map_size_x; |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
77 |
return _map_size_x; |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
78 |
} |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
79 |
|
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
80 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
81 |
* Get the size of the map along the Y |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
82 |
* @return the number of tiles along the Y of the map |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
83 |
*/ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
84 |
static inline uint MapSizeY() |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
85 |
{ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
86 |
extern uint _map_size_y; |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
87 |
return _map_size_y; |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
88 |
} |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
89 |
|
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
90 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
91 |
* Get the size of the map |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
92 |
* @return the number of tiles of the map |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
93 |
*/ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
94 |
static inline uint MapSize() |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
95 |
{ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
96 |
extern uint _map_size; |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
97 |
return _map_size; |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
98 |
} |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
99 |
|
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
100 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
101 |
* Gets the maximum X coordinate within the map, including MP_VOID |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
102 |
* @return the maximum X coordinate |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
103 |
*/ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
104 |
static inline uint MapMaxX() |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
105 |
{ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
106 |
return MapSizeX() - 1; |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
107 |
} |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
108 |
|
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
109 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
110 |
* Gets the maximum X coordinate within the map, including MP_VOID |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
111 |
* @return the maximum X coordinate |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
112 |
*/ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
113 |
static inline uint MapMaxY() |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
114 |
{ |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
115 |
return MapSizeY() - 1; |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
116 |
} |
689 | 117 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
118 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
119 |
* Scales relative to the number of tiles. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
120 |
*/ |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
121 |
uint ScaleByMapSize(uint); |
1202
4d2a20c50760
(svn r1706) Implement ScaleByMapSize() and ScaleByMapSize1D()
tron
parents:
1174
diff
changeset
|
122 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
123 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
124 |
* Scale relative to the circumference of the map. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
125 |
*/ |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
126 |
uint ScaleByMapSize1D(uint); |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
127 |
|
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
128 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
129 |
* An offset value between to tiles. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
130 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
131 |
* This value is used fro the difference between |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
132 |
* to tiles. It can be added to a tileindex to get |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
133 |
* the resulting tileindex of the start tile applied |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
134 |
* with this saved difference. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
135 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
136 |
* @see TileDiffXY(int, int) |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
137 |
*/ |
1981 | 138 |
typedef int32 TileIndexDiff; |
139 |
||
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
140 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
141 |
* Returns the TileIndex of a coordinate. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
142 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
143 |
* @param x The x coordinate of the tile |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
144 |
* @param y The y coordinate of the tile |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
145 |
* @return The TileIndex calculated by the coordinate |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
146 |
*/ |
1981 | 147 |
static inline TileIndex TileXY(uint x, uint y) |
148 |
{ |
|
2051 | 149 |
return (y * MapSizeX()) + x; |
1981 | 150 |
} |
151 |
||
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
152 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
153 |
* Calculates an offset for the given coordinate(-offset). |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
154 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
155 |
* This function calculate an offset value which can be added to an |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
156 |
* #TileIndex. The coordinates can be negative. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
157 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
158 |
* @param x The offset in x direction |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
159 |
* @param y The offset in y direction |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
160 |
* @return The resulting offset value of the given coordinate |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
161 |
* @see ToTileIndexDiff(TileIndexDiffC) |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
162 |
*/ |
1981 | 163 |
static inline TileIndexDiff TileDiffXY(int x, int y) |
164 |
{ |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
165 |
/* Multiplication gives much better optimization on MSVC than shifting. |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
166 |
* 0 << shift isn't optimized to 0 properly. |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
167 |
* Typically x and y are constants, and then this doesn't result |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
168 |
* in any actual multiplication in the assembly code.. */ |
2051 | 169 |
return (y * MapSizeX()) + x; |
1981 | 170 |
} |
1330
5d76a0522a11
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1247
diff
changeset
|
171 |
|
1980
6c5917cfcb78
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
172 |
static inline TileIndex TileVirtXY(uint x, uint y) |
6c5917cfcb78
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
173 |
{ |
6c5917cfcb78
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
174 |
return (y >> 4 << MapLogX()) + (x >> 4); |
6c5917cfcb78
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
175 |
} |
6c5917cfcb78
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
176 |
|
1330
5d76a0522a11
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1247
diff
changeset
|
177 |
|
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
178 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
179 |
* Get the X component of a tile |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
180 |
* @param tile the tile to get the X component of |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
181 |
* @return the X component |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
182 |
*/ |
926
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
183 |
static inline uint TileX(TileIndex tile) |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
184 |
{ |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
185 |
return tile & MapMaxX(); |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
186 |
} |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
187 |
|
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
188 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
189 |
* Get the Y component of a tile |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
190 |
* @param tile the tile to get the Y component of |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
191 |
* @return the Y component |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
192 |
*/ |
926
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
193 |
static inline uint TileY(TileIndex tile) |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
194 |
{ |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
195 |
return tile >> MapLogX(); |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
196 |
} |
a6d140a6a4de
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
tron
parents:
909
diff
changeset
|
197 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
198 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
199 |
* Return the offset between to tiles from a TileIndexDiffC struct. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
200 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
201 |
* This function works like #TileDiffXY(int, int) and returns the |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
202 |
* difference between two tiles. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
203 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
204 |
* @param tidc The coordinate of the offset as TileIndexDiffC |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
205 |
* @return The difference between two tiles. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
206 |
* @see TileDiffXY(int, int) |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
207 |
*/ |
909
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
208 |
static inline TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc) |
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
209 |
{ |
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
210 |
return (tidc.y << MapLogX()) + tidc.x; |
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
211 |
} |
900 | 212 |
|
955
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
213 |
|
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
214 |
#ifndef _DEBUG |
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
215 |
/** |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
216 |
* Adds to tiles together. |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
217 |
* |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
218 |
* @param x One tile |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
219 |
* @param y An other tile to add |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
220 |
* @return The resulting tile(index) |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
221 |
*/ |
955
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
222 |
#define TILE_ADD(x,y) ((x) + (y)) |
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
223 |
#else |
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
224 |
extern TileIndex TileAdd(TileIndex tile, TileIndexDiff add, |
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
225 |
const char *exp, const char *file, int line); |
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
226 |
#define TILE_ADD(x, y) (TileAdd((x), (y), #x " + " #y, __FILE__, __LINE__)) |
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
227 |
#endif |
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
228 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
229 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
230 |
* Adds a given offset to a tile. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
231 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
232 |
* @param tile The tile to add an offset on it |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
233 |
* @param x The x offset to add to the tile |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
234 |
* @param y The y offset to add to the tile |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
235 |
*/ |
1981 | 236 |
#define TILE_ADDXY(tile, x, y) TILE_ADD(tile, TileDiffXY(x, y)) |
955
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
237 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
238 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
239 |
* Adds an offset to a tile and check if we are still on the map. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
240 |
*/ |
8331
5514b3a1d52c
(svn r11897) -Fix: Replace an uint with TileIndex and a small coding style fix.
frosch
parents:
8139
diff
changeset
|
241 |
TileIndex TileAddWrap(TileIndex tile, int addx, int addy); |
1247 | 242 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
243 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
244 |
* Returns the TileIndexDiffC offset from a DiagDirection. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
245 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
246 |
* @param dir The given direction |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
247 |
* @return The offset as TileIndexDiffC value |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
248 |
*/ |
7317
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
249 |
static inline TileIndexDiffC TileIndexDiffCByDiagDir(DiagDirection dir) |
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
250 |
{ |
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
251 |
extern const TileIndexDiffC _tileoffs_by_diagdir[DIAGDIR_END]; |
4561 | 252 |
|
7317
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
253 |
assert(IsValidDiagDirection(dir)); |
4561 | 254 |
return _tileoffs_by_diagdir[dir]; |
1247 | 255 |
} |
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
256 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
257 |
/** |
8380
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
258 |
* Returns the TileIndexDiffC offset from a Direction. |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
259 |
* |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
260 |
* @param dir The given direction |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
261 |
* @return The offset as TileIndexDiffC value |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
262 |
*/ |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
263 |
static inline TileIndexDiffC TileIndexDiffCByDir(Direction dir) |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
264 |
{ |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
265 |
extern const TileIndexDiffC _tileoffs_by_dir[DIR_END]; |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
266 |
|
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
267 |
assert(IsValidDirection(dir)); |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
268 |
return _tileoffs_by_dir[dir]; |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
269 |
} |
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
270 |
|
174326093caa
(svn r11947) -Feature: Make use of new sprites added by Action5 type 0D.
frosch
parents:
8348
diff
changeset
|
271 |
/** |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
272 |
* Add a TileIndexDiffC to a TileIndex and returns the new one. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
273 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
274 |
* Returns tile + the diff given in diff. If the result tile would end up |
1247 | 275 |
* outside of the map, INVALID_TILE is returned instead. |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
276 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
277 |
* @param tile The base tile to add the offset on |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
278 |
* @param diff The offset to add on the tile |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
279 |
* @return The resulting TileIndex |
1247 | 280 |
*/ |
7317
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
281 |
static inline TileIndex AddTileIndexDiffCWrap(TileIndex tile, TileIndexDiffC diff) |
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
282 |
{ |
1247 | 283 |
int x = TileX(tile) + diff.x; |
284 |
int y = TileY(tile) + diff.y; |
|
285 |
if (x < 0 || y < 0 || x > (int)MapMaxX() || y > (int)MapMaxY()) |
|
286 |
return INVALID_TILE; |
|
287 |
else |
|
1981 | 288 |
return TileXY(x, y); |
1247 | 289 |
} |
955
62b8588f50c8
(svn r1447) Move TILE_ADD(), TILE_ADDXY() and SafeTileAdd() to map.[ch] and make the latter map size agnostic
tron
parents:
927
diff
changeset
|
290 |
|
6571
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
291 |
/** |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
292 |
* Returns the diff between two tiles |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
293 |
* |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
294 |
* @param tile_a from tile |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
295 |
* @param tile_b to tile |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
296 |
* @return the difference between tila_a and tile_b |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
297 |
*/ |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
298 |
static inline TileIndexDiffC TileIndexToTileIndexDiffC(TileIndex tile_a, TileIndex tile_b) |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
299 |
{ |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
300 |
TileIndexDiffC difference; |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
301 |
|
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
302 |
difference.x = TileX(tile_a) - TileX(tile_b); |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
303 |
difference.y = TileY(tile_a) - TileY(tile_b); |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
304 |
|
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
305 |
return difference; |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
306 |
} |
6a8a1d0835d9
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
belugas
parents:
6540
diff
changeset
|
307 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
308 |
/* Functions to calculate distances */ |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
309 |
uint DistanceManhattan(TileIndex, TileIndex); ///< also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads) |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
310 |
uint DistanceSquare(TileIndex, TileIndex); ///< euclidian- or L2-Norm squared |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
311 |
uint DistanceMax(TileIndex, TileIndex); ///< also known as L-Infinity-Norm |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
312 |
uint DistanceMaxPlusManhattan(TileIndex, TileIndex); ///< Max + Manhattan |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
5596
diff
changeset
|
313 |
uint DistanceFromEdge(TileIndex); ///< shortest distance from any edge of the map |
1245
3822f77cbc53
(svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names
tron
parents:
1218
diff
changeset
|
314 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
315 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
316 |
* Starts a loop which iterates to a square of tiles |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
317 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
318 |
* This macro starts 2 nested loops which iterates over a square of tiles. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
319 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
320 |
* @param var The name of the variable which contains the current tile |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
321 |
* @param w The width (x-width) of the square |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
322 |
* @param h The heigth (y-width) of the square |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
323 |
* @param tile The start tile of the square |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
324 |
*/ |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6332
diff
changeset
|
325 |
#define BEGIN_TILE_LOOP(var, w, h, tile) \ |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2051
diff
changeset
|
326 |
{ \ |
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2051
diff
changeset
|
327 |
int h_cur = h; \ |
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2051
diff
changeset
|
328 |
uint var = tile; \ |
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2051
diff
changeset
|
329 |
do { \ |
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2051
diff
changeset
|
330 |
int w_cur = w; \ |
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2051
diff
changeset
|
331 |
do { |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
332 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
333 |
* Ends the square-loop used before |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
334 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
335 |
* @see BEGIN_TILE_LOOP |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
336 |
*/ |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6332
diff
changeset
|
337 |
#define END_TILE_LOOP(var, w, h, tile) \ |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2051
diff
changeset
|
338 |
} while (++var, --w_cur != 0); \ |
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2051
diff
changeset
|
339 |
} while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \ |
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2051
diff
changeset
|
340 |
} |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
341 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
342 |
* Convert a DiagDirection to a TileIndexDiff |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
343 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
344 |
* @param dir The DiagDirection |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
345 |
* @return The resulting TileIndexDiff |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
346 |
* @see TileIndexDiffCByDiagDir |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
347 |
*/ |
7317
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
348 |
static inline TileIndexDiff TileOffsByDiagDir(DiagDirection dir) |
4559
aa0c13e39840
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4344
diff
changeset
|
349 |
{ |
7317
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
350 |
extern const TileIndexDiffC _tileoffs_by_diagdir[DIAGDIR_END]; |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2051
diff
changeset
|
351 |
|
7317
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
352 |
assert(IsValidDiagDirection(dir)); |
4559
aa0c13e39840
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4344
diff
changeset
|
353 |
return ToTileIndexDiff(_tileoffs_by_diagdir[dir]); |
aa0c13e39840
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4344
diff
changeset
|
354 |
} |
aa0c13e39840
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
Darkvater
parents:
4344
diff
changeset
|
355 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
356 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
357 |
* Convert a Direction to a TileIndexDiff. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
358 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
359 |
* @param dir The direction to convert from |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
360 |
* @return The resulting TileIndexDiff |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
361 |
*/ |
7317
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
362 |
static inline TileIndexDiff TileOffsByDir(Direction dir) |
900 | 363 |
{ |
7317
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
364 |
extern const TileIndexDiffC _tileoffs_by_dir[DIR_END]; |
900 | 365 |
|
7317
e61af9d8a2b3
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
6571
diff
changeset
|
366 |
assert(IsValidDirection(dir)); |
909
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
367 |
return ToTileIndexDiff(_tileoffs_by_dir[dir]); |
900 | 368 |
} |
369 |
||
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
370 |
/** |
7641
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
371 |
* Adds a DiagDir to a tile. |
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
372 |
* |
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
373 |
* @param tile The current tile |
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
374 |
* @param dir The direction in which we want to step |
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
375 |
* @return the moved tile |
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
376 |
*/ |
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
377 |
static inline TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir) |
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
378 |
{ |
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
379 |
return TILE_ADD(tile, TileOffsByDiagDir(dir)); |
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
380 |
} |
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
381 |
|
3a75903fd892
(svn r11172) -Codechange: rewrite of town road building and addition of the possibility to clean up unconnected road bits during the local road reconstructions. Based on a patch by skidd13.
rubidium
parents:
7546
diff
changeset
|
382 |
/** |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
383 |
* A callback function type for searching tiles. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
384 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
385 |
* @param tile The tile to test |
9592
835ccfd13653
(svn r13632) -Codechange: Use 'void *' for user-data of CircularTileSearch().
frosch
parents:
9449
diff
changeset
|
386 |
* @param user_data additional data for the callback function to use |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
387 |
* @return A boolean value, depend on the definition of the function. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
388 |
*/ |
9592
835ccfd13653
(svn r13632) -Codechange: Use 'void *' for user-data of CircularTileSearch().
frosch
parents:
9449
diff
changeset
|
389 |
typedef bool TestTileOnSearchProc(TileIndex tile, void *user_data); |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
390 |
|
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
391 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
392 |
* Searches for some cirumstances of a tile around a given tile with a helper function. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
393 |
*/ |
9592
835ccfd13653
(svn r13632) -Codechange: Use 'void *' for user-data of CircularTileSearch().
frosch
parents:
9449
diff
changeset
|
394 |
bool CircularTileSearch(TileIndex *tile, uint size, TestTileOnSearchProc proc, void *user_data); |
5118
9640617e1abb
(svn r7198) -Codechange: Implement a circular tile search function.
belugas
parents:
4849
diff
changeset
|
395 |
|
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
396 |
/** |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
397 |
* Get a random tile out of a given seed. |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
398 |
* @param r the random 'seed' |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
399 |
* @return a valid tile |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
400 |
*/ |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
401 |
static inline TileIndex RandomTileSeed(uint32 r) |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
402 |
{ |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
403 |
return TILE_MASK(r); |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
404 |
} |
1677
d534f0c8c845
(svn r2181) - Add: DistanceTrack() to calculate the distance over optimally laid out tracks.
matthijs
parents:
1433
diff
changeset
|
405 |
|
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
406 |
/** |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
407 |
* Get a valid random tile. |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
408 |
* @note a define so 'random' gets inserted in the place where it is actually |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
409 |
* called, thus making the random traces more explicit. |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
410 |
* @return a valid tile |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
411 |
*/ |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
412 |
#define RandomTile() RandomTileSeed(Random()) |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
413 |
|
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
414 |
#endif /* MAP_FUNC_H */ |