From e86e9f96ca34114d53d4909ce2d6aa2d83dde2eb Mon Sep 17 00:00:00 2001 From: tron Date: Sat, 29 Jan 2005 13:33:48 +0000 Subject: (svn r1715) Move [GS]etMapExtraBits to tile.[ch] --- Makefile | 1 + functions.h | 2 -- landscape.c | 11 ----------- tile.c | 14 ++++++++++++++ tile.h | 3 +++ 5 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 tile.c diff --git a/Makefile b/Makefile index 3b8090542..318b12255 100644 --- a/Makefile +++ b/Makefile @@ -624,6 +624,7 @@ C_SOURCES += strings.c C_SOURCES += subsidy_gui.c C_SOURCES += terraform_gui.c C_SOURCES += texteff.c +C_SOURCES += tile.c C_SOURCES += town_cmd.c C_SOURCES += town_gui.c C_SOURCES += train_cmd.c diff --git a/functions.h b/functions.h index 36a8e6295..e39e27d38 100644 --- a/functions.h +++ b/functions.h @@ -14,8 +14,6 @@ int GetTileZ(uint tile); void DoClearSquare(uint tile); void CDECL ModifyTile(uint tile, uint flags, ...); -void SetMapExtraBits(uint tile, byte flags); -uint GetMapExtraBits(uint tile); void RunTileLoop(void); uint GetPartialZ(int x, int y, int corners); diff --git a/landscape.c b/landscape.c index 4e14682fd..993badea8 100644 --- a/landscape.c +++ b/landscape.c @@ -430,17 +430,6 @@ void CDECL ModifyTile(uint tile, uint flags, ...) MarkTileDirtyByTile(tile); } -void SetMapExtraBits(uint tile, byte bits) -{ - _map_extra_bits[tile >> 2] &= ~(3 << ((tile&3)*2)); - _map_extra_bits[tile >> 2] |= (bits&3) << ((tile&3)*2); -} - -uint GetMapExtraBits(uint tile) -{ - assert(tile < MapSize()); - return (_map_extra_bits[tile >> 2] >> (tile & 3) * 2) & 3; -} #define TILELOOP_BITS 4 #define TILELOOP_SIZE (1 << TILELOOP_BITS) diff --git a/tile.c b/tile.c new file mode 100644 index 000000000..f8641ca98 --- /dev/null +++ b/tile.c @@ -0,0 +1,14 @@ +#include "tile.h" + +void SetMapExtraBits(TileIndex tile, byte bits) +{ + assert(tile < MapSize()); + _map_extra_bits[tile >> 2] &= ~(3 << ((tile & 3) * 2)); + _map_extra_bits[tile >> 2] |= (bits&3) << ((tile & 3) * 2); +} + +uint GetMapExtraBits(TileIndex tile) +{ + assert(tile < MapSize()); + return (_map_extra_bits[tile >> 2] >> (tile & 3) * 2) & 3; +} diff --git a/tile.h b/tile.h index 0019397dd..ec274d62f 100644 --- a/tile.h +++ b/tile.h @@ -3,6 +3,9 @@ #include "map.h" +void SetMapExtraBits(TileIndex tile, byte flags); +uint GetMapExtraBits(TileIndex tile); + static inline uint TileHeight(TileIndex tile) { assert(tile < MapSize()); -- cgit v1.2.3-70-g09d2