# HG changeset patch # User rubidium # Date 1198626172 0 # Node ID dbfdc08fa6b93ddb985a5bad894eae188ee093f8 # Parent 8233ffd0f1ab105315371c284d2e703ad55294c7 (svn r11700) -Codechange: reduce the amount of unnecessary includes. diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/airport.h --- a/src/airport.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/airport.h Tue Dec 25 23:42:52 2007 +0000 @@ -6,6 +6,7 @@ #define AIRPORT_H #include "direction_type.h" +#include "map.h" enum {MAX_TERMINALS = 10}; enum {MAX_HELIPADS = 4}; diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/aystar.h --- a/src/aystar.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/aystar.h Tue Dec 25 23:42:52 2007 +0000 @@ -12,6 +12,7 @@ #define AYSTAR_H #include "queue.h" +#include "tile_type.h" //#define AYSTAR_DEBUG enum { diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/bridge.h --- a/src/bridge.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/bridge.h Tue Dec 25 23:42:52 2007 +0000 @@ -6,6 +6,7 @@ #define BRIDGE_H #include "gfx_type.h" +#include "tile_cmd.h" enum { MAX_BRIDGES = 13 diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/clear_cmd.cpp --- a/src/clear_cmd.cpp Tue Dec 25 18:25:25 2007 +0000 +++ b/src/clear_cmd.cpp Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/economy_func.h --- a/src/economy_func.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/economy_func.h Tue Dec 25 23:42:52 2007 +0000 @@ -9,6 +9,7 @@ #include "economy_type.h" #include "cargo_type.h" #include "vehicle_type.h" +#include "tile_type.h" struct Player; diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/functions.h --- a/src/functions.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/functions.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/genworld.cpp --- a/src/genworld.cpp Tue Dec 25 18:25:25 2007 +0000 +++ b/src/genworld.cpp Tue Dec 25 23:42:52 2007 +0000 @@ -19,6 +19,7 @@ #include "heightmap.h" #include "date.h" #include "viewport.h" +#include "map.h" void GenerateClearTile(); void GenerateIndustries(); diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/gui.h --- a/src/gui.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/gui.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 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 @@ /* main_gui.cpp */ void HandleOnEditText(const char *str); VARDEF bool _station_show_coverage; -VARDEF PlaceProc *_place_proc; void InitializeGUI(); diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/industry.h --- a/src/industry.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/industry.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/landscape.h --- a/src/landscape.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/landscape.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/map.h --- a/src/map.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/map.h Tue Dec 25 23:42:52 2007 +0000 @@ -186,17 +186,6 @@ } -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/news.h --- a/src/news.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/news.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/openttd.h --- a/src/openttd.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/openttd.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 @@ typedef TinyEnumT 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 @@ 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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/order.h --- a/src/order.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/order.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/rail.h --- a/src/rail.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/rail.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 @@ 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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/rail_map.h --- a/src/rail_map.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/rail_map.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/road_func.h --- a/src/road_func.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/road_func.h Tue Dec 25 23:42:52 2007 +0000 @@ -7,6 +7,7 @@ #include "core/bitmath_func.hpp" #include "road_type.h" +#include "direction_func.h" /** * Whether the given roadtype is valid. diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/road_internal.h --- a/src/road_internal.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/road_internal.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/screenshot.cpp --- a/src/screenshot.cpp Tue Dec 25 18:25:25 2007 +0000 +++ b/src/screenshot.cpp Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/signal_func.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/signal_func.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/slope_func.h --- a/src/slope_func.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/slope_func.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/sound.h --- a/src/sound.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/sound.h Tue Dec 25 23:42:52 2007 +0000 @@ -7,6 +7,7 @@ #include "core/enum_type.hpp" #include "vehicle_type.h" +#include "tile_type.h" struct MusicFileSettings { byte playlist; diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/station_map.h --- a/src/station_map.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/station_map.h Tue Dec 25 23:42:52 2007 +0000 @@ -8,6 +8,7 @@ #include "rail_map.h" #include "road_map.h" #include "station.h" +#include "rail.h" typedef byte StationGfx; diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/tile_cmd.h --- a/src/tile_cmd.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/tile_cmd.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 @@ }; 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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/tile_type.h --- a/src/tile_type.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/tile_type.h Tue Dec 25 23:42:52 2007 +0000 @@ -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) -/** Maximum allowed snowline height */ -#define MAX_SNOWLINE_HEIGHT (MAX_TILE_HEIGHT - 2) + MAX_TILE_HEIGHT = 15, ///< Maximum allowed tile height + MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2), ///< Maximum allowed snowline height +}; + /** * The different type of a tile. @@ -51,4 +55,9 @@ */ typedef uint32 TileIndex; +/** + * The very nice invalid tile marker + */ +static const TileIndex INVALID_TILE = (TileIndex)-1; + #endif /* TILE_TYPE_H */ diff -r 8233ffd0f1ab -r dbfdc08fa6b9 src/town.h --- a/src/town.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/town.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/variables.h --- a/src/variables.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/variables.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/vehicle.h --- a/src/vehicle.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/vehicle.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/viewport.h --- a/src/viewport.h Tue Dec 25 18:25:25 2007 +0000 +++ b/src/viewport.h Tue Dec 25 23:42:52 2007 +0000 @@ -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 -r 8233ffd0f1ab -r dbfdc08fa6b9 src/waypoint.cpp --- a/src/waypoint.cpp Tue Dec 25 18:25:25 2007 +0000 +++ b/src/waypoint.cpp Tue Dec 25 23:42:52 2007 +0000 @@ -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,