< Previous | Contents | Next >
The Lobby::Clear() member function removes all of the players from the lobby.
void Lobby::Clear()
{
while (m_pHead != 0)
{
Introducing the Game Lobby Program 323
The list of players just before and just after a player node is removed.
RemovePlayer();
}
}
If the list is empty, the loop isn’t entered and the function ends. Otherwise, the loop is entered and the function keeps removing the first Player object in the list by calling RemovePlayer() until there are no more Player objects.