From 0762aa9ec950a7c7966b1706daa7a032f5de790a Mon Sep 17 00:00:00 2001 From: tron Date: Thu, 21 Jul 2005 22:15:02 +0000 Subject: (svn r2669) Shuffle some more stuff around to reduce dependencies --- ai_build.c | 1 + aircraft_gui.c | 1 + airport.c | 13 +++++++++++++ airport.h | 12 +----------- airport_movement.h | 1 - bridge_gui.c | 1 + command.c | 1 + dedicated.c | 1 + disaster_cmd.c | 1 + dock_gui.c | 1 + economy.c | 2 ++ engine.c | 1 + engine_gui.c | 1 + fileio.c | 1 + graph_gui.c | 1 + gui.h | 2 -- industry_cmd.c | 1 + industry_gui.c | 1 + intro_gui.c | 1 + landscape.c | 1 + macros.h | 17 ++++++----------- main_gui.c | 1 + map.c | 1 + map.h | 14 ++++++++++++++ misc.c | 1 + misc_cmd.c | 1 + misc_gui.c | 1 + music_gui.c | 2 ++ network_client.c | 1 + network_server.c | 1 + newgrf.c | 1 + news_gui.c | 1 + npf.h | 1 + openttd.h | 2 +- order.h | 1 + pbs.h | 1 - player.h | 1 - player_gui.c | 1 + players.c | 2 ++ rail_gui.c | 1 + road_gui.c | 1 + roadveh_gui.c | 1 + saveload.c | 1 + screenshot.c | 1 + sdl.c | 1 + settings_gui.c | 1 + ship_cmd.c | 1 + ship_gui.c | 1 + smallmap_gui.c | 1 + spritecache.c | 1 + station_gui.c | 2 ++ strings.c | 1 + subsidy_gui.c | 1 + terraform_gui.c | 1 + town_cmd.c | 1 + town_gui.c | 1 + tunnelbridge_cmd.c | 1 + unix.c | 1 + unmovable_cmd.c | 1 + vehicle.h | 1 - vehicle_gui.c | 8 ++++++++ vehicle_gui.h | 5 +---- viewport.c | 1 + waypoint.c | 1 + window.c | 1 + window.h | 2 -- 66 files changed, 101 insertions(+), 35 deletions(-) diff --git a/ai_build.c b/ai_build.c index 569783d45..121b9fee0 100644 --- a/ai_build.c +++ b/ai_build.c @@ -7,6 +7,7 @@ #include "ai_new.h" #include "engine.h" #include "station.h" +#include "variables.h" // Build HQ // Params: diff --git a/aircraft_gui.c b/aircraft_gui.c index 29ff1365b..b38a7244f 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -15,6 +15,7 @@ #include "viewport.h" #include "player.h" #include "depot.h" +#include "vehicle_gui.h" /** * Draw the purchase info details of an aircraft at a given location. diff --git a/airport.c b/airport.c index 36be248f4..a8d72e52a 100644 --- a/airport.c +++ b/airport.c @@ -3,6 +3,8 @@ #include "debug.h" #include "map.h" #include "airport.h" +#include "macros.h" +#include "variables.h" AirportFTAClass *CountryAirport; AirportFTAClass *CityAirport; @@ -359,3 +361,14 @@ const AirportFTAClass* GetAirport(const byte airport_type) } return Airport; } + +uint32 GetValidAirports(void) +{ + uint32 bytemask = _avail_aircraft; /// sets the first 3 bytes, 0 - 2, @see AdjustAvailAircraft() + + // 1980-1-1 is --> 21915 + // 1990-1-1 is --> 25568 + if (_date >= 21915) {SETBIT(bytemask, 3);} // metropilitan airport 1980 + if (_date >= 25568) {SETBIT(bytemask, 4);} // international airport 1990 + return bytemask; +} diff --git a/airport.h b/airport.h index 09c7a4881..71db19a79 100644 --- a/airport.h +++ b/airport.h @@ -2,7 +2,6 @@ #define AIRPORT_H #include "airport_movement.h" -#include "variables.h" enum {MAX_TERMINALS = 6}; enum {MAX_HELIPADS = 2}; @@ -54,15 +53,6 @@ const AirportFTAClass* GetAirport(const byte airport_type); * Bit 0 means the small airport is buildable, etc. * @todo set availability of airports by year, instead of airplane */ -static inline uint32 GetValidAirports(void) -{ - uint32 bytemask = _avail_aircraft; /// sets the first 3 bytes, 0 - 2, @see AdjustAvailAircraft() - - // 1980-1-1 is --> 21915 - // 1990-1-1 is --> 25568 - if (_date >= 21915) {SETBIT(bytemask, 3);} // metropilitan airport 1980 - if (_date >= 25568) {SETBIT(bytemask, 4);} // international airport 1990 - return bytemask; -} +uint32 GetValidAirports(void); #endif /* AIRPORT_H */ diff --git a/airport_movement.h b/airport_movement.h index fdc8c2292..f5ae098a7 100644 --- a/airport_movement.h +++ b/airport_movement.h @@ -2,7 +2,6 @@ #define AIRPORT_MOVEMENT_H #include "stdafx.h" -#include "macros.h" typedef struct AirportMovingData { int x,y; diff --git a/bridge_gui.c b/bridge_gui.c index a84a6a2d1..47401c538 100644 --- a/bridge_gui.c +++ b/bridge_gui.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "command.h" #include "sound.h" +#include "variables.h" static struct BridgeData { uint count; diff --git a/command.c b/command.c index 90c548c9a..df5099a28 100644 --- a/command.c +++ b/command.c @@ -6,6 +6,7 @@ #include "command.h" #include "player.h" #include "network.h" +#include "variables.h" const char* _cmd_text = NULL; diff --git a/dedicated.c b/dedicated.c index 1e00fb0e0..cd99dfbbb 100644 --- a/dedicated.c +++ b/dedicated.c @@ -10,6 +10,7 @@ #include "window.h" #include "command.h" #include "console.h" +#include "variables.h" #ifdef WIN32 # include /* GetTickCount */ # include diff --git a/disaster_cmd.c b/disaster_cmd.c index a0e22b7f2..371c69710 100644 --- a/disaster_cmd.c +++ b/disaster_cmd.c @@ -12,6 +12,7 @@ #include "player.h" #include "airport_movement.h" #include "sound.h" +#include "variables.h" static void DisasterClearSquare(TileIndex tile) { diff --git a/dock_gui.c b/dock_gui.c index d5b8b691e..53a9cb75f 100644 --- a/dock_gui.c +++ b/dock_gui.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "sound.h" #include "command.h" +#include "variables.h" static void ShowBuildDockStationPicker(void); static void ShowBuildDocksDepotPicker(void); diff --git a/economy.c b/economy.c index cc989a87c..6ebd81e9a 100644 --- a/economy.c +++ b/economy.c @@ -18,6 +18,8 @@ #include "sound.h" #include "engine.h" #include "network_data.h" +#include "variables.h" +#include "vehicle_gui.h" // get a mask of the allowed currencies depending on the year uint GetMaskOfAllowedCurrencies(void) diff --git a/engine.c b/engine.c index a17841dd8..1c4f544b3 100644 --- a/engine.c +++ b/engine.c @@ -11,6 +11,7 @@ #include "news.h" #include "saveload.h" #include "sprite.h" +#include "variables.h" enum { ENGINE_AVAILABLE = 1, diff --git a/engine_gui.c b/engine_gui.c index 72e939b5b..9cbcdb5d3 100644 --- a/engine_gui.c +++ b/engine_gui.c @@ -8,6 +8,7 @@ #include "engine.h" #include "command.h" #include "news.h" +#include "variables.h" static StringID GetEngineCategoryName(byte engine) diff --git a/fileio.c b/fileio.c index e3c7d5021..e13a73ead 100644 --- a/fileio.c +++ b/fileio.c @@ -1,6 +1,7 @@ #include "stdafx.h" #include "openttd.h" #include "fileio.h" +#include "macros.h" #include "variables.h" #if defined(UNIX) || defined(__OS2__) #include // required for tolower() diff --git a/graph_gui.c b/graph_gui.c index 0c3ecf5bc..527830b60 100644 --- a/graph_gui.c +++ b/graph_gui.c @@ -9,6 +9,7 @@ #include "signs.h" #include "strings.h" #include "debug.h" +#include "variables.h" static uint _legend_excludebits; static uint _legend_cargobits; diff --git a/gui.h b/gui.h index 2b081c457..da57e5d72 100644 --- a/gui.h +++ b/gui.h @@ -114,8 +114,6 @@ bool InsertTextBufferChar(Textbuf *tb, byte key); bool InsertTextBufferClipboard(Textbuf *tb); bool MoveTextBufferPos(Textbuf *tb, int navmode); void UpdateTextBufferSize(Textbuf *tb); -/* IS_INT_INSIDE = filter for ascii-function codes like BELL and so on [we need an special filter here later] */ -static inline bool IsValidAsciiChar(byte key) {return IS_INT_INSIDE(key, ' ', 256);} void BuildFileList(void); void SetFiosType(const byte fiostype); diff --git a/industry_cmd.c b/industry_cmd.c index 8c03d6341..f368122c9 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -13,6 +13,7 @@ #include "saveload.h" #include "economy.h" #include "sound.h" +#include "variables.h" enum { /* Max industries: 64000 (8 * 8000) */ diff --git a/industry_gui.c b/industry_gui.c index 7a8743807..db2d016e1 100644 --- a/industry_gui.c +++ b/industry_gui.c @@ -12,6 +12,7 @@ #include "viewport.h" #include "industry.h" #include "town.h" +#include "variables.h" /* Present in table/build_industry.h" */ extern const byte _build_industry_types[4][12]; diff --git a/intro_gui.c b/intro_gui.c index 273d9588e..f81e129f7 100644 --- a/intro_gui.c +++ b/intro_gui.c @@ -9,6 +9,7 @@ #include "command.h" #include "console.h" #include "network.h" +#include "variables.h" extern void SwitchMode(int new_mode); diff --git a/landscape.c b/landscape.c index dd029560e..cae2a1427 100644 --- a/landscape.c +++ b/landscape.c @@ -9,6 +9,7 @@ #include "viewport.h" #include "command.h" #include "vehicle.h" +#include "variables.h" extern const TileTypeProcs _tile_type_clear_procs, diff --git a/macros.h b/macros.h index 28b61c308..460360e7f 100644 --- a/macros.h +++ b/macros.h @@ -110,17 +110,6 @@ static inline int KillFirstBit2x64(int value) #define CHANCE16R(a,b,r) ((uint16)(r=Random()) <= (uint16)((65536 * a) / b)) #define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * a) / b)) -#define BEGIN_TILE_LOOP(var,w,h,tile) \ - {int h_cur = h; \ - uint var = tile; \ - do { \ - int w_cur = w; \ - do { - -#define END_TILE_LOOP(var,w,h,tile) \ - } while (++var, --w_cur != 0); \ - } while (var += TileDiffXY(0, 1) - (w), --h_cur != 0);} - #define for_each_bit(_i,_b) \ for(_i=0; _b!=0; _i++,_b>>=1) \ @@ -165,4 +154,10 @@ static inline void swap_tile(TileIndex *a, TileIndex *b) { TileIndex t = *a; *a #define ROL(x, n) ((x) << (n) | (x) >> (sizeof(x) * 8 - (n))) #define ROR(x, n) ((x) >> (n) | (x) << (sizeof(x) * 8 - (n))) +/* IS_INT_INSIDE = filter for ascii-function codes like BELL and so on [we need an special filter here later] */ +static inline bool IsValidAsciiChar(byte key) +{ + return IS_INT_INSIDE(key, ' ', 256); +} + #endif /* MACROS_H */ diff --git a/main_gui.c b/main_gui.c index 3abb9cc65..e4d42f715 100644 --- a/main_gui.c +++ b/main_gui.c @@ -20,6 +20,7 @@ #include "network.h" #include "signs.h" #include "waypoint.h" +#include "variables.h" #include "network_data.h" #include "network_client.h" diff --git a/map.c b/map.c index 2eeaa8af1..84a619a51 100644 --- a/map.c +++ b/map.c @@ -2,6 +2,7 @@ #include "openttd.h" #include "debug.h" #include "functions.h" +#include "macros.h" #include "map.h" uint _map_log_x; diff --git a/map.h b/map.h index 02513ddd0..bb11c3612 100644 --- a/map.h +++ b/map.h @@ -146,6 +146,20 @@ uint DistanceTrack(TileIndex, TileIndex); // Returns the shortest distance one c uint DistanceFromEdge(TileIndex); // shortest distance from any edge of the map +#define BEGIN_TILE_LOOP(var,w,h,tile) \ + { \ + int h_cur = h; \ + uint var = tile; \ + do { \ + int w_cur = w; \ + do { + +#define END_TILE_LOOP(var,w,h,tile) \ + } while (++var, --w_cur != 0); \ + } while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \ + } + + static inline TileIndexDiff TileOffsByDir(uint dir) { extern const TileIndexDiffC _tileoffs_by_dir[4]; diff --git a/misc.c b/misc.c index d2479bd89..daf8169c8 100644 --- a/misc.c +++ b/misc.c @@ -13,6 +13,7 @@ #include "network_server.h" #include "engine.h" #include "vehicle_gui.h" +#include "variables.h" extern void StartupEconomy(void); extern void InitNewsItemStructs(void); diff --git a/misc_cmd.c b/misc_cmd.c index 1b087b498..b5958a20a 100644 --- a/misc_cmd.c +++ b/misc_cmd.c @@ -9,6 +9,7 @@ #include "gui.h" #include "economy.h" #include "network.h" +#include "variables.h" /** Change the player's face. * @param x,y unused diff --git a/misc_gui.c b/misc_gui.c index 47c07702c..fb2cf75f1 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -18,6 +18,7 @@ #include "sound.h" #include "network.h" #include "string.h" +#include "variables.h" #include "hal.h" // for file list diff --git a/music_gui.c b/music_gui.c index 2294c460a..0c5731d82 100644 --- a/music_gui.c +++ b/music_gui.c @@ -6,6 +6,8 @@ #include "gfx.h" #include "sound.h" #include "hal.h" +#include "macros.h" +#include "variables.h" static byte _music_wnd_cursong; static bool _song_is_active; diff --git a/network_client.c b/network_client.c index 697df83c1..0bb0a8673 100644 --- a/network_client.c +++ b/network_client.c @@ -14,6 +14,7 @@ #include "window.h" #include "settings.h" #include "console.h" +#include "variables.h" // This file handles all the client-commands diff --git a/network_server.c b/network_server.c index 45f40bcc8..6cad02896 100644 --- a/network_server.c +++ b/network_server.c @@ -15,6 +15,7 @@ #include "vehicle.h" #include "station.h" #include "settings.h" +#include "variables.h" // This file handles all the server-commands diff --git a/newgrf.c b/newgrf.c index 534240838..66e15af15 100644 --- a/newgrf.c +++ b/newgrf.c @@ -10,6 +10,7 @@ #include "station.h" #include "sprite.h" #include "newgrf.h" +#include "variables.h" /* TTDPatch extended GRF format codec * (c) Petr Baudis 2004 (GPL'd) diff --git a/news_gui.c b/news_gui.c index 3886879cf..c9d919aff 100644 --- a/news_gui.c +++ b/news_gui.c @@ -10,6 +10,7 @@ #include "news.h" #include "vehicle.h" #include "sound.h" +#include "variables.h" /* News system News system is realized as a FIFO queue (in an array) diff --git a/npf.h b/npf.h index 0ded7fcfa..8ceb35217 100644 --- a/npf.h +++ b/npf.h @@ -7,6 +7,7 @@ #include "pbs.h" #include "tile.h" #include "rail.h" +#include "variables.h" //mowing grass enum { diff --git a/openttd.h b/openttd.h index 46d125705..912b0aea1 100644 --- a/openttd.h +++ b/openttd.h @@ -51,7 +51,7 @@ typedef struct YearMonthDay { #define MAX_YEAR_END_REAL 2090 #define MAX_YEAR_END 170 -#include "macros.h" +#include "map.h" // Forward declarations of structs. typedef struct Vehicle Vehicle; diff --git a/order.h b/order.h index 1b0bdd18a..0e0c5ad43 100644 --- a/order.h +++ b/order.h @@ -1,6 +1,7 @@ #ifndef ORDER_H #define ORDER_H +#include "macros.h" #include "pool.h" /* Order types */ diff --git a/pbs.h b/pbs.h index 013802ee6..2cac9498e 100644 --- a/pbs.h +++ b/pbs.h @@ -5,7 +5,6 @@ * @see pbs.c */ #include "vehicle.h" -#include "tile.h" #include "map.h" #include "rail.h" diff --git a/player.h b/player.h index 609dc25ad..aabb34871 100644 --- a/player.h +++ b/player.h @@ -2,7 +2,6 @@ #define PLAYER_H #include "aystar.h" -#include "engine.h" #include "rail.h" typedef struct PlayerEconomyEntry { diff --git a/player_gui.c b/player_gui.c index e3f21768f..bd5e4cc5b 100644 --- a/player_gui.c +++ b/player_gui.c @@ -11,6 +11,7 @@ #include "vehicle.h" #include "economy.h" #include "network.h" +#include "variables.h" #ifdef ENABLE_NETWORK #include "network_data.h" diff --git a/players.c b/players.c index 971473480..55313ada9 100644 --- a/players.c +++ b/players.c @@ -1,5 +1,6 @@ #include "stdafx.h" #include "openttd.h" +#include "engine.h" #include "string.h" #include "strings.h" #include "table/strings.h" @@ -15,6 +16,7 @@ #include "ai_new.h" #include "sound.h" #include "network.h" +#include "variables.h" PlayerID _current_player; diff --git a/rail_gui.c b/rail_gui.c index ce770de7d..bdc474b48 100644 --- a/rail_gui.c +++ b/rail_gui.c @@ -14,6 +14,7 @@ #include "station.h" #include "waypoint.h" #include "debug.h" +#include "variables.h" static uint _cur_railtype; static bool _remove_button_clicked; diff --git a/road_gui.c b/road_gui.c index ed48966a5..0b3c5ebf3 100644 --- a/road_gui.c +++ b/road_gui.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "sound.h" #include "command.h" +#include "variables.h" //needed for catchments #include "station.h" diff --git a/roadveh_gui.c b/roadveh_gui.c index 88dbec7e1..01d9b3e8a 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -14,6 +14,7 @@ #include "player.h" #include "engine.h" #include "depot.h" +#include "vehicle_gui.h" /** * Draw the purchase info details of road vehicle at a given location. diff --git a/saveload.c b/saveload.c index bef3ef6f9..1bba25281 100644 --- a/saveload.c +++ b/saveload.c @@ -21,6 +21,7 @@ #include "town.h" #include "player.h" #include "saveload.h" +#include "variables.h" enum { SAVEGAME_MAJOR_VERSION = 15, diff --git a/screenshot.c b/screenshot.c index c9deaca7e..c0c07dd5c 100644 --- a/screenshot.c +++ b/screenshot.c @@ -8,6 +8,7 @@ #include "player.h" #include "gui.h" #include "screenshot.h" +#include "variables.h" char _screenshot_format_name[8]; uint _num_screenshot_formats; diff --git a/sdl.c b/sdl.c index f1df13727..26232c465 100644 --- a/sdl.c +++ b/sdl.c @@ -10,6 +10,7 @@ #include "player.h" #include "hal.h" #include "network.h" +#include "variables.h" #ifdef UNIX #include diff --git a/settings_gui.c b/settings_gui.c index a2ef471cf..0604c9d6f 100644 --- a/settings_gui.c +++ b/settings_gui.c @@ -14,6 +14,7 @@ #include "network.h" #include "console.h" #include "town.h" +#include "variables.h" static uint32 _difficulty_click_a; static uint32 _difficulty_click_b; diff --git a/ship_cmd.c b/ship_cmd.c index a0c3d7e10..e93fd5d2e 100644 --- a/ship_cmd.c +++ b/ship_cmd.c @@ -14,6 +14,7 @@ #include "sound.h" #include "npf.h" #include "depot.h" +#include "vehicle_gui.h" static const uint16 _ship_sprites[] = {0x0E5D, 0x0E55, 0x0E65, 0x0E6D}; static const byte _ship_sometracks[4] = {0x19, 0x16, 0x25, 0x2A}; diff --git a/ship_gui.c b/ship_gui.c index 14d0e0179..752bc4f53 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -13,6 +13,7 @@ #include "player.h" #include "engine.h" #include "depot.h" +#include "vehicle_gui.h" /** * Draw the purchase info details of a ship at a given location. diff --git a/smallmap_gui.c b/smallmap_gui.c index 2a69cfc96..5890562c9 100644 --- a/smallmap_gui.c +++ b/smallmap_gui.c @@ -13,6 +13,7 @@ #include "vehicle.h" #include "town.h" #include "sound.h" +#include "variables.h" static const Widget _smallmap_widgets[] = { { WWT_TEXTBTN, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, diff --git a/spritecache.c b/spritecache.c index f365d3b6b..fe5925555 100644 --- a/spritecache.c +++ b/spritecache.c @@ -7,6 +7,7 @@ #include "fileio.h" #include "newgrf.h" #include "md5.h" +#include "variables.h" #include #define SPRITECACHE_ID 0xF00F0006 diff --git a/station_gui.c b/station_gui.c index df4d2b66e..9b5b1de22 100644 --- a/station_gui.c +++ b/station_gui.c @@ -10,6 +10,8 @@ #include "player.h" #include "town.h" #include "command.h" +#include "variables.h" +#include "vehicle_gui.h" static void StationsWndShowStationRating(int x, int y, int type, uint acceptance, int rating) { diff --git a/strings.c b/strings.c index 0620ccd2c..77a263563 100644 --- a/strings.c +++ b/strings.c @@ -11,6 +11,7 @@ #include "screenshot.h" #include "waypoint.h" #include "industry.h" +#include "variables.h" static char *StationGetSpecialString(char *buff, int x); static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed); diff --git a/subsidy_gui.c b/subsidy_gui.c index 1a8929e96..f966724e1 100644 --- a/subsidy_gui.c +++ b/subsidy_gui.c @@ -9,6 +9,7 @@ #include "player.h" #include "gfx.h" #include "economy.h" +#include "variables.h" static void HandleSubsidyClick(int y) { diff --git a/terraform_gui.c b/terraform_gui.c index c5e5caf00..10a0c78d0 100644 --- a/terraform_gui.c +++ b/terraform_gui.c @@ -12,6 +12,7 @@ #include "command.h" #include "vehicle.h" #include "signs.h" +#include "variables.h" void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2) { diff --git a/town_cmd.c b/town_cmd.c index 4e92e886d..76ca08d97 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -18,6 +18,7 @@ #include "economy.h" #include "gui.h" #include "network.h" +#include "variables.h" enum { /* Max towns: 64000 (8 * 8000) */ diff --git a/town_gui.c b/town_gui.c index 49bddab1c..23791b663 100644 --- a/town_gui.c +++ b/town_gui.c @@ -12,6 +12,7 @@ #include "command.h" #include "player.h" #include "network.h" +#include "variables.h" static const Widget _town_authority_widgets[] = { { WWT_TEXTBTN, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index e72de08d3..250cd6277 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -12,6 +12,7 @@ #include "sound.h" #include "pbs.h" #include "debug.h" +#include "variables.h" extern void DrawCanalWater(TileIndex tile); diff --git a/unix.c b/unix.c index 07585c926..6dcd70be9 100644 --- a/unix.c +++ b/unix.c @@ -4,6 +4,7 @@ #include "string.h" #include "table/strings.h" #include "hal.h" +#include "variables.h" #include #include diff --git a/unmovable_cmd.c b/unmovable_cmd.c index 75701c1e5..5b04328e6 100644 --- a/unmovable_cmd.c +++ b/unmovable_cmd.c @@ -12,6 +12,7 @@ #include "economy.h" #include "town.h" #include "sprite.h" +#include "variables.h" /** Destroy a HQ. * During normal gameplay you can only implicitely destroy a HQ when you are diff --git a/vehicle.h b/vehicle.h index f396ccd5a..6e90cc96f 100644 --- a/vehicle.h +++ b/vehicle.h @@ -4,7 +4,6 @@ #include "pool.h" #include "order.h" #include "rail.h" -#include "variables.h" enum { VEH_Train = 0x10, diff --git a/vehicle_gui.c b/vehicle_gui.c index 5955e52ac..2cfc40a4d 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -11,6 +11,14 @@ #include "gui.h" #include "command.h" #include "gfx.h" +#include "variables.h" +#include "vehicle_gui.h" + +Sorting _sorting; + +static uint32 _internal_name_sorter_id; // internal StringID for default vehicle-names +static uint32 _last_vehicle_idx; // cached index to hopefully speed up name-sorting +static bool _internal_sort_order; // descending/ascending VehicleSortListingTypeFunctions * const _vehicle_sorter[] = { &VehicleUnsortedSorter, diff --git a/vehicle_gui.h b/vehicle_gui.h index 9b4e40f0b..bb9d0d4d9 100644 --- a/vehicle_gui.h +++ b/vehicle_gui.h @@ -17,9 +17,6 @@ void BuildVehicleList(struct vehiclelist_d *vl, int type, int owner, int station void SortVehicleList(struct vehiclelist_d *vl); int CDECL GeneralOwnerSorter(const void *a, const void *b); -VARDEF uint32 _internal_name_sorter_id; // internal StringID for default vehicle-names -VARDEF uint32 _last_vehicle_idx; // cached index to hopefully speed up name-sorting -VARDEF bool _internal_sort_order; // descending/ascending #define PERIODIC_RESORT_DAYS 10 #define DEF_SORTER(yyyy) int CDECL yyyy(const void *a, const void *b) @@ -60,7 +57,7 @@ typedef struct Sorting { Listing train; } Sorting; -VARDEF Sorting _sorting; +extern Sorting _sorting; enum { PLY_WND_PRC__OFFSET_TOP_WIDGET = 26, diff --git a/viewport.c b/viewport.c index 32dd8637d..48f1b8230 100644 --- a/viewport.c +++ b/viewport.c @@ -14,6 +14,7 @@ #include "town.h" #include "signs.h" #include "waypoint.h" +#include "variables.h" #define VIEWPORT_DRAW_MEM (65536 * 2) diff --git a/waypoint.c b/waypoint.c index 539d72b45..958dd5378 100644 --- a/waypoint.c +++ b/waypoint.c @@ -10,6 +10,7 @@ #include "tile.h" #include "town.h" #include "waypoint.h" +#include "variables.h" #include "table/sprites.h" #include "table/strings.h" #include "table/track_land.h" diff --git a/window.c b/window.c index 392f1d5ad..6760be8df 100644 --- a/window.c +++ b/window.c @@ -7,6 +7,7 @@ #include "gfx.h" #include "viewport.h" #include "console.h" +#include "variables.h" // delta between mouse cursor and upper left corner of dragged window static Point _drag_delta; diff --git a/window.h b/window.h index 3eab3f80e..fbdf8ba26 100644 --- a/window.h +++ b/window.h @@ -1,8 +1,6 @@ #ifndef WINDOW_H #define WINDOW_H -#include "vehicle_gui.h" - typedef union WindowEvent WindowEvent; //typedef void WindowProc(Window *w, int event, int wparam, long lparam); -- cgit v1.2.3-70-g09d2