summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-22 22:47:58 +0000
committertron <tron@openttd.org>2005-01-22 22:47:58 +0000
commite5cd6b61933537888b1be19af437415861cca57f (patch)
tree078e42c5f2a6e1d8ef465541334a5c00039419e1
parente75c48ec7a8920c475e515fa13c7629f19cf1a14 (diff)
downloadopenttd-e5cd6b61933537888b1be19af437415861cca57f.tar.xz
(svn r1596) Add some more statics
-rw-r--r--ai_pathfinder.c12
-rw-r--r--aystar.c15
-rw-r--r--clear_cmd.c10
-rw-r--r--console.c3
-rw-r--r--console_cmds.c2
-rw-r--r--engine_gui.c2
-rw-r--r--gfx.c3
-rw-r--r--landscape.c2
-rw-r--r--misc.c2
-rw-r--r--misc_gui.c4
-rw-r--r--network.c2
-rw-r--r--network_data.c2
-rw-r--r--network_gamelist.c4
-rw-r--r--news_gui.c4
-rw-r--r--order_gui.c2
-rw-r--r--queue.c58
-rw-r--r--rail_cmd.c2
-rw-r--r--road_cmd.c4
-rw-r--r--roadveh_cmd.c4
-rw-r--r--saveload.c12
-rw-r--r--settings_gui.c12
-rw-r--r--terraform_gui.c2
-rw-r--r--train_cmd.c4
-rw-r--r--ttd.c20
-rw-r--r--tunnelbridge_cmd.c2
-rw-r--r--viewport.c5
-rw-r--r--widget.c2
-rw-r--r--window.c7
28 files changed, 116 insertions, 87 deletions
diff --git a/ai_pathfinder.c b/ai_pathfinder.c
index 81300e070..5c05879ad 100644
--- a/ai_pathfinder.c
+++ b/ai_pathfinder.c
@@ -8,7 +8,8 @@
// Tests if a station can be build on the given spot
// TODO: make it train compatible
-bool TestCanBuildStationHere(uint tile, byte dir) {
+static bool TestCanBuildStationHere(uint tile, byte dir)
+{
Player *p = DEREF_PLAYER(_current_player);
if (dir == TEST_STATION_NO_DIR) {
// TODO: currently we only allow spots that can be access from al 4 directions...
@@ -46,7 +47,8 @@ static bool IsRoad(TileIndex tile)
#define TILES_BETWEEN(a, b, c) (TileX(a) >= TileX(b) && TileX(a) <= TileX(c) && TileY(a) >= TileY(b) && TileY(a) <= TileY(c))
// Check if the current tile is in our end-area
-int32 AyStar_AiPathFinder_EndNodeCheck(AyStar *aystar, OpenListNode *current) {
+static int32 AyStar_AiPathFinder_EndNodeCheck(AyStar *aystar, OpenListNode *current)
+{
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
// It is not allowed to have a station on the end of a bridge or tunnel ;)
if (current->path.node.user_data[0] != 0) return AYSTAR_DONE;
@@ -60,12 +62,14 @@ int32 AyStar_AiPathFinder_EndNodeCheck(AyStar *aystar, OpenListNode *current) {
// Calculates the hash
// Currently it is a 10 bit hash, so the hash array has a max depth of 6 bits (so 64)
-uint AiPathFinder_Hash(uint key1, uint key2) {
+static uint AiPathFinder_Hash(uint key1, uint key2)
+{
return (TileX(key1) & 0x1F) + ((TileY(key1) & 0x1F) << 5);
}
// Clear the memory of all the things
-void AyStar_AiPathFinder_Free(AyStar *aystar) {
+static void AyStar_AiPathFinder_Free(AyStar *aystar)
+{
AyStarMain_Free(aystar);
free(aystar);
}
diff --git a/aystar.c b/aystar.c
index 704922030..22d4ba813 100644
--- a/aystar.c
+++ b/aystar.c
@@ -19,13 +19,15 @@
#include "aystar.h"
// This looks in the Hash if a node exists in ClosedList
// If so, it returns the PathNode, else NULL
-PathNode *AyStarMain_ClosedList_IsInList(AyStar *aystar, AyStarNode *node) {
+static PathNode *AyStarMain_ClosedList_IsInList(AyStar *aystar, AyStarNode *node)
+{
return (PathNode*)Hash_Get(&aystar->ClosedListHash, node->tile, node->direction);
}
// This adds a node to the ClosedList
// It makes a copy of the data
-void AyStarMain_ClosedList_Add(AyStar *aystar, PathNode *node) {
+static void AyStarMain_ClosedList_Add(AyStar *aystar, PathNode *node)
+{
// Add a node to the ClosedList
PathNode *new_node = malloc(sizeof(PathNode));
*new_node = *node;
@@ -34,14 +36,16 @@ void AyStarMain_ClosedList_Add(AyStar *aystar, PathNode *node) {
// Checks if a node is in the OpenList
// If so, it returns the OpenListNode, else NULL
-OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, AyStarNode *node) {
+static OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, AyStarNode *node)
+{
return (OpenListNode*)Hash_Get(&aystar->OpenListHash, node->tile, node->direction);
}
// Gets the best node from OpenList
// returns the best node, or NULL of none is found
// Also it deletes the node from the OpenList
-OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar) {
+static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar)
+{
// Return the item the Queue returns.. the best next OpenList item.
OpenListNode* res = (OpenListNode*)aystar->OpenListQueue.pop(&aystar->OpenListQueue);
if (res != NULL)
@@ -52,7 +56,8 @@ OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar) {
// Adds a node to the OpenList
// It makes a copy of node, and puts the pointer of parent in the struct
-void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, AyStarNode *node, int f, int g, int userdata) {
+static void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, AyStarNode *node, int f, int g, int userdata)
+{
// Add a new Node to the OpenList
OpenListNode* new_node = malloc(sizeof(OpenListNode));
new_node->g = g;
diff --git a/clear_cmd.c b/clear_cmd.c
index 6c0c9829d..de411c72a 100644
--- a/clear_cmd.c
+++ b/clear_cmd.c
@@ -413,7 +413,8 @@ int32 CmdPurchaseLandArea(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
-int32 ClearTile_Clear(uint tile, byte flags) {
+static int32 ClearTile_Clear(uint tile, byte flags)
+{
static const int32 * _clear_price_table[] = {
NULL,
&_price.clear_1, &_price.clear_1,&_price.clear_1,
@@ -523,9 +524,12 @@ static void DrawTile_Clear(TileInfo *ti)
DrawClearLandFence(ti, _map3_hi[ti->tile] >> 2);
}
-uint GetSlopeZ_Clear(TileInfo *ti) { return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + ti->z; }
+static uint GetSlopeZ_Clear(TileInfo *ti)
+{
+ return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
+}
-uint GetSlopeTileh_Clear(TileInfo *ti)
+static uint GetSlopeTileh_Clear(TileInfo *ti)
{
return ti->tileh;
}
diff --git a/console.c b/console.c
index 224e20fb3..b1c2b4eeb 100644
--- a/console.c
+++ b/console.c
@@ -590,7 +590,8 @@ _iconsole_alias* IConsoleAliasGet(const char* name)
return NULL;
}
-void IConsoleAliasExec(const char* cmdline, char* tokens[20], byte tokentypes[20]) {
+static void IConsoleAliasExec(const char* cmdline, char* tokens[20], byte tokentypes[20])
+{
char* lines[ICON_MAX_ALIAS_LINES];
char* linestream;
char* linestream_s;
diff --git a/console_cmds.c b/console_cmds.c
index 12619cb0a..0495ccf20 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -1167,7 +1167,7 @@ DEF_CONSOLE_CMD(ConSet) {
/* debug commands and variables */
/* ****************************************** */
-void IConsoleDebugLibRegister(void)
+static void IConsoleDebugLibRegister(void)
{
// debugging variables and functions
extern bool _stdlib_con_developer; /* XXX extern in .c */
diff --git a/engine_gui.c b/engine_gui.c
index 9ad7718ff..9f4abb474 100644
--- a/engine_gui.c
+++ b/engine_gui.c
@@ -10,7 +10,7 @@
#include "news.h"
-StringID GetEngineCategoryName(byte engine)
+static StringID GetEngineCategoryName(byte engine)
{
if (engine < NUM_TRAIN_ENGINES) {
switch (_engines[engine].railtype) {
diff --git a/gfx.c b/gfx.c
index 1d3131f1d..bc28816c1 100644
--- a/gfx.c
+++ b/gfx.c
@@ -290,7 +290,8 @@ void DrawStringCenterUnderline(int x, int y, uint16 str, uint16 color)
GfxFillRect(x-(w>>1), y+10, x-(w>>1)+w, y+10, _string_colorremap[1]);
}
-uint32 FormatStringLinebreaks(byte *str, int maxw) {
+static uint32 FormatStringLinebreaks(byte *str, int maxw)
+{
int num = 0;
int base = _stringwidth_base;
int w;
diff --git a/landscape.c b/landscape.c
index b72fbdd73..e977e15e3 100644
--- a/landscape.c
+++ b/landscape.c
@@ -234,7 +234,7 @@ uint GetSlopeZ(int x, int y)
// direction=true: check for foundation in east and south corner
// direction=false: check for foundation in west and south corner
-bool hasFoundation(TileInfo *ti, bool direction)
+static bool hasFoundation(TileInfo *ti, bool direction)
{
bool south, other; // southern corner and east/west corner
uint slope = _tile_type_procs[ti->type]->get_slope_tileh_proc(ti);
diff --git a/misc.c b/misc.c
index f8da0036b..5979e61e8 100644
--- a/misc.c
+++ b/misc.c
@@ -569,7 +569,7 @@ void OnNewDay_Train(Vehicle *v);
void OnNewDay_RoadVeh(Vehicle *v);
void OnNewDay_Aircraft(Vehicle *v);
void OnNewDay_Ship(Vehicle *v);
-void OnNewDay_EffectVehicle(Vehicle *v) { /* empty */ }
+static void OnNewDay_EffectVehicle(Vehicle *v) { /* empty */ }
void OnNewDay_DisasterVehicle(Vehicle *v);
typedef void OnNewVehicleDayProc(Vehicle *v);
diff --git a/misc_gui.c b/misc_gui.c
index e9a9e02cb..efa9ffa00 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -1514,7 +1514,7 @@ static int32 ClickChangePlayerCheat(int32 p1, int32 p2)
}
// p1 -1 or +1 (down/up)
-int32 ClickChangeClimateCheat(int32 p1, int32 p2)
+static int32 ClickChangeClimateCheat(int32 p1, int32 p2)
{
if(p1==-1) p1 = 3;
if(p1==4) p1 = 0;
@@ -1527,7 +1527,7 @@ int32 ClickChangeClimateCheat(int32 p1, int32 p2)
extern void EnginesMonthlyLoop(void);
// p2 1 (increase) or -1 (decrease)
-int32 ClickChangeDateCheat(int32 p1, int32 p2)
+static int32 ClickChangeDateCheat(int32 p1, int32 p2)
{
YearMonthDay ymd;
ConvertDayToYMD(&ymd, _date);
diff --git a/network.c b/network.c
index 59535a1ef..83833d7db 100644
--- a/network.c
+++ b/network.c
@@ -182,7 +182,7 @@ uint NetworkCalculateLag(const NetworkClientState *cs)
// There was a non-recoverable error, drop back to the main menu with a nice
// error
-void NetworkError(StringID error_string)
+static void NetworkError(StringID error_string)
{
_switch_mode = SM_MENU;
_switch_mode_errorstr = error_string;
diff --git a/network_data.c b/network_data.c
index bc8074eb2..f2d370749 100644
--- a/network_data.c
+++ b/network_data.c
@@ -114,7 +114,7 @@ void NetworkSend_Packet(Packet *packet, NetworkClientState *cs)
// this handles what to do.
// For clients: close connection and drop back to main-menu
// For servers: close connection and that is it
-NetworkRecvStatus CloseConnection(NetworkClientState *cs)
+static NetworkRecvStatus CloseConnection(NetworkClientState *cs)
{
NetworkCloseClient(cs);
diff --git a/network_gamelist.c b/network_gamelist.c
index 7f2f6a5d4..484d39453 100644
--- a/network_gamelist.c
+++ b/network_gamelist.c
@@ -9,7 +9,7 @@
extern void UpdateNetworkGameWindow(bool unselect);
-void NetworkGameListClear(void)
+static void NetworkGameListClear(void)
{
NetworkGameList *item;
NetworkGameList *next;
@@ -92,7 +92,7 @@ void NetworkGameListRemoveItem(NetworkGameList *remove)
}
}
-void NetworkGameListAddQueriedItem(const NetworkGameInfo *info, bool server_online)
+static void NetworkGameListAddQueriedItem(const NetworkGameInfo *info, bool server_online)
{
// We queried a server and now we are going to add it to the list
NetworkGameList *item;
diff --git a/news_gui.c b/news_gui.c
index 59840f814..e51935f3d 100644
--- a/news_gui.c
+++ b/news_gui.c
@@ -200,7 +200,7 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
// returns the correct index in the array
// (to deal with overflows)
-byte increaseIndex(byte i)
+static byte increaseIndex(byte i)
{
if (i == INVALID_NEWS)
return 0;
@@ -451,7 +451,7 @@ void NewsLoop(void)
}
/* Do a forced show of a specific message */
-void ShowNewsMessage(byte i)
+static void ShowNewsMessage(byte i)
{
if (_total_news == 0) return;
diff --git a/order_gui.c b/order_gui.c
index 57e16f227..02921ad15 100644
--- a/order_gui.c
+++ b/order_gui.c
@@ -167,7 +167,7 @@ static void *FindVehicleCallb(Vehicle *v, FindVehS *f)
return v;
}
-Vehicle *GetVehicleOnTile(TileIndex tile, byte owner)
+static Vehicle *GetVehicleOnTile(TileIndex tile, byte owner)
{
FindVehS fs;
fs.tile = tile;
diff --git a/queue.c b/queue.c
index 60d85965d..00e14b8b3 100644
--- a/queue.c
+++ b/queue.c
@@ -2,7 +2,7 @@
#include "ttd.h"
#include "queue.h"
-void Stack_Clear(Queue* q, bool free_values)
+static void Stack_Clear(Queue* q, bool free_values)
{
uint i;
if (free_values)
@@ -11,7 +11,7 @@ void Stack_Clear(Queue* q, bool free_values)
q->data.stack.size = 0;
}
-void Stack_Free(Queue* q, bool free_values)
+static void Stack_Free(Queue* q, bool free_values)
{
q->clear(q, free_values);
free(q->data.stack.elements);
@@ -19,14 +19,16 @@ void Stack_Free(Queue* q, bool free_values)
free(q);
}
-bool Stack_Push(Queue* q, void* item, int priority) {
+static bool Stack_Push(Queue* q, void* item, int priority)
+{
if (q->data.stack.size == q->data.stack.max_size)
return false;
q->data.stack.elements[q->data.stack.size++] = item;
return true;
}
-void* Stack_Pop(Queue* q) {
+static void* Stack_Pop(Queue* q)
+{
void* result;
if (q->data.stack.size == 0)
return NULL;
@@ -35,12 +37,13 @@ void* Stack_Pop(Queue* q) {
return result;
}
-bool Stack_Delete(Queue* q, void* item, int priority)
+static bool Stack_Delete(Queue* q, void* item, int priority)
{
return false;
}
-Queue* init_stack(Queue* q, uint max_size) {
+static Queue* init_stack(Queue* q, uint max_size)
+{
q->push = Stack_Push;
q->pop = Stack_Pop;
q->del = Stack_Delete;
@@ -65,7 +68,7 @@ Queue* new_Stack(uint max_size)
* Fifo
*/
-void Fifo_Clear(Queue* q, bool free_values)
+static void Fifo_Clear(Queue* q, bool free_values)
{
uint head, tail;
if (free_values) {
@@ -79,7 +82,7 @@ void Fifo_Clear(Queue* q, bool free_values)
q->data.fifo.head = q->data.fifo.tail = 0;
}
-void Fifo_Free(Queue* q, bool free_values)
+static void Fifo_Free(Queue* q, bool free_values)
{
q->clear(q, free_values);
free(q->data.fifo.elements);
@@ -87,7 +90,8 @@ void Fifo_Free(Queue* q, bool free_values)
free(q);
}
-bool Fifo_Push(Queue* q, void* item, int priority) {
+static bool Fifo_Push(Queue* q, void* item, int priority)
+{
uint next = (q->data.fifo.head + 1) % q->data.fifo.max_size;
if (next == q->data.fifo.tail)
return false;
@@ -98,7 +102,8 @@ bool Fifo_Push(Queue* q, void* item, int priority) {
return true;
}
-void* Fifo_Pop(Queue* q) {
+static void* Fifo_Pop(Queue* q)
+{
void* result;
if (q->data.fifo.head == q->data.fifo.tail)
return NULL;
@@ -109,12 +114,13 @@ void* Fifo_Pop(Queue* q) {
return result;
}
-bool Fifo_Delete(Queue* q, void* item, int priority)
+static bool Fifo_Delete(Queue* q, void* item, int priority)
{
return false;
}
-Queue* init_fifo(Queue* q, uint max_size) {
+static Queue* init_fifo(Queue* q, uint max_size)
+{
q->push = Fifo_Push;
q->pop = Fifo_Pop;
q->del = Fifo_Delete;
@@ -141,7 +147,8 @@ Queue* new_Fifo(uint max_size)
* Insertion Sorter
*/
-void InsSort_Clear(Queue* q, bool free_values) {
+static void InsSort_Clear(Queue* q, bool free_values)
+{
InsSortNode* node = q->data.inssort.first;
InsSortNode* prev;
while (node != NULL) {
@@ -155,14 +162,15 @@ void InsSort_Clear(Queue* q, bool free_values) {
q->data.inssort.first = NULL;
}
-void InsSort_Free(Queue* q, bool free_values)
+static void InsSort_Free(Queue* q, bool free_values)
{
q->clear(q, free_values);
if (q->freeq)
free(q);
}
-bool InsSort_Push(Queue* q, void* item, int priority) {
+static bool InsSort_Push(Queue* q, void* item, int priority)
+{
InsSortNode* newnode = malloc(sizeof(InsSortNode));
if (newnode == NULL) return false;
newnode->item = item;
@@ -184,7 +192,8 @@ bool InsSort_Push(Queue* q, void* item, int priority) {
return true;
}
-void* InsSort_Pop(Queue* q) {
+static void* InsSort_Pop(Queue* q)
+{
InsSortNode* node = q->data.inssort.first;
void* result;
if (node == NULL)
@@ -197,7 +206,7 @@ void* InsSort_Pop(Queue* q) {
return result;
}
-bool InsSort_Delete(Queue* q, void* item, int priority)
+static bool InsSort_Delete(Queue* q, void* item, int priority)
{
return false;
}
@@ -235,7 +244,7 @@ Queue* new_InsSort(void)
// q->data.binaryheap.elements[i-1] every time, we use this define.
#define BIN_HEAP_ARR(i) q->data.binaryheap.elements[((i)-1) >> BINARY_HEAP_BLOCKSIZE_BITS][((i)-1) & BINARY_HEAP_BLOCKSIZE_MASK]
-void BinaryHeap_Clear(Queue* q, bool free_values)
+static void BinaryHeap_Clear(Queue* q, bool free_values)
{
/* Free all items if needed and free all but the first blocks of
* memory */
@@ -264,7 +273,7 @@ void BinaryHeap_Clear(Queue* q, bool free_values)
q->data.binaryheap.blocks = 1;
}
-void BinaryHeap_Free(Queue* q, bool free_values)
+static void BinaryHeap_Free(Queue* q, bool free_values)
{
uint i;
q->clear(q, free_values);
@@ -277,7 +286,8 @@ void BinaryHeap_Free(Queue* q, bool free_values)
free(q);
}
-bool BinaryHeap_Push(Queue* q, void* item, int priority) {
+static bool BinaryHeap_Push(Queue* q, void* item, int priority)
+{
#ifdef QUEUE_DEBUG
printf("[BinaryHeap] Pushing an element. There are %d elements left\n", q->data.binaryheap.size);
#endif
@@ -325,7 +335,7 @@ bool BinaryHeap_Push(Queue* q, void* item, int priority) {
return true;
}
-bool BinaryHeap_Delete(Queue* q, void* item, int priority)
+static bool BinaryHeap_Delete(Queue* q, void* item, int priority)
{
#ifdef QUEUE_DEBUG
printf("[BinaryHeap] Deleting an element. There are %d elements left\n", q->data.binaryheap.size);
@@ -381,7 +391,8 @@ bool BinaryHeap_Delete(Queue* q, void* item, int priority)
return true;
}
-void* BinaryHeap_Pop(Queue* q) {
+static void* BinaryHeap_Pop(Queue* q)
+{
#ifdef QUEUE_DEBUG
printf("[BinaryHeap] Popping an element. There are %d elements left\n", q->data.binaryheap.size);
#endif
@@ -523,7 +534,8 @@ void clear_Hash(Hash* h, bool free_values)
* bucket, or NULL if it is empty. prev can also be NULL, in which case it is
* not used for output.
*/
-HashNode* Hash_FindNode(Hash* h, uint key1, uint key2, HashNode** prev_out) {
+static HashNode* Hash_FindNode(Hash* h, uint key1, uint key2, HashNode** prev_out)
+{
uint hash = h->hash(key1, key2);
HashNode* result = NULL;
#ifdef HASH_DEBUG
diff --git a/rail_cmd.c b/rail_cmd.c
index b9256b961..d39d5185b 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -2017,7 +2017,7 @@ static uint GetSlopeZ_Track(TileInfo *ti)
return z;
}
-uint GetSlopeTileh_Track(TileInfo *ti)
+static uint GetSlopeTileh_Track(TileInfo *ti)
{
// check if it's a foundation
if (ti->tileh != 0) {
diff --git a/road_cmd.c b/road_cmd.c
index f043f8a74..cfac45d59 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -20,7 +20,7 @@ static bool _road_special_gettrackstatus;
void RoadVehEnterDepot(Vehicle *v);
-bool HasTileRoadAt(uint tile, int i)
+static bool HasTileRoadAt(uint tile, int i)
{
int mask;
byte b;
@@ -886,7 +886,7 @@ static uint GetSlopeZ_Road(TileInfo *ti)
return z; // normal Z if no slope
}
-uint GetSlopeTileh_Road(TileInfo *ti)
+static uint GetSlopeTileh_Road(TileInfo *ti)
{
// check if it's a foundation
if (ti->tileh != 0) {
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 7d9343faf..b8879b2b2 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -649,7 +649,7 @@ typedef struct RoadVehFindData {
byte dir;
} RoadVehFindData;
-void *EnumCheckRoadVehClose(Vehicle *v, RoadVehFindData *rvf)
+static void *EnumCheckRoadVehClose(Vehicle *v, RoadVehFindData *rvf)
{
static const short _dists[] = {
-4, -8, -4, -1, 4, 8, 4, 1,
@@ -801,7 +801,7 @@ typedef struct OvertakeData {
byte tilebits;
} OvertakeData;
-void *EnumFindVehToOvertake(Vehicle *v, OvertakeData *od)
+static void *EnumFindVehToOvertake(Vehicle *v, OvertakeData *od)
{
if (v->tile != (TileIndex)od->tile ||
v->type != VEH_Road ||
diff --git a/saveload.c b/saveload.c
index a4b73c75e..deeedbb8c 100644
--- a/saveload.c
+++ b/saveload.c
@@ -131,22 +131,22 @@ static uint SlGetGammaLength(uint i) {
return (i>=0x80) ? 2 : 1;
}
-inline int SlReadSparseIndex(void)
+static inline int SlReadSparseIndex(void)
{
return SlReadSimpleGamma();
}
-inline void SlWriteSparseIndex(uint index)
+static inline void SlWriteSparseIndex(uint index)
{
SlWriteSimpleGamma(index);
}
-inline int SlReadArrayLength(void)
+static inline int SlReadArrayLength(void)
{
return SlReadSimpleGamma();
}
-inline void SlWriteArrayLength(uint length)
+static inline void SlWriteArrayLength(uint length)
{
SlWriteSimpleGamma(length);
}
@@ -241,7 +241,7 @@ static void SlCopyBytes(void *ptr, size_t length)
}
}
-void SlSkipBytes(size_t length)
+static void SlSkipBytes(size_t length)
{
while (length) {
SlReadByte();
@@ -925,7 +925,7 @@ static uint ReferenceToInt(void *v, uint t)
return 0;
}
-void *IntToReference(uint r, uint t)
+static void *IntToReference(uint r, uint t)
{
/* From version 4.3 REF_VEHICLE_OLD is saved as REF_VEHICLE, and should be loaded
like that */
diff --git a/settings_gui.c b/settings_gui.c
index 44998ba6f..2ee835d89 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -517,7 +517,7 @@ void ShowGameDifficulty(void)
}
// virtual PositionMainToolbar function, calls the right one.
-int32 v_PositionMainToolbar(int32 p1)
+static int32 v_PositionMainToolbar(int32 p1)
{
if (_game_mode != GM_MENU)
PositionMainToolbar(NULL);
@@ -525,7 +525,7 @@ int32 v_PositionMainToolbar(int32 p1)
return 0;
}
-int32 AiNew_PatchActive_Warning(int32 p1)
+static int32 AiNew_PatchActive_Warning(int32 p1)
{
if (p1 == 1)
ShowErrorMessage(-1, TEMP_AI_ACTIVATED, 0, 0);
@@ -533,7 +533,7 @@ int32 AiNew_PatchActive_Warning(int32 p1)
return 0;
}
-int32 PopulationInLabelActive(int32 p1)
+static int32 PopulationInLabelActive(int32 p1)
{
Town *t;
@@ -546,20 +546,20 @@ int32 PopulationInLabelActive(int32 p1)
return 0;
}
-int32 InvisibleTreesActive(int32 p1)
+static int32 InvisibleTreesActive(int32 p1)
{
MarkWholeScreenDirty();
return 0;
}
-int32 InValidateDetailsWindow(int32 p1)
+static int32 InValidateDetailsWindow(int32 p1)
{
InvalidateWindowClasses(WC_VEHICLE_DETAILS);
return 0;
}
/* Check service intervals of vehicles, p1 is value of % or day based servicing */
-int32 CheckInterval(int32 p1)
+static int32 CheckInterval(int32 p1)
{
bool warning;
if (p1) {
diff --git a/terraform_gui.c b/terraform_gui.c
index 5fa98c504..440cd9691 100644
--- a/terraform_gui.c
+++ b/terraform_gui.c
@@ -61,7 +61,7 @@ void PlaceProc_LevelLand(uint tile)
VpStartPlaceSizing(tile, VPM_X_AND_Y | (2<<4));
}
-void PlaceProc_PlantTree(uint tile)
+static void PlaceProc_PlantTree(uint tile)
{
}
diff --git a/train_cmd.c b/train_cmd.c
index 2881f4f02..09ece94e0 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1997,7 +1997,7 @@ typedef struct TrainCollideChecker {
} TrainCollideChecker;
-void *FindTrainCollideEnum(Vehicle *v, TrainCollideChecker *tcc)
+static void *FindTrainCollideEnum(Vehicle *v, TrainCollideChecker *tcc)
{
if (v == tcc->v || v == tcc->v_skip || v->type != VEH_Train || v->u.rail.track==0x80)
return 0;
@@ -2621,7 +2621,7 @@ void Train_Tick(Vehicle *v)
static const byte _depot_track_ind[4] = {0,1,0,1};
// Validation for the news item "Train is waiting in depot"
-bool ValidateTrainInDepot( uint data_a, uint data_b )
+static bool ValidateTrainInDepot( uint data_a, uint data_b )
{
Vehicle *v = GetVehicle(data_a);
return (v->u.rail.track == 0x80 && (v->vehstatus | VS_STOPPED));
diff --git a/ttd.c b/ttd.c
index a6b019ff9..94bb66272 100644
--- a/ttd.c
+++ b/ttd.c
@@ -211,7 +211,7 @@ void ttd_strlcpy(char *dst, const char *src, size_t len)
*dst = 0;
}
-char *strecpy(char *dst, const char *src)
+static char *strecpy(char *dst, const char *src)
{
while ( (*dst++ = *src++) != 0) {}
return dst - 1;
@@ -469,7 +469,7 @@ void SetDebugString(const char *s)
}
}
-void ParseResolution(int res[2], char *s)
+static void ParseResolution(int res[2], char *s)
{
char *t = strchr(s, 'x');
if (t == NULL) {
@@ -513,7 +513,7 @@ static void UnInitializeDynamicVariables(void)
}
-void LoadIntroGame(void)
+static void LoadIntroGame(void)
{
char filename[256];
_game_mode = GM_MENU;
@@ -776,7 +776,7 @@ static void ShowScreenshotResult(bool b)
}
-void MakeNewGame(void)
+static void MakeNewGame(void)
{
_game_mode = GM_NORMAL;
@@ -834,7 +834,7 @@ static void MakeNewEditorWorld(void)
void StartupPlayers(void);
void StartupDisasters(void);
-void StartScenario(void)
+static void StartScenario(void)
{
_game_mode = GM_NORMAL;
@@ -1190,7 +1190,7 @@ void BeforeSaveGame(void)
}
}
-void ConvertTownOwner(void)
+static void ConvertTownOwner(void)
{
uint tile;
@@ -1209,7 +1209,7 @@ void ConvertTownOwner(void)
}
// before savegame version 4, the name of the company determined if it existed
-void CheckIsPlayerActive(void)
+static void CheckIsPlayerActive(void)
{
Player *p;
FOR_ALL_PLAYERS(p) {
@@ -1220,7 +1220,7 @@ void CheckIsPlayerActive(void)
}
// since savegame version 4.1, exclusive transport rights are stored at towns
-void UpdateExclusiveRights(void)
+static void UpdateExclusiveRights(void)
{
Town *t;
FOR_ALL_TOWNS(t) if (t->xy != 0) {
@@ -1245,14 +1245,14 @@ byte convert_currency[] = {
18, 2, 20, };
// since savegame version 4.2 the currencies are arranged differently
-void UpdateCurrencies(void)
+static void UpdateCurrencies(void)
{
_opt.currency = convert_currency[_opt.currency];
}
// up to revision 1413, the invisible tiles at the southern border have not been MP_VOID
// even though they should have. This is fixed by this function
-void UpdateVoidTiles(void)
+static void UpdateVoidTiles(void)
{
uint i;
// create void tiles on the border
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 67c9c0961..0c7aba758 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -902,7 +902,7 @@ int32 DoConvertTunnelBridgeRail(uint tile, uint totype, bool exec)
// fast routine for getting the height of a middle bridge tile. 'tile' MUST be a middle bridge tile.
-uint GetBridgeHeight(const TileInfo *ti)
+static uint GetBridgeHeight(const TileInfo *ti)
{
uint delta;
TileInfo ti_end;
diff --git a/viewport.c b/viewport.c
index d637ec4cb..a612b9b42 100644
--- a/viewport.c
+++ b/viewport.c
@@ -266,7 +266,8 @@ ViewPort *IsPtInWindowViewport(Window *w, int x, int y)
return NULL;
}
-Point TranslateXYToTileCoord(ViewPort *vp, int x, int y) {
+static Point TranslateXYToTileCoord(ViewPort *vp, int x, int y)
+{
int z;
Point pt;
int a,b;
@@ -1682,7 +1683,7 @@ void HandleClickOnTrain(Vehicle *v);
void HandleClickOnRoadVeh(Vehicle *v);
void HandleClickOnAircraft(Vehicle *v);
void HandleClickOnShip(Vehicle *v);
-void HandleClickOnSpecialVeh(Vehicle *v) {}
+static void HandleClickOnSpecialVeh(Vehicle *v) {}
void HandleClickOnDisasterVeh(Vehicle *v);
typedef void OnVehicleClickProc(Vehicle *v);
static OnVehicleClickProc * const _on_vehicle_click_proc[6] = {
diff --git a/widget.c b/widget.c
index 593058b41..bf166eba3 100644
--- a/widget.c
+++ b/widget.c
@@ -478,7 +478,7 @@ static int GetDropdownItem(Window *w)
return item;
}
-void DropdownMenuWndProc(Window *w, WindowEvent *e)
+static void DropdownMenuWndProc(Window *w, WindowEvent *e)
{
int item;
diff --git a/window.c b/window.c
index 5a88e2fe5..fc4459fae 100644
--- a/window.c
+++ b/window.c
@@ -532,7 +532,8 @@ static bool IsGoodAutoPlace2(int left, int top)
return true;
}
-Point GetAutoPlacePosition(int width, int height) {
+static Point GetAutoPlacePosition(int width, int height)
+{
Window *w;
Point pt;
@@ -778,7 +779,7 @@ static bool HandlePopupMenu(void)
return false;
}
-bool HandleMouseOver(void)
+static bool HandleMouseOver(void)
{
Window *w;
WindowEvent e;
@@ -811,7 +812,7 @@ bool HandleMouseOver(void)
return true;
}
-bool HandleWindowDragging(void)
+static bool HandleWindowDragging(void)
{
Window *w;
// Get out immediately if no window is being dragged at all.