diff options
author | rubidium <rubidium@openttd.org> | 2010-08-03 08:09:45 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-08-03 08:09:45 +0000 |
commit | f44c51577b93faa5efc27a99b2696e08b24f7ca4 (patch) | |
tree | 5d746b7ce00185b4b742af2fbeccd39162ce35c0 /src/unmovable_map.h | |
parent | 1a9d5ae076fb507cc6056f1da95e1789d2e0b1d9 (diff) | |
download | openttd-f44c51577b93faa5efc27a99b2696e08b24f7ca4.tar.xz |
(svn r20334) -Codechange: reorder the unmovable bits a bit for futher extension
Diffstat (limited to 'src/unmovable_map.h')
-rw-r--r-- | src/unmovable_map.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/unmovable_map.h b/src/unmovable_map.h index 7725ac5cb..fd88d116a 100644 --- a/src/unmovable_map.h +++ b/src/unmovable_map.h @@ -108,50 +108,50 @@ static inline TownID GetStatueTownID(TileIndex t) /** * Get the 'stage' of the HQ. * @param t a tile of the HQ. - * @pre IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t) + * @pre IsTileType(t, MP_UNMOVABLE) * @return the 'stage' of the HQ. */ static inline byte GetCompanyHQSize(TileIndex t) { - assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)); - return GB(_m[t].m3, 2, 3); + assert(IsTileType(t, MP_UNMOVABLE)); + return GB(_m[t].m6, 2, 4); } /** * Set the 'stage' of the HQ. * @param t a tile of the HQ. * @param size the actual stage of the HQ - * @pre IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t) + * @pre IsTileType(t, MP_UNMOVABLE) */ static inline void SetCompanyHQSize(TileIndex t, uint8 size) { - assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)); - SB(_m[t].m3, 2, 3, size); + assert(IsTileType(t, MP_UNMOVABLE)); + SB(_m[t].m6, 2, 4, size); } /** * Get the 'section' of the HQ. * The scetion is in fact which side of teh HQ the tile represent * @param t a tile of the HQ. - * @pre IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t) + * @pre IsTileType(t, MP_UNMOVABLE) * @return the 'section' of the HQ. */ static inline byte GetCompanyHQSection(TileIndex t) { - assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)); - return GB(_m[t].m3, 0, 2); + assert(IsTileType(t, MP_UNMOVABLE)); + return _m[t].m3; } /** * Set the 'section' of the HQ. * @param t a tile of the HQ. * @param section to be set. - * @pre IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t) + * @pre IsTileType(t, MP_UNMOVABLE) */ static inline void SetCompanyHQSection(TileIndex t, uint8 section) { - assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)); - SB(_m[t].m3, 0, 2, section); + assert(IsTileType(t, MP_UNMOVABLE)); + _m[t].m3 = section; } /** @@ -177,16 +177,17 @@ static inline void EnlargeCompanyHQ(TileIndex t, byte size) /** * Make an Unmovable tile. * @note do not use this function directly. Use one of the other Make* functions. - * @param t the tile to make unmovable. - * @param u the unmovable type of the tile. - * @param o the new owner of the tile. + * @param t The tile to make unmovable. + * @param u The unmovable type of the tile. + * @param o The new owner of the tile. + * @param offset The offset to the northern tile of this object */ -static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o) +static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o, uint8 offset = 0) { SetTileType(t, MP_UNMOVABLE); SetTileOwner(t, o); _m[t].m2 = 0; - _m[t].m3 = 0; + _m[t].m3 = offset; _m[t].m4 = 0; _m[t].m5 = u; SB(_m[t].m6, 2, 4, 0); @@ -242,8 +243,7 @@ static inline void MakeOwnedLand(TileIndex t, Owner o) */ static inline void MakeUnmovableHQHelper(TileIndex t, uint8 section, Owner o) { - MakeUnmovable(t, UNMOVABLE_HQ, o); - SetCompanyHQSection(t, section); + MakeUnmovable(t, UNMOVABLE_HQ, o, section); } /** @@ -253,10 +253,10 @@ static inline void MakeUnmovableHQHelper(TileIndex t, uint8 section, Owner o) */ static inline void MakeCompanyHQ(TileIndex t, Owner o) { - MakeUnmovableHQHelper(t, 0, o); - MakeUnmovableHQHelper(t + TileDiffXY(0, 1), 1, o); - MakeUnmovableHQHelper(t + TileDiffXY(1, 0), 2, o); - MakeUnmovableHQHelper(t + TileDiffXY(1, 1), 3, o); + MakeUnmovableHQHelper(t, 0x00, o); + MakeUnmovableHQHelper(t + TileDiffXY(0, 1), 0x01, o); + MakeUnmovableHQHelper(t + TileDiffXY(1, 0), 0x10, o); + MakeUnmovableHQHelper(t + TileDiffXY(1, 1), 0x11, o); } #endif /* UNMOVABLE_MAP_H */ |