(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
authortron
Wed, 15 Dec 2004 22:18:54 +0000
changeset 679 e959706a3e4d
parent 678 9c84b180ecd7
child 680 fca287dc62a1
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
Makefile
ai.c
ai_build.c
ai_new.c
ai_pathfinder.c
ai_shared.c
aircraft_cmd.c
aircraft_gui.c
airport.c
airport_gui.c
bridge_gui.c
clear_cmd.c
command.c
disaster_cmd.c
dock_gui.c
economy.c
industry_cmd.c
industry_gui.c
landscape.c
macros.h
main_gui.c
map.c
map.h
misc.c
misc_gui.c
network.c
oldloader.c
order_gui.c
pathfind.c
players.c
rail_cmd.c
rail_gui.c
road_cmd.c
road_gui.c
roadveh_cmd.c
roadveh_gui.c
ship_cmd.c
ship_gui.c
smallmap_gui.c
sound.c
station_cmd.c
town_cmd.c
train_cmd.c
train_gui.c
tree_cmd.c
ttd.c
tunnelbridge_cmd.c
unmovable_cmd.c
variables.h
vehicle.c
viewport.c
water_cmd.c
window.c
--- a/Makefile	Wed Dec 15 22:06:47 2004 +0000
+++ b/Makefile	Wed Dec 15 22:18:54 2004 +0000
@@ -575,6 +575,7 @@
 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
--- a/ai.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/ai.c	Wed Dec 15 22:18:54 2004 +0000
@@ -1,5 +1,6 @@
 #include "stdafx.h"
 #include "ttd.h"
+#include "map.h"
 #include "player.h"
 #include "vehicle.h"
 #include "engine.h"
--- a/ai_build.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/ai_build.c	Wed Dec 15 22:18:54 2004 +0000
@@ -1,5 +1,6 @@
 #include "stdafx.h"
 #include "ttd.h"
+#include "map.h"
 #include "command.h"
 #include "ai.h"
 #include "engine.h"
--- a/ai_new.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/ai_new.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/ai_pathfinder.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/ai_pathfinder.c	Wed Dec 15 22:18:54 2004 +0000
@@ -1,5 +1,6 @@
 #include "stdafx.h"
 #include "ttd.h"
+#include "map.h"
 #include "command.h"
 #include "ai.h"
 
--- a/ai_shared.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/ai_shared.c	Wed Dec 15 22:18:54 2004 +0000
@@ -1,5 +1,6 @@
 #include "stdafx.h"
 #include "ttd.h"
+#include "map.h"
 #include "ai.h"
 #include "vehicle.h"
 
--- a/aircraft_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/aircraft_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/aircraft_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/aircraft_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/airport.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/airport.c	Wed Dec 15 22:18:54 2004 +0000
@@ -1,5 +1,6 @@
 #include "stdafx.h"
 #include "ttd.h"
+#include "map.h"
 #include "airport.h"
 
 AirportFTAClass *CountryAirport;
--- a/airport_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/airport_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/bridge_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/bridge_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/clear_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/clear_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -1,6 +1,7 @@
 #include "stdafx.h"
 #include "ttd.h"
 #include "table/strings.h"
+#include "map.h"
 #include "viewport.h"
 #include "command.h"
 
--- a/command.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/command.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/disaster_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/disaster_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/dock_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/dock_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/economy.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/economy.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/industry_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/industry_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/industry_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/industry_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/landscape.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/landscape.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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,
--- a/macros.h	Wed Dec 15 22:06:47 2004 +0000
+++ b/macros.h	Wed Dec 15 22:18:54 2004 +0000
@@ -66,8 +66,6 @@
 //#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 @@
 };
 #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);
--- a/main_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/main_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/map.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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];
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/map.h	Wed Dec 15 22:18:54 2004 +0000
@@ -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
--- a/misc.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/misc.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/misc_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/misc_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/network.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/network.c	Wed Dec 15 22:18:54 2004 +0000
@@ -1,4 +1,5 @@
 #include "stdafx.h"
+#include "map.h"
 #include "network_data.h"
 
 #if defined(WITH_REV)
--- a/oldloader.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/oldloader.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/order_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/order_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/pathfind.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/pathfind.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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.
--- a/players.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/players.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/rail_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/rail_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/rail_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/rail_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/road_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/road_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/road_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/road_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/roadveh_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/roadveh_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/roadveh_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/roadveh_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/ship_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/ship_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/ship_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/ship_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/smallmap_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/smallmap_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/sound.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/sound.c	Wed Dec 15 22:18:54 2004 +0000
@@ -1,5 +1,6 @@
 #include "stdafx.h"
 #include "ttd.h"
+#include "map.h"
 #include "sound.h"
 #include "vehicle.h"
 #include "window.h"
--- a/station_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/station_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/town_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/town_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/train_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/train_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/train_gui.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/train_gui.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/tree_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/tree_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/ttd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/ttd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -1,5 +1,6 @@
 #include "stdafx.h"
 #include "table/strings.h"
+#include "map.h"
 
 #define VARDEF
 #include "ttd.h"
--- a/tunnelbridge_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/tunnelbridge_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/unmovable_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/unmovable_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/variables.h	Wed Dec 15 22:06:47 2004 +0000
+++ b/variables.h	Wed Dec 15 22:18:54 2004 +0000
@@ -384,13 +384,6 @@
 
 /* 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,
--- a/vehicle.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/vehicle.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/viewport.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/viewport.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/water_cmd.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/water_cmd.c	Wed Dec 15 22:18:54 2004 +0000
@@ -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"
--- a/window.c	Wed Dec 15 22:06:47 2004 +0000
+++ b/window.c	Wed Dec 15 22:18:54 2004 +0000
@@ -1,5 +1,6 @@
 #include "stdafx.h"
 #include "ttd.h"
+#include "map.h"
 #include "window.h"
 #include "gfx.h"
 #include "viewport.h"