summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--ai.c1
-rw-r--r--ai_build.c1
-rw-r--r--ai_new.c1
-rw-r--r--ai_pathfinder.c1
-rw-r--r--ai_shared.c1
-rw-r--r--aircraft_cmd.c1
-rw-r--r--aircraft_gui.c1
-rw-r--r--airport.c1
-rw-r--r--airport_gui.c1
-rw-r--r--bridge_gui.c1
-rw-r--r--clear_cmd.c1
-rw-r--r--command.c1
-rw-r--r--disaster_cmd.c1
-rw-r--r--dock_gui.c1
-rw-r--r--economy.c1
-rw-r--r--industry_cmd.c1
-rw-r--r--industry_gui.c1
-rw-r--r--landscape.c9
-rw-r--r--macros.h8
-rw-r--r--main_gui.c1
-rw-r--r--map.c11
-rw-r--r--map.h21
-rw-r--r--misc.c1
-rw-r--r--misc_gui.c1
-rw-r--r--network.c1
-rw-r--r--oldloader.c1
-rw-r--r--order_gui.c1
-rw-r--r--pathfind.c1
-rw-r--r--players.c1
-rw-r--r--rail_cmd.c1
-rw-r--r--rail_gui.c1
-rw-r--r--road_cmd.c1
-rw-r--r--road_gui.c1
-rw-r--r--roadveh_cmd.c1
-rw-r--r--roadveh_gui.c1
-rw-r--r--ship_cmd.c1
-rw-r--r--ship_gui.c1
-rw-r--r--smallmap_gui.c1
-rw-r--r--sound.c1
-rw-r--r--station_cmd.c1
-rw-r--r--town_cmd.c1
-rw-r--r--train_cmd.c1
-rw-r--r--train_gui.c1
-rw-r--r--tree_cmd.c1
-rw-r--r--ttd.c1
-rw-r--r--tunnelbridge_cmd.c1
-rw-r--r--unmovable_cmd.c1
-rw-r--r--variables.h7
-rw-r--r--vehicle.c1
-rw-r--r--viewport.c1
-rw-r--r--water_cmd.c1
-rw-r--r--window.c1
53 files changed, 81 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 9610337ed..0e87cae29 100644
--- a/Makefile
+++ b/Makefile
@@ -575,6 +575,7 @@ C_SOURCES += industry_gui.c
C_SOURCES += intro_gui.c
C_SOURCES += landscape.c
C_SOURCES += main_gui.c
+C_SOURCES += map.c
C_SOURCES += md5.c
C_SOURCES += minilzo.c
C_SOURCES += misc.c
diff --git a/ai.c b/ai.c
index 1d8d583f3..855c39c22 100644
--- a/ai.c
+++ b/ai.c
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "ttd.h"
+#include "map.h"
#include "player.h"
#include "vehicle.h"
#include "engine.h"
diff --git a/ai_build.c b/ai_build.c
index f6c4f1d54..2530a78b6 100644
--- a/ai_build.c
+++ b/ai_build.c
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "ttd.h"
+#include "map.h"
#include "command.h"
#include "ai.h"
#include "engine.h"
diff --git a/ai_new.c b/ai_new.c
index ba335196a..9e72d3c90 100644
--- a/ai_new.c
+++ b/ai_new.c
@@ -16,6 +16,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "command.h"
#include "ai.h"
#include "town.h"
diff --git a/ai_pathfinder.c b/ai_pathfinder.c
index f51f34b83..5c837a460 100644
--- a/ai_pathfinder.c
+++ b/ai_pathfinder.c
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "ttd.h"
+#include "map.h"
#include "command.h"
#include "ai.h"
diff --git a/ai_shared.c b/ai_shared.c
index 9e7edaad0..9558c72bd 100644
--- a/ai_shared.c
+++ b/ai_shared.c
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "ttd.h"
+#include "map.h"
#include "ai.h"
#include "vehicle.h"
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index a851343fe..11cfec92b 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "engine.h"
#include "command.h"
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 5dbfebaa8..74c4150d2 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "vehicle.h"
diff --git a/airport.c b/airport.c
index 0b5ea344b..7b6c96276 100644
--- a/airport.c
+++ b/airport.c
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "ttd.h"
+#include "map.h"
#include "airport.h"
AirportFTAClass *CountryAirport;
diff --git a/airport_gui.c b/airport_gui.c
index 65c42a1e4..2c7f035f6 100644
--- a/airport_gui.c
+++ b/airport_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "viewport.h"
diff --git a/bridge_gui.c b/bridge_gui.c
index af2739f08..c38f1ce59 100644
--- a/bridge_gui.c
+++ b/bridge_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "viewport.h"
diff --git a/clear_cmd.c b/clear_cmd.c
index 225f40ed0..a6d062839 100644
--- a/clear_cmd.c
+++ b/clear_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "viewport.h"
#include "command.h"
diff --git a/command.c b/command.c
index 95c290b9c..756c5dda2 100644
--- a/command.c
+++ b/command.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "gui.h"
#include "command.h"
#include "player.h"
diff --git a/disaster_cmd.c b/disaster_cmd.c
index 9e72f7c6b..a1bf71644 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "command.h"
#include "news.h"
diff --git a/dock_gui.c b/dock_gui.c
index 36efe83b8..e9a80fe1e 100644
--- a/dock_gui.c
+++ b/dock_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "station.h"
#include "gui.h"
diff --git a/economy.c b/economy.c
index 78b88ba14..fb42abe0d 100644
--- a/economy.c
+++ b/economy.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "news.h"
#include "player.h"
#include "station.h"
diff --git a/industry_cmd.c b/industry_cmd.c
index 53da5e600..528fc231c 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "viewport.h"
#include "command.h"
#include "industry.h"
diff --git a/industry_gui.c b/industry_gui.c
index e031844f3..9c13e2b21 100644
--- a/industry_gui.c
+++ b/industry_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
//#include "gui.h"
#include "window.h"
#include "gfx.h"
diff --git a/landscape.c b/landscape.c
index 5126115a2..78da7197f 100644
--- a/landscape.c
+++ b/landscape.c
@@ -1,19 +1,12 @@
#include "stdafx.h"
#include "ttd.h"
+#include "map.h"
#include <stdarg.h>
#include "gfx.h"
#include "viewport.h"
#include "command.h"
#include "vehicle.h"
-byte _map_type_and_height[TILES_X * TILES_Y];
-byte _map5[TILES_X * TILES_Y];
-byte _map3_lo[TILES_X * TILES_Y];
-byte _map3_hi[TILES_X * TILES_Y];
-byte _map_owner[TILES_X * TILES_Y];
-byte _map2[TILES_X * TILES_Y];
-byte _map_extra_bits[TILES_X * TILES_Y/4];
-
extern const TileTypeProcs
_tile_type_clear_procs,
_tile_type_rail_procs,
diff --git a/macros.h b/macros.h
index 7517d6fed..584006312 100644
--- a/macros.h
+++ b/macros.h
@@ -66,8 +66,6 @@ static inline int64 BIGMULS(int32 a, int32 b) {
//#define IS_INSIDE_1D(x, base, size) ((x) >= (base) && (x) < (base) + (size))
#define IS_INSIDE_1D(x, base, size) ( (uint)((x) - (base)) < ((uint)(size)) )
-#define TILE_X_BITS 8
-#define TILE_Y_BITS 8
#define LANDSCAPE_SIZE_FACTOR 1
#define TILE_FROM_XY(x,y) (int)((((y) >> 4) << TILE_X_BITS) + ((x) >> 4))
@@ -82,12 +80,6 @@ enum {
};
#define CORRECT_Z(tileh) (CORRECT_Z_BITS & (1 << tileh))
-#define TILES_X (1 << TILE_X_BITS)
-#define TILES_Y (1 << TILE_Y_BITS)
-
-#define TILE_X_MAX (TILES_X-1)
-#define TILE_Y_MAX (TILES_Y-1)
-
#define TILE_ASSERT(x) assert( TILE_MASK(x) == (x) );
extern uint SafeTileAdd(uint x, int add, const char *exp, const char *file, int line);
diff --git a/main_gui.c b/main_gui.c
index 765ef1935..3bc7349a5 100644
--- a/main_gui.c
+++ b/main_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "viewport.h"
diff --git a/map.c b/map.c
new file mode 100644
index 000000000..6cd86d260
--- /dev/null
+++ b/map.c
@@ -0,0 +1,11 @@
+#include "stdafx.h"
+#include "ttd.h"
+#include "map.h"
+
+byte _map_type_and_height[TILES_X * TILES_Y];
+byte _map5[TILES_X * TILES_Y];
+byte _map3_lo[TILES_X * TILES_Y];
+byte _map3_hi[TILES_X * TILES_Y];
+byte _map_owner[TILES_X * TILES_Y];
+byte _map2[TILES_X * TILES_Y];
+byte _map_extra_bits[TILES_X * TILES_Y / 4];
diff --git a/map.h b/map.h
new file mode 100644
index 000000000..8694ff277
--- /dev/null
+++ b/map.h
@@ -0,0 +1,21 @@
+#ifndef MAP_H
+#define MAP_H
+
+#define TILE_X_BITS 8
+#define TILE_Y_BITS 8
+
+#define TILES_X (1 << TILE_X_BITS)
+#define TILES_Y (1 << TILE_Y_BITS)
+
+#define TILE_X_MAX (TILES_X - 1)
+#define TILE_Y_MAX (TILES_Y - 1)
+
+extern byte _map_type_and_height[TILES_X * TILES_Y];
+extern byte _map5[TILES_X * TILES_Y];
+extern byte _map3_lo[TILES_X * TILES_Y];
+extern byte _map3_hi[TILES_X * TILES_Y];
+extern byte _map_owner[TILES_X * TILES_Y];
+extern byte _map2[TILES_X * TILES_Y];
+extern byte _map_extra_bits[TILES_X * TILES_Y / 4];
+
+#endif
diff --git a/misc.c b/misc.c
index bca6cc973..8b6a7b032 100644
--- a/misc.c
+++ b/misc.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "gfx.h"
#include "assert.h"
diff --git a/misc_gui.c b/misc_gui.c
index 73e378197..e85fcc741 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "viewport.h"
diff --git a/network.c b/network.c
index 1b3e529d6..006c2cd91 100644
--- a/network.c
+++ b/network.c
@@ -1,4 +1,5 @@
#include "stdafx.h"
+#include "map.h"
#include "network_data.h"
#if defined(WITH_REV)
diff --git a/oldloader.c b/oldloader.c
index 522d3ec70..d09ddf20a 100644
--- a/oldloader.c
+++ b/oldloader.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "town.h"
#include "industry.h"
#include "station.h"
diff --git a/order_gui.c b/order_gui.c
index 23a5074e9..0722215e0 100644
--- a/order_gui.c
+++ b/order_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "gfx.h"
diff --git a/pathfind.c b/pathfind.c
index 775fe9818..9c6e14c7f 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "ttd.h"
+#include "map.h"
#include "pathfind.h"
// remember which tiles we have already visited so we don't visit them again.
diff --git a/players.c b/players.c
index 603d1ead7..2bddbecee 100644
--- a/players.c
+++ b/players.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "player.h"
#include "town.h"
#include "vehicle.h"
diff --git a/rail_cmd.c b/rail_cmd.c
index 4b5eb17d8..1bb4172bf 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "viewport.h"
#include "command.h"
diff --git a/rail_gui.c b/rail_gui.c
index 36d13ba74..49f9856c8 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "viewport.h"
diff --git a/road_cmd.c b/road_cmd.c
index a269171be..07874499f 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "viewport.h"
#include "command.h"
diff --git a/road_gui.c b/road_gui.c
index 948cbd4a1..e64e47ff8 100644
--- a/road_gui.c
+++ b/road_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "viewport.h"
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index a36604713..c051039c0 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "engine.h"
#include "command.h"
diff --git a/roadveh_gui.c b/roadveh_gui.c
index cf2be1ea7..31172e5d6 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "gfx.h"
diff --git a/ship_cmd.c b/ship_cmd.c
index 8f2dfb89a..201ccadac 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "command.h"
#include "pathfind.h"
diff --git a/ship_gui.c b/ship_gui.c
index 1e5eaca68..74b083487 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "gfx.h"
diff --git a/smallmap_gui.c b/smallmap_gui.c
index 3f8debefe..515a80a29 100644
--- a/smallmap_gui.c
+++ b/smallmap_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "gui.h"
#include "window.h"
#include "gfx.h"
diff --git a/sound.c b/sound.c
index 6bf6a6884..1dd67e834 100644
--- a/sound.c
+++ b/sound.c
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "ttd.h"
+#include "map.h"
#include "sound.h"
#include "vehicle.h"
#include "window.h"
diff --git a/station_cmd.c b/station_cmd.c
index 56c51ec38..9c2f6cf8f 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "station.h"
#include "gfx.h"
#include "window.h"
diff --git a/town_cmd.c b/town_cmd.c
index 2cdfc56b9..8208cf0a5 100644
--- a/town_cmd.c
+++ b/town_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "viewport.h"
#include "town.h"
#include "command.h"
diff --git a/train_cmd.c b/train_cmd.c
index 50df00a59..d2bab6abf 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "command.h"
#include "pathfind.h"
diff --git a/train_gui.c b/train_gui.c
index 92175b13e..ad88ea98e 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "window.h"
#include "gui.h"
#include "gfx.h"
diff --git a/tree_cmd.c b/tree_cmd.c
index 64590fa69..f5830c88b 100644
--- a/tree_cmd.c
+++ b/tree_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "viewport.h"
#include "command.h"
#include "town.h"
diff --git a/ttd.c b/ttd.c
index 94722239d..2074f79e9 100644
--- a/ttd.c
+++ b/ttd.c
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "table/strings.h"
+#include "map.h"
#define VARDEF
#include "ttd.h"
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 5ff825ddb..f301d7be7 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "viewport.h"
#include "command.h"
diff --git a/unmovable_cmd.c b/unmovable_cmd.c
index 61b6fb4b0..277086a9c 100644
--- a/unmovable_cmd.c
+++ b/unmovable_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "command.h"
#include "viewport.h"
#include "player.h"
diff --git a/variables.h b/variables.h
index 667bd4a83..e95b8bb35 100644
--- a/variables.h
+++ b/variables.h
@@ -384,13 +384,6 @@ static inline uint32 GetDParam(uint n)
/* landscape.c */
extern const byte _tileh_to_sprite[32];
-extern byte _map_type_and_height[TILES_X * TILES_Y];
-extern byte _map5[TILES_X * TILES_Y];
-extern byte _map3_lo[TILES_X * TILES_Y];
-extern byte _map3_hi[TILES_X * TILES_Y];
-extern byte _map_owner[TILES_X * TILES_Y];
-extern byte _map2[TILES_X * TILES_Y];
-extern byte _map_extra_bits[TILES_X * TILES_Y/4];
static const byte _inclined_tileh[] = {
3,9,3,6,12,6,12,9,
diff --git a/vehicle.c b/vehicle.c
index 55bb3a186..87590054d 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "gfx.h"
//#include "station.h"
diff --git a/viewport.c b/viewport.c
index dc91e988d..1c64641c6 100644
--- a/viewport.c
+++ b/viewport.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "viewport.h"
#include "window.h"
#include "vehicle.h"
diff --git a/water_cmd.c b/water_cmd.c
index 8682e5911..3a878a50b 100644
--- a/water_cmd.c
+++ b/water_cmd.c
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "ttd.h"
#include "table/strings.h"
+#include "map.h"
#include "vehicle.h"
#include "viewport.h"
#include "command.h"
diff --git a/window.c b/window.c
index ba0e488dd..29bfb3b88 100644
--- a/window.c
+++ b/window.c
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "ttd.h"
+#include "map.h"
#include "window.h"
#include "gfx.h"
#include "viewport.h"