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
master
Buginator 2010-07-10 00:38:00 +00:00 committed by Git SVN Gateway
parent 1941064f77
commit 8e02c3d3ea
1 changed files with 19 additions and 1 deletions

View File

@ -103,7 +103,7 @@ static SDWORD msgStackPos = -1; //top element pointer
// Remote Prototypes // Remote Prototypes
extern RESEARCH* asResearch; //list of possible research items. extern RESEARCH* asResearch; //list of possible research items.
extern PLAYER_RESEARCH* asPlayerResList[MAX_PLAYERS]; extern PLAYER_RESEARCH* asPlayerResList[MAX_PLAYERS];
extern int NET_PlayerConnectionStatus;
// //////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////
// Local Prototypes // Local Prototypes
@ -690,6 +690,24 @@ BOOL recvMessage(void)
case NET_OPTIONS: case NET_OPTIONS:
recvOptions(); recvOptions();
break; 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 case NET_PLAYERRESPONDING: // remote player is now playing
{ {
uint32_t player_id; uint32_t player_id;