mirror of
https://github.com/moparisthebest/minetest
synced 2024-11-16 22:35:07 -05:00
Remove goto from Environment::removePlayer
This commit is contained in:
parent
c9b64206f9
commit
2bc2ce3bd1
@ -85,19 +85,17 @@ void Environment::addPlayer(Player *player)
|
|||||||
void Environment::removePlayer(u16 peer_id)
|
void Environment::removePlayer(u16 peer_id)
|
||||||
{
|
{
|
||||||
DSTACK(__FUNCTION_NAME);
|
DSTACK(__FUNCTION_NAME);
|
||||||
re_search:
|
|
||||||
for(std::list<Player*>::iterator i = m_players.begin();
|
for(std::list<Player*>::iterator i = m_players.begin();
|
||||||
i != m_players.end(); ++i)
|
i != m_players.end();)
|
||||||
{
|
{
|
||||||
Player *player = *i;
|
Player *player = *i;
|
||||||
if(player->peer_id != peer_id)
|
if(player->peer_id == peer_id) {
|
||||||
continue;
|
delete player;
|
||||||
|
i = m_players.erase(i);
|
||||||
delete player;
|
} else {
|
||||||
m_players.erase(i);
|
++i;
|
||||||
// See if there is an another one
|
}
|
||||||
// (shouldn't be, but just to be sure)
|
|
||||||
goto re_search;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user