From: <hi...@us...> - 2013-07-11 12:59:56
|
Revision: 13181 http://sourceforge.net/p/supertuxkart/code/13181 Author: hilnius Date: 2013-07-11 12:59:53 +0000 (Thu, 11 Jul 2013) Log Message: ----------- more pointers for less bugs Modified Paths: -------------- main/branches/hilnius/src/network/client_network_manager.cpp main/branches/hilnius/src/network/protocol_manager.cpp main/branches/hilnius/src/network/stk_peer.cpp main/branches/hilnius/src/network/stk_peer.hpp Modified: main/branches/hilnius/src/network/client_network_manager.cpp =================================================================== --- main/branches/hilnius/src/network/client_network_manager.cpp 2013-07-11 12:22:35 UTC (rev 13180) +++ main/branches/hilnius/src/network/client_network_manager.cpp 2013-07-11 12:59:53 UTC (rev 13181) @@ -64,7 +64,7 @@ ClientLobbyRoomProtocol* clrp = static_cast<ClientLobbyRoomProtocol*>(protocol); clrp->requestKartSelection(str2); } - else + else if (NetworkManager::getInstance()->getPeers().size() > 0) { NetworkString msg; msg.ai8(0); Modified: main/branches/hilnius/src/network/protocol_manager.cpp =================================================================== --- main/branches/hilnius/src/network/protocol_manager.cpp 2013-07-11 12:22:35 UTC (rev 13180) +++ main/branches/hilnius/src/network/protocol_manager.cpp 2013-07-11 12:59:53 UTC (rev 13181) @@ -80,11 +80,8 @@ void ProtocolManager::notifyEvent(Event* event) { - Log::debug("ProtocolManager", "Event received."); Event* event2 = new Event(*event); - Log::debug("ProtocolManager", "Trying to copy the event"); pthread_mutex_lock(&m_events_mutex); - Log::debug("ProtocolManager", "Event ADDED."); m_events_to_process.push_back(event2); // add the event to the queue pthread_mutex_unlock(&m_events_mutex); } Modified: main/branches/hilnius/src/network/stk_peer.cpp =================================================================== --- main/branches/hilnius/src/network/stk_peer.cpp 2013-07-11 12:22:35 UTC (rev 13180) +++ main/branches/hilnius/src/network/stk_peer.cpp 2013-07-11 12:59:53 UTC (rev 13181) @@ -25,7 +25,8 @@ STKPeer::STKPeer() { m_peer = NULL; - m_player_profile = new NetworkPlayerProfile(); + m_player_profile = new NetworkPlayerProfile*; + *m_player_profile = NULL; m_client_server_token = new uint32_t; *m_client_server_token = 0; m_token_set = new bool; @@ -36,7 +37,6 @@ STKPeer::STKPeer(const STKPeer& peer) { - Log::verbose("STKPeer", "Construction a copy of a STKPeer."); m_peer = peer.m_peer; m_player_profile = peer.m_player_profile; m_client_server_token = peer.m_client_server_token; Modified: main/branches/hilnius/src/network/stk_peer.hpp =================================================================== --- main/branches/hilnius/src/network/stk_peer.hpp 2013-07-11 12:22:35 UTC (rev 13180) +++ main/branches/hilnius/src/network/stk_peer.hpp 2013-07-11 12:59:53 UTC (rev 13181) @@ -38,12 +38,13 @@ void setClientServerToken(const uint32_t& token) { *m_client_server_token = token; *m_token_set = true; } void unsetClientServerToken() { *m_token_set = false; } - void setPlayerProfile(NetworkPlayerProfile* profile) { *m_player_profile = *profile; } + void setPlayerProfile(NetworkPlayerProfile* profile) { *m_player_profile = profile; } + void setPlayerProfilePtr(NetworkPlayerProfile** profile) { m_player_profile = profile; } bool isConnected() const; uint32_t getAddress() const; uint16_t getPort() const; - NetworkPlayerProfile* getPlayerProfile() { return m_player_profile; } + NetworkPlayerProfile* getPlayerProfile() { return *m_player_profile; } uint32_t getClientServerToken() const { return *m_client_server_token; } bool isClientServerTokenSet() const { return *m_token_set; } @@ -51,7 +52,7 @@ protected: ENetPeer* m_peer; - NetworkPlayerProfile* m_player_profile; + NetworkPlayerProfile** m_player_profile; uint32_t *m_client_server_token; bool *m_token_set; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |