Files
@ r5388:b83fe4735739
Branch filter:
Location: cpp/openttd-patchpack/source/water_map.h - annotation
r5388:b83fe4735739
2.8 KiB
text/x-c
(svn r7577) -Fix (r7565): Missed out some OSX files (Bjarni)
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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3402:d8966314468d r3402:d8966314468d r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3402:d8966314468d r3373:1ed18d2c1b0c r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3424:e544653fffcf r3424:e544653fffcf r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3402:d8966314468d r3423:33787b70f1e0 r3423:33787b70f1e0 r3423:33787b70f1e0 r3423:33787b70f1e0 r3423:33787b70f1e0 r3402:d8966314468d r3402:d8966314468d r3636:a8e0c73aca96 r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3423:33787b70f1e0 r3423:33787b70f1e0 r3423:33787b70f1e0 r3423:33787b70f1e0 r3423:33787b70f1e0 r3953:57cc3965106e r3953:57cc3965106e r3953:57cc3965106e r3953:57cc3965106e r3953:57cc3965106e r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3373:1ed18d2c1b0c r3425:e2fe1b39a433 r3425:e2fe1b39a433 r3425:e2fe1b39a433 r3425:e2fe1b39a433 r3425:e2fe1b39a433 r3425:e2fe1b39a433 r3373:1ed18d2c1b0c r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3111:3de136b83596 r3940:eb699b175cdf r3940:eb699b175cdf r3940:eb699b175cdf r3940:eb699b175cdf r3940:eb699b175cdf r3940:eb699b175cdf r3940:eb699b175cdf r3940:eb699b175cdf r3940:eb699b175cdf r3940:eb699b175cdf r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3940:eb699b175cdf r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3940:eb699b175cdf r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3372:44f1fe38aca0 r3940:eb699b175cdf r3372:44f1fe38aca0 r4559:2222e3ea9700 r3372:44f1fe38aca0 r3940:eb699b175cdf r3940:eb699b175cdf r3940:eb699b175cdf r3372:44f1fe38aca0 r3372:44f1fe38aca0 r4666:2a2c50111c72 | /* $Id$ */
#ifndef WATER_MAP_H
#define WATER_MAP_H
typedef enum WaterTileType {
WATER_CLEAR,
WATER_COAST,
WATER_LOCK,
WATER_DEPOT,
} WaterTileType;
typedef enum DepotPart {
DEPOT_NORTH = 0x80,
DEPOT_SOUTH = 0x81,
DEPOT_END = 0x84,
} DepotPart;
typedef enum LockPart {
LOCK_MIDDLE = 0x10,
LOCK_LOWER = 0x14,
LOCK_UPPER = 0x18,
LOCK_END = 0x1C
} LockPart;
static inline WaterTileType GetWaterTileType(TileIndex t)
{
if (_m[t].m5 == 0) return WATER_CLEAR;
if (_m[t].m5 == 1) return WATER_COAST;
if (IS_INT_INSIDE(_m[t].m5, LOCK_MIDDLE, LOCK_END)) return WATER_LOCK;
assert(IS_INT_INSIDE(_m[t].m5, DEPOT_NORTH, DEPOT_END));
return WATER_DEPOT;
}
static inline bool IsWater(TileIndex t)
{
return GetWaterTileType(t) == WATER_CLEAR;
}
static inline bool IsCoast(TileIndex t)
{
return GetWaterTileType(t) == WATER_COAST;
}
static inline bool IsClearWaterTile(TileIndex t)
{
return IsTileType(t, MP_WATER) && IsWater(t) && GetTileSlope(t, NULL) == SLOPE_FLAT;
}
static inline TileIndex GetOtherShipDepotTile(TileIndex t)
{
return t + (HASBIT(_m[t].m5, 0) ? -1 : 1) * (HASBIT(_m[t].m5, 1) ? TileDiffXY(0, 1) : TileDiffXY(1, 0));
}
static inline TileIndex IsShipDepot(TileIndex t)
{
return IS_INT_INSIDE(_m[t].m5, DEPOT_NORTH, DEPOT_END);
}
static inline Axis GetShipDepotAxis(TileIndex t)
{
return (Axis)GB(_m[t].m5, 1, 1);
}
static inline DiagDirection GetShipDepotDirection(TileIndex t)
{
return XYNSToDiagDir(GetShipDepotAxis(t), GB(_m[t].m5, 0, 1));
}
static inline DiagDirection GetLockDirection(TileIndex t)
{
return (DiagDirection)GB(_m[t].m5, 0, 2);
}
static inline byte GetSection(TileIndex t)
{
assert(GetWaterTileType(t) == WATER_LOCK || GetWaterTileType(t) == WATER_DEPOT);
return GB(_m[t].m5, 0, 4);
}
static inline void MakeWater(TileIndex t)
{
SetTileType(t, MP_WATER);
SetTileOwner(t, OWNER_WATER);
_m[t].m2 = 0;
_m[t].m3 = 0;
_m[t].m4 = 0;
_m[t].m5 = 0;
}
static inline void MakeShore(TileIndex t)
{
SetTileType(t, MP_WATER);
SetTileOwner(t, OWNER_WATER);
_m[t].m2 = 0;
_m[t].m3 = 0;
_m[t].m4 = 0;
_m[t].m5 = 1;
}
static inline void MakeCanal(TileIndex t, Owner o)
{
SetTileType(t, MP_WATER);
SetTileOwner(t, o);
_m[t].m2 = 0;
_m[t].m3 = 0;
_m[t].m4 = 0;
_m[t].m5 = 0;
}
static inline void MakeShipDepot(TileIndex t, Owner o, DepotPart base, Axis a)
{
SetTileType(t, MP_WATER);
SetTileOwner(t, o);
_m[t].m2 = 0;
_m[t].m3 = 0;
_m[t].m4 = 0;
_m[t].m5 = base + a * 2;
}
static inline void MakeLockTile(TileIndex t, Owner o, byte section)
{
SetTileType(t, MP_WATER);
SetTileOwner(t, o);
_m[t].m2 = 0;
_m[t].m3 = 0;
_m[t].m4 = 0;
_m[t].m5 = section;
}
static inline void MakeLock(TileIndex t, Owner o, DiagDirection d)
{
TileIndexDiff delta = TileOffsByDiagDir(d);
MakeLockTile(t, o, LOCK_MIDDLE + d);
MakeLockTile(t - delta, o, LOCK_LOWER + d);
MakeLockTile(t + delta, o, LOCK_UPPER + d);
}
#endif /* WATER_MAP_H */
|