Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change m_client_event_queue's type to std::queue
As indicated in its name, m_client_event_queue should be a queue.
Change std::list to std::queue to improve the queue's performance.
  • Loading branch information
nerzhul authored and est31 committed Sep 8, 2015
1 parent fe6575b commit 1f1e14a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/environment.cpp
Expand Up @@ -2562,15 +2562,15 @@ void ClientEnvironment::damageLocalPlayer(u8 damage, bool handle_hp)
event.type = CEE_PLAYER_DAMAGE;
event.player_damage.amount = damage;
event.player_damage.send_to_server = handle_hp;
m_client_event_queue.push_back(event);
m_client_event_queue.push(event);
}

void ClientEnvironment::updateLocalPlayerBreath(u16 breath)
{
ClientEnvEvent event;
event.type = CEE_PLAYER_BREATH;
event.player_breath.amount = breath;
m_client_event_queue.push_back(event);
m_client_event_queue.push(event);
}

/*
Expand Down Expand Up @@ -2604,7 +2604,7 @@ ClientEnvEvent ClientEnvironment::getClientEvent()
event.type = CEE_NONE;
else {
event = m_client_event_queue.front();
m_client_event_queue.pop_front();
m_client_event_queue.pop();
}
return event;
}
Expand Down
2 changes: 1 addition & 1 deletion src/environment.h
Expand Up @@ -534,7 +534,7 @@ class ClientEnvironment : public Environment
IrrlichtDevice *m_irr;
std::map<u16, ClientActiveObject*> m_active_objects;
std::vector<ClientSimpleObject*> m_simple_objects;
std::list<ClientEnvEvent> m_client_event_queue;
std::queue<ClientEnvEvent> m_client_event_queue;
IntervalLimiter m_active_object_light_update_interval;
IntervalLimiter m_lava_hurt_interval;
IntervalLimiter m_drowning_interval;
Expand Down

0 comments on commit 1f1e14a

Please sign in to comment.