(svn r18028) -Codechange: unglobalise some functions

pull/155/head
rubidium 15 years ago
parent b2d7edddfa
commit 224f4e0197

@ -239,7 +239,7 @@ static const WindowDesc _ai_list_desc(
NULL, _nested_ai_list_widgets, lengthof(_nested_ai_list_widgets)
);
void ShowAIListWindow(CompanyID slot)
static void ShowAIListWindow(CompanyID slot)
{
DeleteWindowByClass(WC_AI_LIST);
new AIListWindow(&_ai_list_desc, slot);
@ -438,7 +438,7 @@ static const WindowDesc _ai_settings_desc(
NULL, _nested_ai_settings_widgets, lengthof(_nested_ai_settings_widgets)
);
void ShowAISettingsWindow(CompanyID slot)
static void ShowAISettingsWindow(CompanyID slot)
{
DeleteWindowByClass(WC_AI_LIST);
DeleteWindowByClass(WC_AI_SETTINGS);

@ -90,7 +90,7 @@ static void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, const AySt
* return values:
* AYSTAR_DONE : indicates we are done
*/
int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
static int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
{
int new_f, new_g, new_h;
PathNode *closedlist_parent;
@ -156,7 +156,7 @@ int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *pare
* AYSTAR_FOUND_END_NODE : indicates we found the end. Path_found now is true, and in path is the path found.
* AYSTAR_STILL_BUSY : indicates we have done this tile, did not found the path yet, and have items left to try.
*/
int AyStarMain_Loop(AyStar *aystar)
static int AyStarMain_Loop(AyStar *aystar)
{
int i, r;
@ -200,7 +200,7 @@ int AyStarMain_Loop(AyStar *aystar)
/*
* This function frees the memory it allocated
*/
void AyStarMain_Free(AyStar *aystar)
static void AyStarMain_Free(AyStar *aystar)
{
aystar->OpenListQueue.free(&aystar->OpenListQueue, false);
/* 2nd argument above is false, below is true, to free the values only
@ -276,7 +276,7 @@ int AyStarMain_Main(AyStar *aystar)
* clear() automatically when the algorithm finishes
* g is the cost for starting with this node.
*/
void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g)
static void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g)
{
#ifdef AYSTAR_DEBUG
printf("[AyStar] Starting A* Algorithm from node (%d, %d, %d)\n",

@ -169,11 +169,7 @@ struct AyStar {
};
void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g);
int AyStarMain_Main(AyStar *aystar);
int AyStarMain_Loop(AyStar *aystar);
int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
void AyStarMain_Free(AyStar *aystar);
void AyStarMain_Clear(AyStar *aystar);
/* Initialize an AyStar. You should fill all appropriate fields before

@ -14,7 +14,12 @@
#include "tunnelbridge_map.h"
TileIndex GetBridgeEnd(TileIndex tile, DiagDirection dir)
/**
* Finds the end of a bridge in the specified direction starting at a middle tile
* @param t the bridge tile to find the bridge ramp for
* @param d the direction to search in
*/
static TileIndex GetBridgeEnd(TileIndex tile, DiagDirection dir)
{
TileIndexDiff delta = TileOffsByDiagDir(dir);

@ -93,13 +93,6 @@ static inline Axis GetBridgeAxis(TileIndex t)
return (Axis)(GB(_m[t].m6, 6, 2) - 1);
}
/**
* Finds the end of a bridge in the specified direction starting at a middle tile
* @param t the bridge tile to find the bridge ramp for
* @param d the direction to search in
*/
TileIndex GetBridgeEnd(TileIndex t, DiagDirection d);
/**
* Finds the northern end of a bridge starting at a middle tile
* @param t the bridge tile to find the bridge ramp for

@ -534,6 +534,53 @@ IConsoleVar *IConsoleVarGet(const char *name)
return NULL;
}
/**
* Get the value of the variable and put it into a printable
* string form so we can use it for printing
*/
static char *IConsoleVarGetStringValue(const IConsoleVar *var)
{
static char tempres[50];
char *value = tempres;
switch (var->type) {
case ICONSOLE_VAR_BOOLEAN:
snprintf(tempres, sizeof(tempres), "%s", (*(bool*)var->addr) ? "on" : "off");
break;
case ICONSOLE_VAR_BYTE:
snprintf(tempres, sizeof(tempres), "%u", *(byte*)var->addr);
break;
case ICONSOLE_VAR_UINT16:
snprintf(tempres, sizeof(tempres), "%u", *(uint16*)var->addr);
break;
case ICONSOLE_VAR_UINT32:
snprintf(tempres, sizeof(tempres), "%u", *(uint32*)var->addr);
break;
case ICONSOLE_VAR_INT16:
snprintf(tempres, sizeof(tempres), "%i", *(int16*)var->addr);
break;
case ICONSOLE_VAR_INT32:
snprintf(tempres, sizeof(tempres), "%i", *(int32*)var->addr);
break;
case ICONSOLE_VAR_STRING:
value = (char*)var->addr;
break;
default: NOT_REACHED();
}
return value;
}
/**
* Print out the value of the variable after it has been assigned
* a new value, thus giving us feedback on the action
*/
static void IConsoleVarPrintSetValue(const IConsoleVar *var)
{
char *value = IConsoleVarGetStringValue(var);
IConsolePrintF(CC_WARNING, "'%s' changed to: %s", var->name, value);
}
/**
* Set a new value to a console variable
* @param *var the variable being set/changed
@ -618,43 +665,6 @@ static uint32 IConsoleVarGetValue(const IConsoleVar *var)
return result;
}
/**
* Get the value of the variable and put it into a printable
* string form so we can use it for printing
*/
static char *IConsoleVarGetStringValue(const IConsoleVar *var)
{
static char tempres[50];
char *value = tempres;
switch (var->type) {
case ICONSOLE_VAR_BOOLEAN:
snprintf(tempres, sizeof(tempres), "%s", (*(bool*)var->addr) ? "on" : "off");
break;
case ICONSOLE_VAR_BYTE:
snprintf(tempres, sizeof(tempres), "%u", *(byte*)var->addr);
break;
case ICONSOLE_VAR_UINT16:
snprintf(tempres, sizeof(tempres), "%u", *(uint16*)var->addr);
break;
case ICONSOLE_VAR_UINT32:
snprintf(tempres, sizeof(tempres), "%u", *(uint32*)var->addr);
break;
case ICONSOLE_VAR_INT16:
snprintf(tempres, sizeof(tempres), "%i", *(int16*)var->addr);
break;
case ICONSOLE_VAR_INT32:
snprintf(tempres, sizeof(tempres), "%i", *(int32*)var->addr);
break;
case ICONSOLE_VAR_STRING:
value = (char*)var->addr;
break;
default: NOT_REACHED();
}
return value;
}
/**
* Print out the value of the variable when asked
*/
@ -672,16 +682,6 @@ void IConsoleVarPrintGetValue(const IConsoleVar *var)
IConsolePrintF(CC_WARNING, "Current value for '%s' is: %s", var->name, value);
}
/**
* Print out the value of the variable after it has been assigned
* a new value, thus giving us feedback on the action
*/
void IConsoleVarPrintSetValue(const IConsoleVar *var)
{
char *value = IConsoleVarGetStringValue(var);
IConsolePrintF(CC_WARNING, "'%s' changed to: %s", var->name, value);
}
/**
* Execute a variable command. Without any parameters, print out its value
* with parameters it assigns a new value to the variable
@ -689,7 +689,7 @@ void IConsoleVarPrintSetValue(const IConsoleVar *var)
* @param tokencount how many additional parameters have been given to the commandline
* @param *token the actual parameters the variable was called with
*/
void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[ICON_TOKEN_COUNT])
static void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[ICON_TOKEN_COUNT])
{
const char *tokenptr = token[0];
byte t_index = tokencount;

@ -407,7 +407,6 @@ void IConsoleSwitch()
}
void IConsoleClose() {if (_iconsole_mode == ICONSOLE_OPENED) IConsoleSwitch();}
void IConsoleOpen() {if (_iconsole_mode == ICONSOLE_CLOSED) IConsoleSwitch();}
/**
* Add the entered line into the history so you can look it back

@ -110,7 +110,6 @@ extern IConsoleAlias *_iconsole_aliases; ///< list of registred aliases
/* console functions */
void IConsoleClearBuffer();
void IConsoleOpen();
/* Commands */
void IConsoleCmdRegister(const char *name, IConsoleCmdProc *proc);
@ -123,10 +122,6 @@ void IConsoleVarRegister(const char *name, void *addr, IConsoleVarTypes type, co
void IConsoleVarStringRegister(const char *name, void *addr, uint32 size, const char *help);
IConsoleVar *IConsoleVarGet(const char *name);
void IConsoleVarPrintGetValue(const IConsoleVar *var);
void IConsoleVarPrintSetValue(const IConsoleVar *var);
/* Parser */
void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[]);
/* console std lib (register ingame commands/aliases/variables) */
void IConsoleStdLibRegister();

@ -302,7 +302,7 @@ char *FioGetDirectory(char *buf, size_t buflen, Subdirectory subdir)
return buf;
}
FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath sp, Subdirectory subdir, size_t *filesize)
static FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath sp, Subdirectory subdir, size_t *filesize)
{
#if defined(WIN32) && defined(UNICODE)
/* fopen is implemented as a define with ellipses for
@ -436,7 +436,7 @@ void FioCreateDirectory(const char *name)
* @param buf string to append the separator to
* @param buflen the length of the buf
*/
void AppendPathSeparator(char *buf, size_t buflen)
static void AppendPathSeparator(char *buf, size_t buflen)
{
size_t s = strlen(buf);

@ -57,7 +57,6 @@ char *FioAppendDirectory(char *buf, size_t buflen, Searchpath sp, Subdirectory s
char *FioGetDirectory(char *buf, size_t buflen, Subdirectory subdir);
void SanitizeFilename(char *filename);
void AppendPathSeparator(char *buf, size_t buflen);
void DeterminePaths(const char *exe);
void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
bool FileExists(const char *filename);

@ -902,7 +902,7 @@ static void SetGlyphPtr(FontSize size, WChar key, const GlyphEntry *glyph)
_glyph_ptr[size][GB(key, 8, 8)][GB(key, 0, 8)].width = glyph->width;
}
void *AllocateFont(size_t size)
static void *AllocateFont(size_t size)
{
return MallocT<byte>(size);
}

@ -310,7 +310,7 @@ static const NWidgetPart _nested_heightmap_load_widgets[] = {
EndContainer(),
};
void StartGeneratingLandscape(glwp_modes mode)
static void StartGeneratingLandscape(glwp_modes mode)
{
DeleteAllNonVitalWindows();

@ -65,7 +65,7 @@ static uint LoadGrfFile(const char *filename, uint load_index, int file_index)
}
void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_tbl)
static void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_tbl)
{
uint start;
while ((start = *index_tbl++) != END) {

@ -12,9 +12,6 @@
#ifndef GFXINIT_H
#define GFXINIT_H
#include "gfx_type.h"
void GfxLoadSprites();
void LoadSpritesIndexed(int file_index, uint *sprite_id, const SpriteID *index_tbl);
#endif /* GFXINIT_H */

@ -2058,7 +2058,7 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept
* service the industry, and 1 otherwise (only competitors can service the
* industry)
*/
int WhoCanServiceIndustry(Industry *ind)
static int WhoCanServiceIndustry(Industry *ind)
{
/* Find all stations within reach of the industry */
StationList stations;

@ -430,7 +430,7 @@ struct NetworkUDPQueryServerInfo : NetworkAddress {
* Threaded part for resolving the IP of a server and querying it.
* @param pntr the NetworkUDPQueryServerInfo.
*/
void NetworkUDPQueryServerThread(void *pntr)
static void NetworkUDPQueryServerThread(void *pntr)
{
NetworkUDPQueryServerInfo *info = (NetworkUDPQueryServerInfo*)pntr;
@ -459,7 +459,7 @@ void NetworkUDPQueryServer(NetworkAddress address, bool manually)
}
}
void NetworkUDPRemoveAdvertiseThread(void *pntr)
static void NetworkUDPRemoveAdvertiseThread(void *pntr)
{
DEBUG(net, 1, "[udp] removing advertise from master server");
@ -491,7 +491,7 @@ void NetworkUDPRemoveAdvertise(bool blocking)
}
}
void NetworkUDPAdvertiseThread(void *pntr)
static void NetworkUDPAdvertiseThread(void *pntr)
{
/* Find somewhere to send */
NetworkAddress out_addr(NETWORK_MASTER_SERVER_HOST, NETWORK_MASTER_SERVER_PORT);

@ -775,7 +775,7 @@ void DeleteIndustryNews(IndustryID iid)
}
}
void RemoveOldNewsItems()
static void RemoveOldNewsItems()
{
NewsItem *next;
for (NewsItem *cur = _oldest_news; _total_news > MIN_NEWS_AMOUNT && cur != NULL; cur = next) {

@ -143,7 +143,7 @@ static const int _signals_to_handle[] = { SIGSEGV, SIGABRT, SIGFPE, SIGBUS };
* @note Not static so it shows up in the backtrace.
* @param signum the signal that caused us to crash.
*/
void CDECL HandleCrash(int signum)
static void CDECL HandleCrash(int signum)
{
/* Disable all handling of signals by us, so we don't go into infinite loops. */
for (const int *i = _signals_to_handle; i != endof(_signals_to_handle); i++) {

@ -227,7 +227,6 @@ static inline Money RailConvertCost(RailType from, RailType to)
return RailBuildCost(to) + _price[PR_CLEAR_RAIL];
}
Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data);
void DrawTrainDepotSprite(int x, int y, int image, RailType railtype);
Vehicle *EnsureNoTrainOnTrackProc(Vehicle *v, void *data);
int TicksToLeaveDepot(const Train *v);

@ -1256,7 +1256,7 @@ CommandCost CmdRemoveSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1,
}
/** Update power of train under which is the railtype being converted */
Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data)
static Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data)
{
if (v->type != VEH_TRAIN) return NULL;

@ -21,7 +21,14 @@
#include "date_func.h"
#include "landscape.h"
bool IsPossibleCrossing(const TileIndex tile, Axis ax)
/**
* Return if the tile is a valid tile for a crossing.
*
* @param tile the curent tile
* @param ax the axis of the road over the rail
* @return true if it is a valid tile
*/
static bool IsPossibleCrossing(const TileIndex tile, Axis ax)
{
return (IsTileType(tile, MP_RAILWAY) &&
GetRailTileType(tile) == RAIL_TILE_NORMAL &&

@ -103,7 +103,7 @@ static const RoadBits _invalid_tileh_slopes_road[2][15] = {
}
};
Foundation GetRoadFoundation(Slope tileh, RoadBits bits);
static Foundation GetRoadFoundation(Slope tileh, RoadBits bits);
/**
* Is it allowed to remove the given road bits from the given tile?
@ -981,7 +981,7 @@ struct DrawRoadTileStruct {
* @param bits The RoadBits part
* @return The resulting Foundation
*/
Foundation GetRoadFoundation(Slope tileh, RoadBits bits)
static Foundation GetRoadFoundation(Slope tileh, RoadBits bits)
{
/* Flat land and land without a road doesn't require a foundation */
if (tileh == SLOPE_FLAT || bits == ROAD_NONE) return FOUNDATION_NONE;

@ -369,16 +369,6 @@ static inline DiagDirection GetRoadDepotDirection(TileIndex t)
*/
RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance = false);
/**
* Return if the tile is a valid tile for a crossing.
*
* @note function is overloaded
* @param tile the curent tile
* @param ax the axis of the road over the rail
* @return true if it is a valid tile
*/
bool IsPossibleCrossing(const TileIndex tile, Axis ax);
static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram)
{

@ -148,7 +148,7 @@ static uint32 RemapOldTownName(uint32 townnameparts, byte old_town_name_type)
#undef FIXNUM
void FixOldTowns()
static void FixOldTowns()
{
Town *town;

@ -767,7 +767,7 @@ static inline size_t SlCalcListLen(const void *list)
* @param list The list being manipulated
* @param conv SLRefType type of the list (Vehicle *, Station *, etc)
*/
void SlList(void *list, SLRefType conv)
static void SlList(void *list, SLRefType conv)
{
/* Automatically calculate the length? */
if (_sl.need_length != NL_NONE) {

@ -259,7 +259,7 @@ static void Load_STNS()
}
}
void Ptrs_STNS()
static void Ptrs_STNS()
{
/* Don't run when savegame version is higher than or equal to 123. */
if (!CheckSavegameVersion(123)) return;

@ -27,7 +27,7 @@ static const SaveLoad _subsidies_desc[] = {
SLE_END()
};
void Save_SUBS()
static void Save_SUBS()
{
Subsidy *s;
FOR_ALL_SUBSIDIES(s) {
@ -36,7 +36,7 @@ void Save_SUBS()
}
}
void Load_SUBS()
static void Load_SUBS()
{
int index;
while ((index = SlIterateArray()) != -1) {

@ -737,7 +737,7 @@ void Load_VEHS()
}
}
void Ptrs_VEHS()
static void Ptrs_VEHS()
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {

@ -796,7 +796,7 @@ void SetDifficultyLevel(int mode, DifficultySettings *gm_opt)
* Checks the difficulty levels read from the configuration and
* forces them to be correct when invalid.
*/
void CheckDifficultyLevels()
static void CheckDifficultyLevels()
{
if (_settings_newgame.difficulty.diff_level != 3) {
SetDifficultyLevel(_settings_newgame.difficulty.diff_level, &_settings_newgame.difficulty);
@ -1048,7 +1048,7 @@ static void HandleOldDiffCustom(bool savegame)
* @param name pointer to the string defining name of the old news config
* @param value pointer to the string defining value of the old news config
* @returns true if conversion could have been made */
bool ConvertOldNewsSetting(const char *name, const char *value)
static bool ConvertOldNewsSetting(const char *name, const char *value)
{
if (strcasecmp(name, "openclose") == 0) {
/* openclose has been split in "open" and "close".

@ -1052,7 +1052,7 @@ uint SettingEntry::Draw(GameSettings *settings_ptr, int base_x, int base_y, int
return cur_row;
}
const void *ResolveVariableAddress(const GameSettings *settings_ptr, const SettingDesc *sd)
static const void *ResolveVariableAddress(const GameSettings *settings_ptr, const SettingDesc *sd)
{
if ((sd->desc.flags & SGF_PER_COMPANY) != 0) {
if (Company::IsValidID(_local_company) && _game_mode != GM_MENU) {

@ -141,7 +141,7 @@ bool SpriteExists(SpriteID id)
return !(GetSpriteCache(id)->file_pos == 0 && GetSpriteCache(id)->file_slot == 0);
}
void *AllocSprite(size_t);
static void *AllocSprite(size_t);
static void *ReadSprite(SpriteCache *sc, SpriteID id, SpriteType sprite_type)
{
@ -451,7 +451,7 @@ static void DeleteEntryFromSpriteCache()
}
}
void *AllocSprite(size_t mem_req)
static void *AllocSprite(size_t mem_req)
{
mem_req += sizeof(MemBlock);

@ -917,7 +917,7 @@ CommandCost FindJoiningBaseStation(StationID existing_station, StationID station
* @param st 'return' pointer for the found station
* @return command cost with the error or 'okay'
*/
CommandCost FindJoiningStation(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Station **st)
static CommandCost FindJoiningStation(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Station **st)
{
return FindJoiningBaseStation<Station, STR_ERROR_MUST_REMOVE_RAILWAY_STATION_FIRST>(existing_station, station_to_join, adjacent, ta, st);
}

@ -122,7 +122,7 @@ void DepotSortList(VehicleList *list)
}
/** draw the vehicle profit button in the vehicle list window. */
void DrawVehicleProfitButton(const Vehicle *v, int x, int y)
static void DrawVehicleProfitButton(const Vehicle *v, int x, int y)
{
SpriteID pal;

@ -19,7 +19,6 @@
#include "engine_type.h"
#include "tile_type.h"
void DrawVehicleProfitButton(const Vehicle *v, int x, int y);
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent);
/** Constants of vehicle view widget indices */

@ -46,7 +46,7 @@ void Waypoint::UpdateVirtCoord()
* Set the default name for a waypoint
* @param wp Waypoint to work on
*/
void MakeDefaultWaypointName(Waypoint *wp)
static void MakeDefaultWaypointName(Waypoint *wp)
{
uint32 used = 0; // bitmap of used waypoint numbers, sliding window with 'next' as base
uint32 next = 0; // first waypoint number in the bitmap

@ -22,6 +22,5 @@ CommandCost RemoveBuoy(TileIndex tile, DoCommandFlag flags);
Axis GetAxisForNewWaypoint(TileIndex tile);
void ShowWaypointWindow(const Waypoint *wp);
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
void MakeDefaultWaypointName(Waypoint *wp);
#endif /* WAYPOINT_FUNC_H */

@ -2314,7 +2314,7 @@ bool NWidgetLeaf::ButtonHit(const Point &pt)
* @note Caller should release returned widget array with \c free(widgets).
* @ingroup NestedWidgets
*/
Widget *InitializeNWidgets(NWidgetBase *nwid, bool rtl, int biggest_index)
static Widget *InitializeNWidgets(NWidgetBase *nwid, bool rtl, int biggest_index)
{
/* Initialize nested widgets. */
nwid->SetupSmallestSize(NULL, false);

@ -548,7 +548,6 @@ private:
static Dimension closebox_dimension; ///< Cached size of a closebox widget.
};
Widget *InitializeNWidgets(NWidgetBase *nwid, bool rtl = false);
bool CompareWidgetArrays(const Widget *orig, const Widget *gen, bool report = true);
/**

Loading…
Cancel
Save