summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-13 13:36:01 +0000
committerrubidium <rubidium@openttd.org>2008-01-13 13:36:01 +0000
commit5c4150d304242d224d5974f79d5461ff3090cea3 (patch)
treeec37405dba3eeb85aaeaa7e2ed2433812d3061d6 /src
parentb0c34f4d6275a0dc1b8639b5529e37233240f6e2 (diff)
downloadopenttd-5c4150d304242d224d5974f79d5461ff3090cea3.tar.xz
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
Diffstat (limited to 'src')
-rw-r--r--src/ai/ai.cpp3
-rw-r--r--src/ai/ai.h4
-rw-r--r--src/console.cpp13
-rw-r--r--src/console.h18
-rw-r--r--src/engine.cpp1
-rw-r--r--src/engine.h2
-rw-r--r--src/gui.h1
-rw-r--r--src/news.h2
-rw-r--r--src/news_gui.cpp1
-rw-r--r--src/openttd.cpp2
-rw-r--r--src/openttd.h29
-rw-r--r--src/order.h4
-rw-r--r--src/order_cmd.cpp3
-rw-r--r--src/settings_type.h25
-rw-r--r--src/signs.cpp1
-rw-r--r--src/signs.h2
-rw-r--r--src/station_gui.cpp2
-rw-r--r--src/station_gui.h2
-rw-r--r--src/town.h19
-rw-r--r--src/town_cmd.cpp10
-rw-r--r--src/window.cpp13
-rw-r--r--src/window_gui.h16
22 files changed, 111 insertions, 62 deletions
diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp
index 07b31f77d..c6158b0c4 100644
--- a/src/ai/ai.cpp
+++ b/src/ai/ai.cpp
@@ -11,6 +11,9 @@
#include "ai.h"
#include "default/default.h"
+AIStruct _ai;
+AIPlayer _ai_player[MAX_PLAYERS];
+
/**
* Dequeues commands put in the queue via AI_PutCommandInQueue.
*/
diff --git a/src/ai/ai.h b/src/ai/ai.h
index 7ecc97571..44c6fe78c 100644
--- a/src/ai/ai.h
+++ b/src/ai/ai.h
@@ -36,8 +36,8 @@ struct AIStruct {
uint tick; ///< The current tick (something like _frame_counter, only for AIs)
};
-VARDEF AIStruct _ai;
-VARDEF AIPlayer _ai_player[MAX_PLAYERS];
+extern AIStruct _ai;
+extern AIPlayer _ai_player[MAX_PLAYERS];
// ai.c
void AI_StartNewAI(PlayerID player);
diff --git a/src/console.cpp b/src/console.cpp
index be90dfc4e..885f5eaf4 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -29,6 +29,19 @@
#define ICON_MAX_ALIAS_LINES 40
#define ICON_TOKEN_COUNT 20
+/* console parser */
+IConsoleCmd *_iconsole_cmds; ///< list of registred commands
+IConsoleVar *_iconsole_vars; ///< list of registred vars
+IConsoleAlias *_iconsole_aliases; ///< list of registred aliases
+
+/* console colors/modes */
+byte _icolour_def;
+byte _icolour_err;
+byte _icolour_warn;
+byte _icolour_dbg;
+byte _icolour_cmd;
+IConsoleModes _iconsole_mode;
+
/* ** main console ** */
static char *_iconsole_buffer[ICON_BUFFER + 1];
static uint16 _iconsole_cbuffer[ICON_BUFFER + 1];
diff --git a/src/console.h b/src/console.h
index 4030c3851..30f1c30d9 100644
--- a/src/console.h
+++ b/src/console.h
@@ -103,17 +103,17 @@ struct IConsoleAlias {
};
/* console parser */
-VARDEF IConsoleCmd *_iconsole_cmds; ///< list of registred commands
-VARDEF IConsoleVar *_iconsole_vars; ///< list of registred vars
-VARDEF IConsoleAlias *_iconsole_aliases; ///< list of registred aliases
+extern IConsoleCmd *_iconsole_cmds; ///< list of registred commands
+extern IConsoleVar *_iconsole_vars; ///< list of registred vars
+extern IConsoleAlias *_iconsole_aliases; ///< list of registred aliases
/* console colors/modes */
-VARDEF byte _icolour_def;
-VARDEF byte _icolour_err;
-VARDEF byte _icolour_warn;
-VARDEF byte _icolour_dbg;
-VARDEF byte _icolour_cmd;
-VARDEF IConsoleModes _iconsole_mode;
+extern byte _icolour_def;
+extern byte _icolour_err;
+extern byte _icolour_warn;
+extern byte _icolour_dbg;
+extern byte _icolour_cmd;
+extern IConsoleModes _iconsole_mode;
/* console functions */
void IConsoleInit();
diff --git a/src/engine.cpp b/src/engine.cpp
index 499de4d2f..6af2a856a 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -29,6 +29,7 @@
#include "table/strings.h"
#include "table/engines.h"
+Engine _engines[TOTAL_NUM_ENGINES];
EngineInfo _engine_info[TOTAL_NUM_ENGINES];
RailVehicleInfo _rail_vehicle_info[NUM_TRAIN_ENGINES];
ShipVehicleInfo _ship_vehicle_info[NUM_SHIP_ENGINES];
diff --git a/src/engine.h b/src/engine.h
index 5e2f1e678..69fff1c20 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -202,7 +202,7 @@ static inline EngineID GetLastEngineOfType(byte type)
return end[type];
}
-VARDEF Engine _engines[TOTAL_NUM_ENGINES];
+extern Engine _engines[TOTAL_NUM_ENGINES];
#define FOR_ALL_ENGINES(e) for (e = _engines; e != endof(_engines); e++)
#define FOR_ALL_ENGINEIDS_OF_TYPE(e, type) for (e = GetFirstEngineOfType(type); e != GetLastEngineOfType(type); e++)
diff --git a/src/gui.h b/src/gui.h
index a5fb774bc..2f1882a85 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -112,7 +112,6 @@ void ShowMusicWindow();
/* main_gui.cpp */
void HandleOnEditText(const char *str);
-VARDEF bool _station_show_coverage;
void InitializeGUI();
diff --git a/src/news.h b/src/news.h
index 20d04f3a3..08b1069ac 100644
--- a/src/news.h
+++ b/src/news.h
@@ -49,7 +49,7 @@ void NewsLoop();
void DrawNewsBorder(const Window *w);
void InitNewsItemStructs();
-VARDEF NewsItem _statusbar_news_item;
+extern NewsItem _statusbar_news_item;
/** Type of news. */
enum NewsType {
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 922d14b2c..91252ece4 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -51,6 +51,7 @@
typedef byte NewsID;
#define INVALID_NEWS 255
+NewsItem _statusbar_news_item;
static NewsItem _news_items[MAX_NEWS]; ///< The news FIFO queue
static NewsID _current_news = INVALID_NEWS; ///< points to news item that should be shown next
static NewsID _oldest_news = 0; ///< points to first item in fifo queue
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 6df99dba1..0e0e783d5 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -319,6 +319,8 @@ static void LoadIntroGame()
if (_music_driver->IsSongPlaying()) ResetMusic();
}
+byte _no_scroll;
+byte _savegame_sort_order;
#if defined(UNIX) && !defined(__MORPHOS__)
extern void DedicatedFork();
#endif
diff --git a/src/openttd.h b/src/openttd.h
index 8b8f0c0a2..edc9d4339 100644
--- a/src/openttd.h
+++ b/src/openttd.h
@@ -112,31 +112,6 @@ enum {
NUM_LANDSCAPE = 4,
};
-#define GAME_DIFFICULTY_NUM 18
-
-/** Specific type for Game Difficulty to ease changing the type */
-typedef uint16 GDType;
-struct GameDifficulty {
- GDType max_no_competitors;
- GDType competitor_start_time;
- GDType number_towns;
- GDType number_industries;
- GDType max_loan;
- GDType initial_interest;
- GDType vehicle_costs;
- GDType competitor_speed;
- GDType competitor_intelligence; // no longer in use
- GDType vehicle_breakdowns;
- GDType subsidy_multiplier;
- GDType construction_cost;
- GDType terrain_type;
- GDType quantity_sea_lakes;
- GDType economy;
- GDType line_reverse_mode;
- GDType disasters;
- GDType town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
-};
-
struct ViewportSign {
int32 left;
int32 top;
@@ -150,7 +125,7 @@ enum {
SORT_BY_NAME = 2
};
-VARDEF byte _savegame_sort_order;
+extern byte _savegame_sort_order;
enum {
MAX_SCREEN_WIDTH = 2048,
@@ -166,7 +141,7 @@ enum {
SCROLL_SAVE = 2,
SCROLL_CHAT = 4,
};
-VARDEF byte _no_scroll;
+extern byte _no_scroll;
/** To have a concurrently running thread interface with the main program, use
* the OTTD_SendThreadMessage() function. Actions to perform upon the message are handled
diff --git a/src/order.h b/src/order.h
index b3d688d5a..a34cad0d9 100644
--- a/src/order.h
+++ b/src/order.h
@@ -130,8 +130,8 @@ struct BackuppedOrders {
char *name;
};
-VARDEF TileIndex _backup_orders_tile;
-VARDEF BackuppedOrders _backup_orders_data;
+extern TileIndex _backup_orders_tile;
+extern BackuppedOrders _backup_orders_data;
static inline VehicleOrderID GetMaxOrderIndex()
{
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 78ebb3120..202bf068e 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -25,6 +25,9 @@
#include "table/strings.h"
+TileIndex _backup_orders_tile;
+BackuppedOrders _backup_orders_data;
+
DEFINE_OLD_POOL_GENERIC(Order, Order)
/**
diff --git a/src/settings_type.h b/src/settings_type.h
index 53cdb6387..8f693aea3 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -9,6 +9,31 @@
#include "date_type.h"
#include "town_type.h"
+#define GAME_DIFFICULTY_NUM 18
+
+/** Specific type for Game Difficulty to ease changing the type */
+typedef uint16 GDType;
+struct GameDifficulty {
+ GDType max_no_competitors;
+ GDType competitor_start_time;
+ GDType number_towns;
+ GDType number_industries;
+ GDType max_loan;
+ GDType initial_interest;
+ GDType vehicle_costs;
+ GDType competitor_speed;
+ GDType competitor_intelligence; // no longer in use
+ GDType vehicle_breakdowns;
+ GDType subsidy_multiplier;
+ GDType construction_cost;
+ GDType terrain_type;
+ GDType quantity_sea_lakes;
+ GDType economy;
+ GDType line_reverse_mode;
+ GDType disasters;
+ GDType town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
+};
+
struct GameOptions {
GameDifficulty diff;
byte diff_level;
diff --git a/src/signs.cpp b/src/signs.cpp
index 7e593b233..7444bf024 100644
--- a/src/signs.cpp
+++ b/src/signs.cpp
@@ -23,6 +23,7 @@
SignID _new_sign_id;
uint _total_signs;
+bool _sign_sort_dirty;
/* Initialize the sign-pool */
DEFINE_OLD_POOL_GENERIC(Sign, Sign)
diff --git a/src/signs.h b/src/signs.h
index 5036700bd..3f014c0cc 100644
--- a/src/signs.h
+++ b/src/signs.h
@@ -60,7 +60,7 @@ static inline bool IsValidSignID(uint index)
#define FOR_ALL_SIGNS_FROM(ss, start) for (ss = GetSign(start); ss != NULL; ss = (ss->index + 1U < GetSignPoolSize()) ? GetSign(ss->index + 1U) : NULL) if (ss->IsValid())
#define FOR_ALL_SIGNS(ss) FOR_ALL_SIGNS_FROM(ss, 0)
-VARDEF bool _sign_sort_dirty;
+extern bool _sign_sort_dirty;
void UpdateAllSignVirtCoords();
void PlaceProc_Sign(TileIndex tile);
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 380fbe2d5..28b5955ab 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -34,6 +34,8 @@ static StationSortListingTypeFunction StationTypeSorter;
static StationSortListingTypeFunction StationWaitingSorter;
static StationSortListingTypeFunction StationRatingMaxSorter;
+bool _station_show_coverage;
+
/**
* Draw small boxes of cargo amount and ratings data at the given
* coordinates. If amount exceeds 576 units, it is shown 'full', same
diff --git a/src/station_gui.h b/src/station_gui.h
index 2911266ca..69fdad220 100644
--- a/src/station_gui.h
+++ b/src/station_gui.h
@@ -61,4 +61,6 @@ enum StationCoverageType {
void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad);
void CheckRedrawStationCoverage(const Window *w);
+extern bool _station_show_coverage;
+
#endif /* STATION_GUI_H */
diff --git a/src/town.h b/src/town.h
index 16f852a77..c80fa9a13 100644
--- a/src/town.h
+++ b/src/town.h
@@ -198,7 +198,7 @@ struct HouseSpec {
const struct GRFFile *grffile; ///< grf file that introduced this house
};
-VARDEF HouseSpec _house_specs[HOUSE_MAX];
+extern HouseSpec _house_specs[HOUSE_MAX];
uint32 GetWorldPopulation();
@@ -239,8 +239,6 @@ enum {
bool CheckforTownRating(uint32 flags, Town *t, byte type);
-VARDEF const Town** _town_sort;
-
static inline HouseSpec *GetHouseSpecs(HouseID house_id)
{
assert(house_id < HOUSE_MAX);
@@ -257,8 +255,6 @@ static inline bool IsValidTownID(TownID index)
return index < GetTownPoolSize() && GetTown(index)->IsValid();
}
-VARDEF uint _total_towns;
-
static inline TownID GetMaxTownIndex()
{
/* TODO - This isn't the real content of the function, but
@@ -271,6 +267,8 @@ static inline TownID GetMaxTownIndex()
static inline uint GetNumTowns()
{
+ extern uint _total_towns;
+
return _total_towns;
}
@@ -296,16 +294,17 @@ static inline Town *GetRandomTown()
return GetTown(index);
}
-Town* CalcClosestTownFromTile(TileIndex tile, uint threshold);
+Town *CalcClosestTownFromTile(TileIndex tile, uint threshold);
#define FOR_ALL_TOWNS_FROM(t, start) for (t = GetTown(start); t != NULL; t = (t->index + 1U < GetTownPoolSize()) ? GetTown(t->index + 1U) : NULL) if (t->IsValid())
#define FOR_ALL_TOWNS(t) FOR_ALL_TOWNS_FROM(t, 0)
-VARDEF bool _town_sort_dirty;
-VARDEF byte _town_sort_order;
+extern bool _town_sort_dirty;
+extern byte _town_sort_order;
+extern const Town **_town_sort;
-VARDEF Town *_cleared_town;
-VARDEF int _cleared_town_rating;
+extern Town *_cleared_town;
+extern int _cleared_town_rating;
uint OriginalTileRandomiser(uint x, uint y);
void ResetHouses();
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 2d84ae473..ed83f4884 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -44,6 +44,16 @@
#include "table/sprites.h"
#include "table/town_land.h"
+uint _total_towns;
+HouseSpec _house_specs[HOUSE_MAX];
+
+bool _town_sort_dirty;
+byte _town_sort_order;
+const Town **_town_sort;
+
+Town *_cleared_town;
+int _cleared_town_rating;
+
/* Initialize the town-pool */
DEFINE_OLD_POOL_GENERIC(Town, Town)
diff --git a/src/window.cpp b/src/window.cpp
index dba76b16a..0163f5bac 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -28,6 +28,19 @@ static Window _windows[MAX_NUMBER_OF_WINDOWS];
Window *_z_windows[lengthof(_windows)];
Window **_last_z_window; ///< always points to the next free space in the z-array
+Point _cursorpos_drag_start;
+
+int _scrollbar_start_pos;
+int _scrollbar_size;
+byte _scroller_click_timeout;
+
+bool _scrolling_scrollbar;
+bool _scrolling_viewport;
+bool _popup_menu_active;
+
+byte _special_mouse_mode;
+
+
void CDECL Window::SetWidgetsDisabledState(bool disab_stat, int widgets, ...)
{
va_list wdg_list;
diff --git a/src/window_gui.h b/src/window_gui.h
index 67b936115..bb7c23199 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -607,17 +607,17 @@ extern Window *_z_windows[];
extern Window **_last_z_window;
#define FOR_ALL_WINDOWS(wz) for (wz = _z_windows; wz != _last_z_window; wz++)
-VARDEF Point _cursorpos_drag_start;
+extern Point _cursorpos_drag_start;
-VARDEF int _scrollbar_start_pos;
-VARDEF int _scrollbar_size;
-VARDEF byte _scroller_click_timeout;
+extern int _scrollbar_start_pos;
+extern int _scrollbar_size;
+extern byte _scroller_click_timeout;
-VARDEF bool _scrolling_scrollbar;
-VARDEF bool _scrolling_viewport;
-VARDEF bool _popup_menu_active;
+extern bool _scrolling_scrollbar;
+extern bool _scrolling_viewport;
+extern bool _popup_menu_active;
-VARDEF byte _special_mouse_mode;
+extern byte _special_mouse_mode;
enum SpecialMouseMode {
WSM_NONE = 0,
WSM_DRAGDROP = 1,