Change m_client_event_queue's type to std::queue
authorLoic Blot <loic.blot@unix-experience.fr>
Tue, 8 Sep 2015 16:29:02 +0000 (18:29 +0200)
committerest31 <MTest31@outlook.com>
Tue, 8 Sep 2015 19:23:09 +0000 (21:23 +0200)
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.

src/environment.cpp
src/environment.h

index c337139e892a3a52c70eb11a5ef3407ade7a0706..eb599668b82333b644d616c89457c729887bd464 100644 (file)
@@ -2562,7 +2562,7 @@ 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)
@@ -2570,7 +2570,7 @@ 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);
 }
 
 /*
@@ -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;
 }
index 6ace12671838976c1c9b7c648a621ca357af8673..22840a9fcaba7a924c664d0c05779f76aed2d3e8 100644 (file)
@@ -534,7 +534,7 @@ private:
        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;