(svn r18027) -Codechange: make some unneededly global variables static and remove some unused variables

This commit is contained in:
rubidium 2009-11-09 09:59:35 +00:00
parent 3702746756
commit c2221885f4
14 changed files with 23 additions and 25 deletions

View File

@ -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] = {

View File

@ -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];

View File

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

View File

@ -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;

View File

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

View File

@ -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 */

View File

@ -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;

View File

@ -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

View File

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

View File

@ -161,7 +161,7 @@ void FixOldTowns()
}
}
StringID *_old_vehicle_names;
static StringID *_old_vehicle_names;
void FixOldVehicles()
{

View File

@ -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. */

View File

@ -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,

View File

@ -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);

View File

@ -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)
{