(svn r1596) Add some more statics

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
tron 20 years ago
parent e75c48ec7a
commit e5cd6b6193

@ -8,7 +8,8 @@
// Tests if a station can be build on the given spot // Tests if a station can be build on the given spot
// TODO: make it train compatible // TODO: make it train compatible
bool TestCanBuildStationHere(uint tile, byte dir) { static bool TestCanBuildStationHere(uint tile, byte dir)
{
Player *p = DEREF_PLAYER(_current_player); Player *p = DEREF_PLAYER(_current_player);
if (dir == TEST_STATION_NO_DIR) { if (dir == TEST_STATION_NO_DIR) {
// TODO: currently we only allow spots that can be access from al 4 directions... // 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)) #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 // 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; Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
// It is not allowed to have a station on the end of a bridge or tunnel ;) // 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; 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 // Calculates the hash
// Currently it is a 10 bit hash, so the hash array has a max depth of 6 bits (so 64) // 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); return (TileX(key1) & 0x1F) + ((TileY(key1) & 0x1F) << 5);
} }
// Clear the memory of all the things // Clear the memory of all the things
void AyStar_AiPathFinder_Free(AyStar *aystar) { static void AyStar_AiPathFinder_Free(AyStar *aystar)
{
AyStarMain_Free(aystar); AyStarMain_Free(aystar);
free(aystar); free(aystar);
} }

@ -19,13 +19,15 @@
#include "aystar.h" #include "aystar.h"
// This looks in the Hash if a node exists in ClosedList // This looks in the Hash if a node exists in ClosedList
// If so, it returns the PathNode, else NULL // 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); return (PathNode*)Hash_Get(&aystar->ClosedListHash, node->tile, node->direction);
} }
// This adds a node to the ClosedList // This adds a node to the ClosedList
// It makes a copy of the data // 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 // Add a node to the ClosedList
PathNode *new_node = malloc(sizeof(PathNode)); PathNode *new_node = malloc(sizeof(PathNode));
*new_node = *node; *new_node = *node;
@ -34,14 +36,16 @@ void AyStarMain_ClosedList_Add(AyStar *aystar, PathNode *node) {
// Checks if a node is in the OpenList // Checks if a node is in the OpenList
// If so, it returns the OpenListNode, else NULL // 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); return (OpenListNode*)Hash_Get(&aystar->OpenListHash, node->tile, node->direction);
} }
// Gets the best node from OpenList // Gets the best node from OpenList
// returns the best node, or NULL of none is found // returns the best node, or NULL of none is found
// Also it deletes the node from the OpenList // 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. // Return the item the Queue returns.. the best next OpenList item.
OpenListNode* res = (OpenListNode*)aystar->OpenListQueue.pop(&aystar->OpenListQueue); OpenListNode* res = (OpenListNode*)aystar->OpenListQueue.pop(&aystar->OpenListQueue);
if (res != NULL) if (res != NULL)
@ -52,7 +56,8 @@ OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar) {
// Adds a node to the OpenList // Adds a node to the OpenList
// It makes a copy of node, and puts the pointer of parent in the struct // 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 // Add a new Node to the OpenList
OpenListNode* new_node = malloc(sizeof(OpenListNode)); OpenListNode* new_node = malloc(sizeof(OpenListNode));
new_node->g = g; new_node->g = g;

@ -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[] = { static const int32 * _clear_price_table[] = {
NULL, NULL,
&_price.clear_1, &_price.clear_1,&_price.clear_1, &_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); 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; return ti->tileh;
} }

@ -590,7 +590,8 @@ _iconsole_alias* IConsoleAliasGet(const char* name)
return NULL; 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* lines[ICON_MAX_ALIAS_LINES];
char* linestream; char* linestream;
char* linestream_s; char* linestream_s;

@ -1167,7 +1167,7 @@ DEF_CONSOLE_CMD(ConSet) {
/* debug commands and variables */ /* debug commands and variables */
/* ****************************************** */ /* ****************************************** */
void IConsoleDebugLibRegister(void) static void IConsoleDebugLibRegister(void)
{ {
// debugging variables and functions // debugging variables and functions
extern bool _stdlib_con_developer; /* XXX extern in .c */ extern bool _stdlib_con_developer; /* XXX extern in .c */

@ -10,7 +10,7 @@
#include "news.h" #include "news.h"
StringID GetEngineCategoryName(byte engine) static StringID GetEngineCategoryName(byte engine)
{ {
if (engine < NUM_TRAIN_ENGINES) { if (engine < NUM_TRAIN_ENGINES) {
switch (_engines[engine].railtype) { switch (_engines[engine].railtype) {

@ -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]); 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 num = 0;
int base = _stringwidth_base; int base = _stringwidth_base;
int w; int w;

@ -234,7 +234,7 @@ uint GetSlopeZ(int x, int y)
// direction=true: check for foundation in east and south corner // direction=true: check for foundation in east and south corner
// direction=false: check for foundation in west 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 bool south, other; // southern corner and east/west corner
uint slope = _tile_type_procs[ti->type]->get_slope_tileh_proc(ti); uint slope = _tile_type_procs[ti->type]->get_slope_tileh_proc(ti);

@ -569,7 +569,7 @@ void OnNewDay_Train(Vehicle *v);
void OnNewDay_RoadVeh(Vehicle *v); void OnNewDay_RoadVeh(Vehicle *v);
void OnNewDay_Aircraft(Vehicle *v); void OnNewDay_Aircraft(Vehicle *v);
void OnNewDay_Ship(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); void OnNewDay_DisasterVehicle(Vehicle *v);
typedef void OnNewVehicleDayProc(Vehicle *v); typedef void OnNewVehicleDayProc(Vehicle *v);

@ -1514,7 +1514,7 @@ static int32 ClickChangePlayerCheat(int32 p1, int32 p2)
} }
// p1 -1 or +1 (down/up) // 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==-1) p1 = 3;
if(p1==4) p1 = 0; if(p1==4) p1 = 0;
@ -1527,7 +1527,7 @@ int32 ClickChangeClimateCheat(int32 p1, int32 p2)
extern void EnginesMonthlyLoop(void); extern void EnginesMonthlyLoop(void);
// p2 1 (increase) or -1 (decrease) // p2 1 (increase) or -1 (decrease)
int32 ClickChangeDateCheat(int32 p1, int32 p2) static int32 ClickChangeDateCheat(int32 p1, int32 p2)
{ {
YearMonthDay ymd; YearMonthDay ymd;
ConvertDayToYMD(&ymd, _date); ConvertDayToYMD(&ymd, _date);

@ -182,7 +182,7 @@ uint NetworkCalculateLag(const NetworkClientState *cs)
// There was a non-recoverable error, drop back to the main menu with a nice // There was a non-recoverable error, drop back to the main menu with a nice
// error // error
void NetworkError(StringID error_string) static void NetworkError(StringID error_string)
{ {
_switch_mode = SM_MENU; _switch_mode = SM_MENU;
_switch_mode_errorstr = error_string; _switch_mode_errorstr = error_string;

@ -114,7 +114,7 @@ void NetworkSend_Packet(Packet *packet, NetworkClientState *cs)
// this handles what to do. // this handles what to do.
// For clients: close connection and drop back to main-menu // For clients: close connection and drop back to main-menu
// For servers: close connection and that is it // For servers: close connection and that is it
NetworkRecvStatus CloseConnection(NetworkClientState *cs) static NetworkRecvStatus CloseConnection(NetworkClientState *cs)
{ {
NetworkCloseClient(cs); NetworkCloseClient(cs);

@ -9,7 +9,7 @@
extern void UpdateNetworkGameWindow(bool unselect); extern void UpdateNetworkGameWindow(bool unselect);
void NetworkGameListClear(void) static void NetworkGameListClear(void)
{ {
NetworkGameList *item; NetworkGameList *item;
NetworkGameList *next; 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 // We queried a server and now we are going to add it to the list
NetworkGameList *item; NetworkGameList *item;

@ -200,7 +200,7 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
// returns the correct index in the array // returns the correct index in the array
// (to deal with overflows) // (to deal with overflows)
byte increaseIndex(byte i) static byte increaseIndex(byte i)
{ {
if (i == INVALID_NEWS) if (i == INVALID_NEWS)
return 0; return 0;
@ -451,7 +451,7 @@ void NewsLoop(void)
} }
/* Do a forced show of a specific message */ /* Do a forced show of a specific message */
void ShowNewsMessage(byte i) static void ShowNewsMessage(byte i)
{ {
if (_total_news == 0) return; if (_total_news == 0) return;

@ -167,7 +167,7 @@ static void *FindVehicleCallb(Vehicle *v, FindVehS *f)
return v; return v;
} }
Vehicle *GetVehicleOnTile(TileIndex tile, byte owner) static Vehicle *GetVehicleOnTile(TileIndex tile, byte owner)
{ {
FindVehS fs; FindVehS fs;
fs.tile = tile; fs.tile = tile;

@ -2,7 +2,7 @@
#include "ttd.h" #include "ttd.h"
#include "queue.h" #include "queue.h"
void Stack_Clear(Queue* q, bool free_values) static void Stack_Clear(Queue* q, bool free_values)
{ {
uint i; uint i;
if (free_values) if (free_values)
@ -11,7 +11,7 @@ void Stack_Clear(Queue* q, bool free_values)
q->data.stack.size = 0; 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); q->clear(q, free_values);
free(q->data.stack.elements); free(q->data.stack.elements);
@ -19,14 +19,16 @@ void Stack_Free(Queue* q, bool free_values)
free(q); 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) if (q->data.stack.size == q->data.stack.max_size)
return false; return false;
q->data.stack.elements[q->data.stack.size++] = item; q->data.stack.elements[q->data.stack.size++] = item;
return true; return true;
} }
void* Stack_Pop(Queue* q) { static void* Stack_Pop(Queue* q)
{
void* result; void* result;
if (q->data.stack.size == 0) if (q->data.stack.size == 0)
return NULL; return NULL;
@ -35,12 +37,13 @@ void* Stack_Pop(Queue* q) {
return result; return result;
} }
bool Stack_Delete(Queue* q, void* item, int priority) static bool Stack_Delete(Queue* q, void* item, int priority)
{ {
return false; return false;
} }
Queue* init_stack(Queue* q, uint max_size) { static Queue* init_stack(Queue* q, uint max_size)
{
q->push = Stack_Push; q->push = Stack_Push;
q->pop = Stack_Pop; q->pop = Stack_Pop;
q->del = Stack_Delete; q->del = Stack_Delete;
@ -65,7 +68,7 @@ Queue* new_Stack(uint max_size)
* Fifo * Fifo
*/ */
void Fifo_Clear(Queue* q, bool free_values) static void Fifo_Clear(Queue* q, bool free_values)
{ {
uint head, tail; uint head, tail;
if (free_values) { if (free_values) {
@ -79,7 +82,7 @@ void Fifo_Clear(Queue* q, bool free_values)
q->data.fifo.head = q->data.fifo.tail = 0; 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); q->clear(q, free_values);
free(q->data.fifo.elements); free(q->data.fifo.elements);
@ -87,7 +90,8 @@ void Fifo_Free(Queue* q, bool free_values)
free(q); 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; uint next = (q->data.fifo.head + 1) % q->data.fifo.max_size;
if (next == q->data.fifo.tail) if (next == q->data.fifo.tail)
return false; return false;
@ -98,7 +102,8 @@ bool Fifo_Push(Queue* q, void* item, int priority) {
return true; return true;
} }
void* Fifo_Pop(Queue* q) { static void* Fifo_Pop(Queue* q)
{
void* result; void* result;
if (q->data.fifo.head == q->data.fifo.tail) if (q->data.fifo.head == q->data.fifo.tail)
return NULL; return NULL;
@ -109,12 +114,13 @@ void* Fifo_Pop(Queue* q) {
return result; return result;
} }
bool Fifo_Delete(Queue* q, void* item, int priority) static bool Fifo_Delete(Queue* q, void* item, int priority)
{ {
return false; return false;
} }
Queue* init_fifo(Queue* q, uint max_size) { static Queue* init_fifo(Queue* q, uint max_size)
{
q->push = Fifo_Push; q->push = Fifo_Push;
q->pop = Fifo_Pop; q->pop = Fifo_Pop;
q->del = Fifo_Delete; q->del = Fifo_Delete;
@ -141,7 +147,8 @@ Queue* new_Fifo(uint max_size)
* Insertion Sorter * 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* node = q->data.inssort.first;
InsSortNode* prev; InsSortNode* prev;
while (node != NULL) { while (node != NULL) {
@ -155,14 +162,15 @@ void InsSort_Clear(Queue* q, bool free_values) {
q->data.inssort.first = NULL; 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); q->clear(q, free_values);
if (q->freeq) if (q->freeq)
free(q); 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)); InsSortNode* newnode = malloc(sizeof(InsSortNode));
if (newnode == NULL) return false; if (newnode == NULL) return false;
newnode->item = item; newnode->item = item;
@ -184,7 +192,8 @@ bool InsSort_Push(Queue* q, void* item, int priority) {
return true; return true;
} }
void* InsSort_Pop(Queue* q) { static void* InsSort_Pop(Queue* q)
{
InsSortNode* node = q->data.inssort.first; InsSortNode* node = q->data.inssort.first;
void* result; void* result;
if (node == NULL) if (node == NULL)
@ -197,7 +206,7 @@ void* InsSort_Pop(Queue* q) {
return result; return result;
} }
bool InsSort_Delete(Queue* q, void* item, int priority) static bool InsSort_Delete(Queue* q, void* item, int priority)
{ {
return false; return false;
} }
@ -235,7 +244,7 @@ Queue* new_InsSort(void)
// q->data.binaryheap.elements[i-1] every time, we use this define. // 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] #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 /* Free all items if needed and free all but the first blocks of
* memory */ * memory */
@ -264,7 +273,7 @@ void BinaryHeap_Clear(Queue* q, bool free_values)
q->data.binaryheap.blocks = 1; q->data.binaryheap.blocks = 1;
} }
void BinaryHeap_Free(Queue* q, bool free_values) static void BinaryHeap_Free(Queue* q, bool free_values)
{ {
uint i; uint i;
q->clear(q, free_values); q->clear(q, free_values);
@ -277,7 +286,8 @@ void BinaryHeap_Free(Queue* q, bool free_values)
free(q); free(q);
} }
bool BinaryHeap_Push(Queue* q, void* item, int priority) { static bool BinaryHeap_Push(Queue* q, void* item, int priority)
{
#ifdef QUEUE_DEBUG #ifdef QUEUE_DEBUG
printf("[BinaryHeap] Pushing an element. There are %d elements left\n", q->data.binaryheap.size); printf("[BinaryHeap] Pushing an element. There are %d elements left\n", q->data.binaryheap.size);
#endif #endif
@ -325,7 +335,7 @@ bool BinaryHeap_Push(Queue* q, void* item, int priority) {
return true; return true;
} }
bool BinaryHeap_Delete(Queue* q, void* item, int priority) static bool BinaryHeap_Delete(Queue* q, void* item, int priority)
{ {
#ifdef QUEUE_DEBUG #ifdef QUEUE_DEBUG
printf("[BinaryHeap] Deleting an element. There are %d elements left\n", q->data.binaryheap.size); 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; return true;
} }
void* BinaryHeap_Pop(Queue* q) { static void* BinaryHeap_Pop(Queue* q)
{
#ifdef QUEUE_DEBUG #ifdef QUEUE_DEBUG
printf("[BinaryHeap] Popping an element. There are %d elements left\n", q->data.binaryheap.size); printf("[BinaryHeap] Popping an element. There are %d elements left\n", q->data.binaryheap.size);
#endif #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 * bucket, or NULL if it is empty. prev can also be NULL, in which case it is
* not used for output. * 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); uint hash = h->hash(key1, key2);
HashNode* result = NULL; HashNode* result = NULL;
#ifdef HASH_DEBUG #ifdef HASH_DEBUG

@ -2017,7 +2017,7 @@ static uint GetSlopeZ_Track(TileInfo *ti)
return z; return z;
} }
uint GetSlopeTileh_Track(TileInfo *ti) static uint GetSlopeTileh_Track(TileInfo *ti)
{ {
// check if it's a foundation // check if it's a foundation
if (ti->tileh != 0) { if (ti->tileh != 0) {

@ -20,7 +20,7 @@ static bool _road_special_gettrackstatus;
void RoadVehEnterDepot(Vehicle *v); void RoadVehEnterDepot(Vehicle *v);
bool HasTileRoadAt(uint tile, int i) static bool HasTileRoadAt(uint tile, int i)
{ {
int mask; int mask;
byte b; byte b;
@ -886,7 +886,7 @@ static uint GetSlopeZ_Road(TileInfo *ti)
return z; // normal Z if no slope return z; // normal Z if no slope
} }
uint GetSlopeTileh_Road(TileInfo *ti) static uint GetSlopeTileh_Road(TileInfo *ti)
{ {
// check if it's a foundation // check if it's a foundation
if (ti->tileh != 0) { if (ti->tileh != 0) {

@ -649,7 +649,7 @@ typedef struct RoadVehFindData {
byte dir; byte dir;
} RoadVehFindData; } RoadVehFindData;
void *EnumCheckRoadVehClose(Vehicle *v, RoadVehFindData *rvf) static void *EnumCheckRoadVehClose(Vehicle *v, RoadVehFindData *rvf)
{ {
static const short _dists[] = { static const short _dists[] = {
-4, -8, -4, -1, 4, 8, 4, 1, -4, -8, -4, -1, 4, 8, 4, 1,
@ -801,7 +801,7 @@ typedef struct OvertakeData {
byte tilebits; byte tilebits;
} OvertakeData; } OvertakeData;
void *EnumFindVehToOvertake(Vehicle *v, OvertakeData *od) static void *EnumFindVehToOvertake(Vehicle *v, OvertakeData *od)
{ {
if (v->tile != (TileIndex)od->tile || if (v->tile != (TileIndex)od->tile ||
v->type != VEH_Road || v->type != VEH_Road ||

@ -131,22 +131,22 @@ static uint SlGetGammaLength(uint i) {
return (i>=0x80) ? 2 : 1; return (i>=0x80) ? 2 : 1;
} }
inline int SlReadSparseIndex(void) static inline int SlReadSparseIndex(void)
{ {
return SlReadSimpleGamma(); return SlReadSimpleGamma();
} }
inline void SlWriteSparseIndex(uint index) static inline void SlWriteSparseIndex(uint index)
{ {
SlWriteSimpleGamma(index); SlWriteSimpleGamma(index);
} }
inline int SlReadArrayLength(void) static inline int SlReadArrayLength(void)
{ {
return SlReadSimpleGamma(); return SlReadSimpleGamma();
} }
inline void SlWriteArrayLength(uint length) static inline void SlWriteArrayLength(uint length)
{ {
SlWriteSimpleGamma(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) { while (length) {
SlReadByte(); SlReadByte();
@ -925,7 +925,7 @@ static uint ReferenceToInt(void *v, uint t)
return 0; 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 /* From version 4.3 REF_VEHICLE_OLD is saved as REF_VEHICLE, and should be loaded
like that */ like that */

@ -517,7 +517,7 @@ void ShowGameDifficulty(void)
} }
// virtual PositionMainToolbar function, calls the right one. // virtual PositionMainToolbar function, calls the right one.
int32 v_PositionMainToolbar(int32 p1) static int32 v_PositionMainToolbar(int32 p1)
{ {
if (_game_mode != GM_MENU) if (_game_mode != GM_MENU)
PositionMainToolbar(NULL); PositionMainToolbar(NULL);
@ -525,7 +525,7 @@ int32 v_PositionMainToolbar(int32 p1)
return 0; return 0;
} }
int32 AiNew_PatchActive_Warning(int32 p1) static int32 AiNew_PatchActive_Warning(int32 p1)
{ {
if (p1 == 1) if (p1 == 1)
ShowErrorMessage(-1, TEMP_AI_ACTIVATED, 0, 0); ShowErrorMessage(-1, TEMP_AI_ACTIVATED, 0, 0);
@ -533,7 +533,7 @@ int32 AiNew_PatchActive_Warning(int32 p1)
return 0; return 0;
} }
int32 PopulationInLabelActive(int32 p1) static int32 PopulationInLabelActive(int32 p1)
{ {
Town *t; Town *t;
@ -546,20 +546,20 @@ int32 PopulationInLabelActive(int32 p1)
return 0; return 0;
} }
int32 InvisibleTreesActive(int32 p1) static int32 InvisibleTreesActive(int32 p1)
{ {
MarkWholeScreenDirty(); MarkWholeScreenDirty();
return 0; return 0;
} }
int32 InValidateDetailsWindow(int32 p1) static int32 InValidateDetailsWindow(int32 p1)
{ {
InvalidateWindowClasses(WC_VEHICLE_DETAILS); InvalidateWindowClasses(WC_VEHICLE_DETAILS);
return 0; return 0;
} }
/* Check service intervals of vehicles, p1 is value of % or day based servicing */ /* Check service intervals of vehicles, p1 is value of % or day based servicing */
int32 CheckInterval(int32 p1) static int32 CheckInterval(int32 p1)
{ {
bool warning; bool warning;
if (p1) { if (p1) {

@ -61,7 +61,7 @@ void PlaceProc_LevelLand(uint tile)
VpStartPlaceSizing(tile, VPM_X_AND_Y | (2<<4)); VpStartPlaceSizing(tile, VPM_X_AND_Y | (2<<4));
} }
void PlaceProc_PlantTree(uint tile) static void PlaceProc_PlantTree(uint tile)
{ {
} }

@ -1997,7 +1997,7 @@ typedef struct TrainCollideChecker {
} 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) if (v == tcc->v || v == tcc->v_skip || v->type != VEH_Train || v->u.rail.track==0x80)
return 0; return 0;
@ -2621,7 +2621,7 @@ void Train_Tick(Vehicle *v)
static const byte _depot_track_ind[4] = {0,1,0,1}; static const byte _depot_track_ind[4] = {0,1,0,1};
// Validation for the news item "Train is waiting in depot" // 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); Vehicle *v = GetVehicle(data_a);
return (v->u.rail.track == 0x80 && (v->vehstatus | VS_STOPPED)); return (v->u.rail.track == 0x80 && (v->vehstatus | VS_STOPPED));

20
ttd.c

@ -211,7 +211,7 @@ void ttd_strlcpy(char *dst, const char *src, size_t len)
*dst = 0; *dst = 0;
} }
char *strecpy(char *dst, const char *src) static char *strecpy(char *dst, const char *src)
{ {
while ( (*dst++ = *src++) != 0) {} while ( (*dst++ = *src++) != 0) {}
return dst - 1; 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'); char *t = strchr(s, 'x');
if (t == NULL) { if (t == NULL) {
@ -513,7 +513,7 @@ static void UnInitializeDynamicVariables(void)
} }
void LoadIntroGame(void) static void LoadIntroGame(void)
{ {
char filename[256]; char filename[256];
_game_mode = GM_MENU; _game_mode = GM_MENU;
@ -776,7 +776,7 @@ static void ShowScreenshotResult(bool b)
} }
void MakeNewGame(void) static void MakeNewGame(void)
{ {
_game_mode = GM_NORMAL; _game_mode = GM_NORMAL;
@ -834,7 +834,7 @@ static void MakeNewEditorWorld(void)
void StartupPlayers(void); void StartupPlayers(void);
void StartupDisasters(void); void StartupDisasters(void);
void StartScenario(void) static void StartScenario(void)
{ {
_game_mode = GM_NORMAL; _game_mode = GM_NORMAL;
@ -1190,7 +1190,7 @@ void BeforeSaveGame(void)
} }
} }
void ConvertTownOwner(void) static void ConvertTownOwner(void)
{ {
uint tile; uint tile;
@ -1209,7 +1209,7 @@ void ConvertTownOwner(void)
} }
// before savegame version 4, the name of the company determined if it existed // before savegame version 4, the name of the company determined if it existed
void CheckIsPlayerActive(void) static void CheckIsPlayerActive(void)
{ {
Player *p; Player *p;
FOR_ALL_PLAYERS(p) { FOR_ALL_PLAYERS(p) {
@ -1220,7 +1220,7 @@ void CheckIsPlayerActive(void)
} }
// since savegame version 4.1, exclusive transport rights are stored at towns // since savegame version 4.1, exclusive transport rights are stored at towns
void UpdateExclusiveRights(void) static void UpdateExclusiveRights(void)
{ {
Town *t; Town *t;
FOR_ALL_TOWNS(t) if (t->xy != 0) { FOR_ALL_TOWNS(t) if (t->xy != 0) {
@ -1245,14 +1245,14 @@ byte convert_currency[] = {
18, 2, 20, }; 18, 2, 20, };
// since savegame version 4.2 the currencies are arranged differently // since savegame version 4.2 the currencies are arranged differently
void UpdateCurrencies(void) static void UpdateCurrencies(void)
{ {
_opt.currency = convert_currency[_opt.currency]; _opt.currency = convert_currency[_opt.currency];
} }
// up to revision 1413, the invisible tiles at the southern border have not been MP_VOID // 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 // even though they should have. This is fixed by this function
void UpdateVoidTiles(void) static void UpdateVoidTiles(void)
{ {
uint i; uint i;
// create void tiles on the border // create void tiles on the border

@ -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. // 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; uint delta;
TileInfo ti_end; TileInfo ti_end;

@ -266,7 +266,8 @@ ViewPort *IsPtInWindowViewport(Window *w, int x, int y)
return NULL; return NULL;
} }
Point TranslateXYToTileCoord(ViewPort *vp, int x, int y) { static Point TranslateXYToTileCoord(ViewPort *vp, int x, int y)
{
int z; int z;
Point pt; Point pt;
int a,b; int a,b;
@ -1682,7 +1683,7 @@ void HandleClickOnTrain(Vehicle *v);
void HandleClickOnRoadVeh(Vehicle *v); void HandleClickOnRoadVeh(Vehicle *v);
void HandleClickOnAircraft(Vehicle *v); void HandleClickOnAircraft(Vehicle *v);
void HandleClickOnShip(Vehicle *v); void HandleClickOnShip(Vehicle *v);
void HandleClickOnSpecialVeh(Vehicle *v) {} static void HandleClickOnSpecialVeh(Vehicle *v) {}
void HandleClickOnDisasterVeh(Vehicle *v); void HandleClickOnDisasterVeh(Vehicle *v);
typedef void OnVehicleClickProc(Vehicle *v); typedef void OnVehicleClickProc(Vehicle *v);
static OnVehicleClickProc * const _on_vehicle_click_proc[6] = { static OnVehicleClickProc * const _on_vehicle_click_proc[6] = {

@ -478,7 +478,7 @@ static int GetDropdownItem(Window *w)
return item; return item;
} }
void DropdownMenuWndProc(Window *w, WindowEvent *e) static void DropdownMenuWndProc(Window *w, WindowEvent *e)
{ {
int item; int item;

@ -532,7 +532,8 @@ static bool IsGoodAutoPlace2(int left, int top)
return true; return true;
} }
Point GetAutoPlacePosition(int width, int height) { static Point GetAutoPlacePosition(int width, int height)
{
Window *w; Window *w;
Point pt; Point pt;
@ -778,7 +779,7 @@ static bool HandlePopupMenu(void)
return false; return false;
} }
bool HandleMouseOver(void) static bool HandleMouseOver(void)
{ {
Window *w; Window *w;
WindowEvent e; WindowEvent e;
@ -811,7 +812,7 @@ bool HandleMouseOver(void)
return true; return true;
} }
bool HandleWindowDragging(void) static bool HandleWindowDragging(void)
{ {
Window *w; Window *w;
// Get out immediately if no window is being dragged at all. // Get out immediately if no window is being dragged at all.

Loading…
Cancel
Save