Skip to content

Commit

Permalink
Clear player names iff game not started, instead of iff not host.
Browse files Browse the repository at this point in the history
This seems more logical, and matches the comment on the next line. Clients no longer
disagree with the host on whether an empty slot has a name, when a player joins and
leaves before the game starts.
  • Loading branch information
Cyp committed May 6, 2012
1 parent 1ef4fc6 commit ef685d0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion lib/netplay/netplay.cpp
Expand Up @@ -280,7 +280,7 @@ void NET_InitPlayer(int i, bool initPosition)
NetPlay.players[i].heartattacktime = 0;
NetPlay.players[i].heartbeat = true; // we always start with a hearbeat
NetPlay.players[i].kick = false;
if (!NetPlay.isHost)
if (ingame.localJoiningInProgress)
{ // only clear name outside of games.
NetPlay.players[i].name[0] = '\0';
}
Expand Down
3 changes: 0 additions & 3 deletions src/loop.cpp
Expand Up @@ -427,13 +427,10 @@ static void gameStateUpdate()
NetPlay.players[0].allocated, NetPlay.players[1].allocated, NetPlay.players[2].allocated, NetPlay.players[3].allocated, NetPlay.players[4].allocated, NetPlay.players[5].allocated, NetPlay.players[6].allocated, NetPlay.players[7].allocated, NetPlay.players[8].allocated, NetPlay.players[9].allocated,
NetPlay.players[0].position, NetPlay.players[1].position, NetPlay.players[2].position, NetPlay.players[3].position, NetPlay.players[4].position, NetPlay.players[5].position, NetPlay.players[6].position, NetPlay.players[7].position, NetPlay.players[8].position, NetPlay.players[9].position
);
// TODO: Figure out why the following player names aren't always synchronised.
uint32_t crc = syncDebugGetCrc();
for (unsigned n = 0; n < MAX_PLAYERS; ++n)
{
syncDebug("Player %d = \"%s\"", n, NetPlay.players[n].name);
}
syncDebugSetCrc(crc); // Do not dump desynch logs because of NetPlay.players[n].name being different.

// Actually send pending droid orders.
sendQueuedDroidInfo();
Expand Down

0 comments on commit ef685d0

Please sign in to comment.