summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-04-23 20:13:33 +0000
committerrubidium <rubidium@openttd.org>2014-04-23 20:13:33 +0000
commit0463dbdc9e5b39399765015c394e29dedaf7d041 (patch)
tree0d115f2027997f6c452d59d63919f9a6d05cb8be /src/script
parent287ecd158249628a9b12aa5567e0e188499084f5 (diff)
downloadopenttd-0463dbdc9e5b39399765015c394e29dedaf7d041.tar.xz
(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
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/script_accounting.cpp2
-rw-r--r--src/script/api/script_admin.cpp2
-rw-r--r--src/script/api/script_airport.cpp2
-rw-r--r--src/script/api/script_base.cpp2
-rw-r--r--src/script/api/script_basestation.cpp2
-rw-r--r--src/script/api/script_bridge.cpp2
-rw-r--r--src/script/api/script_bridgelist.cpp2
-rw-r--r--src/script/api/script_cargo.cpp2
-rw-r--r--src/script/api/script_cargolist.cpp2
-rw-r--r--src/script/api/script_cargomonitor.cpp2
-rw-r--r--src/script/api/script_company.cpp2
-rw-r--r--src/script/api/script_companymode.cpp2
-rw-r--r--src/script/api/script_controller.cpp2
-rw-r--r--src/script/api/script_date.cpp2
-rw-r--r--src/script/api/script_depotlist.cpp2
-rw-r--r--src/script/api/script_engine.cpp2
-rw-r--r--src/script/api/script_enginelist.cpp2
-rw-r--r--src/script/api/script_error.cpp2
-rw-r--r--src/script/api/script_event.cpp2
-rw-r--r--src/script/api/script_event_types.cpp2
-rw-r--r--src/script/api/script_execmode.cpp2
-rw-r--r--src/script/api/script_game.cpp2
-rw-r--r--src/script/api/script_gamesettings.cpp2
-rw-r--r--src/script/api/script_goal.cpp2
-rw-r--r--src/script/api/script_group.cpp2
-rw-r--r--src/script/api/script_grouplist.cpp2
-rw-r--r--src/script/api/script_industry.cpp2
-rw-r--r--src/script/api/script_industrylist.cpp2
-rw-r--r--src/script/api/script_industrytype.cpp2
-rw-r--r--src/script/api/script_industrytypelist.cpp2
-rw-r--r--src/script/api/script_infrastructure.cpp2
-rw-r--r--src/script/api/script_list.cpp2
-rw-r--r--src/script/api/script_log.cpp2
-rw-r--r--src/script/api/script_map.cpp2
-rw-r--r--src/script/api/script_marine.cpp2
-rw-r--r--src/script/api/script_news.cpp2
-rw-r--r--src/script/api/script_object.cpp2
-rw-r--r--src/script/api/script_order.cpp2
-rw-r--r--src/script/api/script_rail.cpp2
-rw-r--r--src/script/api/script_railtypelist.cpp2
-rw-r--r--src/script/api/script_road.cpp2
-rw-r--r--src/script/api/script_sign.cpp2
-rw-r--r--src/script/api/script_signlist.cpp2
-rw-r--r--src/script/api/script_station.cpp2
-rw-r--r--src/script/api/script_stationlist.cpp2
-rw-r--r--src/script/api/script_story_page.cpp2
-rw-r--r--src/script/api/script_storypageelementlist.cpp2
-rw-r--r--src/script/api/script_storypagelist.cpp2
-rw-r--r--src/script/api/script_subsidy.cpp2
-rw-r--r--src/script/api/script_subsidylist.cpp2
-rw-r--r--src/script/api/script_testmode.cpp2
-rw-r--r--src/script/api/script_text.cpp2
-rw-r--r--src/script/api/script_tile.cpp2
-rw-r--r--src/script/api/script_tilelist.cpp2
-rw-r--r--src/script/api/script_town.cpp2
-rw-r--r--src/script/api/script_townlist.cpp2
-rw-r--r--src/script/api/script_tunnel.cpp2
-rw-r--r--src/script/api/script_vehicle.cpp2
-rw-r--r--src/script/api/script_vehiclelist.cpp2
-rw-r--r--src/script/api/script_viewport.cpp2
-rw-r--r--src/script/api/script_waypoint.cpp2
-rw-r--r--src/script/api/script_waypointlist.cpp2
-rw-r--r--src/script/api/script_window.cpp2
-rw-r--r--src/script/script_config.cpp2
-rw-r--r--src/script/script_info.cpp2
-rw-r--r--src/script/script_info_dummy.cpp2
-rw-r--r--src/script/script_instance.cpp2
-rw-r--r--src/script/script_scanner.cpp2
-rw-r--r--src/script/squirrel.cpp2
-rw-r--r--src/script/squirrel_std.cpp2
70 files changed, 140 insertions, 0 deletions
diff --git a/src/script/api/script_accounting.cpp b/src/script/api/script_accounting.cpp
index dfe05df3b..e6fddf9e8 100644
--- a/src/script/api/script_accounting.cpp
+++ b/src/script/api/script_accounting.cpp
@@ -12,6 +12,8 @@
#include "../../stdafx.h"
#include "script_accounting.hpp"
+#include "../../safeguards.h"
+
Money ScriptAccounting::GetCosts()
{
return this->GetDoCommandCosts();
diff --git a/src/script/api/script_admin.cpp b/src/script/api/script_admin.cpp
index 3625fb458..9027b29a2 100644
--- a/src/script/api/script_admin.cpp
+++ b/src/script/api/script_admin.cpp
@@ -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) {
diff --git a/src/script/api/script_airport.cpp b/src/script/api/script_airport.cpp
index 438a18ae9..edb912609 100644
--- a/src/script/api/script_airport.cpp
+++ b/src/script/api/script_airport.cpp
@@ -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();
diff --git a/src/script/api/script_base.cpp b/src/script/api/script_base.cpp
index 7fd5b2df9..5b2d550b8 100644
--- a/src/script/api/script_base.cpp
+++ b/src/script/api/script_base.cpp
@@ -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)
diff --git a/src/script/api/script_basestation.cpp b/src/script/api/script_basestation.cpp
index 5134243a9..229abf865 100644
--- a/src/script/api/script_basestation.cpp
+++ b/src/script/api/script_basestation.cpp
@@ -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);
diff --git a/src/script/api/script_bridge.cpp b/src/script/api/script_bridge.cpp
index 25f9fc454..45bec466c 100644
--- a/src/script/api/script_bridge.cpp
+++ b/src/script/api/script_bridge.cpp
@@ -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;
diff --git a/src/script/api/script_bridgelist.cpp b/src/script/api/script_bridgelist.cpp
index 9687663e9..0969342ec 100644
--- a/src/script/api/script_bridgelist.cpp
+++ b/src/script/api/script_bridgelist.cpp
@@ -14,6 +14,8 @@
#include "script_bridge.hpp"
#include "../../bridge.h"
+#include "../../safeguards.h"
+
ScriptBridgeList::ScriptBridgeList()
{
for (byte j = 0; j < MAX_BRIDGES; j++) {
diff --git a/src/script/api/script_cargo.cpp b/src/script/api/script_cargo.cpp
index b2459af4e..a2643f897 100644
--- a/src/script/api/script_cargo.cpp
+++ b/src/script/api/script_cargo.cpp
@@ -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());
diff --git a/src/script/api/script_cargolist.cpp b/src/script/api/script_cargolist.cpp
index 08f705d60..39b22a792 100644
--- a/src/script/api/script_cargolist.cpp
+++ b/src/script/api/script_cargolist.cpp
@@ -17,6 +17,8 @@
#include "../../industry.h"
#include "../../station_base.h"
+#include "../../safeguards.h"
+
ScriptCargoList::ScriptCargoList()
{
const CargoSpec *cs;
diff --git a/src/script/api/script_cargomonitor.cpp b/src/script/api/script_cargomonitor.cpp
index e19821bba..4b5b85ed6 100644
--- a/src/script/api/script_cargomonitor.cpp
+++ b/src/script/api/script_cargomonitor.cpp
@@ -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);
diff --git a/src/script/api/script_company.cpp b/src/script/api/script_company.cpp
index 851ca7888..53f58c914 100644
--- a/src/script/api/script_company.cpp
+++ b/src/script/api/script_company.cpp
@@ -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) {
diff --git a/src/script/api/script_companymode.cpp b/src/script/api/script_companymode.cpp
index bf6da493c..1931a5db7 100644
--- a/src/script/api/script_companymode.cpp
+++ b/src/script/api/script_companymode.cpp
@@ -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;
diff --git a/src/script/api/script_controller.cpp b/src/script/api/script_controller.cpp
index 7ca0c7d46..d8489da49 100644
--- a/src/script/api/script_controller.cpp
+++ b/src/script/api/script_controller.cpp
@@ -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;
diff --git a/src/script/api/script_date.cpp b/src/script/api/script_date.cpp
index 6ff92deba..2f5b39963 100644
--- a/src/script/api/script_date.cpp
+++ b/src/script/api/script_date.cpp
@@ -14,6 +14,8 @@
#include "script_date.hpp"
#include "../../date_func.h"
+#include "../../safeguards.h"
+
/* static */ bool ScriptDate::IsValidDate(Date date)
{
return date >= 0;
diff --git a/src/script/api/script_depotlist.cpp b/src/script/api/script_depotlist.cpp
index 7adbe8a28..05bb4ccd0 100644
--- a/src/script/api/script_depotlist.cpp
+++ b/src/script/api/script_depotlist.cpp
@@ -14,6 +14,8 @@
#include "../../depot_base.h"
#include "../../station_base.h"
+#include "../../safeguards.h"
+
ScriptDepotList::ScriptDepotList(ScriptTile::TransportType transport_type)
{
::TileType tile_type;
diff --git a/src/script/api/script_engine.cpp b/src/script/api/script_engine.cpp
index 138628547..1fe16321b 100644
--- a/src/script/api/script_engine.cpp
+++ b/src/script/api/script_engine.cpp
@@ -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);
diff --git a/src/script/api/script_enginelist.cpp b/src/script/api/script_enginelist.cpp
index b6143a20e..99ab9537b 100644
--- a/src/script/api/script_enginelist.cpp
+++ b/src/script/api/script_enginelist.cpp
@@ -13,6 +13,8 @@
#include "script_enginelist.hpp"
#include "../../engine_base.h"
+#include "../../safeguards.h"
+
ScriptEngineList::ScriptEngineList(ScriptVehicle::VehicleType vehicle_type)
{
Engine *e;
diff --git a/src/script/api/script_error.cpp b/src/script/api/script_error.cpp
index 46d287f77..9dd6ece19 100644
--- a/src/script/api/script_error.cpp
+++ b/src/script/api/script_error.cpp
@@ -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();
diff --git a/src/script/api/script_event.cpp b/src/script/api/script_event.cpp
index d7d19863f..0e711ca41 100644
--- a/src/script/api/script_event.cpp
+++ b/src/script/api/script_event.cpp
@@ -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.
diff --git a/src/script/api/script_event_types.cpp b/src/script/api/script_event_types.cpp
index f22bb2f61..8c1395c11 100644
--- a/src/script/api/script_event_types.cpp
+++ b/src/script/api/script_event_types.cpp
@@ -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);
diff --git a/src/script/api/script_execmode.cpp b/src/script/api/script_execmode.cpp
index fe2ac3d7c..4fb0cc7e2 100644
--- a/src/script/api/script_execmode.cpp
+++ b/src/script/api/script_execmode.cpp
@@ -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
diff --git a/src/script/api/script_game.cpp b/src/script/api/script_game.cpp
index f0aeb191f..c24757a3c 100644
--- a/src/script/api/script_game.cpp
+++ b/src/script/api/script_game.cpp
@@ -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);
diff --git a/src/script/api/script_gamesettings.cpp b/src/script/api/script_gamesettings.cpp
index ed284ae59..1f8ded877 100644
--- a/src/script/api/script_gamesettings.cpp
+++ b/src/script/api/script_gamesettings.cpp
@@ -15,6 +15,8 @@
#include "../../settings_type.h"
#include "../../command_type.h"
+#include "../../safeguards.h"
+
/* static */ bool ScriptGameSettings::IsValid(const char *setting)
{
uint i;
diff --git a/src/script/api/script_goal.cpp b/src/script/api/script_goal.cpp
index 535450973..5153e0ef0 100644
--- a/src/script/api/script_goal.cpp
+++ b/src/script/api/script_goal.cpp
@@ -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);
diff --git a/src/script/api/script_group.cpp b/src/script/api/script_group.cpp
index 89cbf2c71..1e8d6d774 100644
--- a/src/script/api/script_group.cpp
+++ b/src/script/api/script_group.cpp
@@ -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);
diff --git a/src/script/api/script_grouplist.cpp b/src/script/api/script_grouplist.cpp
index 39dd31002..d1071c36c 100644
--- a/src/script/api/script_grouplist.cpp
+++ b/src/script/api/script_grouplist.cpp
@@ -13,6 +13,8 @@
#include "script_grouplist.hpp"
#include "../../group.h"
+#include "../../safeguards.h"
+
ScriptGroupList::ScriptGroupList()
{
Group *g;
diff --git a/src/script/api/script_industry.cpp b/src/script/api/script_industry.cpp
index 5e30f1377..c536ec559 100644
--- a/src/script/api/script_industry.cpp
+++ b/src/script/api/script_industry.cpp
@@ -19,6 +19,8 @@
#include "../../newgrf_industries.h"
#include "table/strings.h"
+#include "../../safeguards.h"
+
/* static */ int32 ScriptIndustry::GetIndustryCount()
{
return (int32)::Industry::GetNumItems();
diff --git a/src/script/api/script_industrylist.cpp b/src/script/api/script_industrylist.cpp
index b9824b9ac..d2d298fa3 100644
--- a/src/script/api/script_industrylist.cpp
+++ b/src/script/api/script_industrylist.cpp
@@ -13,6 +13,8 @@
#include "script_industrylist.hpp"
#include "../../industry.h"
+#include "../../safeguards.h"
+
ScriptIndustryList::ScriptIndustryList()
{
Industry *i;
diff --git a/src/script/api/script_industrytype.cpp b/src/script/api/script_industrytype.cpp
index bbfca99a4..1ac59975d 100644
--- a/src/script/api/script_industrytype.cpp
+++ b/src/script/api/script_industrytype.cpp
@@ -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;
diff --git a/src/script/api/script_industrytypelist.cpp b/src/script/api/script_industrytypelist.cpp
index c72fabcaa..b60361578 100644
--- a/src/script/api/script_industrytypelist.cpp
+++ b/src/script/api/script_industrytypelist.cpp
@@ -13,6 +13,8 @@
#include "script_industrytypelist.hpp"
#include "../../industry.h"
+#include "../../safeguards.h"
+
ScriptIndustryTypeList::ScriptIndustryTypeList()
{
for (int i = 0; i < NUM_INDUSTRYTYPES; i++) {
diff --git a/src/script/api/script_infrastructure.cpp b/src/script/api/script_infrastructure.cpp
index 1ce051bba..d7da2747e 100644
--- a/src/script/api/script_infrastructure.cpp
+++ b/src/script/api/script_infrastructure.cpp
@@ -17,6 +17,8 @@
#include "../../water.h"
#include "../../station_func.h"
+#include "../../safeguards.h"
+
/* static */ uint32 ScriptInfrastructure::GetRailPieceCount(ScriptCompany::CompanyID company, ScriptRail::RailType railtype)
{
diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp
index 68df5bf95..7add90c74 100644
--- a/src/script/api/script_list.cpp
+++ b/src/script/api/script_list.cpp
@@ -14,6 +14,8 @@
#include "../../debug.h"
#include "../../script/squirrel.hpp"
+#include "../../safeguards.h"
+
/**
* Base class for any ScriptList sorter.
*/
diff --git a/src/script/api/script_log.cpp b/src/script/api/script_log.cpp
index fc6a0b193..6e725617c 100644
--- a/src/script/api/script_log.cpp
+++ b/src/script/api/script_log.cpp
@@ -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);
diff --git a/src/script/api/script_map.cpp b/src/script/api/script_map.cpp
index 3f224b3d1..6334089fd 100644
--- a/src/script/api/script_map.cpp
+++ b/src/script/api/script_map.cpp
@@ -13,6 +13,8 @@
#include "script_map.hpp"
#include "../../tile_map.h"
+#include "../../safeguards.h"
+
/* static */ bool ScriptMap::IsValidTile(TileIndex t)
{
return ::IsValidTile(t);
diff --git a/src/script/api/script_marine.cpp b/src/script/api/script_marine.cpp
index abc8666f1..434ec11ac 100644
--- a/src/script/api/script_marine.cpp
+++ b/src/script/api/script_marine.cpp
@@ -15,6 +15,8 @@
#include "../../station_base.h"
#include "../../tile_cmd.h"
+#include "../../safeguards.h"
+
/* static */ bool ScriptMarine::IsWaterDepotTile(TileIndex tile)
{
diff --git a/src/script/api/script_news.cpp b/src/script/api/script_news.cpp
index e80b88491..8d808ff3c 100644
--- a/src/script/api/script_news.cpp
+++ b/src/script/api/script_news.cpp
@@ -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);
diff --git a/src/script/api/script_object.cpp b/src/script/api/script_object.cpp
index 679efd1a7..47de2b1a7 100644
--- a/src/script/api/script_object.cpp
+++ b/src/script/api/script_object.cpp
@@ -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.
diff --git a/src/script/api/script_order.cpp b/src/script/api/script_order.cpp
index 3098b452f..676262dc7 100644
--- a/src/script/api/script_order.cpp
+++ b/src/script/api/script_order.cpp
@@ -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
diff --git a/src/script/api/script_rail.cpp b/src/script/api/script_rail.cpp
index 26317a72c..af68a3edc 100644
--- a/src/script/api/script_rail.cpp
+++ b/src/script/api/script_rail.cpp
@@ -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;
diff --git a/src/script/api/script_railtypelist.cpp b/src/script/api/script_railtypelist.cpp
index 9373ce85c..016145b76 100644
--- a/src/script/api/script_railtypelist.cpp
+++ b/src/script/api/script_railtypelist.cpp
@@ -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++) {
diff --git a/src/script/api/script_road.cpp b/src/script/api/script_road.cpp
index 445446695..3a9a8ca3f 100644
--- a/src/script/api/script_road.cpp
+++ b/src/script/api/script_road.cpp
@@ -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;
diff --git a/src/script/api/script_sign.cpp b/src/script/api/script_sign.cpp
index 3373800b5..236e1df7e 100644
--- a/src/script/api/script_sign.cpp
+++ b/src/script/api/script_sign.cpp
@@ -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);
diff --git a/src/script/api/script_signlist.cpp b/src/script/api/script_signlist.cpp
index 5f6c6075b..61ab9665a 100644
--- a/src/script/api/script_signlist.cpp
+++ b/src/script/api/script_signlist.cpp
@@ -14,6 +14,8 @@
#include "script_sign.hpp"
#include "../../signs_base.h"
+#include "../../safeguards.h"
+
ScriptSignList::ScriptSignList()
{
Sign *s;
diff --git a/src/script/api/script_station.cpp b/src/script/api/script_station.cpp
index 2774ac28e..db0865261 100644
--- a/src/script/api/script_station.cpp
+++ b/src/script/api/script_station.cpp
@@ -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);
diff --git a/src/script/api/script_stationlist.cpp b/src/script/api/script_stationlist.cpp
index a7269bd24..9d88fd8fc 100644
--- a/src/script/api/script_stationlist.cpp
+++ b/src/script/api/script_stationlist.cpp
@@ -15,6 +15,8 @@
#include "../../station_base.h"
#include "../../vehicle_base.h"
+#include "../../safeguards.h"
+
ScriptStationList::ScriptStationList(ScriptStation::StationType station_type)
{
Station *st;
diff --git a/src/script/api/script_story_page.cpp b/src/script/api/script_story_page.cpp
index 17b7b8273..11820ec3f 100644
--- a/src/script/api/script_story_page.cpp
+++ b/src/script/api/script_story_page.cpp
@@ -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);
diff --git a/src/script/api/script_storypageelementlist.cpp b/src/script/api/script_storypageelementlist.cpp
index 5b6b2cd53..3f1fa4ebb 100644
--- a/src/script/api/script_storypageelementlist.cpp
+++ b/src/script/api/script_storypageelementlist.cpp
@@ -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;
diff --git a/src/script/api/script_storypagelist.cpp b/src/script/api/script_storypagelist.cpp
index 795ff0201..fc32e80a3 100644
--- a/src/script/api/script_storypagelist.cpp
+++ b/src/script/api/script_storypagelist.cpp
@@ -14,6 +14,8 @@
#include "script_story_page.hpp"
#include "../../story_base.h"
+#include "../../safeguards.h"
+
ScriptStoryPageList::ScriptStoryPageList(ScriptCompany::CompanyID company)
{
uint8 c = company;
diff --git a/src/script/api/script_subsidy.cpp b/src/script/api/script_subsidy.cpp
index 146ba690d..640f7ab0a 100644
--- a/src/script/api/script_subsidy.cpp
+++ b/src/script/api/script_subsidy.cpp
@@ -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);
diff --git a/src/script/api/script_subsidylist.cpp b/src/script/api/script_subsidylist.cpp
index 68644846f..fd7d94779 100644
--- a/src/script/api/script_subsidylist.cpp
+++ b/src/script/api/script_subsidylist.cpp
@@ -13,6 +13,8 @@
#include "script_subsidylist.hpp"
#include "../../subsidy_base.h"
+#include "../../safeguards.h"
+
ScriptSubsidyList::ScriptSubsidyList()
{
const Subsidy *s;
diff --git a/src/script/api/script_testmode.cpp b/src/script/api/script_testmode.cpp
index 46cc15e05..37f296de0 100644
--- a/src/script/api/script_testmode.cpp
+++ b/src/script/api/script_testmode.cpp
@@ -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
diff --git a/src/script/api/script_text.cpp b/src/script/api/script_text.cpp
index f87b2e8b2..9fb297990 100644
--- a/src/script/api/script_text.cpp
+++ b/src/script/api/script_text.cpp
@@ -17,6 +17,8 @@
#include "table/strings.h"
+#include "../../safeguards.h"
+
ScriptText::ScriptText(HSQUIRRELVM vm) :
ZeroedMemoryAllocator()
{
diff --git a/src/script/api/script_tile.cpp b/src/script/api/script_tile.cpp
index c84e8411a..db9220acd 100644
--- a/src/script/api/script_tile.cpp
+++ b/src/script/api/script_tile.cpp
@@ -20,6 +20,8 @@
#include "../../town.h"
#include "../../landscape.h"
+#include "../../safeguards.h"
+
/* static */ bool ScriptTile::IsBuildable(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;
diff --git a/src/script/api/script_tilelist.cpp b/src/script/api/script_tilelist.cpp
index d4fe9f977..933a92c4c 100644
--- a/src/script/api/script_tilelist.cpp
+++ b/src/script/api/script_tilelist.cpp
@@ -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;
diff --git a/src/script/api/script_town.cpp b/src/script/api/script_town.cpp
index 725c7d0a6..d81704ae3 100644
--- a/src/script/api/script_town.cpp
+++ b/src/script/api/script_town.cpp
@@ -21,6 +21,8 @@
#include "../../landscape.h"
#include "table/strings.h"
+#include "../../safeguards.h"
+
/* static */ int32 ScriptTown::GetTownCount()
{
return (int32)::Town::GetNumItems();
diff --git a/src/script/api/script_townlist.cpp b/src/script/api/script_townlist.cpp
index 33a3fc070..a2e12febe 100644
--- a/src/script/api/script_townlist.cpp
+++ b/src/script/api/script_townlist.cpp
@@ -13,6 +13,8 @@
#include "script_townlist.hpp"
#include "../../town.h"
+#include "../../safeguards.h"
+
ScriptTownList::ScriptTownList()
{
Town *t;
diff --git a/src/script/api/script_tunnel.cpp b/src/script/api/script_tunnel.cpp
index 97085688f..7b891f28d 100644
--- a/src/script/api/script_tunnel.cpp
+++ b/src/script/api/script_tunnel.cpp
@@ -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;
diff --git a/src/script/api/script_vehicle.cpp b/src/script/api/script_vehicle.cpp
index 23003ca26..ca841f755 100644
--- a/src/script/api/script_vehicle.cpp
+++ b/src/script/api/script_vehicle.cpp
@@ -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);
diff --git a/src/script/api/script_vehiclelist.cpp b/src/script/api/script_vehiclelist.cpp
index 3017266fa..625f0f8c4 100644
--- a/src/script/api/script_vehiclelist.cpp
+++ b/src/script/api/script_vehiclelist.cpp
@@ -17,6 +17,8 @@
#include "../../depot_map.h"
#include "../../vehicle_base.h"
+#include "../../safeguards.h"
+
ScriptVehicleList::ScriptVehicleList()
{
const Vehicle *v;
diff --git a/src/script/api/script_viewport.cpp b/src/script/api/script_viewport.cpp
index 139edb029..737e7e68d 100644
--- a/src/script/api/script_viewport.cpp
+++ b/src/script/api/script_viewport.cpp
@@ -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;
diff --git a/src/script/api/script_waypoint.cpp b/src/script/api/script_waypoint.cpp
index a10b3376b..91733a38e 100644
--- a/src/script/api/script_waypoint.cpp
+++ b/src/script/api/script_waypoint.cpp
@@ -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);
diff --git a/src/script/api/script_waypointlist.cpp b/src/script/api/script_waypointlist.cpp
index b32b3e8b3..dd641a684 100644
--- a/src/script/api/script_waypointlist.cpp
+++ b/src/script/api/script_waypointlist.cpp
@@ -15,6 +15,8 @@
#include "../../vehicle_base.h"
#include "../../waypoint_base.h"
+#include "../../safeguards.h"
+
ScriptWaypointList::ScriptWaypointList(ScriptWaypoint::WaypointType waypoint_type)
{
const Waypoint *wp;
diff --git a/src/script/api/script_window.cpp b/src/script/api/script_window.cpp
index 086e59f63..1252f0fc7 100644
--- a/src/script/api/script_window.cpp
+++ b/src/script/api/script_window.cpp
@@ -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;
diff --git a/src/script/script_config.cpp b/src/script/script_config.cpp
index a46f5f392..7842a3a9d 100644
--- a/src/script/script_config.cpp
+++ b/src/script/script_config.cpp
@@ -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);
diff --git a/src/script/script_info.cpp b/src/script/script_info.cpp
index 8b84966f2..f3ea1747b 100644
--- a/src/script/script_info.cpp
+++ b/src/script/script_info.cpp
@@ -17,6 +17,8 @@
#include "script_info.hpp"
#include "script_scanner.hpp"
+#include "../safeguards.h"
+
ScriptInfo::~ScriptInfo()
{
/* Free all allocated strings */
diff --git a/src/script/script_info_dummy.cpp b/src/script/script_info_dummy.cpp
index b84630332..b70032f44 100644
--- a/src/script/script_info_dummy.cpp
+++ b/src/script/script_info_dummy.cpp
@@ -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
diff --git a/src/script/script_instance.cpp b/src/script/script_instance.cpp
index 7e4766fdb..1aa5f1978 100644
--- a/src/script/script_instance.cpp
+++ b/src/script/script_instance.cpp
@@ -29,6 +29,8 @@
#include "../company_func.h"
#include "../fileio_func.h"
+#include "../safeguards.h"
+
ScriptStorage::~ScriptStorage()
{
/* Free our pointers */
diff --git a/src/script/script_scanner.cpp b/src/script/script_scanner.cpp
index 2197a5505..b90f63cd8 100644
--- a/src/script/script_scanner.cpp
+++ b/src/script/script_scanner.cpp
@@ -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);
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp
index ce73f9a64..2c50b964a 100644
--- a/src/script/squirrel.cpp
+++ b/src/script/squirrel.cpp
@@ -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];
diff --git a/src/script/squirrel_std.cpp b/src/script/squirrel_std.cpp
index 9de119e1e..a6f19a5dd 100644
--- a/src/script/squirrel_std.cpp
+++ b/src/script/squirrel_std.cpp
@@ -17,6 +17,8 @@
#include "../core/alloc_func.hpp"
#include "../core/math_func.hpp"
+#include "../safeguards.h"
+
SQInteger SquirrelStd::min(HSQUIRRELVM vm)
{