Don't broadcast to other players about a new player in NET_CreatePlayer(), we will only do NETBroadcastPlayerInfo() when a player has passed all the verification steps.
This fixes ticket:1611 Correctly handle rejection of the verification process as well. 2.3:r10572 git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@10583 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
71a9f27b40
commit
1d47645d07
|
@ -443,7 +443,6 @@ static signed int NET_CreatePlayer(const char* name)
|
|||
NET_InitPlayer(index, false); // re-init everything
|
||||
NetPlay.players[index].allocated = true;
|
||||
sstrcpy(NetPlay.players[index].name, name);
|
||||
NETBroadcastPlayerInfo(index);
|
||||
NetPlay.playercount++;
|
||||
sync_counter.joins++;
|
||||
return index;
|
||||
|
@ -2259,7 +2258,11 @@ static void NETallowJoining(void)
|
|||
|
||||
if (onBanList(clientAddress))
|
||||
{
|
||||
debug(LOG_INFO, "A player that you have kicked tried to rejoin the game, and was rejected. IP:%s", clientAddress);
|
||||
char buf[256] = {'\0'};
|
||||
|
||||
ssprintf(buf, "** A player that you have kicked tried to rejoin the game, and was rejected. IP:%s", clientAddress );
|
||||
debug(LOG_INFO, buf);
|
||||
NETlogEntry(buf, SYNC_FLAG, i);
|
||||
SocketSet_DelSocket(tmp_socket_set, tmp_socket[i]);
|
||||
socketClose(tmp_socket[i]);
|
||||
tmp_socket[i] = NULL;
|
||||
|
@ -2291,7 +2294,7 @@ static void NETallowJoining(void)
|
|||
|
||||
index = tmp;
|
||||
|
||||
debug(LOG_NET, "freeing temp socket %p (%d)", tmp_socket[i], __LINE__);
|
||||
debug(LOG_NET, "freeing temp socket %p (%d), creating permanent socket.", tmp_socket[i], __LINE__);
|
||||
SocketSet_DelSocket(tmp_socket_set, tmp_socket[i]);
|
||||
NET_initBufferedSocket(connected_bsocket[index], tmp_socket[i]);
|
||||
SocketSet_AddSocket(socket_set, connected_bsocket[index]->socket);
|
||||
|
@ -2320,7 +2323,11 @@ static void NETallowJoining(void)
|
|||
|
||||
if (rejected)
|
||||
{
|
||||
debug(LOG_INFO, "We were rejected, reason (%u)", (unsigned int) rejected);
|
||||
char buf[256] = {'\0'};
|
||||
|
||||
ssprintf(buf, "** This player %u, was rejected, error code: %u",(unsigned int) index, (unsigned int) rejected);
|
||||
debug(LOG_INFO, buf);
|
||||
NETlogEntry(buf, SYNC_FLAG, index);
|
||||
NETbeginEncode(NET_REJECTED, index);
|
||||
NETuint8_t(&rejected);
|
||||
NETend();
|
||||
|
@ -2342,6 +2349,9 @@ static void NETallowJoining(void)
|
|||
NETlogEntry(buf, SYNC_FLAG, index);
|
||||
}
|
||||
|
||||
// Broadcast to everyone that a new player has joined
|
||||
NETBroadcastPlayerInfo(index);
|
||||
|
||||
NETbeginEncode(NET_ACCEPTED, index);
|
||||
NETuint8_t(&index);
|
||||
NETend();
|
||||
|
@ -2803,17 +2813,16 @@ BOOL NETjoinGame(UDWORD gameNumber, const char* playername)
|
|||
}
|
||||
else if (type == NET_REJECTED)
|
||||
{
|
||||
// :(
|
||||
uint8_t rejection = 0;
|
||||
|
||||
NETbeginDecode(NET_REJECTED);
|
||||
// WRY???
|
||||
NETuint8_t(&rejection);
|
||||
NETend();
|
||||
|
||||
debug(LOG_NET, "NET_REJECTED received. Better luck next time?");
|
||||
debug(LOG_NET, "NET_REJECTED received. Error code: %u", (unsigned int) rejection);
|
||||
|
||||
setLobbyError((LOBBY_ERROR_TYPES)rejection);
|
||||
NETclose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue