Switched from the service locator pattern to singleton pattern

This commit is contained in:
Kayne Ruse
2013-06-24 09:00:50 +10:00
parent 7ad855348f
commit f049c96df7
12 changed files with 41 additions and 69 deletions
+3 -3
View File
@@ -20,7 +20,7 @@
* distribution.
*/
#include "network_queue.hpp"
#include "service_locator.hpp"
#include "singleton.hpp"
#include "udp_network_utility.hpp"
@@ -37,7 +37,7 @@ static std::deque<Packet> queue;
static bool running = false;
static int networkQueue(void*) {
UDPNetworkUtility* netUtil = ServiceLocator<UDPNetworkUtility>::Get();
UDPNetworkUtility* netUtil = Singleton<UDPNetworkUtility>::Get();
while(running) {
SDL_SemWait(lock);
while(netUtil->Receive()) {
@@ -102,7 +102,7 @@ Packet popNetworkPacket() {
}
void flushNetworkQueue() {
UDPNetworkUtility* netUtil = ServiceLocator<UDPNetworkUtility>::Get();
UDPNetworkUtility* netUtil = Singleton<UDPNetworkUtility>::Get();
SDL_SemWait(lock);
while(netUtil->Receive());
queue.clear();