diff options
author | celestar <celestar@openttd.org> | 2006-04-03 12:20:55 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2006-04-03 12:20:55 +0000 |
commit | e924ff84eba7c15fd2ded05cbd56e1831fabdaea (patch) | |
tree | 75b82a8249e1db78e1e7a97a5da2ea48f14529f5 /unmovable_map.h | |
parent | c541a705f7fb04eae827d95d2a2eb617bdbf2afc (diff) | |
download | openttd-e924ff84eba7c15fd2ded05cbd56e1831fabdaea.tar.xz |
(svn r4255) -Codechange: Add and make use of more accessor functions concerning unmovables. unmovable_cmd is now map access free
Diffstat (limited to 'unmovable_map.h')
-rw-r--r-- | unmovable_map.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/unmovable_map.h b/unmovable_map.h index fed814ced..d8ee49a0b 100644 --- a/unmovable_map.h +++ b/unmovable_map.h @@ -1,5 +1,10 @@ /* $Id$ */ +enum { + HQ_NUM_TILE = 4, + HQ_NUM_SIZE = 5 +}; + typedef enum UnmovableType { UNMOVABLE_TRANSMITTER = 0, UNMOVABLE_LIGHTHOUSE = 1, @@ -9,9 +14,12 @@ typedef enum UnmovableType { UNMOVABLE_HQ_WEST = 0x81, UNMOVABLE_HQ_EAST = 0x82, UNMOVABLE_HQ_SOUTH = 0x83, + + UNMOVABLE_HQ_END = UNMOVABLE_HQ_NORTH + HQ_NUM_SIZE * HQ_NUM_TILE } UnmovableType; + static inline UnmovableType GetUnmovableType(TileIndex t) { assert(IsTileType(t, MP_UNMOVABLE)); @@ -38,6 +46,23 @@ static inline bool IsOwnedLandTile(TileIndex t) return IsTileType(t, MP_UNMOVABLE) && IsOwnedLand(t); } +static inline bool IsCompanyHQ(TileIndex t) +{ + return IS_INT_INSIDE(GetUnmovableType(t), UNMOVABLE_HQ_NORTH, UNMOVABLE_HQ_END); +} + +static inline byte GetCompanyHQSize(TileIndex t) +{ + assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)); + return GB(_m[t].m5, 2, 3); +} + +static inline byte GetCompanyHQSection(TileIndex t) +{ + assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)); + return GB(_m[t].m5, 0, 5); +} + static inline void EnlargeCompanyHQ(TileIndex t, byte size) { |