From 8e02c3d3eacc5437fb1218d4741e4ca258833da7 Mon Sep 17 00:00:00 2001 From: Buginator Date: Sat, 10 Jul 2010 00:38:00 +0000 Subject: [PATCH] When player disconnects / drops, handle the message, instead of the clients ignoring it. Fixes ticket:1020 git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@11109 4a71c877-e1ca-e34f-864e-861f7616d084 --- src/multiplay.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/multiplay.c b/src/multiplay.c index 3ac6cd068..41830d5ce 100644 --- a/src/multiplay.c +++ b/src/multiplay.c @@ -103,7 +103,7 @@ static SDWORD msgStackPos = -1; //top element pointer // Remote Prototypes extern RESEARCH* asResearch; //list of possible research items. extern PLAYER_RESEARCH* asPlayerResList[MAX_PLAYERS]; - +extern int NET_PlayerConnectionStatus; // //////////////////////////////////////////////////////////////////////////// // Local Prototypes @@ -690,6 +690,24 @@ BOOL recvMessage(void) case NET_OPTIONS: recvOptions(); break; + case NET_PLAYER_DROPPED: // remote player got disconnected + { + BOOL host; + uint32_t player_id; + + NETbeginDecode(NET_PLAYER_DROPPED); + { + NETuint32_t(&player_id); + NETbool(&host); + } + NETend(); + + debug(LOG_INFO,"** player %u has dropped! Host is %s", player_id, host?"true":"false"); + + MultiPlayerLeave(player_id); // get rid of their stuff + NET_PlayerConnectionStatus = 2; //DROPPED_CONNECTION + break; + } case NET_PLAYERRESPONDING: // remote player is now playing { uint32_t player_id;