(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
authordarkvater
Thu, 23 Dec 2004 00:24:44 +0000
changeset 774 258c11431acb
parent 773 0c5d7a4bac3d
child 775 af45df06f6fb
(svn r1240) -Fix: OpenTTD once again compiles if ENABLE_NETWORK is disabled.
-Fix: removed some warnings
-Enabled ENABLE_NETWORK on windows again which I accidentally commented out.
dedicated.c
intro_gui.c
main_gui.c
network.h
network_client.c
network_core.h
network_gui.c
network_udp.h
settings.c
ttd.c
--- a/dedicated.c	Wed Dec 22 23:24:53 2004 +0000
+++ b/dedicated.c	Thu Dec 23 00:24:44 2004 +0000
@@ -34,7 +34,7 @@
 
 #ifdef UNIX
 /* We want to fork our dedicated server */
-void DedicatedFork()
+void DedicatedFork(void)
 {
 	/* Fork the program */
 	_dedicated_pid = fork();
@@ -242,6 +242,7 @@
 	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; }
--- a/intro_gui.c	Wed Dec 22 23:24:53 2004 +0000
+++ b/intro_gui.c	Thu Dec 23 00:24:44 2004 +0000
@@ -57,15 +57,14 @@
 		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;
--- a/main_gui.c	Wed Dec 22 23:24:53 2004 +0000
+++ b/main_gui.c	Thu Dec 23 00:24:44 2004 +0000
@@ -2370,7 +2370,7 @@
 
 
 void ShowSelectGameWindow();
-extern void ShowJoinStatusWindowAfterJoin();
+extern void ShowJoinStatusWindowAfterJoin(void);
 
 void SetupColorsAndInitialWindow()
 {
--- a/network.h	Wed Dec 22 23:24:53 2004 +0000
+++ b/network.h	Thu Dec 23 00:24:44 2004 +0000
@@ -132,8 +132,6 @@
 
 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 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 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 */
--- a/network_client.c	Wed Dec 22 23:24:53 2004 +0000
+++ b/network_client.c	Thu Dec 23 00:24:44 2004 +0000
@@ -596,7 +596,7 @@
 {
 	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;
--- a/network_core.h	Wed Dec 22 23:24:53 2004 +0000
+++ b/network_core.h	Thu Dec 23 00:24:44 2004 +0000
@@ -13,7 +13,7 @@
 #	include <winsock2.h>
 #	include <ws2tcpip.h>
 #	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..
--- a/network_gui.c	Wed Dec 22 23:24:53 2004 +0000
+++ b/network_gui.c	Thu Dec 23 00:24:44 2004 +0000
@@ -1315,7 +1315,7 @@
 	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 @@
 	WP(w,querystr_d).buf = _edit_str_buf;
 }
 
-
+#else
+void ShowJoinStatusWindowAfterJoin(void) {}
 #endif /* ENABLE_NETWORK */
--- a/network_udp.h	Wed Dec 22 23:24:53 2004 +0000
+++ b/network_udp.h	Thu Dec 23 00:24:44 2004 +0000
@@ -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 @@
 void NetworkUDPAdvertise(void);
 void NetworkUDPRemoveAdvertise(void);
 
+#endif
+
 #endif /* NETWORK_LAN_H */
--- a/settings.c	Wed Dec 22 23:24:53 2004 +0000
+++ b/settings.c	Thu Dec 23 00:24:44 2004 +0000
@@ -952,14 +952,14 @@
 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]));
--- a/ttd.c	Wed Dec 22 23:24:53 2004 +0000
+++ b/ttd.c	Thu Dec 23 00:24:44 2004 +0000
@@ -519,7 +519,7 @@
 	if (_music_driver->is_song_playing()) ResetMusic();
 }
 
-extern void DedicatedFork();
+extern void DedicatedFork(void);
 
 int ttd_main(int argc, char* argv[])
 {