@@ -605,11 +605,8 @@ ClientInterface::~ClientInterface()
605
605
{
606
606
MutexAutoLock clientslock (m_clients_mutex);
607
607
608
- for (std::map<u16, RemoteClient*>::iterator
609
- i = m_clients.begin ();
610
- i != m_clients.end (); ++i)
611
- {
612
-
608
+ for (UNORDERED_MAP<u16, RemoteClient*>::iterator i = m_clients.begin ();
609
+ i != m_clients.end (); ++i) {
613
610
// Delete client
614
611
delete i->second ;
615
612
}
@@ -621,10 +618,8 @@ std::vector<u16> ClientInterface::getClientIDs(ClientState min_state)
621
618
std::vector<u16> reply;
622
619
MutexAutoLock clientslock (m_clients_mutex);
623
620
624
- for (std::map<u16, RemoteClient*>::iterator
625
- i = m_clients.begin ();
626
- i != m_clients.end (); ++i)
627
- {
621
+ for (UNORDERED_MAP<u16, RemoteClient*>::iterator i = m_clients.begin ();
622
+ i != m_clients.end (); ++i) {
628
623
if (i->second ->getState () >= min_state)
629
624
reply.push_back (i->second ->peer_id );
630
625
}
@@ -691,8 +686,7 @@ void ClientInterface::sendToAll(u16 channelnum,
691
686
NetworkPacket* pkt, bool reliable)
692
687
{
693
688
MutexAutoLock clientslock (m_clients_mutex);
694
- for (std::map<u16, RemoteClient*>::iterator
695
- i = m_clients.begin ();
689
+ for (UNORDERED_MAP<u16, RemoteClient*>::iterator i = m_clients.begin ();
696
690
i != m_clients.end (); ++i) {
697
691
RemoteClient *client = i->second ;
698
692
@@ -705,11 +699,10 @@ void ClientInterface::sendToAll(u16 channelnum,
705
699
RemoteClient* ClientInterface::getClientNoEx (u16 peer_id, ClientState state_min)
706
700
{
707
701
MutexAutoLock clientslock (m_clients_mutex);
708
- std::map<u16, RemoteClient*>::iterator n;
709
- n = m_clients.find (peer_id);
702
+ UNORDERED_MAP<u16, RemoteClient*>::iterator n = m_clients.find (peer_id);
710
703
// The client may not exist; clients are immediately removed if their
711
704
// access is denied, and this event occurs later then.
712
- if (n == m_clients.end ())
705
+ if (n == m_clients.end ())
713
706
return NULL ;
714
707
715
708
if (n->second ->getState () >= state_min)
@@ -720,11 +713,10 @@ RemoteClient* ClientInterface::getClientNoEx(u16 peer_id, ClientState state_min)
720
713
721
714
RemoteClient* ClientInterface::lockedGetClientNoEx (u16 peer_id, ClientState state_min)
722
715
{
723
- std::map<u16, RemoteClient*>::iterator n;
724
- n = m_clients.find (peer_id);
716
+ UNORDERED_MAP<u16, RemoteClient*>::iterator n = m_clients.find (peer_id);
725
717
// The client may not exist; clients are immediately removed if their
726
718
// access is denied, and this event occurs later then.
727
- if (n == m_clients.end ())
719
+ if (n == m_clients.end ())
728
720
return NULL ;
729
721
730
722
if (n->second ->getState () >= state_min)
@@ -736,11 +728,10 @@ RemoteClient* ClientInterface::lockedGetClientNoEx(u16 peer_id, ClientState stat
736
728
ClientState ClientInterface::getClientState (u16 peer_id)
737
729
{
738
730
MutexAutoLock clientslock (m_clients_mutex);
739
- std::map<u16, RemoteClient*>::iterator n;
740
- n = m_clients.find (peer_id);
731
+ UNORDERED_MAP<u16, RemoteClient*>::iterator n = m_clients.find (peer_id);
741
732
// The client may not exist; clients are immediately removed if their
742
733
// access is denied, and this event occurs later then.
743
- if (n == m_clients.end ())
734
+ if (n == m_clients.end ())
744
735
return CS_Invalid;
745
736
746
737
return n->second ->getState ();
@@ -749,11 +740,10 @@ ClientState ClientInterface::getClientState(u16 peer_id)
749
740
void ClientInterface::setPlayerName (u16 peer_id,std::string name)
750
741
{
751
742
MutexAutoLock clientslock (m_clients_mutex);
752
- std::map<u16, RemoteClient*>::iterator n;
753
- n = m_clients.find (peer_id);
743
+ UNORDERED_MAP<u16, RemoteClient*>::iterator n = m_clients.find (peer_id);
754
744
// The client may not exist; clients are immediately removed if their
755
745
// access is denied, and this event occurs later then.
756
- if (n != m_clients.end ())
746
+ if (n != m_clients.end ())
757
747
n->second ->setName (name);
758
748
}
759
749
@@ -762,11 +752,10 @@ void ClientInterface::DeleteClient(u16 peer_id)
762
752
MutexAutoLock conlock (m_clients_mutex);
763
753
764
754
// Error check
765
- std::map<u16, RemoteClient*>::iterator n;
766
- n = m_clients.find (peer_id);
755
+ UNORDERED_MAP<u16, RemoteClient*>::iterator n = m_clients.find (peer_id);
767
756
// The client may not exist; clients are immediately removed if their
768
757
// access is denied, and this event occurs later then.
769
- if (n == m_clients.end ())
758
+ if (n == m_clients.end ())
770
759
return ;
771
760
772
761
/*
@@ -797,10 +786,9 @@ void ClientInterface::CreateClient(u16 peer_id)
797
786
MutexAutoLock conlock (m_clients_mutex);
798
787
799
788
// Error check
800
- std::map<u16, RemoteClient*>::iterator n;
801
- n = m_clients.find (peer_id);
789
+ UNORDERED_MAP<u16, RemoteClient*>::iterator n = m_clients.find (peer_id);
802
790
// The client shouldn't already exist
803
- if (n != m_clients.end ()) return ;
791
+ if (n != m_clients.end ()) return ;
804
792
805
793
// Create client
806
794
RemoteClient *client = new RemoteClient ();
@@ -814,8 +802,7 @@ void ClientInterface::event(u16 peer_id, ClientStateEvent event)
814
802
MutexAutoLock clientlock (m_clients_mutex);
815
803
816
804
// Error check
817
- std::map<u16, RemoteClient*>::iterator n;
818
- n = m_clients.find (peer_id);
805
+ UNORDERED_MAP<u16, RemoteClient*>::iterator n = m_clients.find (peer_id);
819
806
820
807
// No client to deliver event
821
808
if (n == m_clients.end ())
@@ -836,8 +823,7 @@ u16 ClientInterface::getProtocolVersion(u16 peer_id)
836
823
MutexAutoLock conlock (m_clients_mutex);
837
824
838
825
// Error check
839
- std::map<u16, RemoteClient*>::iterator n;
840
- n = m_clients.find (peer_id);
826
+ UNORDERED_MAP<u16, RemoteClient*>::iterator n = m_clients.find (peer_id);
841
827
842
828
// No client to get version
843
829
if (n == m_clients.end ())
@@ -851,8 +837,7 @@ void ClientInterface::setClientVersion(u16 peer_id, u8 major, u8 minor, u8 patch
851
837
MutexAutoLock conlock (m_clients_mutex);
852
838
853
839
// Error check
854
- std::map<u16, RemoteClient*>::iterator n;
855
- n = m_clients.find (peer_id);
840
+ UNORDERED_MAP<u16, RemoteClient*>::iterator n = m_clients.find (peer_id);
856
841
857
842
// No client to set versions
858
843
if (n == m_clients.end ())
0 commit comments