summaryrefslogtreecommitdiff
path: root/src/unmovable_map.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-03 08:58:12 +0000
committerrubidium <rubidium@openttd.org>2010-08-03 08:58:12 +0000
commit3bfe26c69d10c8395057a0fe168906182b563769 (patch)
treec2dc97d833168bb2935913e3de297fe003ab6703 /src/unmovable_map.h
parentf812e800028ae4fc65230da398c77d5d0fd695e7 (diff)
downloadopenttd-3bfe26c69d10c8395057a0fe168906182b563769.tar.xz
(svn r20337) -Codechange: unify the construction of objects on the map
Diffstat (limited to 'src/unmovable_map.h')
-rw-r--r--src/unmovable_map.h72
1 files changed, 4 insertions, 68 deletions
diff --git a/src/unmovable_map.h b/src/unmovable_map.h
index 44395f4d8..ba8fe746f 100644
--- a/src/unmovable_map.h
+++ b/src/unmovable_map.h
@@ -160,13 +160,14 @@ static inline void SetUnmovableOffset(TileIndex t, uint8 offset)
* @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
+ * @param offset The offset to the northern tile of this object.
+ * @param index Generic index associated with the object type.
*/
-static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o, uint8 offset = 0)
+static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o, uint8 offset, uint index)
{
SetTileType(t, MP_UNMOVABLE);
SetTileOwner(t, o);
- _m[t].m2 = 0;
+ _m[t].m2 = index;
_m[t].m3 = offset;
_m[t].m4 = 0;
_m[t].m5 = u;
@@ -174,69 +175,4 @@ static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o, uint8 of
_me[t].m7 = 0;
}
-
-/**
- * Make a transmitter tile.
- * @param t the tile to make a transmitter.
- */
-static inline void MakeTransmitter(TileIndex t)
-{
- MakeUnmovable(t, UNMOVABLE_TRANSMITTER, OWNER_NONE);
-}
-
-/**
- * Make a lighthouse tile.
- * @param t the tile to make a transmitter.
- */
-static inline void MakeLighthouse(TileIndex t)
-{
- MakeUnmovable(t, UNMOVABLE_LIGHTHOUSE, OWNER_NONE);
-}
-
-/**
- * Make a statue tile.
- * @param t the tile to make a statue.
- * @param o the owner of the statue.
- * @param town_id the town the statue was built in.
- */
-static inline void MakeStatue(TileIndex t, Owner o, TownID town_id)
-{
- MakeUnmovable(t, UNMOVABLE_STATUE, o);
- _m[t].m2 = town_id;
-}
-
-/**
- * Make an 'owned land' tile.
- * @param t the tile to make an 'owned land' tile.
- * @param o the owner of the land.
- */
-static inline void MakeOwnedLand(TileIndex t, Owner o)
-{
- MakeUnmovable(t, UNMOVABLE_OWNED_LAND, o);
-}
-
-/**
- * Make a HeadQuarter tile after making it an Unmovable
- * @param t the tile to make an HQ.
- * @param section the part of the HQ this one will be.
- * @param o the new owner of the tile.
- */
-static inline void MakeUnmovableHQHelper(TileIndex t, uint8 section, Owner o)
-{
- MakeUnmovable(t, UNMOVABLE_HQ, o, section);
-}
-
-/**
- * Make an HQ with the given tile as its northern tile.
- * @param t the tile to make the northern tile of a HQ.
- * @param o the owner of the HQ.
- */
-static inline void MakeCompanyHQ(TileIndex t, Owner 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 */