summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-12-25 23:42:52 +0000
committerrubidium <rubidium@openttd.org>2007-12-25 23:42:52 +0000
commitaac835171e2ef3b72e3706754153c1b9304268a8 (patch)
tree070c07001872a2ff901cc931aa615cd0c58aca13
parent6cb68b9144a3c0cd22b4fd3392c519a4217b2f72 (diff)
downloadopenttd-aac835171e2ef3b72e3706754153c1b9304268a8.tar.xz
(svn r11700) -Codechange: reduce the amount of unnecessary includes.
-rw-r--r--src/airport.h1
-rw-r--r--src/aystar.h1
-rw-r--r--src/bridge.h1
-rw-r--r--src/clear_cmd.cpp1
-rw-r--r--src/economy_func.h1
-rw-r--r--src/functions.h2
-rw-r--r--src/genworld.cpp1
-rw-r--r--src/gui.h4
-rw-r--r--src/industry.h2
-rw-r--r--src/landscape.h3
-rw-r--r--src/map.h11
-rw-r--r--src/news.h1
-rw-r--r--src/openttd.h22
-rw-r--r--src/order.h1
-rw-r--r--src/rail.h37
-rw-r--r--src/rail_map.h3
-rw-r--r--src/road_func.h1
-rw-r--r--src/road_internal.h2
-rw-r--r--src/screenshot.cpp1
-rw-r--r--src/signal_func.h40
-rw-r--r--src/slope_func.h1
-rw-r--r--src/sound.h1
-rw-r--r--src/station_map.h1
-rw-r--r--src/tile_cmd.h17
-rw-r--r--src/tile_type.h17
-rw-r--r--src/town.h1
-rw-r--r--src/variables.h2
-rw-r--r--src/vehicle.h1
-rw-r--r--src/viewport.h1
-rw-r--r--src/waypoint.cpp2
30 files changed, 106 insertions, 74 deletions
diff --git a/src/airport.h b/src/airport.h
index 756a03c89..f8f9e2bc4 100644
--- a/src/airport.h
+++ b/src/airport.h
@@ -6,6 +6,7 @@
#define AIRPORT_H
#include "direction_type.h"
+#include "map.h"
enum {MAX_TERMINALS = 10};
enum {MAX_HELIPADS = 4};
diff --git a/src/aystar.h b/src/aystar.h
index f25ac7604..e2b2d73e1 100644
--- a/src/aystar.h
+++ b/src/aystar.h
@@ -12,6 +12,7 @@
#define AYSTAR_H
#include "queue.h"
+#include "tile_type.h"
//#define AYSTAR_DEBUG
enum {
diff --git a/src/bridge.h b/src/bridge.h
index 628eb603e..23772c98e 100644
--- a/src/bridge.h
+++ b/src/bridge.h
@@ -6,6 +6,7 @@
#define BRIDGE_H
#include "gfx_type.h"
+#include "tile_cmd.h"
enum {
MAX_BRIDGES = 13
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp
index d1c3eb57b..a67490210 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -24,6 +24,7 @@
#include "tile_cmd.h"
#include "vehicle.h"
#include "functions.h"
+#include "economy_func.h"
/*
* In one terraforming command all four corners of a initial tile can be raised/lowered (though this is not available to the player).
diff --git a/src/economy_func.h b/src/economy_func.h
index 3eb927f9e..3a7ff2b33 100644
--- a/src/economy_func.h
+++ b/src/economy_func.h
@@ -9,6 +9,7 @@
#include "economy_type.h"
#include "cargo_type.h"
#include "vehicle_type.h"
+#include "tile_type.h"
struct Player;
diff --git a/src/functions.h b/src/functions.h
index 528f9fd85..361d6491a 100644
--- a/src/functions.h
+++ b/src/functions.h
@@ -8,6 +8,8 @@
#include "core/random_func.hpp"
#include "command_type.h"
#include "openttd.h"
+#include "tile_cmd.h"
+#include "map.h"
/* clear_land.cpp */
void DrawHillyLandTile(const TileInfo *ti);
diff --git a/src/genworld.cpp b/src/genworld.cpp
index dae486e8d..28fbdcfe5 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -19,6 +19,7 @@
#include "heightmap.h"
#include "date.h"
#include "viewport.h"
+#include "map.h"
void GenerateClearTile();
void GenerateIndustries();
diff --git a/src/gui.h b/src/gui.h
index 5736821e8..4d2a0cf70 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -9,6 +9,7 @@
#include "vehicle_type.h"
#include "gfx_type.h"
#include "economy_type.h"
+#include "tile_type.h"
/* main_gui.cpp */
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2);
@@ -52,10 +53,12 @@ void ShowTerraformToolbar(Window *link = NULL);
void ShowGenerateLandscape();
void ShowHeightmapLoad();
+typedef void PlaceProc(TileIndex tile);
void PlaceProc_DemolishArea(TileIndex tile);
void PlaceProc_LevelLand(TileIndex tile);
void PlaceProc_BuyLand(TileIndex tile);
bool GUIPlaceProcDragXY(const WindowEvent *e);
+VARDEF PlaceProc *_place_proc;
/** Drag and drop selection process, or, what to do with an area of land when
* you've selected it. */
@@ -121,7 +124,6 @@ void ShowMusicWindow();
/* main_gui.cpp */
void HandleOnEditText(const char *str);
VARDEF bool _station_show_coverage;
-VARDEF PlaceProc *_place_proc;
void InitializeGUI();
diff --git a/src/industry.h b/src/industry.h
index 46f14defc..8809b5ffe 100644
--- a/src/industry.h
+++ b/src/industry.h
@@ -10,6 +10,8 @@
#include "newgrf_storage.h"
#include "cargo_type.h"
#include "economy_type.h"
+#include "map.h"
+#include "slope_type.h"
typedef uint16 IndustryGfx;
typedef uint8 IndustryType;
diff --git a/src/landscape.h b/src/landscape.h
index 7df408753..130deb4b6 100644
--- a/src/landscape.h
+++ b/src/landscape.h
@@ -6,6 +6,9 @@
#define LANDSCAPE_H
#include "core/geometry_type.hpp"
+#include "tile_cmd.h"
+#include "slope_type.h"
+#include "direction_type.h"
enum {
SNOW_LINE_MONTHS = 12,
diff --git a/src/map.h b/src/map.h
index 2edbca31b..887f396eb 100644
--- a/src/map.h
+++ b/src/map.h
@@ -186,17 +186,6 @@ static inline TileIndex TileVirtXY(uint x, uint y)
}
-enum {
- INVALID_TILE = (TileIndex)-1 ///< The very nice invalid tile marker
-};
-
-enum {
- TILE_SIZE = 16, ///< Tiles are 16x16 "units" in size
- TILE_PIXELS = 32, ///< a tile is 32x32 pixels
- TILE_HEIGHT = 8, ///< The standard height-difference between tiles on two levels is 8 (z-diff 8)
-};
-
-
/**
* Get the X component of a tile
* @param tile the tile to get the X component of
diff --git a/src/news.h b/src/news.h
index b84da7600..23b84fa11 100644
--- a/src/news.h
+++ b/src/news.h
@@ -7,6 +7,7 @@
#include "window_type.h"
#include "vehicle_type.h"
+#include "tile_type.h"
struct NewsItem {
StringID string_id; ///< Message text (sometimes also used for storing other info)
diff --git a/src/openttd.h b/src/openttd.h
index a067f312d..c99b68d78 100644
--- a/src/openttd.h
+++ b/src/openttd.h
@@ -8,11 +8,9 @@
#define VARDEF extern
#endif
+#include "core/enum_type.hpp"
#include "strings_type.h"
-#include "map.h"
-#include "slope_type.h"
-
// Forward declarations of structs.
struct Depot;
struct Waypoint;
@@ -144,15 +142,6 @@ template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byt
typedef TinyEnumT<TransportType> TransportTypeByte;
-struct TileInfo {
- uint x;
- uint y;
- Slope tileh;
- TileIndex tile;
- uint z;
-};
-
-
/* Display Options */
enum {
DO_SHOW_TOWN_NAMES = 0,
@@ -216,21 +205,12 @@ struct GameDifficulty {
GDType town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
};
-struct TileDesc {
- StringID str;
- Owner owner;
- Date build_date;
- uint64 dparam[2];
-};
-
struct ViewportSign {
int32 left;
int32 top;
byte width_1, width_2;
};
-typedef void PlaceProc(TileIndex tile);
-
enum {
SORT_ASCENDING = 0,
SORT_DESCENDING = 1,
diff --git a/src/order.h b/src/order.h
index a6e091c77..65aee3961 100644
--- a/src/order.h
+++ b/src/order.h
@@ -9,6 +9,7 @@
#include "core/bitmath_func.hpp"
#include "cargo_type.h"
#include "vehicle_type.h"
+#include "tile_type.h"
enum {
INVALID_VEH_ORDER_ID = 0xFF,
diff --git a/src/rail.h b/src/rail.h
index 9975507fc..1f940e19d 100644
--- a/src/rail.h
+++ b/src/rail.h
@@ -12,6 +12,7 @@
#include "core/bitmath_func.hpp"
#include "economy_func.h"
#include "variables.h"
+#include "tile_cmd.h"
/** This struct contains all the info that is needed to draw and construct tracks.
*/
@@ -97,42 +98,6 @@ enum {
NUM_SSD_STACK = 32, ///< max amount of blocks to check recursively
};
-/*
- * Functions to map tracks to the corresponding bits in the signal
- * presence/status bytes in the map. You should not use these directly, but
- * wrapper functions below instead. XXX: Which are these?
- */
-
-/**
- * Maps a trackdir to the bit that stores its status in the map arrays, in the
- * direction along with the trackdir.
- */
-static inline byte SignalAlongTrackdir(Trackdir trackdir)
-{
- extern const byte _signal_along_trackdir[TRACKDIR_END];
- return _signal_along_trackdir[trackdir];
-}
-
-/**
- * Maps a trackdir to the bit that stores its status in the map arrays, in the
- * direction against the trackdir.
- */
-static inline byte SignalAgainstTrackdir(Trackdir trackdir)
-{
- extern const byte _signal_against_trackdir[TRACKDIR_END];
- return _signal_against_trackdir[trackdir];
-}
-
-/**
- * Maps a Track to the bits that store the status of the two signals that can
- * be present on the given track.
- */
-static inline byte SignalOnTrack(Track track)
-{
- extern const byte _signal_on_track[TRACK_END];
- return _signal_on_track[track];
-}
-
/**
diff --git a/src/rail_map.h b/src/rail_map.h
index 6472a5760..9b9bc16ef 100644
--- a/src/rail_map.h
+++ b/src/rail_map.h
@@ -5,9 +5,10 @@
#ifndef RAIL_MAP_H
#define RAIL_MAP_H
+#include "rail_type.h"
+#include "signal_func.h"
#include "direction_func.h"
#include "track_func.h"
-#include "rail.h"
#include "tile_map.h"
diff --git a/src/road_func.h b/src/road_func.h
index 0a730c31f..4bec22415 100644
--- a/src/road_func.h
+++ b/src/road_func.h
@@ -7,6 +7,7 @@
#include "core/bitmath_func.hpp"
#include "road_type.h"
+#include "direction_func.h"
/**
* Whether the given roadtype is valid.
diff --git a/src/road_internal.h b/src/road_internal.h
index 642e89b6e..0e0218a10 100644
--- a/src/road_internal.h
+++ b/src/road_internal.h
@@ -5,6 +5,8 @@
#ifndef ROAD_INTERNAL_H
#define ROAD_INTERNAL_H
+#include "tile_cmd.h"
+
/**
* Clean up unneccesary RoadBits of a planed tile.
* @param tile current tile
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index d81135a18..e3d6f3911 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -17,6 +17,7 @@
#include "zoom_func.h"
#include "core/alloc_func.hpp"
#include "core/endian_func.hpp"
+#include "map.h"
char _screenshot_format_name[8];
uint _num_screenshot_formats;
diff --git a/src/signal_func.h b/src/signal_func.h
new file mode 100644
index 000000000..1dff79429
--- /dev/null
+++ b/src/signal_func.h
@@ -0,0 +1,40 @@
+/* $Id$ */
+
+/** @file signal_func.h Functions related to signals. */
+
+#ifndef SIGNAL_FUNC_H
+#define SIGNAL_FUNC_H
+
+#include "track_type.h"
+
+/**
+ * Maps a trackdir to the bit that stores its status in the map arrays, in the
+ * direction along with the trackdir.
+ */
+static inline byte SignalAlongTrackdir(Trackdir trackdir)
+{
+ extern const byte _signal_along_trackdir[TRACKDIR_END];
+ return _signal_along_trackdir[trackdir];
+}
+
+/**
+ * Maps a trackdir to the bit that stores its status in the map arrays, in the
+ * direction against the trackdir.
+ */
+static inline byte SignalAgainstTrackdir(Trackdir trackdir)
+{
+ extern const byte _signal_against_trackdir[TRACKDIR_END];
+ return _signal_against_trackdir[trackdir];
+}
+
+/**
+ * Maps a Track to the bits that store the status of the two signals that can
+ * be present on the given track.
+ */
+static inline byte SignalOnTrack(Track track)
+{
+ extern const byte _signal_on_track[TRACK_END];
+ return _signal_on_track[track];
+}
+
+#endif /* SIGNAL_FUNC_H */
diff --git a/src/slope_func.h b/src/slope_func.h
index 507650552..d457292df 100644
--- a/src/slope_func.h
+++ b/src/slope_func.h
@@ -8,6 +8,7 @@
#include "core/math_func.hpp"
#include "slope_type.h"
#include "direction_type.h"
+#include "tile_type.h"
/**
* Rangecheck for Corner enumeration.
diff --git a/src/sound.h b/src/sound.h
index fa4c987bd..0912430d6 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -7,6 +7,7 @@
#include "core/enum_type.hpp"
#include "vehicle_type.h"
+#include "tile_type.h"
struct MusicFileSettings {
byte playlist;
diff --git a/src/station_map.h b/src/station_map.h
index 4c72d1dad..e6500d377 100644
--- a/src/station_map.h
+++ b/src/station_map.h
@@ -8,6 +8,7 @@
#include "rail_map.h"
#include "road_map.h"
#include "station.h"
+#include "rail.h"
typedef byte StationGfx;
diff --git a/src/tile_cmd.h b/src/tile_cmd.h
index 60f8940ce..4b08e9c5b 100644
--- a/src/tile_cmd.h
+++ b/src/tile_cmd.h
@@ -6,9 +6,11 @@
#define TILE_CMD_H
#include "slope_type.h"
+#include "tile_type.h"
#include "command_type.h"
#include "vehicle_type.h"
#include "cargo_type.h"
+#include "strings_type.h"
/** The returned bits of VehicleEnterTile. */
enum VehicleEnterTileStatus {
@@ -31,6 +33,21 @@ enum VehicleEnterTileStatus {
};
DECLARE_ENUM_AS_BIT_SET(VehicleEnterTileStatus);
+struct TileInfo {
+ uint x;
+ uint y;
+ Slope tileh;
+ TileIndex tile;
+ uint z;
+};
+
+struct TileDesc {
+ StringID str;
+ Owner owner;
+ Date build_date;
+ uint64 dparam[2];
+};
+
typedef void DrawTileProc(TileInfo *ti);
typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
typedef CommandCost ClearTileProc(TileIndex tile, byte flags);
diff --git a/src/tile_type.h b/src/tile_type.h
index 4c4f2a9c8..e954aa1fb 100644
--- a/src/tile_type.h
+++ b/src/tile_type.h
@@ -7,11 +7,15 @@
#include "core/enum_type.hpp"
-/** Maximum allowed tile height */
-#define MAX_TILE_HEIGHT 15
+enum {
+ TILE_SIZE = 16, ///< Tiles are 16x16 "units" in size
+ TILE_PIXELS = 32, ///< a tile is 32x32 pixels
+ TILE_HEIGHT = 8, ///< The standard height-difference between tiles on two levels is 8 (z-diff 8)
+
+ MAX_TILE_HEIGHT = 15, ///< Maximum allowed tile height
+ MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2), ///< Maximum allowed snowline height
+};
-/** Maximum allowed snowline height */
-#define MAX_SNOWLINE_HEIGHT (MAX_TILE_HEIGHT - 2)
/**
* The different type of a tile.
@@ -51,4 +55,9 @@ enum TropicZone {
*/
typedef uint32 TileIndex;
+/**
+ * The very nice invalid tile marker
+ */
+static const TileIndex INVALID_TILE = (TileIndex)-1;
+
#endif /* TILE_TYPE_H */
diff --git a/src/town.h b/src/town.h
index 731e45b94..9487c3422 100644
--- a/src/town.h
+++ b/src/town.h
@@ -8,6 +8,7 @@
#include "oldpool.h"
#include "core/random_func.hpp"
#include "cargo_type.h"
+#include "tile_type.h"
enum {
HOUSE_NO_CLASS = 0,
diff --git a/src/variables.h b/src/variables.h
index 079c01c1c..b47f7b192 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -7,6 +7,8 @@
#include "yapf/yapf_settings.h"
#include "openttd.h"
+#include "tile_type.h"
+#include "strings_type.h"
/* ********* START OF SAVE REGION */
diff --git a/src/vehicle.h b/src/vehicle.h
index d8735aaf4..68bf71bb1 100644
--- a/src/vehicle.h
+++ b/src/vehicle.h
@@ -10,6 +10,7 @@
#include "rail_type.h"
#include "road_type.h"
#include "cargo_type.h"
+#include "direction_type.h"
#include "window_type.h"
#include "gfx_type.h"
#include "command_type.h"
diff --git a/src/viewport.h b/src/viewport.h
index 32b0c50be..11c8f992e 100644
--- a/src/viewport.h
+++ b/src/viewport.h
@@ -9,6 +9,7 @@
#include "window_type.h"
#include "vehicle_type.h"
#include "gfx_func.h"
+#include "gui.h"
struct ViewPort {
int left,top; // screen coordinates for the viewport
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index f9b21b47f..f98489e8a 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -10,6 +10,7 @@
#include "map.h"
#include "order.h"
#include "rail_map.h"
+#include "rail.h"
#include "bridge_map.h"
#include "saveload.h"
#include "station.h"
@@ -27,6 +28,7 @@
#include "viewport.h"
#include "functions.h"
#include "window_func.h"
+#include "economy_func.h"
enum {
MAX_WAYPOINTS_PER_TOWN = 64,