src/map_type.h
branchnoai
changeset 9723 eee46cb39750
equal deleted inserted replaced
9722:ebf0ece7d8f6 9723:eee46cb39750
       
     1 /* $Id$ */
       
     2 
       
     3 /** @file map_type.h Types related to maps. */
       
     4 
       
     5 #ifndef MAP_TYPE_H
       
     6 #define MAP_TYPE_H
       
     7 
       
     8 /**
       
     9  * Data that is stored per tile. Also used TileExtended for this.
       
    10  * Look at docs/landscape.html for the exact meaning of the members.
       
    11  */
       
    12 struct Tile {
       
    13 	byte   type_height; ///< The type (bits 4..7) and height of the northern corner
       
    14 	byte   m1;          ///< Primarily used for ownership information
       
    15 	uint16 m2;          ///< Primarily used for indices to towns, industries and stations
       
    16 	byte   m3;          ///< General purpose
       
    17 	byte   m4;          ///< General purpose
       
    18 	byte   m5;          ///< General purpose
       
    19 	byte   m6;          ///< Primarily used for bridges and rainforest/desert
       
    20 };
       
    21 
       
    22 /**
       
    23  * Data that is stored per tile. Also used Tile for this.
       
    24  * Look at docs/landscape.html for the exact meaning of the members.
       
    25  */
       
    26 struct TileExtended {
       
    27 	byte m7; ///< Primarily used for newgrf support
       
    28 };
       
    29 
       
    30 /**
       
    31  * An offset value between to tiles.
       
    32  *
       
    33  * This value is used fro the difference between
       
    34  * to tiles. It can be added to a tileindex to get
       
    35  * the resulting tileindex of the start tile applied
       
    36  * with this saved difference.
       
    37  *
       
    38  * @see TileDiffXY(int, int)
       
    39  */
       
    40 typedef int32 TileIndexDiff;
       
    41 
       
    42 /**
       
    43  * A pair-construct of a TileIndexDiff.
       
    44  *
       
    45  * This can be used to save the difference between to
       
    46  * tiles as a pair of x and y value.
       
    47  */
       
    48 struct TileIndexDiffC {
       
    49 	int16 x;        ///< The x value of the coordinate
       
    50 	int16 y;        ///< The y value of the coordinate
       
    51 };
       
    52 
       
    53 /**
       
    54  * Approximation of the length of a straight track, relative to a diagonal
       
    55  * track (ie the size of a tile side).
       
    56  *
       
    57  * #defined instead of const so it can
       
    58  * stay integer. (no runtime float operations) Is this needed?
       
    59  * Watch out! There are _no_ brackets around here, to prevent intermediate
       
    60  * rounding! Be careful when using this!
       
    61  * This value should be sqrt(2)/2 ~ 0.7071
       
    62  */
       
    63 #define STRAIGHT_TRACK_LENGTH 7071/10000
       
    64 
       
    65 #endif /* MAP_TYPE_H */