Mercurial > hg > openttd
changeset 8138:60ea0f95de91 draft
(svn r11700) -Codechange: reduce the amount of unnecessary includes.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 25 Dec 2007 23:42:52 +0000 |
parents | 2c8eed98b2d2 |
children | db99ba38abc0 |
files | src/airport.h src/aystar.h src/bridge.h src/clear_cmd.cpp src/economy_func.h src/functions.h src/genworld.cpp src/gui.h src/industry.h src/landscape.h src/map.h src/news.h src/openttd.h src/order.h src/rail.h src/rail_map.h src/road_func.h src/road_internal.h src/screenshot.cpp src/signal_func.h src/slope_func.h src/sound.h src/station_map.h src/tile_cmd.h src/tile_type.h src/town.h src/variables.h src/vehicle.h src/viewport.h src/waypoint.cpp |
diffstat | 30 files changed, 106 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- 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};
--- 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 {
--- 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
--- 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).
--- 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;
--- 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);
--- 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();
--- 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 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();
--- 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;
--- 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,
--- a/src/map.h +++ b/src/map.h @@ -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
--- 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)
--- 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 @@ 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 @@ 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,
--- 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,
--- 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 @@ 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]; -} - /**
--- 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"
--- 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.
--- 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
--- 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;
new file mode 100644 --- /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 */
--- 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.
--- 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;
--- 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;
--- 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 @@ }; 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);
--- 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) -/** 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 */
--- 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,
--- 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 */
--- 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"
--- 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
--- 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,