frontport r9644

"Change / add a few log WARNINGS to INFO instead, to track down why the game thinks that people have left when they haven't, and also fix the bug of not destroying the player who dropped / left feature(s).

fixes ticket:1020"

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9704 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2010-02-07 04:49:23 +00:00 committed by Git SVN Gateway
parent ade49a97d6
commit dbdbd4f1a3
3 changed files with 20 additions and 12 deletions

View File

@ -1463,7 +1463,7 @@ static void NETplayerDropped(UDWORD index)
NETbeginEncode(NET_PLAYER_DROPPED, NET_ALL_PLAYERS);
NETuint32_t(&id);
NETend();
debug(LOG_NET, "NET_PLAYER_DROPPED received for player %d", id);
debug(LOG_INFO, "NET_PLAYER_DROPPED received for player %d", id);
NET_DestroyPlayer(id); // just clears array
MultiPlayerLeave(id); // more cleanup
NET_PlayerConnectionStatus = 2; //DROPPED_CONNECTION
@ -1477,7 +1477,7 @@ void NETplayerKicked(UDWORD index)
{
// kicking a player counts as "leaving nicely", since "nicely" in this case
// simply means "there wasn't a connection error."
debug(LOG_INFO, "Player %u was kicked.", index);
NET_DestroyPlayer(index); // sets index player's array to false
MultiPlayerLeave(index); // more cleanup
NETplayerLeaving(index); // need to close socket for the player that left.
@ -2386,7 +2386,7 @@ static BOOL NETprocessSystemMessage(void)
{ // dropped from join screen most likely
debug(LOG_NET, "Receiving NET_PLAYER_LEAVING for player %u ", (unsigned int)index);
}
debug(LOG_INFO, "Player %u has left the game.", index);
NET_DestroyPlayer(index); // sets index player's array to false
MultiPlayerLeave(index); // more cleanup
NETplayerLeaving(index); // need to close socket for the player that left.
@ -2540,7 +2540,7 @@ receive_message:
NETbeginEncode(NET_PLAYER_DROPPED, NET_ALL_PLAYERS);
NETuint32_t(&i);
NETend();
debug(LOG_NET, "sending NET_PLAYER_DROPPED for player %d", i);
debug(LOG_INFO, "sending NET_PLAYER_DROPPED for player %d (invalid socket)", i);
NET_DestroyPlayer(i); // just clears array
MultiPlayerLeave(i); // more cleanup
NET_PlayerConnectionStatus = 2; //DROPPED_CONNECTION

View File

@ -2986,9 +2986,9 @@ void frontendMultiMessages(void)
}
NETend();
debug(LOG_WARNING,"** player %u has dropped! Host is %s",player_id,host?"true":"false");
debug(LOG_INFO,"** player %u has dropped! Host is %s", player_id, host?"true":"false");
MultiPlayerLeave(player_id);
MultiPlayerLeave(player_id); // get rid of their stuff
NET_PlayerConnectionStatus = 2; //DROPPED_CONNECTION
if (host) // host has quit, need to quit too.
{

View File

@ -108,14 +108,22 @@ BOOL intDisplayMultiJoiningStatus(UBYTE joinCount)
return true;
}
// ////////////////////////////////////////////////////////////////////////////
// when a remote player leaves an arena game do this!
//////////////////////////////////////////////////////////////////////////////
/*
** when a remote player leaves an arena game do this!
**
** @param player -- the one we need to clear
** @param quietly -- true means without any visible effects
** @param removeOil -- true means remove all their (oil) feature(s) on map
*/
void clearPlayer(UDWORD player,BOOL quietly,BOOL removeOil)
{
UDWORD i;
BOOL bTemp;
STRUCTURE *psStruct,*psNext;
debug(LOG_INFO, "R.I.P. %s (%u). params: (%d:%d)", getPlayerName(player), player, quietly, removeOil);
ingame.JoiningInProgress[player] = false; // if they never joined, reset the flag
ingame.DataIntegrity[player] = false;
@ -133,7 +141,9 @@ void clearPlayer(UDWORD player,BOOL quietly,BOOL removeOil)
if(quietly)
{
killDroid(apsDroidLists[player]);
}else{
}
else
{
destroyDroid(apsDroidLists[player]);
}
}
@ -158,8 +168,6 @@ void clearPlayer(UDWORD player,BOOL quietly,BOOL removeOil)
}
else
{
// NOTE: when a player leaves, we should destroy everything, including the walls
// Is there any reason why not to do this? (removed wall check code)
destroyStruct(psStruct);
}
@ -222,7 +230,7 @@ BOOL MultiPlayerLeave(UDWORD playerIndex)
ssprintf(buf, _("%s has Left the Game"), getPlayerName(playerIndex));
turnOffMultiMsg(true);
clearPlayer(playerIndex, false, false);
clearPlayer(playerIndex, false, true); // don't do it quietly and kill their oil
game.skDiff[playerIndex] = DIFF_SLIDER_STOPS / 2;
turnOffMultiMsg(false);