From aac835171e2ef3b72e3706754153c1b9304268a8 Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 25 Dec 2007 23:42:52 +0000 Subject: [PATCH] (svn r11700) -Codechange: reduce the amount of unnecessary includes. --- src/airport.h | 1 + src/aystar.h | 1 + src/bridge.h | 1 + src/clear_cmd.cpp | 1 + src/economy_func.h | 1 + src/functions.h | 2 ++ src/genworld.cpp | 1 + src/gui.h | 4 +++- src/industry.h | 2 ++ src/landscape.h | 3 +++ src/map.h | 11 ----------- src/news.h | 1 + src/openttd.h | 22 +--------------------- src/order.h | 1 + src/rail.h | 37 +------------------------------------ src/rail_map.h | 3 ++- src/road_func.h | 1 + src/road_internal.h | 2 ++ src/screenshot.cpp | 1 + src/signal_func.h | 40 ++++++++++++++++++++++++++++++++++++++++ src/slope_func.h | 1 + src/sound.h | 1 + src/station_map.h | 1 + src/tile_cmd.h | 17 +++++++++++++++++ src/tile_type.h | 17 +++++++++++++---- src/town.h | 1 + src/variables.h | 2 ++ src/vehicle.h | 1 + src/viewport.h | 1 + src/waypoint.cpp | 2 ++ 30 files changed, 106 insertions(+), 74 deletions(-) create mode 100644 src/signal_func.h diff --git a/src/airport.h b/src/airport.h index 756a03c895..f8f9e2bc4a 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 f25ac76041..e2b2d73e18 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 628eb603e0..23772c98ec 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 d1c3eb57b9..a67490210e 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 3eb927f9e1..3a7ff2b33c 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 528f9fd854..361d6491ac 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 dae486e8d2..28fbdcfe50 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 5736821e8b..4d2a0cf704 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 46f14defc0..8809b5ffe1 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 7df408753a..130deb4b61 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 2edbca31bb..887f396eb6 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 b84da76007..23b84fa119 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 a067f312d5..c99b68d78b 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 : MakeEnumPropsT 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 a6e091c779..65aee39617 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 9975507fc8..1f940e19d8 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 6472a5760a..9b9bc16ef4 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 0a730c31fb..4bec224150 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 642e89b6e3..0e0218a105 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 d81135a18a..e3d6f3911c 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 0000000000..1dff794298 --- /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 507650552e..d457292df9 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 fa4c987bd7..0912430d6e 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 4c72d1dadf..e6500d3772 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 60f8940cea..4b08e9c5ba 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 4c4f2a9c8f..e954aa1fb6 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 731e45b94c..9487c34225 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 079c01c1c2..b47f7b1927 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 d8735aaf45..68bf71bb1b 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 32b0c50be0..11c8f992e3 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 f9b21b47f1..f98489e8a7 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,