// network.c
// ============================================================================
-#include "libgame/platform.h"
-
-#if defined(NETWORK_AVALIABLE)
-
#include <signal.h>
#include <sys/time.h>
-#include "main.h"
-
#include "libgame/libgame.h"
#include "network.h"
#include "netserv.h"
+#include "main.h"
#include "game.h"
#include "tape.h"
#include "files.h"
static void SendBufferToServer(int size)
{
- if (!options.network)
+ if (!network.enabled)
return;
realbuffer[0] = realbuffer[1] = realbuffer[2] = 0;
if (game_status == GAME_MODE_PLAYING)
{
- if (buffer[2] == NETWORK_STOP_BY_PLAYER)
- Request("Network game stopped by player!", REQ_CONFIRM);
- else if (buffer[2] == NETWORK_STOP_BY_ERROR)
- Request("Network game stopped due to internal error!", REQ_CONFIRM);
- else
- Request("Network game stopped!", REQ_CONFIRM);
+ int client_nr = buffer[0];
+ int index_nr = client_nr - 1;
+ boolean stopped_by_remote_player = (index_nr != local_player->index_nr);
+ char *message = (buffer[2] == NETWORK_STOP_BY_PLAYER ?
+ "Network game stopped by player!" :
+ buffer[2] == NETWORK_STOP_BY_ERROR ?
+ "Network game stopped due to internal error!" :
+ "Network game stopped!");
+
+ if (buffer[2] != NETWORK_STOP_BY_PLAYER || stopped_by_remote_player)
+ Request(message, REQ_CONFIRM | REQ_STAY_CLOSED);
}
SetGameStatus(GAME_MODE_MAIN);
}
while (r > 0);
}
-
-#endif /* NETWORK_AVALIABLE */