(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.
replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
darkvater 20 years ago
parent c4836bbd70
commit 28c1dc3e39

@ -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; }

@ -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;

@ -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 */

@ -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;

@ -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..

@ -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 */

@ -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 */

@ -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[])
{

Loading…
Cancel
Save