summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-02-24 19:52:26 +0000
committertron <tron@openttd.org>2006-02-24 19:52:26 +0000
commitf369dcef51e0cac4eacc4dcf9ec645ebfe5c5fd3 (patch)
tree1c0268c55dfc95a3896ccb746f4e79881af91695
parentaf5a1d49c0b7b06496bfbd4d50514934ed362b3a (diff)
downloadopenttd-f369dcef51e0cac4eacc4dcf9ec645ebfe5c5fd3.tar.xz
(svn r3664) Add a function to turn a tile into a void tile
-rw-r--r--landscape.c7
-rw-r--r--openttd.c7
-rw-r--r--void.h6
3 files changed, 12 insertions, 8 deletions
diff --git a/landscape.c b/landscape.c
index af0b8cb9b..b96c98491 100644
--- a/landscape.c
+++ b/landscape.c
@@ -14,6 +14,7 @@
#include "command.h"
#include "vehicle.h"
#include "variables.h"
+#include "void.h"
extern const TileTypeProcs
_tile_type_clear_procs,
@@ -447,10 +448,8 @@ void InitializeLandscape(void)
}
// create void tiles at the border
- for (i = 0; i < MapMaxY(); ++i)
- SetTileType(i * MapSizeX() + MapMaxX(), MP_VOID);
- for (i = 0; i < MapSizeX(); ++i)
- SetTileType(MapSizeX() * MapMaxY() + i, MP_VOID);
+ for (i = 0; i < MapMaxY(); ++i) MakeVoid(i * MapSizeX() + MapMaxX());
+ for (i = 0; i < MapSizeX(); ++i) MakeVoid(MapSizeX() * MapMaxY() + i);
}
void ConvertGroundTilesIntoWaterTiles(void)
diff --git a/openttd.c b/openttd.c
index f99882e65..a078bad5a 100644
--- a/openttd.c
+++ b/openttd.c
@@ -9,6 +9,7 @@
#include "strings.h"
#include "map.h"
#include "tile.h"
+#include "void.h"
#define VARDEF
#include "openttd.h"
@@ -1059,10 +1060,8 @@ static void UpdateVoidTiles(void)
{
uint i;
- for (i = 0; i < MapMaxY(); ++i)
- SetTileType(i * MapSizeX() + MapMaxX(), MP_VOID);
- for (i = 0; i < MapSizeX(); ++i)
- SetTileType(MapSizeX() * MapMaxY() + i, MP_VOID);
+ for (i = 0; i < MapMaxY(); ++i) MakeVoid(i * MapSizeX() + MapMaxX());
+ for (i = 0; i < MapSizeX(); ++i) MakeVoid(MapSizeX() * MapMaxY() + i);
}
// since savegame version 6.0 each sign has an "owner", signs without owner (from old games are set to 255)
diff --git a/void.h b/void.h
new file mode 100644
index 000000000..711859fa2
--- /dev/null
+++ b/void.h
@@ -0,0 +1,6 @@
+/* $Id$ */
+
+static inline void MakeVoid(TileIndex t)
+{
+ SetTileType(t, MP_VOID);
+}