diff options
author | darkvater <darkvater@openttd.org> | 2004-12-23 00:24:44 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2004-12-23 00:24:44 +0000 |
commit | 28c1dc3e396c221b7d2a740ed49ce881bfe23384 (patch) | |
tree | c61005fca393d8636f471b3f6497712970f87b04 | |
parent | c4836bbd70223842a9df4f412444ece44d9b1147 (diff) | |
download | openttd-28c1dc3e396c221b7d2a740ed49ce881bfe23384.tar.xz |
(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.
-rw-r--r-- | dedicated.c | 3 | ||||
-rw-r--r-- | intro_gui.c | 13 | ||||
-rw-r--r-- | main_gui.c | 2 | ||||
-rw-r--r-- | network.h | 7 | ||||
-rw-r--r-- | network_client.c | 2 | ||||
-rw-r--r-- | network_core.h | 2 | ||||
-rw-r--r-- | network_gui.c | 5 | ||||
-rw-r--r-- | network_udp.h | 4 | ||||
-rw-r--r-- | settings.c | 6 | ||||
-rw-r--r-- | ttd.c | 2 |
10 files changed, 26 insertions, 20 deletions
diff --git a/dedicated.c b/dedicated.c index 051573bee..d17302be9 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 a4f77fcb0..baa64d785 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 b6442a181..c80ac1ae1 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() { @@ -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 49e9a215f..b929af1ba 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 7f8bdc18b..4eaea2d81 100644 --- a/network_core.h +++ b/network_core.h @@ -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.. diff --git a/network_gui.c b/network_gui.c index 144552aaf..94d3f7310 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 ad0e79844..1db6d97ab 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 84572ad00..2f9ea63f4 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])); @@ -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[]) { |