mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)
* ClientEnvironment now uses UNORDERED MAP for active objects * Use RemotePlayer and LocalPlayer everywhere it's possible * Minor code style fixes * Drop Client::getBreath() unused function
This commit is contained in:
parent
067766eec2
commit
fd5a130b86
10 changed files with 124 additions and 152 deletions
|
@ -77,9 +77,9 @@ void RemoteClient::GetNextBlocks (
|
|||
if(m_nothing_to_send_pause_timer >= 0)
|
||||
return;
|
||||
|
||||
Player *player = env->getPlayer(peer_id);
|
||||
RemotePlayer *player = env->getPlayer(peer_id);
|
||||
// This can happen sometimes; clients and players are not in perfect sync.
|
||||
if(player == NULL)
|
||||
if (player == NULL)
|
||||
return;
|
||||
|
||||
// Won't send anything if already sending
|
||||
|
@ -645,8 +645,7 @@ void ClientInterface::step(float dtime)
|
|||
|
||||
void ClientInterface::UpdatePlayerList()
|
||||
{
|
||||
if (m_env != NULL)
|
||||
{
|
||||
if (m_env != NULL) {
|
||||
std::vector<u16> clients = getClientIDs();
|
||||
m_clients_names.clear();
|
||||
|
||||
|
@ -654,10 +653,8 @@ void ClientInterface::UpdatePlayerList()
|
|||
if(!clients.empty())
|
||||
infostream<<"Players:"<<std::endl;
|
||||
|
||||
for(std::vector<u16>::iterator
|
||||
i = clients.begin();
|
||||
i != clients.end(); ++i) {
|
||||
Player *player = m_env->getPlayer(*i);
|
||||
for (std::vector<u16>::iterator i = clients.begin(); i != clients.end(); ++i) {
|
||||
RemotePlayer *player = m_env->getPlayer(*i);
|
||||
|
||||
if (player == NULL)
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue