summaryrefslogtreecommitdiff
path: root/src/saveload
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/saveload
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/saveload')
-rw-r--r--src/saveload/afterload.cpp2
-rw-r--r--src/saveload/ai_sl.cpp2
-rw-r--r--src/saveload/airport_sl.cpp2
-rw-r--r--src/saveload/animated_tile_sl.cpp2
-rw-r--r--src/saveload/autoreplace_sl.cpp2
-rw-r--r--src/saveload/cargomonitor_sl.cpp2
-rw-r--r--src/saveload/cargopacket_sl.cpp2
-rw-r--r--src/saveload/cheat_sl.cpp2
-rw-r--r--src/saveload/company_sl.cpp2
-rw-r--r--src/saveload/depot_sl.cpp2
-rw-r--r--src/saveload/economy_sl.cpp2
-rw-r--r--src/saveload/engine_sl.cpp2
-rw-r--r--src/saveload/game_sl.cpp2
-rw-r--r--src/saveload/gamelog_sl.cpp2
-rw-r--r--src/saveload/goal_sl.cpp2
-rw-r--r--src/saveload/group_sl.cpp2
-rw-r--r--src/saveload/industry_sl.cpp2
-rw-r--r--src/saveload/labelmaps_sl.cpp2
-rw-r--r--src/saveload/linkgraph_sl.cpp2
-rw-r--r--src/saveload/map_sl.cpp2
-rw-r--r--src/saveload/misc_sl.cpp2
-rw-r--r--src/saveload/newgrf_sl.cpp2
-rw-r--r--src/saveload/object_sl.cpp2
-rw-r--r--src/saveload/oldloader.cpp2
-rw-r--r--src/saveload/oldloader_sl.cpp2
-rw-r--r--src/saveload/order_sl.cpp2
-rw-r--r--src/saveload/saveload.cpp2
-rw-r--r--src/saveload/signs_sl.cpp2
-rw-r--r--src/saveload/station_sl.cpp2
-rw-r--r--src/saveload/storage_sl.cpp2
-rw-r--r--src/saveload/story_sl.cpp2
-rw-r--r--src/saveload/strings_sl.cpp2
-rw-r--r--src/saveload/subsidy_sl.cpp2
-rw-r--r--src/saveload/town_sl.cpp2
-rw-r--r--src/saveload/vehicle_sl.cpp2
-rw-r--r--src/saveload/waypoint_sl.cpp2
36 files changed, 72 insertions, 0 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 87754d6b5..d56dbe171 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -58,6 +58,8 @@
#include <signal.h>
+#include "../safeguards.h"
+
extern Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY);
/**
diff --git a/src/saveload/ai_sl.cpp b/src/saveload/ai_sl.cpp
index 51d0a50b8..b86c5541e 100644
--- a/src/saveload/ai_sl.cpp
+++ b/src/saveload/ai_sl.cpp
@@ -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];
diff --git a/src/saveload/airport_sl.cpp b/src/saveload/airport_sl.cpp
index 00a4b2b01..1172d2593 100644
--- a/src/saveload/airport_sl.cpp
+++ b/src/saveload/airport_sl.cpp
@@ -14,6 +14,8 @@
#include "saveload.h"
#include "newgrf_sl.h"
+#include "../safeguards.h"
+
static void Save_APID()
{
Save_NewGRFMapping(_airport_mngr);
diff --git a/src/saveload/animated_tile_sl.cpp b/src/saveload/animated_tile_sl.cpp
index 2ccd42cb5..3fc5f6175 100644
--- a/src/saveload/animated_tile_sl.cpp
+++ b/src/saveload/animated_tile_sl.cpp
@@ -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;
diff --git a/src/saveload/autoreplace_sl.cpp b/src/saveload/autoreplace_sl.cpp
index 0cb9cca8d..99e945503 100644
--- a/src/saveload/autoreplace_sl.cpp
+++ b/src/saveload/autoreplace_sl.cpp
@@ -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),
diff --git a/src/saveload/cargomonitor_sl.cpp b/src/saveload/cargomonitor_sl.cpp
index 2188470a2..98ad95f09 100644
--- a/src/saveload/cargomonitor_sl.cpp
+++ b/src/saveload/cargomonitor_sl.cpp
@@ -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;
diff --git a/src/saveload/cargopacket_sl.cpp b/src/saveload/cargopacket_sl.cpp
index fbc38cc85..dc8d4145e 100644
--- a/src/saveload/cargopacket_sl.cpp
+++ b/src/saveload/cargopacket_sl.cpp
@@ -15,6 +15,8 @@
#include "saveload.h"
+#include "../safeguards.h"
+
/**
* Savegame conversion for cargopackets.
*/
diff --git a/src/saveload/cheat_sl.cpp b/src/saveload/cheat_sl.cpp
index aa5648a88..4616b7e85 100644
--- a/src/saveload/cheat_sl.cpp
+++ b/src/saveload/cheat_sl.cpp
@@ -14,6 +14,8 @@
#include "saveload.h"
+#include "../safeguards.h"
+
/**
* Save the cheat values.
*/
diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp
index 5878f31ea..03e9cdcb3 100644
--- a/src/saveload/company_sl.cpp
+++ b/src/saveload/company_sl.cpp
@@ -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
*
diff --git a/src/saveload/depot_sl.cpp b/src/saveload/depot_sl.cpp
index 0d62d74cd..861a54173 100644
--- a/src/saveload/depot_sl.cpp
+++ b/src/saveload/depot_sl.cpp
@@ -15,6 +15,8 @@
#include "saveload.h"
+#include "../safeguards.h"
+
static TownID _town_index;
static const SaveLoad _depot_desc[] = {
diff --git a/src/saveload/economy_sl.cpp b/src/saveload/economy_sl.cpp
index 86605bdfb..dabf120fc 100644
--- a/src/saveload/economy_sl.cpp
+++ b/src/saveload/economy_sl.cpp
@@ -15,6 +15,8 @@
#include "saveload.h"
+#include "../safeguards.h"
+
/** Prices in pre 126 savegames */
static void Load_PRIC()
{
diff --git a/src/saveload/engine_sl.cpp b/src/saveload/engine_sl.cpp
index d02264cd6..80ab5debd 100644
--- a/src/saveload/engine_sl.cpp
+++ b/src/saveload/engine_sl.cpp
@@ -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),
diff --git a/src/saveload/game_sl.cpp b/src/saveload/game_sl.cpp
index b2b263b13..629bc271a 100644
--- a/src/saveload/game_sl.cpp
+++ b/src/saveload/game_sl.cpp
@@ -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];
diff --git a/src/saveload/gamelog_sl.cpp b/src/saveload/gamelog_sl.cpp
index f25a8d1eb..f818eca13 100644
--- a/src/saveload/gamelog_sl.cpp
+++ b/src/saveload/gamelog_sl.cpp
@@ -15,6 +15,8 @@
#include "saveload.h"
+#include "../safeguards.h"
+
static const SaveLoad _glog_action_desc[] = {
SLE_VAR(LoggedAction, tick, SLE_UINT16),
SLE_END()
diff --git a/src/saveload/goal_sl.cpp b/src/saveload/goal_sl.cpp
index 1c260503e..c415d8ba4 100644
--- a/src/saveload/goal_sl.cpp
+++ b/src/saveload/goal_sl.cpp
@@ -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),
diff --git a/src/saveload/group_sl.cpp b/src/saveload/group_sl.cpp
index 891d6ea6f..93734f80f 100644
--- a/src/saveload/group_sl.cpp
+++ b/src/saveload/group_sl.cpp
@@ -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),
diff --git a/src/saveload/industry_sl.cpp b/src/saveload/industry_sl.cpp
index 469548f23..658cfd2bd 100644
--- a/src/saveload/industry_sl.cpp
+++ b/src/saveload/industry_sl.cpp
@@ -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[] = {
diff --git a/src/saveload/labelmaps_sl.cpp b/src/saveload/labelmaps_sl.cpp
index 5cc77af0c..3b898a3b8 100644
--- a/src/saveload/labelmaps_sl.cpp
+++ b/src/saveload/labelmaps_sl.cpp
@@ -15,6 +15,8 @@
#include "saveload.h"
+#include "../safeguards.h"
+
static SmallVector<RailTypeLabel, RAILTYPE_END> _railtype_list;
/**
diff --git a/src/saveload/linkgraph_sl.cpp b/src/saveload/linkgraph_sl.cpp
index f0dcb1dd4..d9b2b9093 100644
--- a/src/saveload/linkgraph_sl.cpp
+++ b/src/saveload/linkgraph_sl.cpp
@@ -16,6 +16,8 @@
#include "../settings_internal.h"
#include "saveload.h"
+#include "../safeguards.h"
+
typedef LinkGraph::BaseNode Node;
typedef LinkGraph::BaseEdge Edge;
diff --git a/src/saveload/map_sl.cpp b/src/saveload/map_sl.cpp
index 7088a4406..007af7bc6 100644
--- a/src/saveload/map_sl.cpp
+++ b/src/saveload/map_sl.cpp
@@ -16,6 +16,8 @@
#include "saveload.h"
+#include "../safeguards.h"
+
static uint32 _map_dim_x;
static uint32 _map_dim_y;
diff --git a/src/saveload/misc_sl.cpp b/src/saveload/misc_sl.cpp
index 72c56db54..c7bd31e81 100644
--- a/src/saveload/misc_sl.cpp
+++ b/src/saveload/misc_sl.cpp
@@ -21,6 +21,8 @@
#include "saveload.h"
+#include "../safeguards.h"
+
extern TileIndex _cur_tileloop_tile;
extern uint16 _disaster_delay;
extern byte _trees_tick_ctr;
diff --git a/src/saveload/newgrf_sl.cpp b/src/saveload/newgrf_sl.cpp
index d3915340c..cdfd0f317 100644
--- a/src/saveload/newgrf_sl.cpp
+++ b/src/saveload/newgrf_sl.cpp
@@ -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),
diff --git a/src/saveload/object_sl.cpp b/src/saveload/object_sl.cpp
index 4e8539793..dfb1d2cbf 100644
--- a/src/saveload/object_sl.cpp
+++ b/src/saveload/object_sl.cpp
@@ -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),
diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp
index 83fc58ebf..13ee0e5b0 100644
--- a/src/saveload/oldloader.cpp
+++ b/src/saveload/oldloader.cpp
@@ -23,6 +23,8 @@
#include <exception>
+#include "../safeguards.h"
+
static const int TTO_HEADER_SIZE = 41;
static const int TTD_HEADER_SIZE = 49;
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index f9215cf1d..e260acd45 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -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
diff --git a/src/saveload/order_sl.cpp b/src/saveload/order_sl.cpp
index 823416579..40f83f832 100644
--- a/src/saveload/order_sl.cpp
+++ b/src/saveload/order_sl.cpp
@@ -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.
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index ab3e4a290..34b396ddc 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -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
diff --git a/src/saveload/signs_sl.cpp b/src/saveload/signs_sl.cpp
index d5ea26d65..d5bacd509 100644
--- a/src/saveload/signs_sl.cpp
+++ b/src/saveload/signs_sl.cpp
@@ -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),
diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp
index 71e3b31ec..23c306c38 100644
--- a/src/saveload/station_sl.cpp
+++ b/src/saveload/station_sl.cpp
@@ -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.
diff --git a/src/saveload/storage_sl.cpp b/src/saveload/storage_sl.cpp
index d35fa7cc9..110df63a7 100644
--- a/src/saveload/storage_sl.cpp
+++ b/src/saveload/storage_sl.cpp
@@ -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),
diff --git a/src/saveload/story_sl.cpp b/src/saveload/story_sl.cpp
index 310f96fcb..87e3720a6 100644
--- a/src/saveload/story_sl.cpp
+++ b/src/saveload/story_sl.cpp
@@ -14,6 +14,8 @@
#include "saveload.h"
+#include "../safeguards.h"
+
/** Called after load to trash broken pages. */
void AfterLoadStoryBook()
{
diff --git a/src/saveload/strings_sl.cpp b/src/saveload/strings_sl.cpp
index b1cc50d46..c6b63bc1a 100644
--- a/src/saveload/strings_sl.cpp
+++ b/src/saveload/strings_sl.cpp
@@ -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.
diff --git a/src/saveload/subsidy_sl.cpp b/src/saveload/subsidy_sl.cpp
index bfdd25339..f6d650468 100644
--- a/src/saveload/subsidy_sl.cpp
+++ b/src/saveload/subsidy_sl.cpp
@@ -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),
diff --git a/src/saveload/town_sl.cpp b/src/saveload/town_sl.cpp
index de52604f5..7db6a7aa6 100644
--- a/src/saveload/town_sl.cpp
+++ b/src/saveload/town_sl.cpp
@@ -18,6 +18,8 @@
#include "saveload.h"
#include "newgrf_sl.h"
+#include "../safeguards.h"
+
/**
* Rebuild all the cached variables of towns.
*/
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index ad8ef0831..059015be2 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -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
diff --git a/src/saveload/waypoint_sl.cpp b/src/saveload/waypoint_sl.cpp
index 6ea72ea6f..0f9396985 100644
--- a/src/saveload/waypoint_sl.cpp
+++ b/src/saveload/waypoint_sl.cpp
@@ -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;