(svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
rubidium 10 years ago
parent 287ecd1582
commit 0463dbdc9e

@ -60,6 +60,8 @@
#include "../../core/endian_func.hpp" #include "../../core/endian_func.hpp"
#include "md5.h" #include "md5.h"
#include "../../safeguards.h"
#define T_MASK ((uint32)~0) #define T_MASK ((uint32)~0)
#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) #define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) #define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)

@ -15,6 +15,8 @@
#include "ai_config.hpp" #include "ai_config.hpp"
#include "ai_info.hpp" #include "ai_info.hpp"
#include "../safeguards.h"
/** Configuration for AI start date, every AI has this setting. */ /** Configuration for AI start date, every AI has this setting. */
ScriptConfigItem _start_date_config = { ScriptConfigItem _start_date_config = {
"start_date", "start_date",

@ -22,6 +22,8 @@
#include "ai_info.hpp" #include "ai_info.hpp"
#include "ai.hpp" #include "ai.hpp"
#include "../safeguards.h"
/* static */ uint AI::frame_counter = 0; /* static */ uint AI::frame_counter = 0;
/* static */ AIScannerInfo *AI::scanner_info = NULL; /* static */ AIScannerInfo *AI::scanner_info = NULL;
/* static */ AIScannerLibrary *AI::scanner_library = NULL; /* static */ AIScannerLibrary *AI::scanner_library = NULL;

@ -40,11 +40,12 @@
#include "../game/game_info.hpp" #include "../game/game_info.hpp"
#include "../game/game_instance.hpp" #include "../game/game_instance.hpp"
#include "table/strings.h" #include "table/strings.h"
#include <vector> #include <vector>
#include "../safeguards.h"
static ScriptConfig *GetConfig(CompanyID slot) static ScriptConfig *GetConfig(CompanyID slot)
{ {
if (slot == OWNER_DEITY) return GameConfig::GetConfig(); if (slot == OWNER_DEITY) return GameConfig::GetConfig();

@ -17,6 +17,8 @@
#include "../debug.h" #include "../debug.h"
#include "../rev.h" #include "../rev.h"
#include "../safeguards.h"
/** /**
* Check if the API version provided by the AI is supported. * Check if the API version provided by the AI is supported.
* @param api_version The API version as provided by the AI. * @param api_version The API version as provided by the AI.

@ -82,6 +82,8 @@
#include "../company_base.h" #include "../company_base.h"
#include "../company_func.h" #include "../company_func.h"
#include "../safeguards.h"
AIInstance::AIInstance() : AIInstance::AIInstance() :
ScriptInstance("AI") ScriptInstance("AI")
{} {}

@ -18,6 +18,8 @@
#include "ai_info.hpp" #include "ai_info.hpp"
#include "ai_scanner.hpp" #include "ai_scanner.hpp"
#include "../safeguards.h"
AIScannerInfo::AIScannerInfo() : AIScannerInfo::AIScannerInfo() :
ScriptScanner(), ScriptScanner(),

@ -39,6 +39,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
static const int ROTOR_Z_OFFSET = 5; ///< Z Offset between helicopter- and rotorsprite. static const int ROTOR_Z_OFFSET = 5; ///< Z Offset between helicopter- and rotorsprite.
static const int PLANE_HOLDING_ALTITUDE = 150; ///< Altitude of planes in holding pattern (= lowest flight altitude). static const int PLANE_HOLDING_ALTITUDE = 150; ///< Altitude of planes in holding pattern (= lowest flight altitude).

@ -21,6 +21,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/** /**
* Draw the details for the given vehicle at the given position * Draw the details for the given vehicle at the given position
* *

@ -15,6 +15,8 @@
#include "table/airport_movement.h" #include "table/airport_movement.h"
#include "table/airporttile_ids.h" #include "table/airporttile_ids.h"
#include "safeguards.h"
/** /**
* Define a generic airport. * Define a generic airport.

@ -31,6 +31,8 @@
#include "widgets/airport_widget.h" #include "widgets/airport_widget.h"
#include "safeguards.h"
static AirportClassID _selected_airport_class; ///< the currently visible airport class static AirportClassID _selected_airport_class; ///< the currently visible airport class
static int _selected_airport_index; ///< the index of the selected airport in the current class or -1 static int _selected_airport_index; ///< the index of the selected airport in the current class or -1

@ -14,6 +14,8 @@
#include "tile_cmd.h" #include "tile_cmd.h"
#include "viewport_func.h" #include "viewport_func.h"
#include "safeguards.h"
/** The table/list with animated tiles. */ /** The table/list with animated tiles. */
TileIndex *_animated_tile_list = NULL; TileIndex *_animated_tile_list = NULL;
/** The number of animated tiles in the current state. */ /** The number of animated tiles in the current state. */

@ -19,6 +19,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts per vehicle, i.e. when to abort calling the articulated vehicle callback. static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts per vehicle, i.e. when to abort calling the articulated vehicle callback.
/** /**

@ -15,6 +15,8 @@
#include "autoreplace_base.h" #include "autoreplace_base.h"
#include "core/pool_func.hpp" #include "core/pool_func.hpp"
#include "safeguards.h"
/** The pool of autoreplace "orders". */ /** The pool of autoreplace "orders". */
EngineRenewPool _enginerenew_pool("EngineRenew"); EngineRenewPool _enginerenew_pool("EngineRenew");
INSTANTIATE_POOL_METHODS(EngineRenew) INSTANTIATE_POOL_METHODS(EngineRenew)

@ -22,6 +22,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
extern void ChangeVehicleViewports(VehicleID from_index, VehicleID to_index); extern void ChangeVehicleViewports(VehicleID from_index, VehicleID to_index);
extern void ChangeVehicleNews(VehicleID from_index, VehicleID to_index); extern void ChangeVehicleNews(VehicleID from_index, VehicleID to_index);
extern void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index); extern void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index);

@ -28,6 +28,8 @@
#include "widgets/autoreplace_widget.h" #include "widgets/autoreplace_widget.h"
#include "safeguards.h"
uint GetEngineListHeight(VehicleType type); uint GetEngineListHeight(VehicleType type);
void DrawEngineList(VehicleType type, int x, int r, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, bool show_count, GroupID selected_group); void DrawEngineList(VehicleType type, int x, int r, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, bool show_count, GroupID selected_group);

@ -13,6 +13,8 @@
#include "base_consist.h" #include "base_consist.h"
#include "vehicle_base.h" #include "vehicle_base.h"
#include "safeguards.h"
BaseConsist::~BaseConsist() BaseConsist::~BaseConsist()
{ {
free(this->name); free(this->name);

@ -15,6 +15,8 @@
#include "../table/sprites.h" #include "../table/sprites.h"
#include "../safeguards.h"
/** Instantiation of the 32bpp with animation blitter factory. */ /** Instantiation of the 32bpp with animation blitter factory. */
static FBlitter_32bppAnim iFBlitter_32bppAnim; static FBlitter_32bppAnim iFBlitter_32bppAnim;

@ -17,6 +17,8 @@
#include "32bpp_anim_sse4.hpp" #include "32bpp_anim_sse4.hpp"
#include "32bpp_sse_func.hpp" #include "32bpp_sse_func.hpp"
#include "../safeguards.h"
/** Instantiation of the SSE4 32bpp blitter factory. */ /** Instantiation of the SSE4 32bpp blitter factory. */
static FBlitter_32bppSSE4_Anim iFBlitter_32bppSSE4_Anim; static FBlitter_32bppSSE4_Anim iFBlitter_32bppSSE4_Anim;

@ -12,6 +12,8 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "32bpp_base.hpp" #include "32bpp_base.hpp"
#include "../safeguards.h"
void *Blitter_32bppBase::MoveTo(void *video, int x, int y) void *Blitter_32bppBase::MoveTo(void *video, int x, int y)
{ {
return (uint32 *)video + x + y * _screen.pitch; return (uint32 *)video + x + y * _screen.pitch;

@ -14,6 +14,8 @@
#include "../settings_type.h" #include "../settings_type.h"
#include "32bpp_optimized.hpp" #include "32bpp_optimized.hpp"
#include "../safeguards.h"
/** Instantiation of the optimized 32bpp blitter factory. */ /** Instantiation of the optimized 32bpp blitter factory. */
static FBlitter_32bppOptimized iFBlitter_32bppOptimized; static FBlitter_32bppOptimized iFBlitter_32bppOptimized;

@ -15,6 +15,8 @@
#include "../table/sprites.h" #include "../table/sprites.h"
#include "../safeguards.h"
/** Instantiation of the simple 32bpp blitter factory. */ /** Instantiation of the simple 32bpp blitter factory. */
static FBlitter_32bppSimple iFBlitter_32bppSimple; static FBlitter_32bppSimple iFBlitter_32bppSimple;

@ -17,6 +17,8 @@
#include "32bpp_sse2.hpp" #include "32bpp_sse2.hpp"
#include "32bpp_sse_func.hpp" #include "32bpp_sse_func.hpp"
#include "../safeguards.h"
/** Instantiation of the SSE2 32bpp blitter factory. */ /** Instantiation of the SSE2 32bpp blitter factory. */
static FBlitter_32bppSSE2 iFBlitter_32bppSSE2; static FBlitter_32bppSSE2 iFBlitter_32bppSSE2;

@ -17,6 +17,8 @@
#include "32bpp_sse4.hpp" #include "32bpp_sse4.hpp"
#include "32bpp_sse_func.hpp" #include "32bpp_sse_func.hpp"
#include "../safeguards.h"
/** Instantiation of the SSE4 32bpp blitter factory. */ /** Instantiation of the SSE4 32bpp blitter factory. */
static FBlitter_32bppSSE4 iFBlitter_32bppSSE4; static FBlitter_32bppSSE4 iFBlitter_32bppSSE4;

@ -17,6 +17,8 @@
#include "32bpp_ssse3.hpp" #include "32bpp_ssse3.hpp"
#include "32bpp_sse_func.hpp" #include "32bpp_sse_func.hpp"
#include "../safeguards.h"
/** Instantiation of the SSSE3 32bpp blitter factory. */ /** Instantiation of the SSSE3 32bpp blitter factory. */
static FBlitter_32bppSSSE3 iFBlitter_32bppSSSE3; static FBlitter_32bppSSSE3 iFBlitter_32bppSSSE3;

@ -13,6 +13,8 @@
#include "../gfx_func.h" #include "../gfx_func.h"
#include "8bpp_base.hpp" #include "8bpp_base.hpp"
#include "../safeguards.h"
void Blitter_8bppBase::DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) void Blitter_8bppBase::DrawColourMappingRect(void *dst, int width, int height, PaletteID pal)
{ {
const uint8 *ctab = GetNonSprite(pal, ST_RECOLOUR) + 1; const uint8 *ctab = GetNonSprite(pal, ST_RECOLOUR) + 1;

@ -15,6 +15,8 @@
#include "../core/math_func.hpp" #include "../core/math_func.hpp"
#include "8bpp_optimized.hpp" #include "8bpp_optimized.hpp"
#include "../safeguards.h"
/** Instantiation of the 8bpp optimised blitter factory. */ /** Instantiation of the 8bpp optimised blitter factory. */
static FBlitter_8bppOptimized iFBlitter_8bppOptimized; static FBlitter_8bppOptimized iFBlitter_8bppOptimized;

@ -13,6 +13,8 @@
#include "../zoom_func.h" #include "../zoom_func.h"
#include "8bpp_simple.hpp" #include "8bpp_simple.hpp"
#include "../safeguards.h"
/** Instantiation of the simple 8bpp blitter factory. */ /** Instantiation of the simple 8bpp blitter factory. */
static FBlitter_8bppSimple iFBlitter_8bppSimple; static FBlitter_8bppSimple iFBlitter_8bppSimple;

@ -13,6 +13,8 @@
#include "base.hpp" #include "base.hpp"
#include "../core/math_func.hpp" #include "../core/math_func.hpp"
#include "../safeguards.h"
void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
{ {
int dy; int dy;

@ -12,6 +12,8 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "null.hpp" #include "null.hpp"
#include "../safeguards.h"
/** Instantiation of the null blitter factory. */ /** Instantiation of the null blitter factory. */
static FBlitter_Null iFBlitter_Null; static FBlitter_Null iFBlitter_Null;

@ -15,6 +15,8 @@
#include "core/alloc_func.hpp" #include "core/alloc_func.hpp"
#include "core/mem_func.hpp" #include "core/mem_func.hpp"
#include "safeguards.h"
void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file) void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file)
{ {
buffer->pos = -1; buffer->pos = -1;

@ -29,6 +29,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/** Widgets for the background window to prevent smearing. */ /** Widgets for the background window to prevent smearing. */
static const struct NWidgetPart _background_widgets[] = { static const struct NWidgetPart _background_widgets[] = {
NWidget(WWT_PANEL, COLOUR_DARK_BLUE, WID_BB_BACKGROUND), SetResize(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_BLUE, WID_BB_BACKGROUND), SetResize(1, 1),

@ -29,6 +29,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/** The type of the last built rail bridge */ /** The type of the last built rail bridge */
static BridgeType _last_railbridge_type = 0; static BridgeType _last_railbridge_type = 0;
/** The type of the last built road bridge */ /** The type of the last built road bridge */

@ -13,6 +13,8 @@
#include "landscape.h" #include "landscape.h"
#include "tunnelbridge_map.h" #include "tunnelbridge_map.h"
#include "safeguards.h"
/** /**
* Finds the end of a bridge in the specified direction starting at a middle tile * Finds the end of a bridge in the specified direction starting at a middle tile

@ -37,6 +37,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/** /**
* Get the height of a single 'entry' in the engine lists. * Get the height of a single 'entry' in the engine lists.
* @param type the vehicle type to get the height of * @param type the vehicle type to get the height of

@ -14,6 +14,8 @@
#include "cargoaction.h" #include "cargoaction.h"
#include "station_base.h" #include "station_base.h"
#include "safeguards.h"
/** /**
* Decides if a packet needs to be split. * Decides if a packet needs to be split.
* @param cp Packet to be either split or moved in one piece. * @param cp Packet to be either split or moved in one piece.

@ -13,6 +13,8 @@
#include "cargomonitor.h" #include "cargomonitor.h"
#include "station_base.h" #include "station_base.h"
#include "safeguards.h"
CargoMonitorMap _cargo_pickups; ///< Map of monitored pick-ups to the amount since last query/activation. CargoMonitorMap _cargo_pickups; ///< Map of monitored pick-ups to the amount since last query/activation.
CargoMonitorMap _cargo_deliveries; ///< Map of monitored deliveries to the amount since last query/activation. CargoMonitorMap _cargo_deliveries; ///< Map of monitored deliveries to the amount since last query/activation.

@ -17,6 +17,8 @@
#include "cargoaction.h" #include "cargoaction.h"
#include "order_type.h" #include "order_type.h"
#include "safeguards.h"
/* Initialize the cargopacket-pool */ /* Initialize the cargopacket-pool */
CargoPacketPool _cargopacket_pool("CargoPacket"); CargoPacketPool _cargopacket_pool("CargoPacket");
INSTANTIATE_POOL_METHODS(CargoPacket) INSTANTIATE_POOL_METHODS(CargoPacket)

@ -20,6 +20,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "table/cargo_const.h" #include "table/cargo_const.h"
#include "safeguards.h"
CargoSpec CargoSpec::array[NUM_CARGO]; CargoSpec CargoSpec::array[NUM_CARGO];
/** /**

@ -12,6 +12,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "cheat_type.h" #include "cheat_type.h"
#include "safeguards.h"
/** All the cheats. */ /** All the cheats. */
Cheats _cheats; Cheats _cheats;

@ -30,6 +30,8 @@
#include "table/sprites.h" #include "table/sprites.h"
#include "safeguards.h"
/** /**
* The 'amount' to cheat with. * The 'amount' to cheat with.

@ -23,6 +23,8 @@
#include "table/sprites.h" #include "table/sprites.h"
#include "table/clear_land.h" #include "table/clear_land.h"
#include "safeguards.h"
static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlag flags) static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlag flags)
{ {
static const Price clear_price_table[] = { static const Price clear_price_table[] = {

@ -29,6 +29,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
CommandProc CmdBuildRailroadTrack; CommandProc CmdBuildRailroadTrack;
CommandProc CmdRemoveRailroadTrack; CommandProc CmdRemoveRailroadTrack;
CommandProc CmdBuildSingleRail; CommandProc CmdBuildSingleRail;

@ -39,6 +39,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
CompanyByte _local_company; ///< Company controlled by the human player at this client. Can also be #COMPANY_SPECTATOR. CompanyByte _local_company; ///< Company controlled by the human player at this client. Can also be #COMPANY_SPECTATOR.
CompanyByte _current_company; ///< Company currently doing an action. CompanyByte _current_company; ///< Company currently doing an action.
Colours _company_colours[MAX_COMPANIES]; ///< NOSAVE: can be determined from company structs. Colours _company_colours[MAX_COMPANIES]; ///< NOSAVE: can be determined from company structs.

@ -38,6 +38,8 @@
#include "widgets/company_widget.h" #include "widgets/company_widget.h"
#include "safeguards.h"
/** Company GUI constants. */ /** Company GUI constants. */
static const uint EXP_LINESPACE = 2; ///< Amount of vertical space for a horizontal (sub-)total line. static const uint EXP_LINESPACE = 2; ///< Amount of vertical space for a horizontal (sub-)total line.

@ -20,6 +20,8 @@
#include <stdarg.h> #include <stdarg.h>
#include "safeguards.h"
static const uint ICON_TOKEN_COUNT = 20; ///< Maximum number of tokens in one command static const uint ICON_TOKEN_COUNT = 20; ///< Maximum number of tokens in one command
/* console parser */ /* console parser */

@ -40,6 +40,8 @@
#include "game/game.hpp" #include "game/game.hpp"
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/* scriptfile handling */ /* scriptfile handling */
static bool _script_running; ///< Script is running (used to abort execution when #ConReturn is encountered). static bool _script_running; ///< Script is running (used to abort execution when #ConReturn is encountered).

@ -27,6 +27,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
static const uint ICON_HISTORY_SIZE = 20; static const uint ICON_HISTORY_SIZE = 20;
static const uint ICON_LINE_SPACING = 2; static const uint ICON_LINE_SPACING = 2;
static const uint ICON_RIGHT_BORDERWIDTH = 10; static const uint ICON_RIGHT_BORDERWIDTH = 10;

@ -11,6 +11,8 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "../safeguards.h"
/** /**
* Function to exit with an error message after malloc() or calloc() have failed * Function to exit with an error message after malloc() or calloc() have failed
* @param size number of bytes we tried to allocate * @param size number of bytes we tried to allocate

@ -12,6 +12,8 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "bitmath_func.hpp" #include "bitmath_func.hpp"
#include "../safeguards.h"
const uint8 _ffb_64[64] = { const uint8 _ffb_64[64] = {
0, 0, 1, 0, 2, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0,
3, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,

@ -13,6 +13,8 @@
#include "geometry_func.hpp" #include "geometry_func.hpp"
#include "math_func.hpp" #include "math_func.hpp"
#include "../safeguards.h"
/** /**
* Compute bounding box of both dimensions. * Compute bounding box of both dimensions.
* @param d1 First dimension. * @param d1 First dimension.

@ -12,6 +12,8 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "math_func.hpp" #include "math_func.hpp"
#include "../safeguards.h"
/** /**
* Compute least common multiple (lcm) of arguments \a a and \a b, the smallest * Compute least common multiple (lcm) of arguments \a a and \a b, the smallest
* integer value that is a multiple of both \a a and \a b. * integer value that is a multiple of both \a a and \a b.

@ -12,6 +12,8 @@
#include "../stdafx.h" #include "../stdafx.h"
#include "pool_type.hpp" #include "pool_type.hpp"
#include "../safeguards.h"
/** /**
* Destructor removes this object from the pool vector and * Destructor removes this object from the pool vector and
* deletes the vector itself if this was the last item removed. * deletes the vector itself if this was the last item removed.

@ -13,6 +13,8 @@
#include "random_func.hpp" #include "random_func.hpp"
#include "bitmath_func.hpp" #include "bitmath_func.hpp"
#include "../safeguards.h"
Randomizer _random, _interactive_random; Randomizer _random, _interactive_random;
/** /**

@ -12,6 +12,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "core/bitmath_func.hpp" #include "core/bitmath_func.hpp"
#include "safeguards.h"
#undef RDTSC_AVAILABLE #undef RDTSC_AVAILABLE
/* rdtsc for MSC_VER, uses simple inline assembly, or _rdtsc /* rdtsc for MSC_VER, uses simple inline assembly, or _rdtsc

@ -36,6 +36,8 @@
#include <time.h> #include <time.h>
#include "safeguards.h"
/* static */ const char *CrashLog::message = NULL; /* static */ const char *CrashLog::message = NULL;
/* static */ char *CrashLog::gamelog_buffer = NULL; /* static */ char *CrashLog::gamelog_buffer = NULL;
/* static */ const char *CrashLog::gamelog_last = NULL; /* static */ const char *CrashLog::gamelog_last = NULL;

@ -20,6 +20,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/* exchange rate prefix symbol_pos /* exchange rate prefix symbol_pos
* | separator | postfix | * | separator | postfix |
* | | Euro year | | | name * | | Euro year | | | name

@ -21,6 +21,8 @@
#include "linkgraph/linkgraph.h" #include "linkgraph/linkgraph.h"
#include "saveload/saveload.h" #include "saveload/saveload.h"
#include "safeguards.h"
Year _cur_year; ///< Current year, starting at 0 Year _cur_year; ///< Current year, starting at 0
Month _cur_month; ///< Current month (0..11) Month _cur_month; ///< Current month (0..11)
Date _date; ///< Current date in days (day counter) Date _date; ///< Current date in days (day counter)

@ -20,6 +20,8 @@
#include "widgets/dropdown_type.h" #include "widgets/dropdown_type.h"
#include "widgets/date_widget.h" #include "widgets/date_widget.h"
#include "safeguards.h"
/** Window to select a date graphically by using dropdowns */ /** Window to select a date graphically by using dropdowns */
struct SetDateWindow : Window { struct SetDateWindow : Window {

@ -24,6 +24,8 @@
SOCKET _debug_socket = INVALID_SOCKET; SOCKET _debug_socket = INVALID_SOCKET;
#endif /* ENABLE_NETWORK */ #endif /* ENABLE_NETWORK */
#include "safeguards.h"
int _debug_driver_level; int _debug_driver_level;
int _debug_grf_level; int _debug_grf_level;
int _debug_map_level; int _debug_map_level;

@ -20,6 +20,8 @@ FILE *_log_fd = NULL; ///< File to reroute output of a forked OpenTTD to
#include <unistd.h> #include <unistd.h>
#include "safeguards.h"
#if (defined(SUNOS) && !defined(_LP64) && !defined(_I32LPx)) || defined(__HAIKU__) #if (defined(SUNOS) && !defined(_LP64) && !defined(_I32LPx)) || defined(__HAIKU__)
/* Solaris has, in certain situation, pid_t defined as long, while in other /* Solaris has, in certain situation, pid_t defined as long, while in other
* cases it has it defined as int... this handles all cases nicely. * cases it has it defined as int... this handles all cases nicely.

@ -18,6 +18,8 @@
#include "vehicle_gui.h" #include "vehicle_gui.h"
#include "vehiclelist.h" #include "vehiclelist.h"
#include "safeguards.h"
/** All our depots tucked away in a pool. */ /** All our depots tucked away in a pool. */
DepotPool _depot_pool("Depot"); DepotPool _depot_pool("Depot");
INSTANTIATE_POOL_METHODS(Depot) INSTANTIATE_POOL_METHODS(Depot)

@ -21,6 +21,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/** /**
* Check whether the given name is globally unique amongst depots. * Check whether the given name is globally unique amongst depots.
* @param name The name to check. * @param name The name to check.

@ -33,6 +33,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/* /*
* Since all depot window sizes aren't the same, we need to modify sizes a little. * Since all depot window sizes aren't the same, we need to modify sizes a little.
* It's done with the following arrays of widget indexes. Each of them tells if a widget side should be moved and in what direction. * It's done with the following arrays of widget indexes. Each of them tells if a widget side should be moved and in what direction.

@ -47,6 +47,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/** Delay counter for considering the next disaster. */ /** Delay counter for considering the next disaster. */
uint16 _disaster_delay; uint16 _disaster_delay;

@ -32,6 +32,8 @@
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
static void ShowBuildDockStationPicker(Window *parent); static void ShowBuildDockStationPicker(Window *parent);
static void ShowBuildDocksDepotPicker(Window *parent); static void ShowBuildDocksDepotPicker(Window *parent);

@ -16,6 +16,8 @@
#include "video/video_driver.hpp" #include "video/video_driver.hpp"
#include "string_func.h" #include "string_func.h"
#include "safeguards.h"
VideoDriver *_video_driver; ///< The currently active video driver. VideoDriver *_video_driver; ///< The currently active video driver.
char *_ini_videodriver; ///< The video driver a stored in the configuration file. char *_ini_videodriver; ///< The video driver a stored in the configuration file.
int _num_resolutions; ///< The number of resolutions. int _num_resolutions; ///< The number of resolutions.

@ -53,6 +53,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "table/pricebase.h" #include "table/pricebase.h"
#include "safeguards.h"
/* Initialize the cargo payment-pool */ /* Initialize the cargo payment-pool */
CargoPaymentPool _cargo_payment_pool("CargoPayment"); CargoPaymentPool _cargo_payment_pool("CargoPayment");

@ -19,6 +19,8 @@
#include "effectvehicle_func.h" #include "effectvehicle_func.h"
#include "effectvehicle_base.h" #include "effectvehicle_base.h"
#include "safeguards.h"
static void ChimneySmokeInit(EffectVehicle *v) static void ChimneySmokeInit(EffectVehicle *v)
{ {

@ -67,6 +67,8 @@
#include "table/elrail_data.h" #include "table/elrail_data.h"
#include "safeguards.h"
/** /**
* Get the tile location group of a tile. * Get the tile location group of a tile.
* @param t The tile to get the tile location group of. * @param t The tile to get the tile location group of.

@ -35,6 +35,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "table/engines.h" #include "table/engines.h"
#include "safeguards.h"
EnginePool _engine_pool("Engine"); EnginePool _engine_pool("Engine");
INSTANTIATE_POOL_METHODS(Engine) INSTANTIATE_POOL_METHODS(Engine)

@ -25,6 +25,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/** /**
* Return the category of an engine. * Return the category of an engine.
* @param engine Engine to examine. * @param engine Engine to examine.

@ -29,6 +29,8 @@
#include "table/strings.h" #include "table/strings.h"
#include <list> #include <list>
#include "safeguards.h"
static const NWidgetPart _nested_errmsg_widgets[] = { static const NWidgetPart _nested_errmsg_widgets[] = {
NWidget(NWID_HORIZONTAL), NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_RED), NWidget(WWT_CLOSEBOX, COLOUR_RED),

@ -32,6 +32,8 @@
#include "basedir.h" #include "basedir.h"
#endif #endif
#include "safeguards.h"
/** Size of the #Fio data buffer. */ /** Size of the #Fio data buffer. */
#define FIO_BUFFER_SIZE 512 #define FIO_BUFFER_SIZE 512

@ -26,6 +26,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/* Variables to display file lists */ /* Variables to display file lists */
SmallVector<FiosItem, 32> _fios_items; SmallVector<FiosItem, 32> _fios_items;
static char *_fios_path; static char *_fios_path;

@ -34,6 +34,8 @@
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
SaveLoadDialogMode _saveload_mode; SaveLoadDialogMode _saveload_mode;
LoadCheckData _load_check_data; ///< Data loaded from save during SL_LOAD_CHECK. LoadCheckData _load_check_data; ///< Data loaded from save during SL_LOAD_CHECK.

@ -23,6 +23,8 @@
#include "table/control_codes.h" #include "table/control_codes.h"
#include "table/unicode.h" #include "table/unicode.h"
#include "safeguards.h"
static const int ASCII_LETTERSTART = 32; ///< First printable ASCII letter. static const int ASCII_LETTERSTART = 32; ///< First printable ASCII letter.
static const int MAX_FONT_SIZE = 72; ///< Maximum font size. static const int MAX_FONT_SIZE = 72; ///< Maximum font size.

@ -35,6 +35,8 @@ extern FT_Library _library;
#include <shlobj.h> /* SHGetFolderPath */ #include <shlobj.h> /* SHGetFolderPath */
#include "os/windows/win32.h" #include "os/windows/win32.h"
#include "safeguards.h"
/** /**
* Get the short DOS 8.3 format for paths. * Get the short DOS 8.3 format for paths.
* FreeType doesn't support Unicode filenames and Windows' fopen (as used * FreeType doesn't support Unicode filenames and Windows' fopen (as used
@ -373,6 +375,8 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
#include "os/macosx/macos.h" #include "os/macosx/macos.h"
#include "safeguards.h"
FT_Error GetFontByFaceName(const char *font_name, FT_Face *face) FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
{ {
FT_Error err = FT_Err_Cannot_Open_Resource; FT_Error err = FT_Err_Cannot_Open_Resource;
@ -542,6 +546,8 @@ bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, i
#include <fontconfig/fontconfig.h> #include <fontconfig/fontconfig.h>
#include "safeguards.h"
/* ======================================================================================== /* ========================================================================================
* FontConfig (unix) support * FontConfig (unix) support
* ======================================================================================== */ * ======================================================================================== */

@ -15,6 +15,8 @@
#include "game_config.hpp" #include "game_config.hpp"
#include "game_info.hpp" #include "game_info.hpp"
#include "../safeguards.h"
/* static */ GameConfig *GameConfig::GetConfig(ScriptSettingSource source) /* static */ GameConfig *GameConfig::GetConfig(ScriptSettingSource source)
{ {
GameConfig **config; GameConfig **config;

@ -21,6 +21,8 @@
#include "game_instance.hpp" #include "game_instance.hpp"
#include "game_info.hpp" #include "game_info.hpp"
#include "../safeguards.h"
/* static */ uint Game::frame_counter = 0; /* static */ uint Game::frame_counter = 0;
/* static */ GameInfo *Game::info = NULL; /* static */ GameInfo *Game::info = NULL;
/* static */ GameInstance *Game::instance = NULL; /* static */ GameInstance *Game::instance = NULL;

@ -16,6 +16,8 @@
#include "game_scanner.hpp" #include "game_scanner.hpp"
#include "../debug.h" #include "../debug.h"
#include "../safeguards.h"
/** /**
* Check if the API version provided by the Game is supported. * Check if the API version provided by the Game is supported.
* @param api_version The API version as provided by the Game. * @param api_version The API version as provided by the Game.

@ -85,6 +85,8 @@
#include "../script/api/game/game_waypointlist.hpp.sq" #include "../script/api/game/game_waypointlist.hpp.sq"
#include "../script/api/game/game_window.hpp.sq" #include "../script/api/game/game_window.hpp.sq"
#include "../safeguards.h"
GameInstance::GameInstance() : GameInstance::GameInstance() :
ScriptInstance("GS") ScriptInstance("GS")

@ -15,6 +15,8 @@
#include "game_info.hpp" #include "game_info.hpp"
#include "game_scanner.hpp" #include "game_scanner.hpp"
#include "../safeguards.h"
void GameScannerInfo::Initialize() void GameScannerInfo::Initialize()
{ {

@ -24,6 +24,8 @@
#include <stdarg.h> #include <stdarg.h>
#include "../safeguards.h"
void CDECL strgen_warning(const char *s, ...) void CDECL strgen_warning(const char *s, ...)
{ {
char buf[1024]; char buf[1024];

@ -21,6 +21,8 @@
#include <stdarg.h> #include <stdarg.h>
#include "safeguards.h"
extern const uint16 SAVEGAME_VERSION; ///< current savegame version extern const uint16 SAVEGAME_VERSION; ///< current savegame version
extern SavegameType _savegame_type; ///< type of savegame we are loading extern SavegameType _savegame_type; ///< type of savegame we are loading

@ -34,6 +34,8 @@
#include "game/game.hpp" #include "game/game.hpp"
#include "game/game_instance.hpp" #include "game/game_instance.hpp"
#include "safeguards.h"
void GenerateClearTile(); void GenerateClearTile();
void GenerateIndustries(); void GenerateIndustries();

@ -32,6 +32,8 @@
#include "widgets/genworld_widget.h" #include "widgets/genworld_widget.h"
#include "safeguards.h"
extern void MakeNewgameSettingsLive(); extern void MakeNewgameSettingsLive();

@ -26,6 +26,8 @@
#include "table/sprites.h" #include "table/sprites.h"
#include "table/control_codes.h" #include "table/control_codes.h"
#include "safeguards.h"
byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down
bool _fullscreen; bool _fullscreen;
CursorVars _cursor; CursorVars _cursor;

@ -21,6 +21,8 @@
#include <unicode/ustring.h> #include <unicode/ustring.h>
#endif /* WITH_ICU */ #endif /* WITH_ICU */
#include "safeguards.h"
/** Cache of ParagraphLayout lines. */ /** Cache of ParagraphLayout lines. */
Layouter::LineCache *Layouter::linecache; Layouter::LineCache *Layouter::linecache;

@ -25,6 +25,8 @@
#include "table/sprites.h" #include "table/sprites.h"
#include "safeguards.h"
/** Whether the given NewGRFs must get a palette remap from windows to DOS or not. */ /** Whether the given NewGRFs must get a palette remap from windows to DOS or not. */
bool _palette_remap_grf[MAX_FILE_SLOTS]; bool _palette_remap_grf[MAX_FILE_SLOTS];

@ -24,6 +24,8 @@
#include "gui.h" #include "gui.h"
#include "network/network.h" #include "network/network.h"
#include "safeguards.h"
GoalID _new_goal_id; GoalID _new_goal_id;

@ -28,6 +28,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/** Goal list columns. */ /** Goal list columns. */
enum GoalColumn { enum GoalColumn {
GC_GOAL = 0, ///< Goal text column. GC_GOAL = 0, ///< Goal text column.

@ -30,6 +30,8 @@
#include "table/sprites.h" #include "table/sprites.h"
#include <math.h> #include <math.h>
#include "safeguards.h"
/* Bitmasks of company and cargo indices that shouldn't be drawn. */ /* Bitmasks of company and cargo indices that shouldn't be drawn. */
static uint _legend_excluded_companies; static uint _legend_excluded_companies;
static uint _legend_excluded_cargo; static uint _legend_excluded_cargo;

@ -14,6 +14,8 @@
#include "roadveh.h" #include "roadveh.h"
#include "depot_map.h" #include "depot_map.h"
#include "safeguards.h"
/** /**
* Recalculates the cached total power of a vehicle. Should be called when the consist is changed. * Recalculates the cached total power of a vehicle. Should be called when the consist is changed.
*/ */

@ -24,6 +24,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
GroupID _new_group_id; GroupID _new_group_id;
GroupPool _group_pool("Group"); GroupPool _group_pool("Group");

@ -30,6 +30,8 @@
#include "table/sprites.h" #include "table/sprites.h"
#include "safeguards.h"
static const int LEVEL_WIDTH = 10; ///< Indenting width of a sub-group in pixels static const int LEVEL_WIDTH = 10; ///< Indenting width of a sub-group in pixels
typedef GUIList<const Group*> GUIGroupList; typedef GUIList<const Group*> GUIGroupList;

@ -22,6 +22,8 @@
#include "table/strings.h" #include "table/strings.h"
#include "safeguards.h"
/** /**
* Convert RGB colours to Grayscale using 29.9% Red, 58.7% Green, 11.4% Blue * Convert RGB colours to Grayscale using 29.9% Red, 58.7% Green, 11.4% Blue
* (average luminosity formula, NTSC Colour Space) * (average luminosity formula, NTSC Colour Space)

@ -20,6 +20,8 @@
#include "core/sort_func.hpp" #include "core/sort_func.hpp"
#include "debug.h" #include "debug.h"
#include "safeguards.h"
HighScore _highscore_table[SP_HIGHSCORE_END][5]; ///< various difficulty-settings; top 5 HighScore _highscore_table[SP_HIGHSCORE_END][5]; ///< various difficulty-settings; top 5
char *_highscore_file; ///< The file to store the highscore data in. char *_highscore_file; ///< The file to store the highscore data in.

@ -25,6 +25,8 @@
#include "widgets/highscore_widget.h" #include "widgets/highscore_widget.h"
#include "safeguards.h"
struct EndGameHighScoreBaseWindow : Window { struct EndGameHighScoreBaseWindow : Window {
uint32 background_img; uint32 background_img;
int8 rank; int8 rank;

@ -16,6 +16,8 @@
#include "string_func.h" #include "string_func.h"
#include "window_gui.h" #include "window_gui.h"
#include "safeguards.h"
char *_hotkeys_file; char *_hotkeys_file;
/** /**

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save