mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
This commit is contained in:
parent
b0c34f4d62
commit
5c4150d304
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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++)
|
||||
|
||||
|
|
|
@ -112,7 +112,6 @@ void ShowMusicWindow();
|
|||
|
||||
/* main_gui.cpp */
|
||||
void HandleOnEditText(const char *str);
|
||||
VARDEF bool _station_show_coverage;
|
||||
|
||||
void InitializeGUI();
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
#include "table/strings.h"
|
||||
|
||||
TileIndex _backup_orders_tile;
|
||||
BackuppedOrders _backup_orders_data;
|
||||
|
||||
DEFINE_OLD_POOL_GENERIC(Order, Order)
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
19
src/town.h
19
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();
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue