(svn r11776) -Codechange: more header splittings to reduce the dependencies.

This commit is contained in:
rubidium 2008-01-07 14:02:26 +00:00
parent e2f7ec1d3e
commit 71d4004a85
25 changed files with 127 additions and 85 deletions

View File

@ -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.

View File

@ -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;

View File

@ -16,6 +16,7 @@
#include "variables.h"
#include "fontcache.h"
#include "gfx_func.h"
#include "core/alloc_func.hpp"
#include <string.h>
struct MD5File {

View File

@ -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)
/**

16
src/industry_type.h Normal file
View File

@ -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 */

View File

@ -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

View File

@ -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,

View File

@ -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"

View File

@ -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;

View File

@ -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

View File

@ -5,7 +5,7 @@
#ifndef NEWGRF_HOUSE_H
#define NEWGRF_HOUSE_H
#include "town.h"
#include "town_type.h"
#include "newgrf_callbacks.h"
/**

View File

@ -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

View File

@ -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);

View File

@ -23,6 +23,7 @@
#include "sprite.h"
#include "transparency.h"
#include "functions.h"
#include "town.h"
static uint32 GetGRFParameter(IndustryGfx indtile_id, byte parameter)
{

View File

@ -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"

View File

@ -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

View File

@ -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 */

View File

@ -7,6 +7,7 @@
#include "track_func.h"
#include "rail_type.h"
#include "town_type.h"
#include "road_func.h"
#include "tile_map.h"

View File

@ -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

View File

@ -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;

View File

@ -7,6 +7,7 @@
#include "yapf/yapf_settings.h"
#include "date_type.h"
#include "town_type.h"
struct GameOptions {
GameDifficulty diff;

View File

@ -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>

View File

@ -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. */

77
src/town_type.h Normal file
View File

@ -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 */

View File

@ -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;