Files
@ r3173:acfc19891f47
Branch filter:
Location: cpp/openttd-patchpack/source/road_map.h - annotation
r3173:acfc19891f47
2.2 KiB
text/x-c
(svn r3805) - [FS#62] Fix doxygen comments to refer to the correct parameter. (sulai)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | r3144:5b175fed4b0b r3144:5b175fed4b0b r3145:90ae47e0a047 r3145:90ae47e0a047 r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3150:6242a630abac r3150:6242a630abac r3150:6242a630abac r3150:6242a630abac r3150:6242a630abac r3150:6242a630abac r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3167:c678c9ca682c r3167:c678c9ca682c r3167:c678c9ca682c r3167:c678c9ca682c r3167:c678c9ca682c r3167:c678c9ca682c r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3146:b3862f32db0e r3150:6242a630abac r3150:6242a630abac r3150:6242a630abac r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b r3144:5b175fed4b0b | /* $Id$ */
#ifndef ROAD_MAP_H
#define ROAD_MAP_H
#include "macros.h"
#include "rail.h"
#include "tile.h"
typedef enum RoadBits {
ROAD_NW = 1,
ROAD_SW = 2,
ROAD_SE = 4,
ROAD_NE = 8,
ROAD_X = ROAD_SW | ROAD_NE,
ROAD_Y = ROAD_NW | ROAD_SE,
ROAD_ALL = ROAD_X | ROAD_Y
} RoadBits;
static inline RoadBits ComplementRoadBits(RoadBits r)
{
return ROAD_ALL ^ r;
}
static inline RoadBits DiagDirToRoadBits(DiagDirection d)
{
return 1 << (3 ^ d);
}
static inline RoadBits GetRoadBits(TileIndex tile)
{
return GB(_m[tile].m5, 0, 4);
}
static inline void SetRoadBits(TileIndex tile, RoadBits r)
{
SB(_m[tile].m5, 0, 4, r);
}
static inline RoadBits GetCrossingRoadBits(TileIndex tile)
{
return _m[tile].m5 & 8 ? ROAD_Y : ROAD_X;
}
static inline TrackBits GetCrossingRailBits(TileIndex tile)
{
return _m[tile].m5 & 8 ? TRACK_BIT_X : TRACK_BIT_Y;
}
typedef enum RoadType {
ROAD_NORMAL,
ROAD_CROSSING,
ROAD_DEPOT
} RoadType;
static inline RoadType GetRoadType(TileIndex tile)
{
return GB(_m[tile].m5, 4, 4);
}
static inline DiagDirection GetRoadDepotDirection(TileIndex tile)
{
return (DiagDirection)GB(_m[tile].m5, 0, 2);
}
/**
* Returns the RoadBits on an arbitrary tile
* Special behavior:
* - road depots: entrance is treated as road piece
* - road tunnels: entrance is treated as road piece
* - bridge ramps: treated as straight road
* - bridge middle parts: bridge itself is ignored
*/
RoadBits GetAnyRoadBits(TileIndex);
TrackBits GetAnyRoadTrackBits(TileIndex tile);
static inline void MakeRoadNormal(TileIndex t, Owner owner, RoadBits bits, uint town)
{
SetTileType(t, MP_STREET);
SetTileOwner(t, owner);
_m[t].m2 = town;
_m[t].m3 = 0;
_m[t].m4 = 0 << 7 | 0 << 4 | 0;
_m[t].m5 = ROAD_NORMAL << 4 | bits;
}
static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner rail, Axis roaddir, RailType rt, uint town)
{
SetTileType(t, MP_STREET);
SetTileOwner(t, rail);
_m[t].m2 = town;
_m[t].m3 = road;
_m[t].m4 = 0 << 7 | 0 << 4 | rt;
_m[t].m5 = ROAD_CROSSING << 4 | roaddir << 3 | 0 << 2;
}
static inline void MakeRoadDepot(TileIndex t, Owner owner, DiagDirection dir)
{
SetTileType(t, MP_STREET);
SetTileOwner(t, owner);
_m[t].m2 = 0;
_m[t].m3 = 0;
_m[t].m4 = 0;
_m[t].m5 = ROAD_DEPOT << 4 | dir;
}
#endif
|