diff --git a/dedicated.c b/dedicated.c index 051573bee7..d17302be90 100644 --- a/dedicated.c +++ b/dedicated.c @@ -34,7 +34,7 @@ static void *_dedicated_video_mem; #ifdef UNIX /* We want to fork our dedicated server */ -void DedicatedFork() +void DedicatedFork(void) { /* Fork the program */ _dedicated_pid = fork(); @@ -242,6 +242,7 @@ static const char *DedicatedVideoStart(char **parm) { return NULL; } +void DedicatedFork(void) {} static void DedicatedVideoStop() { free(_dedicated_video_mem); } static void DedicatedVideoMakeDirty(int left, int top, int width, int height) {} static bool DedicatedVideoChangeRes(int w, int h) { return false; } diff --git a/intro_gui.c b/intro_gui.c index a4f77fcb03..baa64d7850 100644 --- a/intro_gui.c +++ b/intro_gui.c @@ -57,15 +57,14 @@ static void SelectGameWndProc(Window *w, WindowEvent *e) { case 4: ShowPatchesSelection(); break; case 5: DoCommandP(0, InteractiveRandom(), 0, NULL, CMD_CREATE_SCENARIO); break; case 7: -#ifdef ENABLE_NETWORK + #ifdef ENABLE_NETWORK if (!_network_available) { - ShowErrorMessage(-1,STR_NETWORK_ERR_NOTAVAILABLE, 0, 0); - } else { + ShowErrorMessage(-1, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0); + } else ShowNetworkGameWindow(); - } -#else - ShowErrorMessage(-1,STR_NETWORK_ERR_NOTAVAILABLE, 0, 0); -#endif /* ENABLE_NETWORK */ + #else + ShowErrorMessage(-1 ,STR_NETWORK_ERR_NOTAVAILABLE, 0, 0); + #endif /* ENABLE_NETWORK */ break; case 8: ShowGameOptions(); break; case 9: ShowGameDifficulty(); break; diff --git a/main_gui.c b/main_gui.c index b6442a1812..c80ac1ae12 100644 --- a/main_gui.c +++ b/main_gui.c @@ -2370,7 +2370,7 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) { void ShowSelectGameWindow(); -extern void ShowJoinStatusWindowAfterJoin(); +extern void ShowJoinStatusWindowAfterJoin(void); void SetupColorsAndInitialWindow() { diff --git a/network.h b/network.h index 7fd1d4ebb1..0a13665efd 100644 --- a/network.h +++ b/network.h @@ -132,8 +132,6 @@ VARDEF NetworkClientInfo _network_client_info[MAX_CLIENT_INFO]; VARDEF char _network_player_name[NETWORK_NAME_LENGTH]; VARDEF char _network_default_ip[NETWORK_HOSTNAME_LENGTH]; -#define MAX_SAVED_SERVERS 10 -VARDEF char *_network_host_list[MAX_SAVED_SERVERS]; VARDEF uint16 _network_own_client_index; VARDEF char _network_unique_id[NETWORK_NAME_LENGTH]; // Our own unique ID @@ -186,9 +184,13 @@ VARDEF bool _network_autoclean_companies; VARDEF uint8 _network_autoclean_unprotected; // Remove a company after X months VARDEF uint8 _network_autoclean_protected; // Unprotect a company after X months +NetworkGameList *NetworkQueryServer(const byte* host, unsigned short port, bool game_info); + #endif /* ENABLE_NETWORK */ // Those variables must always be registered! +#define MAX_SAVED_SERVERS 10 +VARDEF char *_network_host_list[MAX_SAVED_SERVERS]; VARDEF bool _networking; VARDEF bool _network_available; // is network mode available? VARDEF bool _network_server; // network-server is active @@ -199,7 +201,6 @@ void ParseConnectionString(const byte **player, const byte **port, byte *connect void NetworkUpdateClientInfo(uint16 client_index); void NetworkAddServer(const byte *b); void NetworkRebuildHostList(); -NetworkGameList *NetworkQueryServer(const byte* host, unsigned short port, bool game_info); void NetworkChangeCompanyPassword(const char *str); #endif /* NETWORK_H */ diff --git a/network_client.c b/network_client.c index 49e9a215fe..b929af1bac 100644 --- a/network_client.c +++ b/network_client.c @@ -596,7 +596,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT) { NetworkAction action = NetworkRecv_uint8(p); char msg[MAX_TEXT_MSG_LEN]; - NetworkClientInfo *ci, *ci_to; + NetworkClientInfo *ci = NULL, *ci_to; uint16 index; char name[NETWORK_NAME_LENGTH]; bool self_send; diff --git a/network_core.h b/network_core.h index 7f8bdc18bb..4eaea2d81d 100644 --- a/network_core.h +++ b/network_core.h @@ -13,7 +13,7 @@ # include # include # pragma comment (lib, "ws2_32.lib") -//# define ENABLE_NETWORK // On windows, the network is always enabled +# define ENABLE_NETWORK // On windows, the network is always enabled # define GET_LAST_ERROR() WSAGetLastError() # define EWOULDBLOCK WSAEWOULDBLOCK // Windows has some different names for some types.. diff --git a/network_gui.c b/network_gui.c index 144552aafd..94d3f73102 100644 --- a/network_gui.c +++ b/network_gui.c @@ -1315,7 +1315,7 @@ void ShowJoinStatusWindow() AllocateWindowDesc(&_network_join_status_window_desc); } -void ShowJoinStatusWindowAfterJoin() +void ShowJoinStatusWindowAfterJoin(void) { /* This is a special instant of ShowJoinStatusWindow, because it is opened after the map is loaded, but the client maybe is not @@ -1454,5 +1454,6 @@ void ShowChatWindow(StringID str, StringID caption, int maxlen, int maxwidth, by WP(w,querystr_d).buf = _edit_str_buf; } - +#else +void ShowJoinStatusWindowAfterJoin(void) {} #endif /* ENABLE_NETWORK */ diff --git a/network_udp.h b/network_udp.h index ad0e79844d..1db6d97ab1 100644 --- a/network_udp.h +++ b/network_udp.h @@ -1,6 +1,8 @@ #ifndef NETWORK_LAN_H #define NETWORK_LAN_H +#ifdef ENABLE_NETWORK + void NetworkUDPInitialize(void); bool NetworkUDPListen(SOCKET *udp, uint32 host, uint16 port, bool broadcast); void NetworkUDPReceive(SOCKET udp); @@ -10,4 +12,6 @@ NetworkGameList *NetworkUDPQueryServer(const byte* host, unsigned short port); void NetworkUDPAdvertise(void); void NetworkUDPRemoveAdvertise(void); +#endif + #endif /* NETWORK_LAN_H */ diff --git a/settings.c b/settings.c index 84572ad005..2f9ea63f4b 100644 --- a/settings.c +++ b/settings.c @@ -952,14 +952,14 @@ static void LoadList(IniFile *ini, const char *grpname, char **list, int len) static void SaveList(IniFile *ini, const char *grpname, char **list, int len) { IniGroup *group = ini_getgroup(ini, grpname, -1); - IniItem *item; + IniItem *item = NULL; int i; bool first = true; if (!group) return; - for ( i=0; i != len; i++) { - if ( list[i] == '\0' ) continue; + for (i = 0; i != len; i++) { + if (list[i] == '\0') continue; if (first) { // add first item to the head of the group item = ini_item_alloc(group, list[i], strlen(list[i])); diff --git a/ttd.c b/ttd.c index c3647c2534..6a676495a5 100644 --- a/ttd.c +++ b/ttd.c @@ -519,7 +519,7 @@ void LoadIntroGame() if (_music_driver->is_song_playing()) ResetMusic(); } -extern void DedicatedFork(); +extern void DedicatedFork(void); int ttd_main(int argc, char* argv[]) {