unmovable_map.h
author belugas
Thu, 30 Mar 2006 19:16:44 +0000
changeset 3379 50b253bb9819
parent 3369 cab209754317
child 3385 18e4ca6d3ef4
permissions -rw-r--r--
(svn r4181) CodeChange : Replaced [G/S]etMapExtraBits by [G/S]etTropicZone. Although it was an accessor, nor his usage nor the values were clear.
3310
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
     1
/* $Id$ */
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
     2
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
     3
typedef enum UnmovableType {
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
     4
	UNMOVABLE_TRANSMITTER = 0,
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
     5
	UNMOVABLE_LIGHTHOUSE  = 1,
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
     6
	UNMOVABLE_STATUE      = 2,
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
     7
	UNMOVABLE_OWNED_LAND  = 3
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
     8
} UnmovableType;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
     9
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    10
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    11
static inline UnmovableType GetUnmovableType(TileIndex t)
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    12
{
3369
cab209754317 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3310
diff changeset
    13
	assert(IsTileType(t, MP_UNMOVABLE));
3310
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    14
	return _m[t].m5;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    15
}
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    16
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    17
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    18
static inline bool IsTransmitterTile(TileIndex t)
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    19
{
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    20
	return
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    21
		IsTileType(t, MP_UNMOVABLE) &&
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    22
		GetUnmovableType(t) == UNMOVABLE_TRANSMITTER;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    23
}
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    24
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    25
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    26
static inline bool IsOwnedLand(TileIndex t)
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    27
{
3369
cab209754317 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3310
diff changeset
    28
	assert(IsTileType(t, MP_UNMOVABLE));
3310
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    29
	return GetUnmovableType(t) == UNMOVABLE_OWNED_LAND;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    30
}
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    31
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    32
static inline bool IsOwnedLandTile(TileIndex t)
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    33
{
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    34
	return IsTileType(t, MP_UNMOVABLE) && IsOwnedLand(t);
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    35
}
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    36
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    37
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    38
static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o)
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    39
{
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    40
	SetTileType(t, MP_UNMOVABLE);
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    41
	SetTileOwner(t, o);
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    42
	_m[t].m2 = 0;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    43
	_m[t].m3 = 0;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    44
	_m[t].m4 = 0;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    45
	_m[t].m5 = u;
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    46
}
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    47
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    48
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    49
static inline void MakeTransmitter(TileIndex t)
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    50
{
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    51
	MakeUnmovable(t, UNMOVABLE_TRANSMITTER, OWNER_NONE);
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    52
}
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    53
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    54
static inline void MakeLighthouse(TileIndex t)
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    55
{
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    56
	MakeUnmovable(t, UNMOVABLE_LIGHTHOUSE, OWNER_NONE);
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    57
}
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    58
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    59
static inline void MakeStatue(TileIndex t, Owner o)
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    60
{
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    61
	MakeUnmovable(t, UNMOVABLE_STATUE, o);
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    62
}
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    63
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    64
static inline void MakeOwnedLand(TileIndex t, Owner o)
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    65
{
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    66
	MakeUnmovable(t, UNMOVABLE_OWNED_LAND, o);
a19f247b75b6 (svn r4073) Add functions to make and test for (most) unmovable tiles
tron
parents:
diff changeset
    67
}