summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-07 14:02:26 +0000
committerrubidium <rubidium@openttd.org>2008-01-07 14:02:26 +0000
commit38115acf5adbcf66643d1f96e30b9abc6dec15a3 (patch)
treeda6be8b1f4ec1cdb8a848d1ab9915d7dddf2ff8b
parenta8a3a7e3f277c205900f5dde7441e612cd0114a8 (diff)
downloadopenttd-38115acf5adbcf66643d1f96e30b9abc6dec15a3.tar.xz
(svn r11776) -Codechange: more header splittings to reduce the dependencies.
-rw-r--r--src/clear_map.h1
-rw-r--r--src/economy_func.h2
-rw-r--r--src/gfxinit.cpp1
-rw-r--r--src/industry.h13
-rw-r--r--src/industry_type.h16
-rw-r--r--src/network/network_gui.cpp1
-rw-r--r--src/newgrf.h4
-rw-r--r--src/newgrf_config.cpp1
-rw-r--r--src/newgrf_engine.cpp1
-rw-r--r--src/newgrf_gui.cpp1
-rw-r--r--src/newgrf_house.h2
-rw-r--r--src/newgrf_industries.cpp1
-rw-r--r--src/newgrf_industries.h9
-rw-r--r--src/newgrf_industrytiles.cpp1
-rw-r--r--src/newgrf_spritegroup.h4
-rw-r--r--src/newgrf_text.cpp2
-rw-r--r--src/openttd.h22
-rw-r--r--src/road_map.h1
-rw-r--r--src/settings.cpp1
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/settings_type.h1
-rw-r--r--src/station.h1
-rw-r--r--src/town.h47
-rw-r--r--src/town_type.h77
-rw-r--r--src/vehicle_gui.cpp1
25 files changed, 127 insertions, 85 deletions
diff --git a/src/clear_map.h b/src/clear_map.h
index c4cb6df96..98fd12034 100644
--- a/src/clear_map.h
+++ b/src/clear_map.h
@@ -6,6 +6,7 @@
#define CLEAR_MAP_H
#include "bridge_map.h"
+#include "industry_type.h"
/**
* Ground types. Valid densities in comments after the enum.
diff --git a/src/economy_func.h b/src/economy_func.h
index 3a7ff2b33..af65dcd11 100644
--- a/src/economy_func.h
+++ b/src/economy_func.h
@@ -10,6 +10,8 @@
#include "cargo_type.h"
#include "vehicle_type.h"
#include "tile_type.h"
+#include "town_type.h"
+#include "industry_type.h"
struct Player;
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index d5f54c442..38588dfa2 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -16,6 +16,7 @@
#include "variables.h"
#include "fontcache.h"
#include "gfx_func.h"
+#include "core/alloc_func.hpp"
#include <string.h>
struct MD5File {
diff --git a/src/industry.h b/src/industry.h
index 4e6dcb95d..8916dae24 100644
--- a/src/industry.h
+++ b/src/industry.h
@@ -13,9 +13,8 @@
#include "map_type.h"
#include "slope_type.h"
#include "date_type.h"
-
-typedef uint16 IndustryGfx;
-typedef uint8 IndustryType;
+#include "town_type.h"
+#include "industry_type.h"
enum {
INVALID_INDUSTRY = 0xFFFF,
@@ -64,13 +63,6 @@ enum IndustryConstructionType {
ICT_SCENARIO_EDITOR ///< while scenarion edition
};
-/** From where is callback CBID_INDUSTRY_AVAILABLE been called */
-enum IndustryAvailabilityCallType {
- IACT_MAPGENERATION, ///< during random map generation
- IACT_RANDOMCREATION, ///< during creation of random ingame industry
- IACT_USERCREATION, ///< from the Fund/build window
-};
-
enum IndustryBehaviour {
INDUSTRYBEH_NONE = 0,
INDUSTRYBEH_PLANT_FIELDS = 1 << 0, ///< periodically plants fileds around itself (temp and artic farms)
@@ -97,7 +89,6 @@ enum IndustryBehaviour {
DECLARE_ENUM_AS_BIT_SET(IndustryBehaviour);
-struct Industry;
DECLARE_OLD_POOL(Industry, Industry, 3, 8000)
/**
diff --git a/src/industry_type.h b/src/industry_type.h
new file mode 100644
index 000000000..dab974017
--- /dev/null
+++ b/src/industry_type.h
@@ -0,0 +1,16 @@
+/* $Id$ */
+
+/** @file industry_type.h Types related to the industry. */
+
+#ifndef INDUSTRY_TYPE_H
+#define INDUSTRY_TYPE_H
+
+typedef uint16 IndustryID;
+typedef uint16 IndustryGfx;
+typedef uint8 IndustryType;
+struct Industry;
+
+struct IndustrySpec;
+struct IndustryTileSpec;
+
+#endif /* INDUSTRY_TYPE_H */
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index b0e286cfd..7b13a6572 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -26,6 +26,7 @@
#include "../newgrf.h"
#include "../functions.h"
#include "../window_func.h"
+#include "../core/alloc_func.hpp"
#define BGC 5
#define BTC 15
diff --git a/src/newgrf.h b/src/newgrf.h
index 687d8aa3f..a0aa19172 100644
--- a/src/newgrf.h
+++ b/src/newgrf.h
@@ -6,10 +6,10 @@
#define NEWGRF_H
#include "station.h"
-#include "town.h"
+#include "town_type.h"
#include "newgrf_config.h"
#include "cargotype.h"
-#include "industry.h"
+#include "industry_type.h"
enum GrfLoadingStage {
GLS_FILESCAN,
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 63d314adb..22427a29f 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -12,6 +12,7 @@
#include "network/network_data.h"
#include "newgrf.h"
#include "newgrf_config.h"
+#include "core/alloc_func.hpp"
#include "fileio.h"
#include "fios.h"
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index b0ab246e9..cb7b84c11 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -20,6 +20,7 @@
#include "cargotype.h"
#include "date_func.h"
#include "vehicle_func.h"
+#include "core/random_func.hpp"
int _traininfo_vehicle_pitch = 0;
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index cf068b347..3fc2de622 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -14,6 +14,7 @@
#include "newgrf_config.h"
#include "strings_func.h"
#include "window_func.h"
+#include "core/alloc_func.hpp"
/** Parse an integerlist string and set each found value
* @param p the string to be parsed. Each element in the list is seperated by a
diff --git a/src/newgrf_house.h b/src/newgrf_house.h
index 27a5672fa..ffee181d5 100644
--- a/src/newgrf_house.h
+++ b/src/newgrf_house.h
@@ -5,7 +5,7 @@
#ifndef NEWGRF_HOUSE_H
#define NEWGRF_HOUSE_H
-#include "town.h"
+#include "town_type.h"
#include "newgrf_callbacks.h"
/**
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 45e481988..84e5af8f2 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -19,6 +19,7 @@
#include "newgrf_text.h"
#include "newgrf_town.h"
#include "window_func.h"
+#include "town.h"
/* Since the industry IDs defined by the GRF file don't necessarily correlate
* to those used by the game, the IDs used for overriding old industries must be
diff --git a/src/newgrf_industries.h b/src/newgrf_industries.h
index f348ee8bc..e98c037b4 100644
--- a/src/newgrf_industries.h
+++ b/src/newgrf_industries.h
@@ -5,7 +5,7 @@
#ifndef NEWGRF_INDUSTRIES_H
#define NEWGRF_INDUSTRIES_H
-#include "industry.h"
+#include "industry_type.h"
#include "newgrf_spritegroup.h"
/** When should the industry(tile) be triggered for random bits? */
@@ -18,6 +18,13 @@ enum IndustryTrigger {
INDUSTRY_TRIGGER_CARGO_DELIVERY = 4,
};
+/** From where is callback CBID_INDUSTRY_AVAILABLE been called */
+enum IndustryAvailabilityCallType {
+ IACT_MAPGENERATION, ///< during random map generation
+ IACT_RANDOMCREATION, ///< during creation of random ingame industry
+ IACT_USERCREATION, ///< from the Fund/build window
+};
+
/* in newgrf_industry.cpp */
uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available);
uint16 GetIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile);
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index da8d3faab..9ebae2fcf 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -23,6 +23,7 @@
#include "sprite.h"
#include "transparency.h"
#include "functions.h"
+#include "town.h"
static uint32 GetGRFParameter(IndustryGfx indtile_id, byte parameter)
{
diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h
index 3c3c2b351..2d703d269 100644
--- a/src/newgrf_spritegroup.h
+++ b/src/newgrf_spritegroup.h
@@ -5,8 +5,8 @@
#ifndef NEWGRF_SPRITEGROUP_H
#define NEWGRF_SPRITEGROUP_H
-#include "town.h"
-#include "industry.h"
+#include "town_type.h"
+#include "industry_type.h"
#include "newgrf_storage.h"
#include "core/bitmath_func.hpp"
#include "gfx_type.h"
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp
index 7866e2fa7..eb766871f 100644
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -19,6 +19,8 @@
#include "newgrf_text.h"
#include "table/control_codes.h"
#include "strings_func.h"
+#include "core/alloc_func.hpp"
+#include "newgrf_storage.h"
#define GRFTAB 28
#define TABSIZE 11
diff --git a/src/openttd.h b/src/openttd.h
index e5a6564d4..228fa5fa0 100644
--- a/src/openttd.h
+++ b/src/openttd.h
@@ -16,9 +16,7 @@ struct Depot;
struct Waypoint;
struct Station;
struct ViewPort;
-struct Town;
struct NewsItem;
-struct Industry;
struct DrawPixelInfo;
struct Group;
typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related)
@@ -32,8 +30,6 @@ typedef EngineID *EngineList; ///< engine list type placeholder acceptable for C
typedef uint16 StationID;
static const StationID INVALID_STATION = 0xFFFF;
typedef uint16 RoadStopID;
-typedef uint16 TownID;
-typedef uint16 IndustryID;
typedef uint16 DepotID;
typedef uint16 WaypointID;
typedef uint16 OrderID;
@@ -153,24 +149,6 @@ enum {
NUM_LANDSCAPE = 4,
};
-/**
- * Town Layouts
- */
-enum TownLayout {
- TL_NO_ROADS = 0, ///< Build no more roads, but still build houses
- TL_ORIGINAL, ///< Original algorithm (min. 1 distance between roads)
- TL_BETTER_ROADS, ///< Extended original algorithm (min. 2 distance between roads)
- TL_2X2_GRID, ///< Geometric 2x2 grid algorithm
- TL_3X3_GRID, ///< Geometric 3x3 grid algorithm
-
- NUM_TLS, ///< Number of town layouts
-};
-
-/* It needs to be 8bits, because we save and load it as such */
-/** Define basic enum properties */
-template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_NO_ROADS, NUM_TLS, NUM_TLS> {};
-typedef TinyEnumT<TownLayout> TownLayoutByte; //typedefing-enumification of TownLayout
-
#define GAME_DIFFICULTY_NUM 18
/** Specific type for Game Difficulty to ease changing the type */
diff --git a/src/road_map.h b/src/road_map.h
index 2cf57ea68..5d5d5dd5d 100644
--- a/src/road_map.h
+++ b/src/road_map.h
@@ -7,6 +7,7 @@
#include "track_func.h"
#include "rail_type.h"
+#include "town_type.h"
#include "road_func.h"
#include "tile_map.h"
diff --git a/src/settings.cpp b/src/settings.cpp
index 71b626aa4..28174c5de 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -42,6 +42,7 @@
#include "strings_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
+#include "core/alloc_func.hpp"
#ifdef WITH_FREETYPE
#include "fontcache.h"
#endif
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index a8fc6d24b..b55b78b74 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -24,6 +24,7 @@
#include "functions.h"
#include "window_func.h"
#include "vehicle_base.h"
+#include "core/alloc_func.hpp"
static uint32 _difficulty_click_a;
static uint32 _difficulty_click_b;
diff --git a/src/settings_type.h b/src/settings_type.h
index 862c6316d..53cdb6387 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -7,6 +7,7 @@
#include "yapf/yapf_settings.h"
#include "date_type.h"
+#include "town_type.h"
struct GameOptions {
GameDifficulty diff;
diff --git a/src/station.h b/src/station.h
index 000dbd22c..c80a43fa7 100644
--- a/src/station.h
+++ b/src/station.h
@@ -13,6 +13,7 @@
#include "newgrf_station.h"
#include "cargopacket.h"
#include "cargo_type.h"
+#include "town_type.h"
#include "core/geometry_type.hpp"
#include <list>
#include <set>
diff --git a/src/town.h b/src/town.h
index 89e7dddbd..118c0ebff 100644
--- a/src/town.h
+++ b/src/town.h
@@ -10,6 +10,7 @@
#include "cargo_type.h"
#include "tile_type.h"
#include "date_type.h"
+#include "town_type.h"
enum {
HOUSE_NO_CLASS = 0,
@@ -68,15 +69,11 @@ enum HouseExtraFlags {
DECLARE_ENUM_AS_BIT_SET(HouseExtraFlags)
-typedef uint16 HouseID;
-typedef uint16 HouseClassID;
-
struct BuildingCounts {
uint8 id_count[HOUSE_MAX];
uint8 class_count[HOUSE_CLASS_MAX];
};
-struct Town;
DECLARE_OLD_POOL(Town, Town, 3, 8000)
struct Town : PoolItem<Town, TownID, &_Town_pool> {
@@ -197,12 +194,6 @@ struct HouseSpec {
const struct GRFFile *grffile; ///< grf file that introduced this house
};
-enum TownSizeMode {
- TSM_RANDOM,
- TSM_FIXED,
- TSM_CITY
-};
-
VARDEF HouseSpec _house_specs[HOUSE_MAX];
uint32 GetWorldPopulation();
@@ -221,42 +212,6 @@ enum {
INDUSTRY_REMOVE = 2
};
-enum {
- /* These refer to the maximums, so Appalling is -1000 to -400
- * MAXIMUM RATINGS BOUNDARIES */
- RATING_MINIMUM = -1000,
- RATING_APPALLING = -400,
- RATING_VERYPOOR = -200,
- RATING_POOR = 0,
- RATING_MEDIOCRE = 200,
- RATING_GOOD = 400,
- RATING_VERYGOOD = 600,
- RATING_EXCELLENT = 800,
- RATING_OUTSTANDING = 1000, ///< OUTSTANDING
-
- RATING_MAXIMUM = RATING_OUTSTANDING,
-
- /* RATINGS AFFECTING NUMBERS */
- RATING_TREE_DOWN_STEP = -35,
- RATING_TREE_MINIMUM = RATING_MINIMUM,
- RATING_TREE_UP_STEP = 7,
- RATING_TREE_MAXIMUM = 220,
-
- RATING_TUNNEL_BRIDGE_DOWN_STEP = -250,
- RATING_TUNNEL_BRIDGE_MINIMUM = 0,
-
- RATING_INDUSTRY_DOWN_STEP = -1500,
- RATING_INDUSTRY_MINIMUM = RATING_MINIMUM,
-
- RATING_ROAD_DOWN_STEP = -50,
- RATING_ROAD_MINIMUM = -100,
- RATING_HOUSE_MINIMUM = RATING_MINIMUM,
-
- RATING_BRIBE_UP_STEP = 200,
- RATING_BRIBE_MAXIMUM = 800,
- RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER?
-};
-
/** This is the number of ticks between towns being processed for building new
* houses or roads. This value originally came from the size of the town array
* in TTD. */
diff --git a/src/town_type.h b/src/town_type.h
new file mode 100644
index 000000000..3491b68d7
--- /dev/null
+++ b/src/town_type.h
@@ -0,0 +1,77 @@
+/* $Id$ */
+
+/** @file town_type.h Types related to towns. */
+
+#ifndef TOWN_TYPE_H
+#define TOWN_TYPE_H
+
+#include "core/enum_type.hpp"
+
+typedef uint16 TownID;
+typedef uint16 HouseID;
+typedef uint16 HouseClassID;
+
+struct Town;
+struct HouseSpec;
+
+enum TownSizeMode {
+ TSM_RANDOM,
+ TSM_FIXED,
+ TSM_CITY
+};
+
+enum {
+ /* These refer to the maximums, so Appalling is -1000 to -400
+ * MAXIMUM RATINGS BOUNDARIES */
+ RATING_MINIMUM = -1000,
+ RATING_APPALLING = -400,
+ RATING_VERYPOOR = -200,
+ RATING_POOR = 0,
+ RATING_MEDIOCRE = 200,
+ RATING_GOOD = 400,
+ RATING_VERYGOOD = 600,
+ RATING_EXCELLENT = 800,
+ RATING_OUTSTANDING = 1000, ///< OUTSTANDING
+
+ RATING_MAXIMUM = RATING_OUTSTANDING,
+
+ /* RATINGS AFFECTING NUMBERS */
+ RATING_TREE_DOWN_STEP = -35,
+ RATING_TREE_MINIMUM = RATING_MINIMUM,
+ RATING_TREE_UP_STEP = 7,
+ RATING_TREE_MAXIMUM = 220,
+
+ RATING_TUNNEL_BRIDGE_DOWN_STEP = -250,
+ RATING_TUNNEL_BRIDGE_MINIMUM = 0,
+
+ RATING_INDUSTRY_DOWN_STEP = -1500,
+ RATING_INDUSTRY_MINIMUM = RATING_MINIMUM,
+
+ RATING_ROAD_DOWN_STEP = -50,
+ RATING_ROAD_MINIMUM = -100,
+ RATING_HOUSE_MINIMUM = RATING_MINIMUM,
+
+ RATING_BRIBE_UP_STEP = 200,
+ RATING_BRIBE_MAXIMUM = 800,
+ RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER?
+};
+
+/**
+ * Town Layouts
+ */
+enum TownLayout {
+ TL_NO_ROADS = 0, ///< Build no more roads, but still build houses
+ TL_ORIGINAL, ///< Original algorithm (min. 1 distance between roads)
+ TL_BETTER_ROADS, ///< Extended original algorithm (min. 2 distance between roads)
+ TL_2X2_GRID, ///< Geometric 2x2 grid algorithm
+ TL_3X3_GRID, ///< Geometric 3x3 grid algorithm
+
+ NUM_TLS, ///< Number of town layouts
+};
+
+/* It needs to be 8bits, because we save and load it as such */
+/** Define basic enum properties */
+template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_NO_ROADS, NUM_TLS, NUM_TLS> {};
+typedef TinyEnumT<TownLayout> TownLayoutByte; //typedefing-enumification of TownLayout
+
+#endif /* TOWN_TYPE_H */
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 518c09283..c9e3a10af 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -33,6 +33,7 @@
#include "window_func.h"
#include "vehicle_func.h"
#include "autoreplace_gui.h"
+#include "core/alloc_func.hpp"
struct Sorting {
Listing aircraft;