Changeset - r21383:942c32fb8b0e
[Not reviewed]
master
! ! !
rubidium - 10 years ago 2014-04-23 20:13:33
rubidium@openttd.org
(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
402 files changed with 873 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/3rdparty/md5/md5.cpp
Show inline comments
 
@@ -60,6 +60,8 @@
 
#include "../../core/endian_func.hpp"
 
#include "md5.h"
 

	
 
#include "../../safeguards.h"
 

	
 
#define T_MASK ((uint32)~0)
 
#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
 
#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)
src/ai/ai_config.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "ai_config.hpp"
 
#include "ai_info.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/** Configuration for AI start date, every AI has this setting. */
 
ScriptConfigItem _start_date_config = {
 
	"start_date",
src/ai/ai_core.cpp
Show inline comments
 
@@ -22,6 +22,8 @@
 
#include "ai_info.hpp"
 
#include "ai.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/* static */ uint AI::frame_counter = 0;
 
/* static */ AIScannerInfo *AI::scanner_info = NULL;
 
/* static */ AIScannerLibrary *AI::scanner_library = NULL;
src/ai/ai_gui.cpp
Show inline comments
 
@@ -40,11 +40,12 @@
 
#include "../game/game_info.hpp"
 
#include "../game/game_instance.hpp"
 

	
 

	
 
#include "table/strings.h"
 

	
 
#include <vector>
 

	
 
#include "../safeguards.h"
 

	
 
static ScriptConfig *GetConfig(CompanyID slot)
 
{
 
	if (slot == OWNER_DEITY) return GameConfig::GetConfig();
src/ai/ai_info.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "../debug.h"
 
#include "../rev.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Check if the API version provided by the AI is supported.
 
 * @param api_version The API version as provided by the AI.
src/ai/ai_instance.cpp
Show inline comments
 
@@ -82,6 +82,8 @@
 
#include "../company_base.h"
 
#include "../company_func.h"
 

	
 
#include "../safeguards.h"
 

	
 
AIInstance::AIInstance() :
 
	ScriptInstance("AI")
 
{}
src/ai/ai_scanner.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "ai_info.hpp"
 
#include "ai_scanner.hpp"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
AIScannerInfo::AIScannerInfo() :
 
	ScriptScanner(),
src/aircraft_cmd.cpp
Show inline comments
 
@@ -39,6 +39,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
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).
src/aircraft_gui.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Draw the details for the given vehicle at the given position
 
 *
src/airport.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "table/airport_movement.h"
 
#include "table/airporttile_ids.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/**
 
 * Define a generic airport.
src/airport_gui.cpp
Show inline comments
 
@@ -31,6 +31,8 @@
 

	
 
#include "widgets/airport_widget.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
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
src/animated_tile.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "tile_cmd.h"
 
#include "viewport_func.h"
 

	
 
#include "safeguards.h"
 

	
 
/** The table/list with animated tiles. */
 
TileIndex *_animated_tile_list = NULL;
 
/** The number of animated tiles in the current state. */
src/articulated_vehicles.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 

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

	
 
/**
src/autoreplace.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "autoreplace_base.h"
 
#include "core/pool_func.hpp"
 

	
 
#include "safeguards.h"
 

	
 
/** The pool of autoreplace "orders". */
 
EngineRenewPool _enginerenew_pool("EngineRenew");
 
INSTANTIATE_POOL_METHODS(EngineRenew)
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -22,6 +22,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
extern void ChangeVehicleViewports(VehicleID from_index, VehicleID to_index);
 
extern void ChangeVehicleNews(VehicleID from_index, VehicleID to_index);
 
extern void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index);
src/autoreplace_gui.cpp
Show inline comments
 
@@ -28,6 +28,8 @@
 

	
 
#include "widgets/autoreplace_widget.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
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);
src/base_consist.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "base_consist.h"
 
#include "vehicle_base.h"
 

	
 
#include "safeguards.h"
 

	
 
BaseConsist::~BaseConsist()
 
{
 
	free(this->name);
src/blitter/32bpp_anim.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 

	
 
#include "../table/sprites.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Instantiation of the 32bpp with animation blitter factory. */
 
static FBlitter_32bppAnim iFBlitter_32bppAnim;
 

	
src/blitter/32bpp_anim_sse4.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "32bpp_anim_sse4.hpp"
 
#include "32bpp_sse_func.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/** Instantiation of the SSE4 32bpp blitter factory. */
 
static FBlitter_32bppSSE4_Anim iFBlitter_32bppSSE4_Anim;
 

	
src/blitter/32bpp_base.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../stdafx.h"
 
#include "32bpp_base.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
void *Blitter_32bppBase::MoveTo(void *video, int x, int y)
 
{
 
	return (uint32 *)video + x + y * _screen.pitch;
src/blitter/32bpp_optimized.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "../settings_type.h"
 
#include "32bpp_optimized.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/** Instantiation of the optimized 32bpp blitter factory. */
 
static FBlitter_32bppOptimized iFBlitter_32bppOptimized;
 

	
src/blitter/32bpp_simple.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 

	
 
#include "../table/sprites.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Instantiation of the simple 32bpp blitter factory. */
 
static FBlitter_32bppSimple iFBlitter_32bppSimple;
 

	
src/blitter/32bpp_sse2.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "32bpp_sse2.hpp"
 
#include "32bpp_sse_func.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/** Instantiation of the SSE2 32bpp blitter factory. */
 
static FBlitter_32bppSSE2 iFBlitter_32bppSSE2;
 

	
src/blitter/32bpp_sse4.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "32bpp_sse4.hpp"
 
#include "32bpp_sse_func.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/** Instantiation of the SSE4 32bpp blitter factory. */
 
static FBlitter_32bppSSE4 iFBlitter_32bppSSE4;
 

	
src/blitter/32bpp_ssse3.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "32bpp_ssse3.hpp"
 
#include "32bpp_sse_func.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/** Instantiation of the SSSE3 32bpp blitter factory. */
 
static FBlitter_32bppSSSE3 iFBlitter_32bppSSSE3;
 

	
src/blitter/8bpp_base.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "../gfx_func.h"
 
#include "8bpp_base.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
void Blitter_8bppBase::DrawColourMappingRect(void *dst, int width, int height, PaletteID pal)
 
{
 
	const uint8 *ctab = GetNonSprite(pal, ST_RECOLOUR) + 1;
src/blitter/8bpp_optimized.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../core/math_func.hpp"
 
#include "8bpp_optimized.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/** Instantiation of the 8bpp optimised blitter factory. */
 
static FBlitter_8bppOptimized iFBlitter_8bppOptimized;
 

	
src/blitter/8bpp_simple.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "../zoom_func.h"
 
#include "8bpp_simple.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/** Instantiation of the simple 8bpp blitter factory. */
 
static FBlitter_8bppSimple iFBlitter_8bppSimple;
 

	
src/blitter/base.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "base.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)
 
{
 
	int dy;
src/blitter/null.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../stdafx.h"
 
#include "null.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/** Instantiation of the null blitter factory. */
 
static FBlitter_Null iFBlitter_Null;
 

	
src/bmp.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "core/alloc_func.hpp"
 
#include "core/mem_func.hpp"
 

	
 
#include "safeguards.h"
 

	
 
void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file)
 
{
 
	buffer->pos      = -1;
src/bootstrap_gui.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Widgets for the background window to prevent smearing. */
 
static const struct NWidgetPart _background_widgets[] = {
 
	NWidget(WWT_PANEL, COLOUR_DARK_BLUE, WID_BB_BACKGROUND), SetResize(1, 1),
src/bridge_gui.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** The type of the last built rail bridge */
 
static BridgeType _last_railbridge_type = 0;
 
/** The type of the last built road bridge */
src/bridge_map.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "landscape.h"
 
#include "tunnelbridge_map.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/**
 
 * Finds the end of a bridge in the specified direction starting at a middle tile
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -37,6 +37,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Get the height of a single 'entry' in the engine lists.
 
 * @param type the vehicle type to get the height of
src/cargoaction.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "cargoaction.h"
 
#include "station_base.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Decides if a packet needs to be split.
 
 * @param cp Packet to be either split or moved in one piece.
src/cargomonitor.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "cargomonitor.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_deliveries; ///< Map of monitored deliveries to the amount since last query/activation.
 

	
src/cargopacket.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "cargoaction.h"
 
#include "order_type.h"
 

	
 
#include "safeguards.h"
 

	
 
/* Initialize the cargopacket-pool */
 
CargoPacketPool _cargopacket_pool("CargoPacket");
 
INSTANTIATE_POOL_METHODS(CargoPacket)
src/cargotype.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "table/strings.h"
 
#include "table/cargo_const.h"
 

	
 
#include "safeguards.h"
 

	
 
CargoSpec CargoSpec::array[NUM_CARGO];
 

	
 
/**
src/cheat.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "stdafx.h"
 
#include "cheat_type.h"
 

	
 
#include "safeguards.h"
 

	
 
/** All the cheats. */
 
Cheats _cheats;
 

	
src/cheat_gui.cpp
Show inline comments
 
@@ -30,6 +30,8 @@
 

	
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/**
 
 * The 'amount' to cheat with.
src/clear_cmd.cpp
Show inline comments
 
@@ -23,6 +23,8 @@
 
#include "table/sprites.h"
 
#include "table/clear_land.h"
 

	
 
#include "safeguards.h"
 

	
 
static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlag flags)
 
{
 
	static const Price clear_price_table[] = {
src/command.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
CommandProc CmdBuildRailroadTrack;
 
CommandProc CmdRemoveRailroadTrack;
 
CommandProc CmdBuildSingleRail;
src/company_cmd.cpp
Show inline comments
 
@@ -39,6 +39,8 @@
 

	
 
#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 _current_company; ///< Company currently doing an action.
 
Colours _company_colours[MAX_COMPANIES];  ///< NOSAVE: can be determined from company structs.
src/company_gui.cpp
Show inline comments
 
@@ -38,6 +38,8 @@
 

	
 
#include "widgets/company_widget.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/** Company GUI constants. */
 
static const uint EXP_LINESPACE  = 2;      ///< Amount of vertical space for a horizontal (sub-)total line.
src/console.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 

	
 
#include <stdarg.h>
 

	
 
#include "safeguards.h"
 

	
 
static const uint ICON_TOKEN_COUNT = 20;     ///< Maximum number of tokens in one command
 

	
 
/* console parser */
src/console_cmds.cpp
Show inline comments
 
@@ -40,6 +40,8 @@
 
#include "game/game.hpp"
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/* scriptfile handling */
 
static bool _script_running; ///< Script is running (used to abort execution when #ConReturn is encountered).
 

	
src/console_gui.cpp
Show inline comments
 
@@ -27,6 +27,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
static const uint ICON_HISTORY_SIZE       = 20;
 
static const uint ICON_LINE_SPACING       =  2;
 
static const uint ICON_RIGHT_BORDERWIDTH  = 10;
src/core/alloc_func.cpp
Show inline comments
 
@@ -11,6 +11,8 @@
 

	
 
#include "../stdafx.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Function to exit with an error message after malloc() or calloc() have failed
 
 * @param size number of bytes we tried to allocate
src/core/bitmath_func.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../stdafx.h"
 
#include "bitmath_func.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
const uint8 _ffb_64[64] = {
 
	0,  0,  1,  0,  2,  0,  1,  0,
 
	3,  0,  1,  0,  2,  0,  1,  0,
src/core/geometry_func.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "geometry_func.hpp"
 
#include "math_func.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Compute bounding box of both dimensions.
 
 * @param d1 First dimension.
src/core/math_func.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../stdafx.h"
 
#include "math_func.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * 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.
src/core/pool_func.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../stdafx.h"
 
#include "pool_type.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Destructor removes this object from the pool vector and
 
 * deletes the vector itself if this was the last item removed.
src/core/random_func.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "random_func.hpp"
 
#include "bitmath_func.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
Randomizer _random, _interactive_random;
 

	
 
/**
src/cpu.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "stdafx.h"
 
#include "core/bitmath_func.hpp"
 

	
 
#include "safeguards.h"
 

	
 
#undef RDTSC_AVAILABLE
 

	
 
/* rdtsc for MSC_VER, uses simple inline assembly, or _rdtsc
src/crashlog.cpp
Show inline comments
 
@@ -36,6 +36,8 @@
 

	
 
#include <time.h>
 

	
 
#include "safeguards.h"
 

	
 
/* static */ const char *CrashLog::message = NULL;
 
/* static */ char *CrashLog::gamelog_buffer = NULL;
 
/* static */ const char *CrashLog::gamelog_last = NULL;
src/currency.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
	/*   exchange rate    prefix                         symbol_pos
 
	 *   |  separator        |           postfix             |
 
	 *   |   |   Euro year   |              |                | name
src/date.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 
#include "linkgraph/linkgraph.h"
 
#include "saveload/saveload.h"
 

	
 
#include "safeguards.h"
 

	
 
Year      _cur_year;   ///< Current year, starting at 0
 
Month     _cur_month;  ///< Current month (0..11)
 
Date      _date;       ///< Current date in days (day counter)
src/date_gui.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "widgets/dropdown_type.h"
 
#include "widgets/date_widget.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/** Window to select a date graphically by using dropdowns */
 
struct SetDateWindow : Window {
src/debug.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
SOCKET _debug_socket = INVALID_SOCKET;
 
#endif /* ENABLE_NETWORK */
 

	
 
#include "safeguards.h"
 

	
 
int _debug_driver_level;
 
int _debug_grf_level;
 
int _debug_map_level;
src/dedicated.cpp
Show inline comments
 
@@ -20,6 +20,8 @@ FILE *_log_fd   = NULL; ///< File to rer
 

	
 
#include <unistd.h>
 

	
 
#include "safeguards.h"
 

	
 
#if (defined(SUNOS) && !defined(_LP64) && !defined(_I32LPx)) || defined(__HAIKU__)
 
/* 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.
src/depot.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "vehicle_gui.h"
 
#include "vehiclelist.h"
 

	
 
#include "safeguards.h"
 

	
 
/** All our depots tucked away in a pool. */
 
DepotPool _depot_pool("Depot");
 
INSTANTIATE_POOL_METHODS(Depot)
src/depot_cmd.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Check whether the given name is globally unique amongst depots.
 
 * @param name The name to check.
src/depot_gui.cpp
Show inline comments
 
@@ -33,6 +33,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/*
 
 * 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.
src/disaster_cmd.cpp
Show inline comments
 
@@ -47,6 +47,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Delay counter for considering the next disaster. */
 
uint16 _disaster_delay;
 

	
src/dock_gui.cpp
Show inline comments
 
@@ -32,6 +32,8 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
static void ShowBuildDockStationPicker(Window *parent);
 
static void ShowBuildDocksDepotPicker(Window *parent);
 

	
src/driver.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "video/video_driver.hpp"
 
#include "string_func.h"
 

	
 
#include "safeguards.h"
 

	
 
VideoDriver *_video_driver; ///< The currently active video driver.
 
char *_ini_videodriver;     ///< The video driver a stored in the configuration file.
 
int _num_resolutions;       ///< The number of resolutions.
src/economy.cpp
Show inline comments
 
@@ -53,6 +53,8 @@
 
#include "table/strings.h"
 
#include "table/pricebase.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/* Initialize the cargo payment-pool */
 
CargoPaymentPool _cargo_payment_pool("CargoPayment");
src/effectvehicle.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "effectvehicle_func.h"
 
#include "effectvehicle_base.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
static void ChimneySmokeInit(EffectVehicle *v)
 
{
src/elrail.cpp
Show inline comments
 
@@ -67,6 +67,8 @@
 

	
 
#include "table/elrail_data.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Get the tile location group of a tile.
 
 * @param t The tile to get the tile location group of.
src/engine.cpp
Show inline comments
 
@@ -35,6 +35,8 @@
 
#include "table/strings.h"
 
#include "table/engines.h"
 

	
 
#include "safeguards.h"
 

	
 
EnginePool _engine_pool("Engine");
 
INSTANTIATE_POOL_METHODS(Engine)
 

	
src/engine_gui.cpp
Show inline comments
 
@@ -25,6 +25,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Return the category of an engine.
 
 * @param engine Engine to examine.
src/error_gui.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 
#include "table/strings.h"
 
#include <list>
 

	
 
#include "safeguards.h"
 

	
 
static const NWidgetPart _nested_errmsg_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_RED),
src/fileio.cpp
Show inline comments
 
@@ -32,6 +32,8 @@
 
#include "basedir.h"
 
#endif
 

	
 
#include "safeguards.h"
 

	
 
/** Size of the #Fio data buffer. */
 
#define FIO_BUFFER_SIZE 512
 

	
src/fios.cpp
Show inline comments
 
@@ -26,6 +26,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/* Variables to display file lists */
 
SmallVector<FiosItem, 32> _fios_items;
 
static char *_fios_path;
src/fios_gui.cpp
Show inline comments
 
@@ -34,6 +34,8 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
SaveLoadDialogMode _saveload_mode;
 
LoadCheckData _load_check_data;    ///< Data loaded from save during SL_LOAD_CHECK.
 

	
src/fontcache.cpp
Show inline comments
 
@@ -23,6 +23,8 @@
 
#include "table/control_codes.h"
 
#include "table/unicode.h"
 

	
 
#include "safeguards.h"
 

	
 
static const int ASCII_LETTERSTART = 32; ///< First printable ASCII letter.
 
static const int MAX_FONT_SIZE     = 72; ///< Maximum font size.
 

	
src/fontdetection.cpp
Show inline comments
 
@@ -35,6 +35,8 @@ extern FT_Library _library;
 
#include <shlobj.h> /* SHGetFolderPath */
 
#include "os/windows/win32.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Get the short DOS 8.3 format for paths.
 
 * FreeType doesn't support Unicode filenames and Windows' fopen (as used
 
@@ -373,6 +375,8 @@ bool SetFallbackFont(FreeTypeSettings *s
 

	
 
#include "os/macosx/macos.h"
 

	
 
#include "safeguards.h"
 

	
 
FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
 
{
 
	FT_Error err = FT_Err_Cannot_Open_Resource;
 
@@ -542,6 +546,8 @@ bool SetFallbackFont(FreeTypeSettings *s
 

	
 
#include <fontconfig/fontconfig.h>
 

	
 
#include "safeguards.h"
 

	
 
/* ========================================================================================
 
 * FontConfig (unix) support
 
 * ======================================================================================== */
src/game/game_config.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "game_config.hpp"
 
#include "game_info.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/* static */ GameConfig *GameConfig::GetConfig(ScriptSettingSource source)
 
{
 
	GameConfig **config;
src/game/game_core.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 
#include "game_instance.hpp"
 
#include "game_info.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
/* static */ uint Game::frame_counter = 0;
 
/* static */ GameInfo *Game::info = NULL;
 
/* static */ GameInstance *Game::instance = NULL;
src/game/game_info.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "game_scanner.hpp"
 
#include "../debug.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Check if the API version provided by the Game is supported.
 
 * @param api_version The API version as provided by the Game.
src/game/game_instance.cpp
Show inline comments
 
@@ -85,6 +85,8 @@
 
#include "../script/api/game/game_waypointlist.hpp.sq"
 
#include "../script/api/game/game_window.hpp.sq"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
GameInstance::GameInstance() :
 
	ScriptInstance("GS")
src/game/game_scanner.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "game_info.hpp"
 
#include "game_scanner.hpp"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
void GameScannerInfo::Initialize()
 
{
src/game/game_text.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 

	
 
#include <stdarg.h>
 

	
 
#include "../safeguards.h"
 

	
 
void CDECL strgen_warning(const char *s, ...)
 
{
 
	char buf[1024];
src/gamelog.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 

	
 
#include <stdarg.h>
 

	
 
#include "safeguards.h"
 

	
 
extern const uint16 SAVEGAME_VERSION;  ///< current savegame version
 

	
 
extern SavegameType _savegame_type; ///< type of savegame we are loading
src/genworld.cpp
Show inline comments
 
@@ -34,6 +34,8 @@
 
#include "game/game.hpp"
 
#include "game/game_instance.hpp"
 

	
 
#include "safeguards.h"
 

	
 

	
 
void GenerateClearTile();
 
void GenerateIndustries();
src/genworld_gui.cpp
Show inline comments
 
@@ -32,6 +32,8 @@
 

	
 
#include "widgets/genworld_widget.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
extern void MakeNewgameSettingsLive();
 

	
src/gfx.cpp
Show inline comments
 
@@ -26,6 +26,8 @@
 
#include "table/sprites.h"
 
#include "table/control_codes.h"
 

	
 
#include "safeguards.h"
 

	
 
byte _dirkeys;        ///< 1 = left, 2 = up, 4 = right, 8 = down
 
bool _fullscreen;
 
CursorVars _cursor;
src/gfx_layout.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 
#include <unicode/ustring.h>
 
#endif /* WITH_ICU */
 

	
 
#include "safeguards.h"
 

	
 

	
 
/** Cache of ParagraphLayout lines. */
 
Layouter::LineCache *Layouter::linecache;
src/gfxinit.cpp
Show inline comments
 
@@ -25,6 +25,8 @@
 

	
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Whether the given NewGRFs must get a palette remap from windows to DOS or not. */
 
bool _palette_remap_grf[MAX_FILE_SLOTS];
 

	
src/goal.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include "gui.h"
 
#include "network/network.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
GoalID _new_goal_id;
 

	
src/goal_gui.cpp
Show inline comments
 
@@ -28,6 +28,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Goal list columns. */
 
enum GoalColumn {
 
	GC_GOAL = 0, ///< Goal text column.
src/graph_gui.cpp
Show inline comments
 
@@ -30,6 +30,8 @@
 
#include "table/sprites.h"
 
#include <math.h>
 

	
 
#include "safeguards.h"
 

	
 
/* Bitmasks of company and cargo indices that shouldn't be drawn. */
 
static uint _legend_excluded_companies;
 
static uint _legend_excluded_cargo;
src/ground_vehicle.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "roadveh.h"
 
#include "depot_map.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Recalculates the cached total power of a vehicle. Should be called when the consist is changed.
 
 */
src/group_cmd.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
GroupID _new_group_id;
 

	
 
GroupPool _group_pool("Group");
src/group_gui.cpp
Show inline comments
 
@@ -30,6 +30,8 @@
 

	
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
static const int LEVEL_WIDTH = 10; ///< Indenting width of a sub-group in pixels
 

	
 
typedef GUIList<const Group*> GUIGroupList;
src/heightmap.cpp
Show inline comments
 
@@ -22,6 +22,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Convert RGB colours to Grayscale using 29.9% Red, 58.7% Green, 11.4% Blue
 
 *  (average luminosity formula, NTSC Colour Space)
src/highscore.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "core/sort_func.hpp"
 
#include "debug.h"
 

	
 
#include "safeguards.h"
 

	
 
HighScore _highscore_table[SP_HIGHSCORE_END][5]; ///< various difficulty-settings; top 5
 
char *_highscore_file; ///< The file to store the highscore data in.
 

	
src/highscore_gui.cpp
Show inline comments
 
@@ -25,6 +25,8 @@
 

	
 
#include "widgets/highscore_widget.h"
 

	
 
#include "safeguards.h"
 

	
 
struct EndGameHighScoreBaseWindow : Window {
 
	uint32 background_img;
 
	int8 rank;
src/hotkeys.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "string_func.h"
 
#include "window_gui.h"
 

	
 
#include "safeguards.h"
 

	
 
char *_hotkeys_file;
 

	
 
/**
src/industry_cmd.cpp
Show inline comments
 
@@ -45,6 +45,8 @@
 
#include "table/industry_land.h"
 
#include "table/build_industry.h"
 

	
 
#include "safeguards.h"
 

	
 
IndustryPool _industry_pool("Industry");
 
INSTANTIATE_POOL_METHODS(Industry)
 

	
src/industry_gui.cpp
Show inline comments
 
@@ -41,6 +41,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
bool _ignore_restrictions;
 
uint64 _displayed_industries; ///< Communication from the industry chain window to the smallmap window about what industries to display.
 

	
src/ini.cpp
Show inline comments
 
@@ -26,6 +26,8 @@
 
# include "core/mem_func.hpp"
 
#endif
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Create a new ini file with given group names.
 
 * @param list_group_names A \c NULL terminated list with group names that should be loaded as lists instead of variables. @see IGT_LIST
src/ini_load.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "ini_type.h"
 
#include "string_func.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Construct a new in-memory item of an Ini file.
 
 * @param parent the group we belong to
src/intro_gui.cpp
Show inline comments
 
@@ -33,6 +33,8 @@
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
struct SelectGameWindow : public Window {
 

	
 
	SelectGameWindow(WindowDesc *desc) : Window(desc)
src/landscape.cpp
Show inline comments
 
@@ -37,6 +37,8 @@
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
extern const TileTypeProcs
 
	_tile_type_clear_procs,
 
	_tile_type_rail_procs,
src/linkgraph/demands.cpp
Show inline comments
 
@@ -4,6 +4,8 @@
 
#include "demands.h"
 
#include <list>
 

	
 
#include "../safeguards.h"
 

	
 
typedef std::list<NodeID> NodeList;
 

	
 
/**
src/linkgraph/flowmapper.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../stdafx.h"
 
#include "flowmapper.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Map the paths generated by the MCF solver into flows associated with nodes.
 
 * @param component the link graph component to be used.
src/linkgraph/linkgraph.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "../core/pool_func.hpp"
 
#include "linkgraph.h"
 

	
 
#include "../safeguards.h"
 

	
 
/* Initialize the link-graph-pool */
 
LinkGraphPool _link_graph_pool("LinkGraph");
 
INSTANTIATE_POOL_METHODS(LinkGraph)
src/linkgraph/linkgraph_gui.cpp
Show inline comments
 
@@ -22,6 +22,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Colours for the various "load" states of links. Ordered from "unused" to
 
 * "overloaded".
src/linkgraph/linkgraphjob.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "linkgraphjob.h"
 
#include "linkgraphschedule.h"
 

	
 
#include "../safeguards.h"
 

	
 
/* Initialize the link-graph-job-pool */
 
LinkGraphJobPool _link_graph_job_pool("LinkGraphJob");
 
INSTANTIATE_POOL_METHODS(LinkGraphJob)
src/linkgraph/linkgraphschedule.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "mcf.h"
 
#include "flowmapper.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Start the next job in the schedule.
 
 */
src/linkgraph/mcf.cpp
Show inline comments
 
@@ -5,6 +5,8 @@
 
#include "mcf.h"
 
#include <set>
 

	
 
#include "../safeguards.h"
 

	
 
typedef std::map<NodeID, Path *> PathViaMap;
 

	
 
/**
src/linkgraph/refresh.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "refresh.h"
 
#include "linkgraph.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Refresh all links the given vehicle will visit.
 
 * @param v Vehicle to refresh links for.
src/main_gui.cpp
Show inline comments
 
@@ -45,6 +45,8 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
static int _rename_id = 1;
 
static int _rename_what = -1;
 

	
src/map.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "core/alloc_func.hpp"
 
#include "water_map.h"
 

	
 
#include "safeguards.h"
 

	
 
#if defined(_MSC_VER)
 
/* Why the hell is that not in all MSVC headers?? */
 
extern "C" _CRTIMP void __cdecl _assert(void *, void *, unsigned);
src/misc.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 
#include "game/game.hpp"
 
#include "linkgraph/linkgraphschedule.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
extern TileIndex _cur_tileloop_tile;
 
extern void MakeNewgameSettingsLive();
src/misc/countedobj.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 

	
 
#include "countedptr.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
int32 SimpleCountedObject::AddRef()
 
{
 
	return ++m_ref_cnt;
src/misc/dbg_helpers.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "../rail_map.h"
 
#include "dbg_helpers.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Trackdir & TrackdirBits short names. */
 
static const char * const trackdir_names[] = {
 
	"NE", "SE", "UE", "LE", "LS", "RS", "rne", "rse",
src/misc/getoptdata.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../stdafx.h"
 
#include "getoptdata.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Find the next option.
 
 * @return Function returns one
src/misc_cmd.cpp
Show inline comments
 
@@ -25,6 +25,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Increase the loan of your company.
 
 * @param tile unused
src/misc_gui.cpp
Show inline comments
 
@@ -30,6 +30,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Method to open the OSK. */
 
enum OskActivation {
 
	OSKA_DISABLED,           ///< The OSK shall not be activated at all.
src/mixer.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include <math.h>
 
#include "core/math_func.hpp"
 

	
 
#include "safeguards.h"
 

	
 
struct MixerChannel {
 
	bool active;
 

	
src/music.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#define SET_TYPE "music"
 
#include "base_media_func.h"
 

	
 
#include "safeguards.h"
 

	
 
INSTANTIATE_BASE_MEDIA_METHODS(BaseMedia<MusicSet>, MusicSet)
 

	
 
/** Names corresponding to the music set's files */
src/music/allegro_m.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "allegro_m.h"
 
#include <allegro.h>
 

	
 
#include "../safeguards.h"
 

	
 
static FMusicDriver_Allegro iFMusicDriver_Allegro;
 
static MIDI *_midi = NULL;
 

	
src/music/bemidi.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
/* BeOS System Includes */
 
#include <MidiSynthFile.h>
 

	
 
#include "../safeguards.h"
 

	
 
/** The file we're playing. */
 
static BMidiSynthFile midiSynthFile;
 

	
src/music/cocoa_m.cpp
Show inline comments
 
@@ -28,6 +28,8 @@
 
#undef Rect
 
#undef Point
 

	
 
#include "../safeguards.h"
 

	
 
static FMusicDriver_Cocoa iFMusicDriver_Cocoa;
 

	
 

	
src/music/dmusic.cpp
Show inline comments
 
@@ -27,6 +27,8 @@
 
#include <dmusicc.h>
 
#include <dmusicf.h>
 

	
 
#include "../safeguards.h"
 

	
 
static FMusicDriver_DMusic iFMusicDriver_DMusic;
 

	
 
/** the direct music object manages buffers and ports */
src/music/extmidi.cpp
Show inline comments
 
@@ -25,6 +25,8 @@
 
#include <sys/stat.h>
 
#include <errno.h>
 

	
 
#include "../safeguards.h"
 

	
 
#ifndef EXTERNAL_PLAYER
 
/** The default external midi player. */
 
#define EXTERNAL_PLAYER "timidity"
src/music/libtimidity.cpp
Show inline comments
 
@@ -26,6 +26,8 @@
 
#include <pspaudiolib.h>
 
#endif /* PSP */
 

	
 
#include "../safeguards.h"
 

	
 
/** The state of playing. */
 
enum MidiState {
 
	MIDI_STOPPED = 0,
src/music/null_m.cpp
Show inline comments
 
@@ -12,5 +12,7 @@
 
#include "../stdafx.h"
 
#include "null_m.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** The factory for the music player that does nothing. */
 
static FMusicDriver_Null iFMusicDriver_Null;
src/music/os2_m.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 
#include <os2.h>
 
#include <os2me.h>
 

	
 
#include "../safeguards.h"
 

	
 
/**********************
 
 * OS/2 MIDI PLAYER
 
 **********************/
src/music/qtmidi.cpp
Show inline comments
 
@@ -38,6 +38,8 @@
 
#undef Rect
 
#undef Point
 

	
 
#include "../safeguards.h"
 

	
 
static FMusicDriver_QtMidi iFMusicDriver_QtMidi;
 

	
 

	
src/music/win32_m.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include <windows.h>
 
#include <mmsystem.h>
 

	
 
#include "../safeguards.h"
 

	
 
static struct {
 
	bool stop_song;
 
	bool terminate;
src/music_gui.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Get the name of the song.
 
 * @param index of the song.
src/network/core/address.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "address.h"
 
#include "../../debug.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Get the hostname; in case it wasn't given the
 
 * IPv4 dotted representation is given.
src/network/core/core.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "os_abstraction.h"
 
#include "packet.h"
 

	
 
#include "../../safeguards.h"
 

	
 

	
 
#ifdef __MORPHOS__
 
/* the library base is required here */
src/network/core/host.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../debug.h"
 
#include "address.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Internal implementation for finding the broadcast IPs.
 
 * This function is implemented multiple times for multiple targets.
src/network/core/packet.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 

	
 
#include "packet.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Create a packet that is used to read from a network socket
 
 * @param cs the socket handler associated with the socket we are reading from
src/network/core/tcp.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 

	
 
#include "tcp.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Construct a socket handler for a TCP connection.
 
 * @param s The just opened TCP connection.
src/network/core/tcp_admin.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "tcp_admin.h"
 
#include "../../debug.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* Make sure that these enums match. */
 
assert_compile((int)CRR_MANUAL    == (int)ADMIN_CRR_MANUAL);
 
assert_compile((int)CRR_AUTOCLEAN == (int)ADMIN_CRR_AUTOCLEAN);
src/network/core/tcp_connect.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 

	
 
#include "tcp.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/** List of connections that are currently being created */
 
static SmallVector<TCPConnecter *,  1> _tcp_connecters;
 

	
src/network/core/tcp_content.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#endif /* OPENTTD_MSU */
 
#include "tcp_content.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/** Clear everything in the struct */
 
ContentInfo::ContentInfo()
 
{
src/network/core/tcp_game.cpp
Show inline comments
 
@@ -22,6 +22,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Create a new socket for the game connection.
 
 * @param s The socket to connect with.
src/network/core/tcp_http.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 

	
 
#include "tcp_http.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/** List of open HTTP connections. */
 
static SmallVector<NetworkHTTPSocketHandler *, 1> _http_connections;
 

	
src/network/core/udp.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "../../debug.h"
 
#include "udp.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Create an UDP socket but don't listen yet.
 
 * @param bind the addresses to bind to.
src/network/network.cpp
Show inline comments
 
@@ -38,6 +38,8 @@
 
#include "../gfx_func.h"
 
#include "../error.h"
 

	
 
#include "../safeguards.h"
 

	
 
#ifdef DEBUG_DUMP_COMMANDS
 
#include "../fileio_func.h"
 
/** When running the server till the wait point, run as fast as we can! */
src/network/network_admin.cpp
Show inline comments
 
@@ -25,6 +25,8 @@
 
#include "../rev.h"
 
#include "../game/game.hpp"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
/* This file handles all the admin network commands. */
 

	
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -30,6 +30,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** The draw buffer must be able to contain the chat message, client name and the "[All]" message,
 
 * some spaces and possible translations of [All] to other languages. */
 
assert_compile((int)DRAW_STRING_BUFFER >= (int)NETWORK_CHAT_LENGTH + NETWORK_NAME_LENGTH + 40);
src/network/network_client.cpp
Show inline comments
 
@@ -34,6 +34,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "../safeguards.h"
 

	
 
/* This file handles all the client-commands */
 

	
 

	
src/network/network_command.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "../company_func.h"
 
#include "../settings_type.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Table with all the callbacks we'll use for conversion*/
 
static CommandCallback * const _callback_table[] = {
 
	/* 0x00 */ NULL,
src/network/network_content.cpp
Show inline comments
 
@@ -27,6 +27,8 @@
 
#include <zlib.h>
 
#endif
 

	
 
#include "../safeguards.h"
 

	
 
extern bool HasScenario(const ContentInfo *ci, bool md5sum);
 

	
 
/** The client we use to connect to the server. */
src/network/network_content_gui.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 
#include "table/strings.h"
 
#include "../table/sprites.h"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
/** Whether the user accepted to enter external websites during this session. */
 
static bool _accepted_external_search = false;
src/network/network_gamelist.cpp
Show inline comments
 
@@ -22,6 +22,8 @@
 
#include "network_udp.h"
 
#include "network_gamelist.h"
 

	
 
#include "../safeguards.h"
 

	
 
NetworkGameList *_network_game_list = NULL;
 

	
 
/** Mutex for handling delayed insertion/querying of servers. */
src/network/network_gui.cpp
Show inline comments
 
@@ -39,6 +39,8 @@
 

	
 
#include "../stringfilter_type.h"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
static void ShowNetworkStartServerWindow();
 
static void ShowNetworkLobbyWindow(NetworkGameList *ngl);
src/network/network_server.cpp
Show inline comments
 
@@ -33,6 +33,8 @@
 
#include "../core/random_func.hpp"
 
#include "../rev.h"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
/* This file handles all the server-commands */
 

	
src/network/network_udp.cpp
Show inline comments
 
@@ -34,6 +34,8 @@
 

	
 
#include "core/udp.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Mutex for all out threaded udp resolution and such. */
 
static ThreadMutex *_network_udp_mutex = ThreadMutex::New();
 

	
src/newgrf.cpp
Show inline comments
 
@@ -52,6 +52,8 @@
 
#include "table/strings.h"
 
#include "table/build_industry.h"
 

	
 
#include "safeguards.h"
 

	
 
/* TTDPatch extended GRF format codec
 
 * (c) Petr Baudis 2004 (GPL'd)
 
 * Changes by Florian octo Forster are (c) by the OpenTTD development team.
src/newgrf_airport.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "station_base.h"
 
#include "newgrf_class_func.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Resolver for the airport scope. */
 
struct AirportScopeResolver : public ScopeResolver {
 
	struct Station *st; ///< Station of the airport for which the callback is run, or \c NULL for build gui.
src/newgrf_airporttiles.cpp
Show inline comments
 
@@ -23,6 +23,8 @@
 
#include "table/airporttiles.h"
 
#include "newgrf_animation_base.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
AirportTileSpec AirportTileSpec::tiles[NUM_AIRPORTTILES];
 

	
src/newgrf_canal.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "water.h"
 
#include "water_map.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Table of canal 'feature' sprite groups */
 
WaterFeature _water_feature[CF_END];
 

	
src/newgrf_cargo.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "debug.h"
 
#include "newgrf_spritegroup.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Resolver of cargo. */
 
struct CargoResolverObject : public ResolverObject {
 
	CargoResolverObject(const CargoSpec *cs, CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
src/newgrf_commons.cpp
Show inline comments
 
@@ -32,6 +32,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Constructor of generic class
 
 * @param offset end of original data for this entity. i.e: houses = 110
src/newgrf_config.cpp
Show inline comments
 
@@ -25,6 +25,8 @@
 
#include "fileio_func.h"
 
#include "fios.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Create a new GRFTextWrapper. */
 
GRFTextWrapper::GRFTextWrapper() :
 
	text(NULL)
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -43,6 +43,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** The sprite picker. */
 
NewGrfDebugSpritePicker _newgrf_debug_sprite_picker = { SPM_NONE, NULL, 0, SmallVector<SpriteID, 256>() };
 

	
src/newgrf_engine.cpp
Show inline comments
 
@@ -25,6 +25,8 @@
 
#include "newgrf_railtype.h"
 
#include "ship.h"
 

	
 
#include "safeguards.h"
 

	
 
struct WagonOverride {
 
	EngineID *train_id;
 
	uint trains;
src/newgrf_generic.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "water_map.h"
 
#include <list>
 

	
 
#include "safeguards.h"
 

	
 
/** Scope resolver for generic objects and properties. */
 
struct GenericScopeResolver : public ScopeResolver {
 
	CargoID cargo_type;
src/newgrf_gui.cpp
Show inline comments
 
@@ -36,6 +36,8 @@
 

	
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
/* Maximum number of NewGRFs that may be loaded. Six reserved slots are:
 
 * 0 - config, 1 - sound, 2 - base, 3 - logos, 4 - climate, 5 - extra */
 
static const int MAX_NEWGRFS = MAX_FILE_SLOTS - 6;
src/newgrf_house.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include "newgrf_cargo.h"
 
#include "station_base.h"
 

	
 
#include "safeguards.h"
 

	
 
static BuildingCounts<uint32> _building_counts;
 
static HouseClassMapping _class_mapping[HOUSE_CLASS_MAX];
 

	
src/newgrf_industries.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.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
 
 * translated when the idustry spec is set. */
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -22,6 +22,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Based on newhouses equivalent, but adapted for newindustries
 
 * @param parameter from callback.  It's in fact a pair of coordinates
src/newgrf_object.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include "water.h"
 
#include "newgrf_animation_base.h"
 

	
 
#include "safeguards.h"
 

	
 
/** The override manager for our objects. */
 
ObjectOverrideManager _object_mngr(NEW_OBJECT_OFFSET, NUM_OBJECTS, INVALID_OBJECT_TYPE);
 

	
src/newgrf_railtype.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "depot_base.h"
 
#include "town.h"
 

	
 
#include "safeguards.h"
 

	
 
/* virtual */ uint32 RailTypeScopeResolver::GetRandomBits() const
 
{
 
	uint tmp = CountBits(this->tile + (TileX(this->tile) + TileY(this->tile)) * TILE_SIZE);
src/newgrf_sound.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "debug.h"
 
#include "settings_type.h"
 

	
 
#include "safeguards.h"
 

	
 
static SmallVector<SoundEntry, 8> _sounds;
 

	
 

	
src/newgrf_spritegroup.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "newgrf_spritegroup.h"
 
#include "core/pool_func.hpp"
 

	
 
#include "safeguards.h"
 

	
 
SpriteGroupPool _spritegroup_pool("SpriteGroup");
 
INSTANTIATE_POOL_METHODS(SpriteGroup)
 

	
src/newgrf_station.cpp
Show inline comments
 
@@ -26,6 +26,8 @@
 
#include "newgrf_animation_base.h"
 
#include "newgrf_class_func.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
template <typename Tspec, typename Tid, Tid Tmax>
 
/* static */ void NewGRFClass<Tspec, Tid, Tmax>::InsertDefaults()
src/newgrf_storage.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "debug.h"
 
#include <set>
 

	
 
#include "safeguards.h"
 

	
 
PersistentStoragePool _persistent_storage_pool("PersistentStorage");
 
INSTANTIATE_POOL_METHODS(PersistentStorage)
 

	
src/newgrf_text.cpp
Show inline comments
 
@@ -33,6 +33,8 @@
 
#include "table/strings.h"
 
#include "table/control_codes.h"
 

	
 
#include "safeguards.h"
 

	
 
#define GRFTAB  28
 
#define TABSIZE 11
 

	
src/newgrf_town.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "town.h"
 
#include "newgrf_town.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Resolver of a town scope.
 
 * @param ro Surrounding resolver.
src/newgrf_townname.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "core/alloc_func.hpp"
 
#include "string_func.h"
 

	
 
#include "safeguards.h"
 

	
 
static GRFTownName *_grf_townnames = NULL;
 

	
 
GRFTownName *GetGRFTownName(uint32 grfid)
src/news_gui.cpp
Show inline comments
 
@@ -38,6 +38,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
const NewsItem *_statusbar_news_item = NULL;
 

	
 
static uint MIN_NEWS_AMOUNT = 30;           ///< preferred minimum amount of news messages
src/object_cmd.cpp
Show inline comments
 
@@ -38,6 +38,8 @@
 
#include "table/strings.h"
 
#include "table/object_land.h"
 

	
 
#include "safeguards.h"
 

	
 
ObjectPool _object_pool("Object");
 
INSTANTIATE_POOL_METHODS(Object)
 
uint16 Object::counts[NUM_OBJECTS];
src/object_gui.cpp
Show inline comments
 
@@ -23,6 +23,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
static ObjectClassID _selected_object_class; ///< the currently visible object class
 
static int _selected_object_index;           ///< the index of the selected object in the current class or -1
 
static uint8 _selected_object_view;          ///< the view of the selected object
src/openttd.cpp
Show inline comments
 
@@ -68,6 +68,8 @@
 

	
 
#include <stdarg.h>
 

	
 
#include "safeguards.h"
 

	
 
void CallLandscapeTick();
 
void IncreaseDate();
 
void DoPaletteAnimations();
src/order_backup.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "window_func.h"
 
#include "station_map.h"
 

	
 
#include "safeguards.h"
 

	
 
OrderBackupPool _order_backup_pool("BackupOrder");
 
INSTANTIATE_POOL_METHODS(OrderBackup)
 

	
src/order_cmd.cpp
Show inline comments
 
@@ -30,6 +30,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/* DestinationID must be at least as large as every these below, because it can
 
 * be any of them
 
 */
src/order_gui.cpp
Show inline comments
 
@@ -32,6 +32,8 @@
 

	
 
#include "widgets/order_widget.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/** Order load types that could be given to station orders. */
 
static const StringID _station_load_types[][5][5] = {
src/os/macosx/crashlog_osx.cpp
Show inline comments
 
@@ -22,6 +22,8 @@
 
#include <dlfcn.h>
 
#include <cxxabi.h>
 

	
 
#include "../../safeguards.h"
 

	
 

	
 
/* Macro testing a stack address for valid alignment. */
 
#if defined(__i386__)
src/os/macosx/splash.cpp
Show inline comments
 
@@ -23,6 +23,8 @@
 

	
 
#include <png.h>
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Handle pnglib error.
 
 *
src/os/os2/os2.cpp
Show inline comments
 
@@ -30,6 +30,8 @@
 
	#include <dos.h>
 
#endif
 

	
 
#include "../../safeguards.h"
 

	
 
#define INCL_WIN
 
#define INCL_WINCLIPBOARD
 

	
src/os/unix/crashlog_unix.cpp
Show inline comments
 
@@ -31,6 +31,8 @@
 
#include <unistd.h>
 
#endif
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Unix implementation for the crash logger.
 
 */
src/os/unix/unix.cpp
Show inline comments
 
@@ -63,6 +63,8 @@ ULONG __stack = (1024*1024)*2; // maybe 
 
	#endif
 
#endif
 

	
 
#include "../../safeguards.h"
 

	
 
bool FiosIsRoot(const char *path)
 
{
 
#if !defined(__MORPHOS__) && !defined(__AMIGAOS__)
src/os/windows/crashlog_win.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include <windows.h>
 
#include <signal.h>
 

	
 
#include "../../safeguards.h"
 

	
 
static const uint MAX_SYMBOL_LEN = 512;
 
static const uint MAX_FRAMES     = 64;
 

	
src/os/windows/win32.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 
#include <errno.h>
 
#include <sys/stat.h>
 

	
 
#include "../../safeguards.h"
 

	
 
static bool _has_console;
 
static bool _cursor_disable = true;
 
static bool _cursor_visible = true;
src/osk_gui.cpp
Show inline comments
 
@@ -23,6 +23,8 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
char _keyboard_opt[2][OSK_KEYBOARD_ENTRIES * 4 + 1];
 
static WChar _keyboard[2][OSK_KEYBOARD_ENTRIES];
 

	
src/pathfinder/npf/aystar.cpp
Show inline comments
 
@@ -27,6 +27,8 @@
 
#include "../../core/alloc_func.hpp"
 
#include "aystar.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * This looks in the hash whether a node exists in the closed list.
 
 * @param node Node to search.
src/pathfinder/npf/npf.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "../follow_track.hpp"
 
#include "aystar.h"
 

	
 
#include "../../safeguards.h"
 

	
 
static const uint NPF_HASH_BITS = 12; ///< The size of the hash used in pathfinding. Just changing this value should be sufficient to change the hash size. Should be an even value.
 
/* Do no change below values */
 
static const uint NPF_HASH_SIZE = 1 << NPF_HASH_BITS;
src/pathfinder/npf/queue.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "../../core/alloc_func.hpp"
 
#include "queue.h"
 

	
 
#include "../../safeguards.h"
 

	
 

	
 
/*
 
 * Binary Heap
src/pathfinder/opf/opf_ship.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../ship.h"
 
#include "../../core/random_func.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
struct RememberData {
 
	uint16 cur_length;
 
	byte depth;
src/pathfinder/yapf/yapf_rail.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "../../viewport_func.h"
 
#include "../../newgrf_station.h"
 

	
 
#include "../../safeguards.h"
 

	
 
#define DEBUG_YAPF_CACHE 0
 

	
 
#if DEBUG_YAPF_CACHE
src/pathfinder/yapf/yapf_road.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "yapf_node_road.hpp"
 
#include "../../roadstop_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 

	
 
template <class Types>
 
class CYapfCostRoadT
src/pathfinder/yapf/yapf_ship.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "yapf.hpp"
 
#include "yapf_node_ship.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
/** Node Follower module of YAPF for ships */
 
template <class Types>
 
class CYapfFollowShipT
src/pbs.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "newgrf_station.h"
 
#include "pathfinder/follow_track.hpp"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Get the reserved trackbits for any tile, regardless of type.
 
 * @param t the tile
src/progress.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "stdafx.h"
 
#include "thread/thread.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Are we in a modal progress or not? */
 
bool _in_modal_progress = false;
 
bool _first_in_modal_loop = false;
src/rail.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "company_base.h"
 
#include "engine_base.h"
 

	
 
#include "safeguards.h"
 

	
 
/* XXX: Below 3 tables store duplicate data. Maybe remove some? */
 
/* Maps a trackdir to the bit that stores its status in the map arrays, in the
 
 * direction along with the trackdir */
src/rail_cmd.cpp
Show inline comments
 
@@ -38,6 +38,8 @@
 
#include "table/railtypes.h"
 
#include "table/track_land.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Helper type for lists/vectors of trains */
 
typedef SmallVector<Train *, 16> TrainList;
 

	
src/rail_gui.cpp
Show inline comments
 
@@ -40,6 +40,8 @@
 

	
 
#include "widgets/rail_widget.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
static RailType _cur_railtype;               ///< Rail type of the current build-rail toolbar.
 
static bool _remove_button_clicked;          ///< Flag whether 'remove' toggle-button is currently enabled
src/rev.cpp.in
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "core/bitmath_func.hpp"
 
#include "rev.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Is this version of OpenTTD a release version?
 
 * @return True if it is a release version.
src/road.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "date_func.h"
 
#include "landscape.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Return if the tile is a valid tile for a crossing.
 
 *
src/road_cmd.cpp
Show inline comments
 
@@ -38,6 +38,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Verify whether a road vehicle is available.
 
 * @return \c true if at least one road vehicle is available, \c false if not
src/road_gui.cpp
Show inline comments
 
@@ -33,6 +33,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
static void ShowRVStationPicker(Window *parent, RoadStopType rs);
 
static void ShowRoadDepotPicker(Window *parent);
 

	
src/road_map.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "station_map.h"
 
#include "tunnelbridge_map.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/**
 
 * Returns the RoadBits on an arbitrary tile
src/roadstop.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "station_base.h"
 
#include "vehicle_func.h"
 

	
 
#include "safeguards.h"
 

	
 
/** The pool of roadstops. */
 
RoadStopPool _roadstop_pool("RoadStop");
 
INSTANTIATE_POOL_METHODS(RoadStop)
src/roadveh_cmd.cpp
Show inline comments
 
@@ -38,6 +38,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
static const uint16 _roadveh_images[] = {
 
	0xCD4, 0xCDC, 0xCE4, 0xCEC, 0xCF4, 0xCFC, 0xD0C, 0xD14,
 
	0xD24, 0xD1C, 0xD2C, 0xD04, 0xD1C, 0xD24, 0xD6C, 0xD74,
src/roadveh_gui.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Draw the details for the given vehicle at the given position
 
 *
src/safeguards.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
/*
 
 * This file is part of OpenTTD.
 
 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 
 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 
 */
 

	
 
/**
 
 * @file safeguards.h A number of safeguards to prevent using unsafe methods.
 
 *
 
 * Unsafe methods are, for example, strndup and strncpy because they may leave the
 
 * string without a null termination, but also strdup and strndup because they can
 
 * return NULL and then all strdups would need to be guarded against that instead
 
 * of using the current MallocT/ReallocT/CallocT technique of just giving the user
 
 * an error that too much memory was used instead of spreading that code though
 
 * the whole code base.
 
 */
 

	
 
#ifndef SAFEGUARDS_H
 
#define SAFEGUARDS_H
 

	
 
/* Use MallocT instead. */
 
#define malloc    SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/* Use MallocT instead. */
 
#define calloc    SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/* Use ReallocT instead. */
 
#define realloc   SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/* Use stredup instead. */
 
//#define strdup    SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/* Use stredup instead. */
 
//#define strndup   SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/* Use strecpy instead. */
 
//#define strcpy    SAFEGUARD_DO_NOT_USE_THIS_METHOD
 
//#define strncpy   SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/* Use strecat instead. */
 
//#define strcat    SAFEGUARD_DO_NOT_USE_THIS_METHOD
 
//#define strncat   SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/* Use seprintf instead. */
 
//#define sprintf   SAFEGUARD_DO_NOT_USE_THIS_METHOD
 
//#define snprintf  SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/* Use vseprintf instead. */
 
//#define vsprintf  SAFEGUARD_DO_NOT_USE_THIS_METHOD
 
//#define vsnprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/* Use fgets instead. */
 
#define gets      SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/* No clear replacement. */
 
//#define strtok    SAFEGUARD_DO_NOT_USE_THIS_METHOD
 

	
 
/*
 
 * Possible future methods to mark unsafe, though needs more thought:
 
 *  - memcpy; when memory area overlaps it messes up, use memmove.
 
 *  - strlen: when the data is 'garbage', this could read beyond bounds.
 
 */
 

	
 
#endif /* SAFEGUARDS_H */
src/saveload/afterload.cpp
Show inline comments
 
@@ -58,6 +58,8 @@
 

	
 
#include <signal.h>
 

	
 
#include "../safeguards.h"
 

	
 
extern Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY);
 

	
 
/**
src/saveload/ai_sl.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "../network/network.h"
 
#include "../ai/ai_instance.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
static char _ai_saveload_name[64];
 
static int  _ai_saveload_version;
 
static char _ai_saveload_settings[1024];
src/saveload/airport_sl.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "saveload.h"
 
#include "newgrf_sl.h"
 

	
 
#include "../safeguards.h"
 

	
 
static void Save_APID()
 
{
 
	Save_NewGRFMapping(_airport_mngr);
src/saveload/animated_tile_sl.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
extern TileIndex *_animated_tile_list;
 
extern uint _animated_tile_count;
 
extern uint _animated_tile_allocated;
src/saveload/autoreplace_sl.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
static const SaveLoad _engine_renew_desc[] = {
 
	    SLE_VAR(EngineRenew, from,     SLE_UINT16),
 
	    SLE_VAR(EngineRenew, to,       SLE_UINT16),
src/saveload/cargomonitor_sl.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Temporary storage of cargo monitoring data for loading or saving it. */
 
struct TempStorage {
 
	CargoMonitorID number;
src/saveload/cargopacket_sl.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Savegame conversion for cargopackets.
 
 */
src/saveload/cheat_sl.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Save the cheat values.
 
 */
src/saveload/company_sl.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Converts an old company manager's face format to the new company manager's face format
 
 *
src/saveload/depot_sl.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
static TownID _town_index;
 

	
 
static const SaveLoad _depot_desc[] = {
src/saveload/economy_sl.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Prices in pre 126 savegames */
 
static void Load_PRIC()
 
{
src/saveload/engine_sl.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "../engine_base.h"
 
#include <map>
 

	
 
#include "../safeguards.h"
 

	
 
static const SaveLoad _engine_desc[] = {
 
	 SLE_CONDVAR(Engine, intro_date,          SLE_FILE_U16 | SLE_VAR_I32,  0,  30),
 
	 SLE_CONDVAR(Engine, intro_date,          SLE_INT32,                  31, SL_MAX_VERSION),
src/saveload/game_sl.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "../game/game_instance.hpp"
 
#include "../game/game_text.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
static char _game_saveload_name[64];
 
static int  _game_saveload_version;
 
static char _game_saveload_settings[1024];
src/saveload/gamelog_sl.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
static const SaveLoad _glog_action_desc[] = {
 
	SLE_VAR(LoggedAction, tick,              SLE_UINT16),
 
	SLE_END()
src/saveload/goal_sl.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
static const SaveLoad _goals_desc[] = {
 
	    SLE_VAR(Goal, company,   SLE_UINT16),
 
	    SLE_VAR(Goal, type,      SLE_UINT16),
src/saveload/group_sl.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
static const SaveLoad _group_desc[] = {
 
	 SLE_CONDVAR(Group, name,               SLE_NAME,                       0,  83),
 
	 SLE_CONDSTR(Group, name,               SLE_STR | SLF_ALLOW_CONTROL, 0, 84, SL_MAX_VERSION),
src/saveload/industry_sl.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "saveload.h"
 
#include "newgrf_sl.h"
 

	
 
#include "../safeguards.h"
 

	
 
static OldPersistentStorage _old_ind_persistent_storage;
 

	
 
static const SaveLoad _industry_desc[] = {
src/saveload/labelmaps_sl.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
static SmallVector<RailTypeLabel, RAILTYPE_END> _railtype_list;
 

	
 
/**
src/saveload/linkgraph_sl.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "../settings_internal.h"
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
typedef LinkGraph::BaseNode Node;
 
typedef LinkGraph::BaseEdge Edge;
 

	
src/saveload/map_sl.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
static uint32 _map_dim_x;
 
static uint32 _map_dim_y;
 

	
src/saveload/misc_sl.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
extern TileIndex _cur_tileloop_tile;
 
extern uint16 _disaster_delay;
 
extern byte _trees_tick_ctr;
src/saveload/newgrf_sl.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "saveload.h"
 
#include "newgrf_sl.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Save and load the mapping between a spec and the NewGRF it came from. */
 
static const SaveLoad _newgrf_mapping_desc[] = {
 
	SLE_VAR(EntityIDMapping, grfid,         SLE_UINT32),
src/saveload/object_sl.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "saveload.h"
 
#include "newgrf_sl.h"
 

	
 
#include "../safeguards.h"
 

	
 
static const SaveLoad _object_desc[] = {
 
	    SLE_VAR(Object, location.tile,              SLE_UINT32),
 
	    SLE_VAR(Object, location.w,                 SLE_FILE_U8 | SLE_VAR_U16),
src/saveload/oldloader.cpp
Show inline comments
 
@@ -23,6 +23,8 @@
 

	
 
#include <exception>
 

	
 
#include "../safeguards.h"
 

	
 
static const int TTO_HEADER_SIZE = 41;
 
static const int TTD_HEADER_SIZE = 49;
 

	
src/saveload/oldloader_sl.cpp
Show inline comments
 
@@ -34,6 +34,8 @@
 
#include "../table/engines.h"
 
#include "../table/townname.h"
 

	
 
#include "../safeguards.h"
 

	
 
static bool _read_ttdpatch_flags;    ///< Have we (tried to) read TTDPatch extra flags?
 
static uint16 _old_extra_chunk_nums; ///< Number of extra TTDPatch chunks
 
static byte _old_vehicle_multiplier; ///< TTDPatch vehicle multiplier
src/saveload/order_sl.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 

	
 
#include "saveload_internal.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Converts this order from an old savegame's version;
 
 * it moves all bits to the new location.
src/saveload/saveload.cpp
Show inline comments
 
@@ -49,6 +49,8 @@
 
#include "saveload_internal.h"
 
#include "saveload_filter.h"
 

	
 
#include "../safeguards.h"
 

	
 
/*
 
 * Previous savegame versions, the trunk revision where they were
 
 * introduced and the released version that had that particular
src/saveload/signs_sl.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Description of a sign within the savegame. */
 
static const SaveLoad _sign_desc[] = {
 
	SLE_CONDVAR(Sign, name,  SLE_NAME,                   0, 83),
src/saveload/station_sl.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "saveload.h"
 
#include "table/strings.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Update the buoy orders to be waypoint orders.
 
 * @param o the order 'list' to check.
src/saveload/storage_sl.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "../newgrf_storage.h"
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Description of the data to save and load in #PersistentStorage. */
 
static const SaveLoad _storage_desc[] = {
 
	 SLE_CONDVAR(PersistentStorage, grfid,    SLE_UINT32,                  6, SL_MAX_VERSION),
src/saveload/story_sl.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Called after load to trash broken pages. */
 
void AfterLoadStoryBook()
 
{
src/saveload/strings_sl.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "../safeguards.h"
 

	
 
static const int NUM_OLD_STRINGS     = 512; ///< The number of custom strings stored in old savegames.
 
static const int LEN_OLD_STRINGS     =  32; ///< The number of characters per string.
 
static const int LEN_OLD_STRINGS_TTO =  24; ///< The number of characters per string in TTO savegames.
src/saveload/subsidy_sl.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 

	
 
#include "saveload.h"
 

	
 
#include "../safeguards.h"
 

	
 
static const SaveLoad _subsidies_desc[] = {
 
	    SLE_VAR(Subsidy, cargo_type, SLE_UINT8),
 
	    SLE_VAR(Subsidy, remaining,  SLE_UINT8),
src/saveload/town_sl.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "saveload.h"
 
#include "newgrf_sl.h"
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Rebuild all the cached variables of towns.
 
 */
src/saveload/vehicle_sl.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 

	
 
#include <map>
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Link front and rear multiheaded engines to each other
 
 * This is done when loading a savegame
src/saveload/waypoint_sl.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 

	
 
#include "saveload_internal.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Helper structure to convert from the old waypoint system. */
 
struct OldWaypoint {
 
	size_t index;
src/screenshot.cpp
Show inline comments
 
@@ -28,6 +28,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
static const char * const SCREENSHOT_NAME = "screenshot"; ///< Default filename of a saved screenshot.
 
static const char * const HEIGHTMAP_NAME  = "heightmap";  ///< Default filename of a saved heightmap.
 

	
src/script/api/script_accounting.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../../stdafx.h"
 
#include "script_accounting.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
Money ScriptAccounting::GetCosts()
 
{
 
	return this->GetDoCommandCosts();
src/script/api/script_admin.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../network/network_admin.h"
 
#include "../script_instance.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptAdmin::MakeJSON(HSQUIRRELVM vm, SQInteger index, int max_depth, std::string &data)
 
{
 
	if (max_depth == 0) {
src/script/api/script_airport.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../station_base.h"
 
#include "../../town.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptAirport::IsValidAirportType(AirportType type)
 
{
 
	return IsAirportInformationAvailable(type) && ::AirportSpec::Get(type)->IsAvailable();
src/script/api/script_base.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../network/network.h"
 
#include "../../core/random_func.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ uint32 ScriptBase::Rand()
 
{
 
	/* We pick RandomRange if we are in SP (so when saved, we do the same over and over)
src/script/api/script_basestation.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "../../strings_func.h"
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptBaseStation::IsValidBaseStation(StationID station_id)
 
{
 
	const BaseStation *st = ::BaseStation::GetIfValid(station_id);
src/script/api/script_bridge.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "../../strings_func.h"
 
#include "../../date_func.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptBridge::IsValidBridge(BridgeID bridge_id)
 
{
 
	return bridge_id < MAX_BRIDGES && ::GetBridgeSpec(bridge_id)->avail_year <= _cur_year;
src/script/api/script_bridgelist.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "script_bridge.hpp"
 
#include "../../bridge.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptBridgeList::ScriptBridgeList()
 
{
 
	for (byte j = 0; j < MAX_BRIDGES; j++) {
src/script/api/script_cargo.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../core/bitmath_func.hpp"
 
#include "../../settings_type.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptCargo::IsValidCargo(CargoID cargo_type)
 
{
 
	return (cargo_type < NUM_CARGO && ::CargoSpec::Get(cargo_type)->IsValid());
src/script/api/script_cargolist.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "../../industry.h"
 
#include "../../station_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptCargoList::ScriptCargoList()
 
{
 
	const CargoSpec *cs;
src/script/api/script_cargomonitor.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../../stdafx.h"
 
#include "script_cargomonitor.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ uint32 ScriptCargoMonitor::GetTownDeliveryAmount(ScriptCompany::CompanyID company, CargoID cargo, TownID town_id, bool keep_monitoring)
 
{
 
	CargoMonitorID monitor = EncodeCargoTownMonitor(static_cast<CompanyID>(company), cargo, town_id);
src/script/api/script_company.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include "../../settings_func.h"
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ ScriptCompany::CompanyID ScriptCompany::ResolveCompanyID(ScriptCompany::CompanyID company)
 
{
 
	if (company == COMPANY_SELF) {
src/script/api/script_companymode.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../../stdafx.h"
 
#include "script_companymode.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptCompanyMode::ScriptCompanyMode(int company)
 
{
 
	if (company < OWNER_BEGIN || company >= MAX_COMPANIES) company = INVALID_COMPANY;
src/script/api/script_controller.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include "../../settings_type.h"
 
#include "../../network/network.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ void ScriptController::SetCommandDelay(int ticks)
 
{
 
	if (ticks <= 0) return;
src/script/api/script_date.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "script_date.hpp"
 
#include "../../date_func.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptDate::IsValidDate(Date date)
 
{
 
	return date >= 0;
src/script/api/script_depotlist.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "../../depot_base.h"
 
#include "../../station_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptDepotList::ScriptDepotList(ScriptTile::TransportType transport_type)
 
{
 
	::TileType tile_type;
src/script/api/script_engine.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "../../articulated_vehicles.h"
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptEngine::IsValidEngine(EngineID engine_id)
 
{
 
	const Engine *e = ::Engine::GetIfValid(engine_id);
src/script/api/script_enginelist.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "script_enginelist.hpp"
 
#include "../../engine_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptEngineList::ScriptEngineList(ScriptVehicle::VehicleType vehicle_type)
 
{
 
	Engine *e;
src/script/api/script_error.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "script_error.hpp"
 
#include "../../core/bitmath_func.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptError::ScriptErrorMap ScriptError::error_map = ScriptError::ScriptErrorMap();
 
ScriptError::ScriptErrorMapString ScriptError::error_map_string = ScriptError::ScriptErrorMapString();
 

	
src/script/api/script_event.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 

	
 
#include <queue>
 

	
 
#include "../../safeguards.h"
 

	
 
/** The queue of events for a script. */
 
struct ScriptEventData {
 
	std::queue<ScriptEvent *> stack; ///< The actual queue.
src/script/api/script_event_types.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "../../articulated_vehicles.h"
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
bool ScriptEventEnginePreview::IsEngineValid() const
 
{
 
	const Engine *e = ::Engine::GetIfValid(this->engine);
src/script/api/script_execmode.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "../script_instance.hpp"
 
#include "../script_fatalerror.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
bool ScriptExecMode::ModeProc()
 
{
 
	/* In execution mode we only return 'true', telling the DoCommand it
src/script/api/script_game.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../settings_type.h"
 
#include "../../network/network.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptGame::Pause()
 
{
 
	return ScriptObject::DoCommand(0, PM_PAUSED_GAME_SCRIPT, 1, CMD_PAUSE);
src/script/api/script_gamesettings.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../settings_type.h"
 
#include "../../command_type.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptGameSettings::IsValid(const char *setting)
 
{
 
	uint i;
src/script/api/script_goal.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "../../goal_base.h"
 
#include "../../string_func.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptGoal::IsValidGoal(GoalID goal_id)
 
{
 
	return ::Goal::IsValidID(goal_id);
src/script/api/script_group.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "../../settings_func.h"
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptGroup::IsValidGroup(GroupID group_id)
 
{
 
	const Group *g = ::Group::GetIfValid(group_id);
src/script/api/script_grouplist.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "script_grouplist.hpp"
 
#include "../../group.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptGroupList::ScriptGroupList()
 
{
 
	Group *g;
src/script/api/script_industry.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include "../../newgrf_industries.h"
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ int32 ScriptIndustry::GetIndustryCount()
 
{
 
	return (int32)::Industry::GetNumItems();
src/script/api/script_industrylist.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "script_industrylist.hpp"
 
#include "../../industry.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptIndustryList::ScriptIndustryList()
 
{
 
	Industry *i;
src/script/api/script_industrytype.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "../../newgrf_industries.h"
 
#include "../../core/random_func.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptIndustryType::IsValidIndustryType(IndustryType industry_type)
 
{
 
	if (industry_type >= NUM_INDUSTRYTYPES) return false;
src/script/api/script_industrytypelist.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "script_industrytypelist.hpp"
 
#include "../../industry.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptIndustryTypeList::ScriptIndustryTypeList()
 
{
 
	for (int i = 0; i < NUM_INDUSTRYTYPES; i++) {
src/script/api/script_infrastructure.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "../../water.h"
 
#include "../../station_func.h"
 

	
 
#include "../../safeguards.h"
 

	
 

	
 
/* static */ uint32 ScriptInfrastructure::GetRailPieceCount(ScriptCompany::CompanyID company, ScriptRail::RailType railtype)
 
{
src/script/api/script_list.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "../../debug.h"
 
#include "../../script/squirrel.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Base class for any ScriptList sorter.
 
 */
src/script/api/script_log.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../debug.h"
 
#include "../../window_func.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ void ScriptLog::Info(const char *message)
 
{
 
	ScriptLog::Log(LOG_INFO, message);
src/script/api/script_map.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "script_map.hpp"
 
#include "../../tile_map.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptMap::IsValidTile(TileIndex t)
 
{
 
	return ::IsValidTile(t);
src/script/api/script_marine.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../station_base.h"
 
#include "../../tile_cmd.h"
 

	
 
#include "../../safeguards.h"
 

	
 

	
 
/* static */ bool ScriptMarine::IsWaterDepotTile(TileIndex tile)
 
{
src/script/api/script_news.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../command_type.h"
 
#include "../../string_func.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptNews::Create(NewsType type, Text *text, ScriptCompany::CompanyID company)
 
{
 
	CCountedPtr<Text> counter(text);
src/script/api/script_object.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include "../script_fatalerror.hpp"
 
#include "script_error.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Get the storage associated with the current ScriptInstance.
 
 * @return The storage.
src/script/api/script_order.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 
#include "../../station_base.h"
 
#include "../../waypoint_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/**
 
 * Gets the order type given a tile
 
 * @param t the tile to get the order from
src/script/api/script_rail.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 
#include "../../newgrf_station.h"
 
#include "../../strings_func.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ char *ScriptRail::GetName(RailType rail_type)
 
{
 
	if (!IsRailTypeAvailable(rail_type)) return NULL;
src/script/api/script_railtypelist.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "script_railtypelist.hpp"
 
#include "../../rail.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptRailTypeList::ScriptRailTypeList()
 
{
 
	for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
src/script/api/script_road.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "../../station_base.h"
 
#include "../../script/squirrel_helper_type.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ ScriptRoad::RoadVehicleType ScriptRoad::GetRoadVehicleTypeForCargo(CargoID cargo_type)
 
{
 
	return ScriptCargo::HasCargoClass(cargo_type, ScriptCargo::CC_PASSENGERS) ? ROADVEHTYPE_BUS : ROADVEHTYPE_TRUCK;
src/script/api/script_sign.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "../../strings_func.h"
 
#include "../../tile_map.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptSign::IsValidSign(SignID sign_id)
 
{
 
	const Sign *si = ::Sign::GetIfValid(sign_id);
src/script/api/script_signlist.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "script_sign.hpp"
 
#include "../../signs_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptSignList::ScriptSignList()
 
{
 
	Sign *s;
src/script/api/script_station.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "../../roadstop_base.h"
 
#include "../../town.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptStation::IsValidStation(StationID station_id)
 
{
 
	const Station *st = ::Station::GetIfValid(station_id);
src/script/api/script_stationlist.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../station_base.h"
 
#include "../../vehicle_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptStationList::ScriptStationList(ScriptStation::StationType station_type)
 
{
 
	Station *st;
src/script/api/script_story_page.cpp
Show inline comments
 
@@ -22,6 +22,8 @@
 
#include "../../string_func.h"
 
#include "../../tile_map.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptStoryPage::IsValidStoryPage(StoryPageID story_page_id)
 
{
 
	return ::StoryPage::IsValidID(story_page_id);
src/script/api/script_storypageelementlist.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "script_storypageelementlist.hpp"
 
#include "../../story_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptStoryPageElementList::ScriptStoryPageElementList(ScriptStoryPage::StoryPageID story_page_id)
 
{
 
	if (!ScriptStoryPage::IsValidStoryPage(story_page_id)) return;
src/script/api/script_storypagelist.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "script_story_page.hpp"
 
#include "../../story_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptStoryPageList::ScriptStoryPageList(ScriptCompany::CompanyID company)
 
{
 
	uint8 c = company;
src/script/api/script_subsidy.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "../../subsidy_base.h"
 
#include "../../station_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptSubsidy::IsValidSubsidy(SubsidyID subsidy_id)
 
{
 
	return ::Subsidy::IsValidID(subsidy_id);
src/script/api/script_subsidylist.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "script_subsidylist.hpp"
 
#include "../../subsidy_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptSubsidyList::ScriptSubsidyList()
 
{
 
	const Subsidy *s;
src/script/api/script_testmode.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "../script_instance.hpp"
 
#include "../script_fatalerror.hpp"
 

	
 
#include "../../safeguards.h"
 

	
 
bool ScriptTestMode::ModeProc()
 
{
 
	/* In test mode we only return 'false', telling the DoCommand it
src/script/api/script_text.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptText::ScriptText(HSQUIRRELVM vm) :
 
	ZeroedMemoryAllocator()
 
{
src/script/api/script_tile.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "../../town.h"
 
#include "../../landscape.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptTile::IsBuildable(TileIndex tile)
 
{
 
	if (!::IsValidTile(tile)) return false;
src/script/api/script_tilelist.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../industry.h"
 
#include "../../station_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
void ScriptTileList::AddRectangle(TileIndex t1, TileIndex t2)
 
{
 
	if (!::IsValidTile(t1)) return;
src/script/api/script_town.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 
#include "../../landscape.h"
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ int32 ScriptTown::GetTownCount()
 
{
 
	return (int32)::Town::GetNumItems();
src/script/api/script_townlist.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#include "script_townlist.hpp"
 
#include "../../town.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptTownList::ScriptTownList()
 
{
 
	Town *t;
src/script/api/script_tunnel.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../script_instance.hpp"
 
#include "../../tunnel_map.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptTunnel::IsTunnelTile(TileIndex tile)
 
{
 
	if (!::IsValidTile(tile)) return false;
src/script/api/script_vehicle.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include "../../aircraft.h"
 
#include "table/strings.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptVehicle::IsValidVehicle(VehicleID vehicle_id)
 
{
 
	const Vehicle *v = ::Vehicle::GetIfValid(vehicle_id);
src/script/api/script_vehiclelist.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "../../depot_map.h"
 
#include "../../vehicle_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptVehicleList::ScriptVehicleList()
 
{
 
	const Vehicle *v;
src/script/api/script_viewport.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "script_map.hpp"
 
#include "../../viewport_func.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ void ScriptViewport::ScrollTo(TileIndex tile)
 
{
 
	if (ScriptGame::IsMultiplayer()) return;
src/script/api/script_waypoint.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "script_marine.hpp"
 
#include "../../waypoint_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ bool ScriptWaypoint::IsValidWaypoint(StationID waypoint_id)
 
{
 
	const Waypoint *wp = ::Waypoint::GetIfValid(waypoint_id);
src/script/api/script_waypointlist.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../vehicle_base.h"
 
#include "../../waypoint_base.h"
 

	
 
#include "../../safeguards.h"
 

	
 
ScriptWaypointList::ScriptWaypointList(ScriptWaypoint::WaypointType waypoint_type)
 
{
 
	const Waypoint *wp;
src/script/api/script_window.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../../window_func.h"
 
#include "../../window_gui.h"
 

	
 
#include "../../safeguards.h"
 

	
 
/* static */ void ScriptWindow::Close(WindowClass window, uint32 number)
 
{
 
	if (ScriptGame::IsMultiplayer()) return;
src/script/script_config.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "script_info.hpp"
 
#include "../textfile_gui.h"
 

	
 
#include "../safeguards.h"
 

	
 
void ScriptConfig::Change(const char *name, int version, bool force_exact_match, bool is_random)
 
{
 
	free(this->name);
src/script/script_info.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "script_info.hpp"
 
#include "script_scanner.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
ScriptInfo::~ScriptInfo()
 
{
 
	/* Free all allocated strings */
src/script/script_info_dummy.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "../string_func.h"
 
#include "../strings_func.h"
 

	
 
#include "../safeguards.h"
 

	
 
/* The reason this exists in C++, is that a user can trash his ai/ or game/ dir,
 
 *  leaving no Scripts available. The complexity to solve this is insane, and
 
 *  therefore the alternative is used, and make sure there is always a Script
src/script/script_instance.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 
#include "../company_func.h"
 
#include "../fileio_func.h"
 

	
 
#include "../safeguards.h"
 

	
 
ScriptStorage::~ScriptStorage()
 
{
 
	/* Free our pointers */
src/script/script_scanner.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "script_scanner.hpp"
 
#include "script_info.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
bool ScriptScanner::AddFile(const char *filename, size_t basepath_length, const char *tar_filename)
 
{
 
	free(this->main_script);
src/script/squirrel.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 
#include <../squirrel/sqpcheader.h>
 
#include <../squirrel/sqvm.h>
 

	
 
#include "../safeguards.h"
 

	
 
void Squirrel::CompileError(HSQUIRRELVM vm, const SQChar *desc, const SQChar *source, SQInteger line, SQInteger column)
 
{
 
	SQChar buf[1024];
src/script/squirrel_std.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "../core/alloc_func.hpp"
 
#include "../core/math_func.hpp"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
SQInteger SquirrelStd::min(HSQUIRRELVM vm)
 
{
src/sdl.cpp
Show inline comments
 
@@ -79,6 +79,8 @@ static const char *LoadSdlDLL()
 

	
 
#endif /* DYNAMICALLY_LOADED_SDL */
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Open the SDL library.
 
 * @param x The subsystem to load.
src/settings.cpp
Show inline comments
 
@@ -71,6 +71,8 @@
 
#include "table/strings.h"
 
#include "table/settings.h"
 

	
 
#include "safeguards.h"
 

	
 
ClientSettings _settings_client;
 
GameSettings _settings_game;     ///< Game settings of a running game or the scenario editor.
 
GameSettings _settings_newgame;  ///< Game settings for new games (updated from the intro screen).
src/settings_gui.cpp
Show inline comments
 
@@ -38,6 +38,8 @@
 
#include "stringfilter_type.h"
 
#include "querystring_gui.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
static const StringID _driveside_dropdown[] = {
 
	STR_GAME_OPTIONS_ROAD_VEHICLES_DROPDOWN_LEFT,
src/settingsgen/settingsgen.cpp
Show inline comments
 
@@ -30,6 +30,8 @@
 
#define stderr stdout
 
#endif /* __MORPHOS__ */
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Report a fatal error.
 
 * @param s Format string.
src/ship_cmd.cpp
Show inline comments
 
@@ -36,6 +36,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Determine the effective #WaterClass for a ship travelling on a tile.
 
 * @param tile Tile of interest
src/ship_gui.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Draws an image of a ship
 
 * @param v         Front vehicle
src/signal.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "train.h"
 
#include "company_base.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/** these are the maximums used for updating signal blocks */
 
static const uint SIG_TBU_SIZE    =  64; ///< number of signals entering to block
src/signs.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Initialize the sign-pool */
 
SignPool _sign_pool("Sign");
 
INSTANTIATE_POOL_METHODS(Sign)
src/signs_cmd.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** The last built sign. */
 
SignID _new_sign_id;
 

	
src/signs_gui.cpp
Show inline comments
 
@@ -33,6 +33,8 @@
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
struct SignList {
 
	/**
 
	 * A GUIList contains signs and uses a StringFilter for filtering.
src/smallmap_gui.cpp
Show inline comments
 
@@ -28,6 +28,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
static int _smallmap_industry_count; ///< Number of used industries
 
static int _smallmap_company_count;  ///< Number of entries in the owner legend.
 
static int _smallmap_cargo_count;    ///< Number of cargos in the link stats legend.
src/sound.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 
#define SET_TYPE "sounds"
 
#include "base_media_func.h"
 

	
 
#include "safeguards.h"
 

	
 
static SoundEntry _original_sounds[ORIGINAL_SAMPLE_COUNT];
 

	
 
static void OpenBankFile(const char *filename)
src/sound/allegro_s.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "allegro_s.h"
 
#include <allegro.h>
 

	
 
#include "../safeguards.h"
 

	
 
static FSoundDriver_Allegro iFSoundDriver_Allegro;
 
/** The stream we are writing too */
 
static AUDIOSTREAM *_stream = NULL;
src/sound/cocoa_s.cpp
Show inline comments
 
@@ -30,6 +30,8 @@
 
#undef Rect
 
#undef Point
 

	
 
#include "../safeguards.h"
 

	
 
static FSoundDriver_Cocoa iFSoundDriver_Cocoa;
 

	
 
static AudioUnit _outputAudioUnit;
src/sound/null_s.cpp
Show inline comments
 
@@ -12,5 +12,7 @@
 
#include "../stdafx.h"
 
#include "null_s.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** The factory for the null sound driver. */
 
static FSoundDriver_Null iFSoundDriver_Null;
src/sound/sdl_s.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
#include "sdl_s.h"
 
#include <SDL.h>
 

	
 
#include "../safeguards.h"
 

	
 
/** Factory for the SDL sound driver. */
 
static FSoundDriver_SDL iFSoundDriver_SDL;
 

	
src/sound/win32_s.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include <windows.h>
 
#include <mmsystem.h>
 

	
 
#include "../safeguards.h"
 

	
 
static FSoundDriver_Win32 iFSoundDriver_Win32;
 

	
 
static HWAVEOUT _waveout;
src/sprite.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "spritecache.h"
 
#include "zoom_func.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/**
 
 * Draws a tile sprite sequence.
src/spritecache.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include "table/strings.h"
 
#include "table/palette_convert.h"
 

	
 
#include "safeguards.h"
 

	
 
/* Default of 4MB spritecache */
 
uint _sprite_cache_size = 4;
 

	
src/spriteloader/grf.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 
#include "../core/bitmath_func.hpp"
 
#include "grf.hpp"
 

	
 
#include "../safeguards.h"
 

	
 
extern const byte _palmap_w2d[];
 

	
 
/** The different colour components a sprite can have. */
src/station.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** The pool of stations. */
 
StationPool _station_pool("Station");
 
INSTANTIATE_POOL_METHODS(Station)
src/station_cmd.cpp
Show inline comments
 
@@ -56,6 +56,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Check whether the given tile is a hangar.
 
 * @param t the tile to of whether it is a hangar.
src/station_gui.cpp
Show inline comments
 
@@ -39,6 +39,8 @@
 
#include <set>
 
#include <vector>
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Calculates and draws the accepted or supplied cargo around the selected tile(s)
 
 * @param left x position where the string is to be drawn
src/statusbar_gui.cpp
Show inline comments
 
@@ -31,6 +31,8 @@
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
static bool DrawScrollingStatusText(const NewsItem *ni, int scroll_pos, int left, int right, int top, int bottom)
 
{
 
	CopyInDParam(0, ni->params, lengthof(ni->params));
src/story.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include "window_func.h"
 
#include "gui.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
StoryPageElementID _new_story_page_element_id;
 
StoryPageID _new_story_page_id;
src/story_gui.cpp
Show inline comments
 
@@ -31,6 +31,8 @@
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
typedef GUIList<const StoryPage*> GUIStoryPageList;
 
typedef GUIList<const StoryPageElement*> GUIStoryPageElementList;
 

	
src/strgen/strgen.cpp
Show inline comments
 
@@ -39,6 +39,8 @@
 

	
 
#include "../table/strgen_tables.h"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
#ifdef _MSC_VER
 
# define LINE_NUM_FMT(s) "%s (%d): warning: %s (" s ")\n"
src/strgen/strgen_base.cpp
Show inline comments
 
@@ -19,6 +19,8 @@
 

	
 
#include "../table/strgen_tables.h"
 

	
 
#include "../safeguards.h"
 

	
 
/* Compiles a list of strings into a compiled string list */
 

	
 
static bool _translated;              ///< Whether the current language is not the master language
src/string.cpp
Show inline comments
 
@@ -32,6 +32,8 @@
 
#include "gfx_func.h"
 
#endif /* WITH_ICU */
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Safer implementation of vsnprintf; same as vsnprintf except:
 
 * - last instead of size, i.e. replace sizeof with lastof.
src/stringfilter.cpp
Show inline comments
 
@@ -15,6 +15,8 @@
 
#include "stringfilter_type.h"
 
#include "gfx_func.h"
 

	
 
#include "safeguards.h"
 

	
 
static const WChar STATE_WHITESPACE = ' ';
 
static const WChar STATE_WORD = 'w';
 
static const WChar STATE_QUOTE1 = '\'';
src/strings.cpp
Show inline comments
 
@@ -41,6 +41,8 @@
 
#include "table/strings.h"
 
#include "table/control_codes.h"
 

	
 
#include "safeguards.h"
 

	
 
char _config_language_file[MAX_PATH];             ///< The file (name) stored in the configuration.
 
LanguageList _languages;                          ///< The actual list of language meta data.
 
const LanguageMetadata *_current_language = NULL; ///< The currently loaded language.
src/subsidy.cpp
Show inline comments
 
@@ -27,6 +27,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
SubsidyPool _subsidy_pool("Subsidy"); ///< Pool for the subsidies.
 
INSTANTIATE_POOL_METHODS(Subsidy)
 

	
src/subsidy_gui.cpp
Show inline comments
 
@@ -25,6 +25,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
struct SubsidyListWindow : Window {
 
	Scrollbar *vscroll;
 

	
src/terraform_cmd.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/*
 
 * In one terraforming command all four corners of a initial tile can be raised/lowered (though this is not available to the player).
 
 * The maximal amount of height modifications is achieved when raising a complete flat land from sea level to MAX_TILE_HEIGHT or vice versa.
src/terraform_gui.cpp
Show inline comments
 
@@ -37,6 +37,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
void CcTerraform(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
	if (result.Succeeded()) {
src/textbuf.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "window_func.h"
 
#include "core/alloc_func.hpp"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Try to retrieve the current clipboard contents.
 
 *
src/texteff.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "viewport_func.h"
 
#include "settings_type.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Container for all information about a text effect */
 
struct TextEffect : public ViewportSign {
 
	uint64 params_1;     ///< DParam parameter
src/textfile_gui.cpp
Show inline comments
 
@@ -21,6 +21,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Widgets for the textfile window. */
 
static const NWidgetPart _nested_textfile_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
src/tgp.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "core/random_func.hpp"
 
#include "landscape_type.h"
 

	
 
#include "safeguards.h"
 

	
 
/*
 
 *
 
 * Quickie guide to Perlin Noise
src/thread/thread_morphos.cpp
Show inline comments
 
@@ -23,6 +23,8 @@
 
#include <proto/dos.h>
 
#include <proto/exec.h>
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 *  avoid name clashes with MorphOS API functions
 
 */
src/thread/thread_none.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "../stdafx.h"
 
#include "thread.h"
 

	
 
#include "../safeguards.h"
 

	
 
/* static */ bool ThreadObject::New(OTTDThreadFunc proc, void *param, ThreadObject **thread)
 
{
 
	if (thread != NULL) *thread = NULL;
src/thread/thread_os2.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include <os2.h>
 
#include <process.h>
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * OS/2 version for ThreadObject.
 
 */
src/thread/thread_pthread.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include <pthread.h>
 
#include <errno.h>
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * POSIX pthread version for ThreadObject.
 
 */
src/thread/thread_win32.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include <windows.h>
 
#include <process.h>
 

	
 
#include "../safeguards.h"
 

	
 
/**
 
 * Win32 thread version for ThreadObject.
 
 */
src/tile_map.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "stdafx.h"
 
#include "tile_map.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Return the slope of a given tile
 
 * @param tile Tile to compute slope of
src/tilearea.cpp
Show inline comments
 
@@ -13,6 +13,8 @@
 

	
 
#include "tilearea_type.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Construct this tile area based on two points.
 
 * @param start the start of the area
src/timetable_cmd.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Change/update a particular timetable entry.
 
 * @param v            The vehicle to change the timetable of.
src/timetable_gui.cpp
Show inline comments
 
@@ -30,6 +30,8 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Container for the arrival/departure dates of a vehicle */
 
struct TimetableArrivalDeparture {
 
	Ticks arrival;   ///< The arrival time
src/toolbar_gui.cpp
Show inline comments
 
@@ -53,6 +53,8 @@
 
#include "network/network_gui.h"
 
#include "network/network_func.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
RailType _last_built_railtype;
 
RoadType _last_built_roadtype;
src/town_cmd.cpp
Show inline comments
 
@@ -50,6 +50,8 @@
 
#include "table/strings.h"
 
#include "table/town_land.h"
 

	
 
#include "safeguards.h"
 

	
 
TownID _new_town_id;
 
uint32 _town_cargoes_accepted; ///< Bitmap of all cargoes accepted by houses.
 

	
src/town_gui.cpp
Show inline comments
 
@@ -37,6 +37,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
typedef GUIList<const Town*> GUITownList;
 

	
 
static const NWidgetPart _nested_town_authority_widgets[] = {
src/townname.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 

	
 
#include "table/townname.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/**
 
 * Initializes this struct from town data
src/train_cmd.cpp
Show inline comments
 
@@ -39,6 +39,8 @@
 
#include "table/strings.h"
 
#include "table/train_cmd.h"
 

	
 
#include "safeguards.h"
 

	
 
static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool force_res, bool *got_reservation, bool mark_stuck);
 
static bool TrainCheckIfLineEnds(Train *v, bool reverse = true);
 
bool TrainController(Train *v, Vehicle *nomove, bool reverse = true); // Also used in vehicle_sl.cpp.
src/train_gui.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Callback for building wagons.
 
 * @param result The result of the command.
src/transparency_gui.cpp
Show inline comments
 
@@ -20,6 +20,8 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
TransparencyOptionBits _transparency_opt;  ///< The bits that should be transparent.
 
TransparencyOptionBits _transparency_lock; ///< Prevent these bits from flipping with X.
 
TransparencyOptionBits _invisibility_opt;  ///< The bits that should be invisible.
src/tree_cmd.cpp
Show inline comments
 
@@ -29,6 +29,8 @@
 
#include "table/tree_land.h"
 
#include "table/clear_land.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * List of tree placer algorithm.
 
 *
src/tree_gui.cpp
Show inline comments
 
@@ -25,6 +25,8 @@
 
#include "table/strings.h"
 
#include "table/tree_land.h"
 

	
 
#include "safeguards.h"
 

	
 
void PlaceTreesRandomly();
 

	
 
/** Tree Sprites with their palettes */
src/tunnel_map.cpp
Show inline comments
 
@@ -12,6 +12,8 @@
 
#include "stdafx.h"
 
#include "tunnelbridge_map.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
/**
 
 * Gets the other end of the tunnel. Where a vehicle would reappear when it
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -44,6 +44,8 @@
 
#include "table/strings.h"
 
#include "table/bridge_land.h"
 

	
 
#include "safeguards.h"
 

	
 
BridgeSpec _bridge[MAX_BRIDGES]; ///< The specification of all bridges.
 
TileIndex _build_tunnel_endtile; ///< The end of a tunnel; as hidden return from the tunnel build command for GUI purposes.
 

	
src/vehicle.cpp
Show inline comments
 
@@ -55,6 +55,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
#define GEN_HASH(x, y) ((GB((y), 6 + ZOOM_LVL_SHIFT, 6) << 6) + GB((x), 7 + ZOOM_LVL_SHIFT, 6))
 

	
 
VehicleID _new_vehicle_id;
src/vehicle_cmd.cpp
Show inline comments
 
@@ -34,6 +34,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/* Tables used in vehicle.h to find the right command for a certain vehicle type */
 
const uint32 _veh_build_proc_table[] = {
 
	CMD_BUILD_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN),
src/vehicle_gui.cpp
Show inline comments
 
@@ -39,6 +39,8 @@
 
#include "tilehighlight_func.h"
 
#include "zoom_func.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
Sorting _sorting;
 

	
src/vehiclelist.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "vehiclelist.h"
 
#include "group.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Pack a VehicleListIdentifier in a single uint32.
 
 * @return The packed identifier.
src/video/allegro_v.cpp
Show inline comments
 
@@ -27,6 +27,8 @@
 
#include "allegro_v.h"
 
#include <allegro.h>
 

	
 
#include "../safeguards.h"
 

	
 
#ifdef _DEBUG
 
/* Allegro replaces SEGV/ABRT signals meaning that the debugger will never
 
 * be triggered, so rereplace the signals and make the debugger useful. */
src/video/dedicated_v.cpp
Show inline comments
 
@@ -131,6 +131,8 @@ static void CloseWindowsConsoleThread()
 

	
 
#endif
 

	
 
#include "../safeguards.h"
 

	
 

	
 
static void *_dedicated_video_mem;
 

	
src/video/null_v.cpp
Show inline comments
 
@@ -14,6 +14,8 @@
 
#include "../blitter/factory.hpp"
 
#include "null_v.h"
 

	
 
#include "../safeguards.h"
 

	
 
/** Factory for the null video driver. */
 
static FVideoDriver_Null iFVideoDriver_Null;
 

	
src/video/sdl_v.cpp
Show inline comments
 
@@ -26,6 +26,8 @@
 
#include "sdl_v.h"
 
#include <SDL.h>
 

	
 
#include "../safeguards.h"
 

	
 
static FVideoDriver_SDL iFVideoDriver_SDL;
 

	
 
static SDL_Surface *_sdl_screen;
src/video/win32_v.cpp
Show inline comments
 
@@ -27,6 +27,8 @@
 
#include <windows.h>
 
#include <imm.h>
 

	
 
#include "../safeguards.h"
 

	
 
/* Missing define in MinGW headers. */
 
#ifndef MAPVK_VK_TO_CHAR
 
#define MAPVK_VK_TO_CHAR    (2)
src/viewport.cpp
Show inline comments
 
@@ -51,6 +51,8 @@
 
#include "table/strings.h"
 
#include "table/palettes.h"
 

	
 
#include "safeguards.h"
 

	
 
Point _tile_fract_coords;
 

	
 
struct StringSpriteToDraw {
src/viewport_gui.cpp
Show inline comments
 
@@ -22,6 +22,8 @@
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
/* Extra ViewPort Window Stuff */
 
static const NWidgetPart _nested_extra_view_port_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
src/viewport_sprite_sorter_sse4.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "smmintrin.h"
 
#include "viewport_sprite_sorter.h"
 

	
 
#include "safeguards.h"
 

	
 
#ifdef _SQ64
 
	assert_compile((sizeof(ParentSpriteToDraw) % 16) == 0);
 
	#define LOAD_128 _mm_load_si128
src/void_cmd.cpp
Show inline comments
 
@@ -17,6 +17,8 @@
 
#include "table/strings.h"
 
#include "table/sprites.h"
 

	
 
#include "safeguards.h"
 

	
 
static void DrawTile_Void(TileInfo *ti)
 
{
 
	DrawGroundSprite(SPR_SHADOW_CELL, PAL_NONE);
src/water_cmd.cpp
Show inline comments
 
@@ -42,6 +42,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Describes from which directions a specific slope can be flooded (if the tile is floodable at all).
 
 */
src/waypoint.cpp
Show inline comments
 
@@ -16,6 +16,8 @@
 
#include "newgrf_station.h"
 
#include "waypoint_base.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Draw a waypoint
 
 * @param x coordinate
src/waypoint_cmd.cpp
Show inline comments
 
@@ -32,6 +32,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/**
 
 * Update the virtual coords needed to draw the waypoint sign.
 
 */
src/waypoint_gui.cpp
Show inline comments
 
@@ -27,6 +27,8 @@
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** GUI for accessing waypoints and buoys. */
 
struct WaypointWindow : Window {
 
private:
src/widget.cpp
Show inline comments
 
@@ -24,6 +24,8 @@
 
#include "table/strings.h"
 
#include "table/palettes.h"
 

	
 
#include "safeguards.h"
 

	
 
static const char *UPARROW   = "\xEE\x8A\xA0"; ///< String containing an upwards pointing arrow.
 
static const char *DOWNARROW = "\xEE\x8A\xAA"; ///< String containing a downwards pointing arrow.
 

	
src/widgets/dropdown.cpp
Show inline comments
 
@@ -18,6 +18,8 @@
 

	
 
#include "dropdown_widget.h"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
void DropDownListItem::Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
 
{
src/window.cpp
Show inline comments
 
@@ -37,6 +37,8 @@
 
#include "game/game.hpp"
 
#include "video/video_driver.hpp"
 

	
 
#include "safeguards.h"
 

	
 
/** Values for _settings_client.gui.auto_scrolling */
 
enum ViewportAutoscrolling {
 
	VA_DISABLED,                  //!< Do not autoscroll when mouse is at edge of viewport.
0 comments (0 inline, 0 general)