src/map_type.h
author belugas
Sun, 15 Jun 2008 02:48:25 +0000
changeset 10965 a2b5f6f9be0c
parent 8635 3bbb6f87fced
permissions -rw-r--r--
(svn r13519) -Feature[newGRF]: Implement var 63, variational action2 variable for Houses.
Or, in more simple terms, the check for the animation frame of nearby house.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     2
8635
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
     3
/** @file map_type.h Types related to maps. */
7036
9f23930e7ded (svn r9729) -Documentation: add some documentation in various places
rubidium
parents: 6987
diff changeset
     4
8635
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
     5
#ifndef MAP_TYPE_H
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
     6
#define MAP_TYPE_H
926
bd4312619522 (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
7036
9f23930e7ded (svn r9729) -Documentation: add some documentation in various places
rubidium
parents: 6987
diff changeset
     8
/**
9f23930e7ded (svn r9729) -Documentation: add some documentation in various places
rubidium
parents: 6987
diff changeset
     9
 * Data that is stored per tile. Also used TileExtended for this.
9f23930e7ded (svn r9729) -Documentation: add some documentation in various places
rubidium
parents: 6987
diff changeset
    10
 * Look at docs/landscape.html for the exact meaning of the members.
9f23930e7ded (svn r9729) -Documentation: add some documentation in various places
rubidium
parents: 6987
diff changeset
    11
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
    12
struct Tile {
8635
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    13
	byte   type_height; ///< The type (bits 4..7) and height of the northern corner
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    14
	byte   m1;          ///< Primarily used for ownership information
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    15
	uint16 m2;          ///< Primarily used for indices to towns, industries and stations
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    16
	byte   m3;          ///< General purpose
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    17
	byte   m4;          ///< General purpose
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    18
	byte   m5;          ///< General purpose
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    19
	byte   m6;          ///< Primarily used for bridges and rainforest/desert
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
    20
};
2049
ad0d49c916d4 (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
7036
9f23930e7ded (svn r9729) -Documentation: add some documentation in various places
rubidium
parents: 6987
diff changeset
    22
/**
9f23930e7ded (svn r9729) -Documentation: add some documentation in various places
rubidium
parents: 6987
diff changeset
    23
 * Data that is stored per tile. Also used Tile for this.
9f23930e7ded (svn r9729) -Documentation: add some documentation in various places
rubidium
parents: 6987
diff changeset
    24
 * Look at docs/landscape.html for the exact meaning of the members.
9f23930e7ded (svn r9729) -Documentation: add some documentation in various places
rubidium
parents: 6987
diff changeset
    25
 */
6658
59048224be55 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents: 6574
diff changeset
    26
struct TileExtended {
7036
9f23930e7ded (svn r9729) -Documentation: add some documentation in various places
rubidium
parents: 6987
diff changeset
    27
	byte m7; ///< Primarily used for newgrf support
6658
59048224be55 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents: 6574
diff changeset
    28
};
59048224be55 (svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents: 6574
diff changeset
    29
8042
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    30
/**
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    31
 * An offset value between to tiles.
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    32
 *
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    33
 * This value is used fro the difference between
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    34
 * to tiles. It can be added to a tileindex to get
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    35
 * the resulting tileindex of the start tile applied
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    36
 * with this saved difference.
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    37
 *
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    38
 * @see TileDiffXY(int, int)
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    39
 */
1981
de031d2aed47 (svn r2487) Replace TILE_XY by TileXY/TileDiffXY
tron
parents: 1980
diff changeset
    40
typedef int32 TileIndexDiff;
de031d2aed47 (svn r2487) Replace TILE_XY by TileXY/TileDiffXY
tron
parents: 1980
diff changeset
    41
8042
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    42
/**
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    43
 * A pair-construct of a TileIndexDiff.
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    44
 *
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    45
 * This can be used to save the difference between to
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    46
 * tiles as a pair of x and y value.
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    47
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
    48
struct TileIndexDiffC {
8042
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    49
	int16 x;        ///< The x value of the coordinate
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    50
	int16 y;        ///< The y value of the coordinate
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
    51
};
909
81bc9ef93f50 (svn r1396) Introduce TileIndexDiffC - the compile time version of TileIndexDiff
tron
parents: 900
diff changeset
    52
8042
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    53
/**
8635
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    54
 * Approximation of the length of a straight track, relative to a diagonal
8042
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    55
 * track (ie the size of a tile side).
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    56
 *
1ccbcf3295b5 (svn r11066) -Documentation [FS#1091]: of map.*. Patch by Progman.
rubidium
parents: 7813
diff changeset
    57
 * #defined instead of const so it can
1677
c18884ca76d5 (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
62f9e55a3835 (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
62f9e55a3835 (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!
8635
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    61
 * This value should be sqrt(2)/2 ~ 0.7071
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    62
 */
1679
62f9e55a3835 (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
c18884ca76d5 (svn r2181) - Add: DistanceTrack() to calculate the distance over optimally laid out tracks.
matthijs
parents: 1433
diff changeset
    64
8635
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8634
diff changeset
    65
#endif /* MAP_TYPE_H */