author | peter1138 |
Sun, 03 Aug 2008 17:35:08 +0000 | |
changeset 9834 | 7474149531c1 |
parent 8139 | 4e91c448c409 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
3 |
/** @file map_type.h Types related to maps. */ |
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
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_TYPE_H |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
6 |
#define MAP_TYPE_H |
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
|
7 |
|
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
8 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
9 |
* Data that is stored per tile. Also used TileExtended for this. |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
10 |
* Look at docs/landscape.html for the exact meaning of the members. |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
11 |
*/ |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
12 |
struct Tile { |
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
13 |
byte type_height; ///< The type (bits 4..7) and height of the northern corner |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
14 |
byte m1; ///< Primarily used for ownership information |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
15 |
uint16 m2; ///< Primarily used for indices to towns, industries and stations |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
16 |
byte m3; ///< General purpose |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
17 |
byte m4; ///< General purpose |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
18 |
byte m5; ///< General purpose |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
19 |
byte m6; ///< Primarily used for bridges and rainforest/desert |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
20 |
}; |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1981
diff
changeset
|
21 |
|
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
22 |
/** |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
23 |
* Data that is stored per tile. Also used Tile for this. |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
24 |
* Look at docs/landscape.html for the exact meaning of the members. |
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
25 |
*/ |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6248
diff
changeset
|
26 |
struct TileExtended { |
6540
d30795308feb
(svn r9729) -Documentation: add some documentation in various places
rubidium
parents:
6491
diff
changeset
|
27 |
byte m7; ///< Primarily used for newgrf support |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6248
diff
changeset
|
28 |
}; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6248
diff
changeset
|
29 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
30 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
31 |
* An offset value between to tiles. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
32 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
33 |
* This value is used fro the difference between |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
34 |
* 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
|
35 |
* the resulting tileindex of the start tile applied |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
36 |
* with this saved difference. |
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 |
* @see TileDiffXY(int, int) |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
39 |
*/ |
1981 | 40 |
typedef int32 TileIndexDiff; |
41 |
||
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
42 |
/** |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
43 |
* A pair-construct of a TileIndexDiff. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
44 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
45 |
* This can be used to save the difference between to |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
46 |
* tiles as a pair of x and y value. |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
47 |
*/ |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
48 |
struct TileIndexDiffC { |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
49 |
int16 x; ///< The x value of the coordinate |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
50 |
int16 y; ///< The y value of the coordinate |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
51 |
}; |
909
65cdb609b7a6
(svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents:
900
diff
changeset
|
52 |
|
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
53 |
/** |
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
54 |
* Approximation of the length of a straight track, relative to a diagonal |
7546
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
55 |
* track (ie the size of a tile side). |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
56 |
* |
c4f9132d9f1e
(svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents:
7317
diff
changeset
|
57 |
* #defined instead of const so it can |
1677
d534f0c8c845
(svn r2181) - Add: DistanceTrack() to calculate the distance over optimally laid out tracks.
matthijs
parents:
1433
diff
changeset
|
58 |
* stay integer. (no runtime float operations) Is this needed? |
1679
9a654f6b85b9
(svn r2183) - Fix: Removed brackets from around STRAIGHT_TRACK_LENGTH, they caused preliminary rounding...
matthijs
parents:
1677
diff
changeset
|
59 |
* Watch out! There are _no_ brackets around here, to prevent intermediate |
9a654f6b85b9
(svn r2183) - Fix: Removed brackets from around STRAIGHT_TRACK_LENGTH, they caused preliminary rounding...
matthijs
parents:
1677
diff
changeset
|
60 |
* rounding! Be careful when using this! |
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
61 |
* This value should be sqrt(2)/2 ~ 0.7071 |
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
62 |
*/ |
1679
9a654f6b85b9
(svn r2183) - Fix: Removed brackets from around STRAIGHT_TRACK_LENGTH, they caused preliminary rounding...
matthijs
parents:
1677
diff
changeset
|
63 |
#define STRAIGHT_TRACK_LENGTH 7071/10000 |
1677
d534f0c8c845
(svn r2181) - Add: DistanceTrack() to calculate the distance over optimally laid out tracks.
matthijs
parents:
1433
diff
changeset
|
64 |
|
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8138
diff
changeset
|
65 |
#endif /* MAP_TYPE_H */ |