summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-09 09:59:35 +0000
committerrubidium <rubidium@openttd.org>2009-11-09 09:59:35 +0000
commitc2221885f488b9a7ca52b11e621582d4c60ab80d (patch)
treeb793601f63728bb573ffd9825355792c89d7e315
parent37027467567dd0b75bbb932cdab87da3ff24dedd (diff)
downloadopenttd-c2221885f488b9a7ca52b11e621582d4c60ab80d.tar.xz
(svn r18027) -Codechange: make some unneededly global variables static and remove some unused variables
-rw-r--r--src/engine.cpp2
-rw-r--r--src/gfx.cpp2
-rw-r--r--src/landscape.cpp2
-rw-r--r--src/network/network.cpp5
-rw-r--r--src/network/network_gamelist.cpp4
-rw-r--r--src/network/network_internal.h5
-rw-r--r--src/network/network_udp.cpp2
-rw-r--r--src/newgrf.cpp6
-rw-r--r--src/newgrf.h2
-rw-r--r--src/saveload/oldloader_sl.cpp2
-rw-r--r--src/table/settings.h2
-rw-r--r--src/toolbar_gui.cpp2
-rw-r--r--src/town.h3
-rw-r--r--src/town_cmd.cpp9
14 files changed, 23 insertions, 25 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 04f483bb8..2e3901393 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -39,7 +39,7 @@ EngineOverrideManager _engine_mngr;
/** Year that engine aging stops. Engines will not reduce in reliability
* and no more engines will be introduced */
-Year _year_engine_aging_stops;
+static Year _year_engine_aging_stops;
/** Number of engines of each vehicle type in original engine data */
const uint8 _engine_counts[4] = {
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 0f011aebb..062ef34f1 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -49,7 +49,7 @@ int _pal_first_dirty;
int _pal_count_dirty;
Colour _cur_palette[256];
-byte _stringwidth_table[FS_END][224]; ///< Cache containing width of often used characters. @see GetCharacterWidth()
+static byte _stringwidth_table[FS_END][224]; ///< Cache containing width of often used characters. @see GetCharacterWidth()
DrawPixelInfo *_cur_dpi;
byte _colour_gradient[COLOUR_END][8];
diff --git a/src/landscape.cpp b/src/landscape.cpp
index fad4551e3..d42d23c8f 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -75,7 +75,7 @@ const byte _tileh_to_sprite[32] = {
* Otherwise it points to a table loaded from a newGRF file, that describes the variable snowline
* @ingroup SnowLineGroup
* @see GetSnowLine() GameCreationSettings */
-SnowLine *_snow_line = NULL;
+static SnowLine *_snow_line = NULL;
/**
* Applies a foundation to a slope.
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 5255b30ef..46cf1a4bb 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -67,7 +67,10 @@ uint32 _frame_counter_max; // To where we may go with our clients
uint32 _frame_counter;
uint32 _last_sync_frame; // Used in the server to store the last time a sync packet was sent to clients.
NetworkAddressList _broadcast_list;
-uint32 _sync_seed_1, _sync_seed_2;
+uint32 _sync_seed_1;
+#ifdef NETWORK_SEND_DOUBLE_SEED
+uint32 _sync_seed_2;
+#endif
uint32 _sync_frame;
bool _network_first_time;
bool _network_udp_server;
diff --git a/src/network/network_gamelist.cpp b/src/network/network_gamelist.cpp
index cef15affa..f0a3fb5c9 100644
--- a/src/network/network_gamelist.cpp
+++ b/src/network/network_gamelist.cpp
@@ -23,8 +23,8 @@
NetworkGameList *_network_game_list = NULL;
-ThreadMutex *_network_game_list_mutex = ThreadMutex::New();
-NetworkGameList *_network_game_delayed_insertion_list = NULL;
+static ThreadMutex *_network_game_list_mutex = ThreadMutex::New();
+static NetworkGameList *_network_game_delayed_insertion_list = NULL;
/** Add a new item to the linked gamelist, but do it delayed in the next tick
* or so to prevent race conditions.
diff --git a/src/network/network_internal.h b/src/network/network_internal.h
index b894d17b9..405b938cc 100644
--- a/src/network/network_internal.h
+++ b/src/network/network_internal.h
@@ -112,7 +112,10 @@ extern uint32 _last_sync_frame; // Used in the server to store the last time a s
/* networking settings */
extern NetworkAddressList _broadcast_list;
-extern uint32 _sync_seed_1, _sync_seed_2;
+extern uint32 _sync_seed_1;
+#ifdef NETWORK_SEND_DOUBLE_SEED
+extern uint32 _sync_seed_2;
+#endif
extern uint32 _sync_frame;
extern bool _network_first_time;
/* Vars needed for the join-GUI */
diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp
index a4b388e91..acf1afb2d 100644
--- a/src/network/network_udp.cpp
+++ b/src/network/network_udp.cpp
@@ -29,7 +29,7 @@
#include "core/udp.h"
-ThreadMutex *_network_udp_mutex = ThreadMutex::New();
+static ThreadMutex *_network_udp_mutex = ThreadMutex::New();
/** Session key to register ourselves to the master server */
static uint64 _session_key = 0;
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index caa30ebb4..3da5acec5 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -65,7 +65,7 @@ static int _skip_sprites; // XXX
static uint _file_index; // XXX
static GRFFile *_cur_grffile;
-GRFFile *_first_grffile;
+static GRFFile *_first_grffile;
static SpriteID _cur_spriteid;
static GrfLoadingStage _cur_stage;
static uint32 _nfo_line;
@@ -132,7 +132,7 @@ struct GRFLocation {
static std::map<GRFLocation, SpriteID> _grm_sprites;
typedef std::map<GRFLocation, byte*> GRFLineToSpriteOverride;
-GRFLineToSpriteOverride _grf_line_to_action6_sprite_override;
+static GRFLineToSpriteOverride _grf_line_to_action6_sprite_override;
/** DEBUG() function dedicated to newGRF debugging messages
* Function is essentialy the same as DEBUG(grf, severity, ...) with the
@@ -255,7 +255,7 @@ static void ClearTemporaryNewGRFData(GRFFile *gf)
typedef std::map<StringID *, uint32> StringIDToGRFIDMapping;
-StringIDToGRFIDMapping _string_to_grf_mapping;
+static StringIDToGRFIDMapping _string_to_grf_mapping;
/** Used when setting an object's property to map to the GRF's strings
* while taking in consideration the "drift" between TTDPatch string system and OpenTTD's one
diff --git a/src/newgrf.h b/src/newgrf.h
index 7c85adf6f..b1ddc8245 100644
--- a/src/newgrf.h
+++ b/src/newgrf.h
@@ -118,8 +118,6 @@ struct GRFFile {
int traininfo_vehicle_width; ///< Width (in pixels) of a 8/8 train vehicle in depot GUI and vehicle details
};
-extern GRFFile *_first_grffile;
-
enum ShoreReplacement {
SHORE_REPLACE_NONE, ///< No shore sprites were replaced.
SHORE_REPLACE_ACTION_5, ///< Shore sprites were replaced by Action5.
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index cb13b10fd..332447b6c 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -161,7 +161,7 @@ void FixOldTowns()
}
}
-StringID *_old_vehicle_names;
+static StringID *_old_vehicle_names;
void FixOldVehicles()
{
diff --git a/src/table/settings.h b/src/table/settings.h
index cac6ce7ea..623ed658d 100644
--- a/src/table/settings.h
+++ b/src/table/settings.h
@@ -278,7 +278,7 @@ static const SettingDescGlobVarList _misc_settings[] = {
};
static const uint GAME_DIFFICULTY_NUM = 18;
-uint16 _old_diff_custom[GAME_DIFFICULTY_NUM];
+static uint16 _old_diff_custom[GAME_DIFFICULTY_NUM];
/* Most of these strings are used both for gameopt-backward compatability
* and the settings tables. The rest is here for consistency. */
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 2d59aaf7d..d087806da 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -50,7 +50,7 @@
#include "table/sprites.h"
RailType _last_built_railtype;
-RoadType _last_built_roadtype;
+static RoadType _last_built_roadtype;
enum ToolbarMode {
TB_NORMAL,
diff --git a/src/town.h b/src/town.h
index ac5b988ec..08d376fc3 100644
--- a/src/town.h
+++ b/src/town.h
@@ -197,9 +197,6 @@ Town *CalcClosestTownFromTile(TileIndex tile, uint threshold = UINT_MAX);
#define FOR_ALL_TOWNS_FROM(var, start) FOR_ALL_ITEMS_FROM(Town, town_index, var, start)
#define FOR_ALL_TOWNS(var) FOR_ALL_TOWNS_FROM(var, 0)
-extern Town *_cleared_town;
-extern int _cleared_town_rating;
-
void ResetHouses();
void ClearTownHouse(Town *t, TileIndex tile);
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 60246f370..0d2b45b71 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -50,13 +50,10 @@
#include "table/strings.h"
#include "table/town_land.h"
-Town *_cleared_town;
-int _cleared_town_rating;
+static Town *_cleared_town;
+static int _cleared_town_rating;
TownID _new_town_id;
-uint32 _cur_town_ctr; ///< iterator through all towns in OnTick_Town
-uint32 _cur_town_iter; ///< frequency iterator at the same place
-
/* Initialize the town-pool */
TownPool _town_pool("Town");
INSTANTIATE_POOL_METHODS(Town)
@@ -2714,7 +2711,7 @@ Town *ClosestTownFromTile(TileIndex tile, uint threshold)
}
static bool _town_rating_test = false;
-SmallMap<const Town *, int, 4> _town_test_ratings;
+static SmallMap<const Town *, int, 4> _town_test_ratings;
void SetTownRatingTestMode(bool mode)
{