more pointers for less bugs

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13181 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hilnius 2013-07-11 12:59:53 +00:00
parent ea8cb2f5c4
commit 64c1ee950f
4 changed files with 7 additions and 9 deletions

View File

@ -64,7 +64,7 @@ void* waitInput(void* data)
ClientLobbyRoomProtocol* clrp = static_cast<ClientLobbyRoomProtocol*>(protocol);
clrp->requestKartSelection(str2);
}
else
else if (NetworkManager::getInstance()->getPeers().size() > 0)
{
NetworkString msg;
msg.ai8(0);

View File

@ -80,11 +80,8 @@ ProtocolManager::~ProtocolManager()
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);
}

View File

@ -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()
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;

View File

@ -38,12 +38,13 @@ class STKPeer
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 @@ class STKPeer
protected:
ENetPeer* m_peer;
NetworkPlayerProfile* m_player_profile;
NetworkPlayerProfile** m_player_profile;
uint32_t *m_client_server_token;
bool *m_token_set;
};