From 7ccda80b0bae730f17d6863df84e78ea455ff1db Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 7 May 2008 09:07:19 +0000 Subject: [PATCH] (svn r12986) -Codechange: move the landscape and transport related types from openttd.h to their own headers. --- projects/openttd_vs80.vcproj | 8 ++++++++ projects/openttd_vs90.vcproj | 8 ++++++++ source.list | 2 ++ src/bridge_map.h | 2 +- src/cargotype.h | 1 + src/genworld_gui.cpp | 1 + src/gfx.cpp | 1 + src/gui.h | 1 + src/industry.h | 1 + src/landscape.cpp | 1 + src/landscape_type.h | 20 ++++++++++++++++++++ src/network/network.cpp | 1 + src/npf.h | 1 + src/openttd.h | 30 ------------------------------ src/settings_type.h | 1 + src/terraform_gui.cpp | 1 + src/tgp.cpp | 1 + src/tile_cmd.h | 2 +- src/transport_type.h | 26 ++++++++++++++++++++++++++ src/tree_cmd.cpp | 1 + src/tunnel_map.h | 1 + src/tunnelbridge_cmd.cpp | 1 + src/tunnelbridge_map.h | 1 + src/unmovable_cmd.cpp | 1 + src/vehicle_base.h | 1 + src/vehicle_func.h | 1 + 26 files changed, 84 insertions(+), 32 deletions(-) create mode 100644 src/landscape_type.h create mode 100644 src/transport_type.h diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj index 401c10587a..35e17291dd 100644 --- a/projects/openttd_vs80.vcproj +++ b/projects/openttd_vs80.vcproj @@ -1075,6 +1075,10 @@ RelativePath=".\..\src\landscape.h" > + + @@ -1527,6 +1531,10 @@ RelativePath=".\..\src\transparency_gui.h" > + + diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj index d9b070cf0a..42a2292f5b 100644 --- a/projects/openttd_vs90.vcproj +++ b/projects/openttd_vs90.vcproj @@ -1072,6 +1072,10 @@ RelativePath=".\..\src\landscape.h" > + + @@ -1524,6 +1528,10 @@ RelativePath=".\..\src\transparency_gui.h" > + + diff --git a/source.list b/source.list index 65fbb0b09e..79d112e44c 100644 --- a/source.list +++ b/source.list @@ -194,6 +194,7 @@ heightmap.h industry.h industry_type.h landscape.h +landscape_type.h livery.h lzoconf.h map_func.h @@ -307,6 +308,7 @@ track_type.h train.h transparency.h transparency_gui.h +transport_type.h ai/trolly/trolly.h tunnelbridge.h unmovable.h diff --git a/src/bridge_map.h b/src/bridge_map.h index a4f4f1e4df..fd82fbdabc 100644 --- a/src/bridge_map.h +++ b/src/bridge_map.h @@ -7,10 +7,10 @@ #include "direction_func.h" #include "rail_type.h" +#include "transport_type.h" #include "road_map.h" #include "bridge.h" - /** * Checks if this is a bridge, instead of a tunnel * @param t The tile to analyze diff --git a/src/cargotype.h b/src/cargotype.h index a117fd6130..e8498cc725 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -8,6 +8,7 @@ #include "cargo_type.h" #include "gfx_type.h" #include "strings_type.h" +#include "landscape_type.h" typedef uint32 CargoLabel; diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 824e572ee0..01fc43d31b 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -28,6 +28,7 @@ #include "widgets/dropdown_type.h" #include "widgets/dropdown_func.h" #include "core/random_func.hpp" +#include "landscape_type.h" #include "table/strings.h" #include "table/sprites.h" diff --git a/src/gfx.cpp b/src/gfx.cpp index acfaa907c2..a59bf568bc 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -18,6 +18,7 @@ #include "core/math_func.hpp" #include "settings_type.h" #include "core/alloc_func.hpp" +#include "landscape_type.h" #include "table/palettes.h" #include "table/sprites.h" diff --git a/src/gui.h b/src/gui.h index fcaad3d3cc..9e1bddf769 100644 --- a/src/gui.h +++ b/src/gui.h @@ -11,6 +11,7 @@ #include "economy_type.h" #include "tile_type.h" #include "strings_type.h" +#include "transport_type.h" /* main_gui.cpp */ void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2); diff --git a/src/industry.h b/src/industry.h index 142f164fe3..246c87c7c9 100644 --- a/src/industry.h +++ b/src/industry.h @@ -15,6 +15,7 @@ #include "date_type.h" #include "town_type.h" #include "industry_type.h" +#include "landscape_type.h" enum { INVALID_INDUSTRY = 0xFFFF, diff --git a/src/landscape.cpp b/src/landscape.cpp index 3cbdaee98f..3439a18257 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -27,6 +27,7 @@ #include "settings_type.h" #include "water.h" #include "effectvehicle_func.h" +#include "landscape_type.h" #include "table/sprites.h" diff --git a/src/landscape_type.h b/src/landscape_type.h new file mode 100644 index 0000000000..eb6b9e7a67 --- /dev/null +++ b/src/landscape_type.h @@ -0,0 +1,20 @@ +/* $Id$ */ + +/** @file landscape_type.h Types related to the landscape. */ + +#ifndef LANDSCAPE_TYPE_H +#define LANDSCAPE_TYPE_H + +typedef byte LandscapeID; + +/* Landscape types */ +enum { + LT_TEMPERATE = 0, + LT_ARCTIC = 1, + LT_TROPIC = 2, + LT_TOYLAND = 3, + + NUM_LANDSCAPE = 4, +}; + +#endif /* LANDSCAPE_TYPE_H */ diff --git a/src/network/network.cpp b/src/network/network.cpp index 9d596ae5ba..30a0cc957b 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -33,6 +33,7 @@ #include "../string_func.h" #include "../player_func.h" #include "../settings_type.h" +#include "../landscape_type.h" #include "../rev.h" #ifdef DEBUG_DUMP_COMMANDS #include "../core/alloc_func.hpp" diff --git a/src/npf.h b/src/npf.h index 36a444b4fd..5a70b6be04 100644 --- a/src/npf.h +++ b/src/npf.h @@ -13,6 +13,7 @@ #include "tile_type.h" #include "track_type.h" #include "core/bitmath_func.hpp" +#include "transport_type.h" /* mowing grass */ enum { diff --git a/src/openttd.h b/src/openttd.h index 3265bfb0cd..de17ccd5d1 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -9,10 +9,6 @@ #define VARDEF extern #endif -// Forward declarations of structs. -typedef byte LandscapeID; -typedef uint16 UnitID; - enum GameModes { GM_MENU, GM_NORMAL, @@ -48,22 +44,6 @@ enum InitializeGameModes { IG_DATE_RESET = 1, /* Reset the date when initializing a game */ }; -enum TransportType { - /* These constants are for now linked to the representation of bridges - * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge. - * In an ideal world, these constants would be used everywhere when - * accessing tunnels and bridges. For now, you should just not change - * the values for road and rail. - */ - TRANSPORT_BEGIN = 0, - TRANSPORT_RAIL = TRANSPORT_BEGIN, - TRANSPORT_ROAD, - TRANSPORT_WATER, - TRANSPORT_AIR, - TRANSPORT_END, - INVALID_TRANSPORT = 0xff, -}; - /* Display Options */ enum { DO_SHOW_TOWN_NAMES = 0, @@ -74,16 +54,6 @@ enum { DO_WAYPOINTS = 6, }; -/* Landscape types */ -enum { - LT_TEMPERATE = 0, - LT_ARCTIC = 1, - LT_TROPIC = 2, - LT_TOYLAND = 3, - - NUM_LANDSCAPE = 4, -}; - struct ViewportSign { int32 left; int32 top; diff --git a/src/settings_type.h b/src/settings_type.h index 46e6f6b39c..c5a74d359b 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -8,6 +8,7 @@ #include "yapf/yapf_settings.h" #include "date_type.h" #include "town_type.h" +#include "transport_type.h" #define GAME_DIFFICULTY_NUM 18 diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 2c0def89d8..969e21e1ad 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -23,6 +23,7 @@ #include "genworld.h" #include "settings_type.h" #include "tree_map.h" +#include "landscape_type.h" #include "table/sprites.h" #include "table/strings.h" diff --git a/src/tgp.cpp b/src/tgp.cpp index c5d4f41017..28169b4559 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -15,6 +15,7 @@ #include "core/alloc_func.hpp" #include "core/random_func.hpp" #include "settings_type.h" +#include "landscape_type.h" #include "table/strings.h" diff --git a/src/tile_cmd.h b/src/tile_cmd.h index 08a363b92e..ce68f987c0 100644 --- a/src/tile_cmd.h +++ b/src/tile_cmd.h @@ -15,7 +15,7 @@ #include "player_type.h" #include "direction_type.h" #include "track_type.h" -#include "openttd.h" +#include "transport_type.h" /** The returned bits of VehicleEnterTile. */ enum VehicleEnterTileStatus { diff --git a/src/transport_type.h b/src/transport_type.h new file mode 100644 index 0000000000..c23afbd7c0 --- /dev/null +++ b/src/transport_type.h @@ -0,0 +1,26 @@ +/* $Id$ */ + +/** @file transport_type.h Base types related to transport. */ + +#ifndef TRANSPORT_TYPE_H +#define TRANSPORT_TYPE_H + +typedef uint16 UnitID; + +enum TransportType { + /* These constants are for now linked to the representation of bridges + * and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge. + * In an ideal world, these constants would be used everywhere when + * accessing tunnels and bridges. For now, you should just not change + * the values for road and rail. + */ + TRANSPORT_BEGIN = 0, + TRANSPORT_RAIL = TRANSPORT_BEGIN, + TRANSPORT_ROAD, + TRANSPORT_WATER, + TRANSPORT_AIR, + TRANSPORT_END, + INVALID_TRANSPORT = 0xff, +}; + +#endif /* TRANSPORT_TYPE_H */ diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index 0c7c8e9e07..f2cd302b5d 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -22,6 +22,7 @@ #include "settings_type.h" #include "water_map.h" #include "water.h" +#include "landscape_type.h" #include "table/strings.h" #include "table/sprites.h" diff --git a/src/tunnel_map.h b/src/tunnel_map.h index c3362765b1..87abbea3c6 100644 --- a/src/tunnel_map.h +++ b/src/tunnel_map.h @@ -8,6 +8,7 @@ #include "direction_func.h" #include "rail_type.h" #include "road_type.h" +#include "transport_type.h" #include "tile_map.h" diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index e6499e9bce..a95c3bfbc4 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -39,6 +39,7 @@ #include "economy_func.h" #include "rail.h" #include "cheat_func.h" +#include "landscape_type.h" #include "table/sprites.h" #include "table/strings.h" diff --git a/src/tunnelbridge_map.h b/src/tunnelbridge_map.h index e5c94a6c0f..bdc709944c 100644 --- a/src/tunnelbridge_map.h +++ b/src/tunnelbridge_map.h @@ -10,6 +10,7 @@ #include "tile_map.h" #include "bridge_map.h" #include "tunnel_map.h" +#include "transport_type.h" /** diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp index 32a368f2b6..b949736f38 100644 --- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -27,6 +27,7 @@ #include "station_type.h" #include "economy_func.h" #include "cheat_func.h" +#include "landscape_type.h" #include "table/strings.h" #include "table/sprites.h" diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 83b1ee2c10..8948901692 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -23,6 +23,7 @@ #include "group_type.h" #include "engine_type.h" #include "order_func.h" +#include "transport_type.h" /** Road vehicle states */ enum RoadVehicleStates { diff --git a/src/vehicle_func.h b/src/vehicle_func.h index 371adc1c73..61ddc7e514 100644 --- a/src/vehicle_func.h +++ b/src/vehicle_func.h @@ -13,6 +13,7 @@ #include "command_type.h" #include "vehicle_type.h" #include "engine_type.h" +#include "transport_type.h" #define is_custom_sprite(x) (x >= 0xFD) #define IS_CUSTOM_FIRSTHEAD_SPRITE(x) (x == 0xFD)