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:
parent
ea8cb2f5c4
commit
64c1ee950f
@ -64,7 +64,7 @@ void* waitInput(void* data)
|
|||||||
ClientLobbyRoomProtocol* clrp = static_cast<ClientLobbyRoomProtocol*>(protocol);
|
ClientLobbyRoomProtocol* clrp = static_cast<ClientLobbyRoomProtocol*>(protocol);
|
||||||
clrp->requestKartSelection(str2);
|
clrp->requestKartSelection(str2);
|
||||||
}
|
}
|
||||||
else
|
else if (NetworkManager::getInstance()->getPeers().size() > 0)
|
||||||
{
|
{
|
||||||
NetworkString msg;
|
NetworkString msg;
|
||||||
msg.ai8(0);
|
msg.ai8(0);
|
||||||
|
@ -80,11 +80,8 @@ ProtocolManager::~ProtocolManager()
|
|||||||
|
|
||||||
void ProtocolManager::notifyEvent(Event* event)
|
void ProtocolManager::notifyEvent(Event* event)
|
||||||
{
|
{
|
||||||
Log::debug("ProtocolManager", "Event received.");
|
|
||||||
Event* event2 = new Event(*event);
|
Event* event2 = new Event(*event);
|
||||||
Log::debug("ProtocolManager", "Trying to copy the event");
|
|
||||||
pthread_mutex_lock(&m_events_mutex);
|
pthread_mutex_lock(&m_events_mutex);
|
||||||
Log::debug("ProtocolManager", "Event ADDED.");
|
|
||||||
m_events_to_process.push_back(event2); // add the event to the queue
|
m_events_to_process.push_back(event2); // add the event to the queue
|
||||||
pthread_mutex_unlock(&m_events_mutex);
|
pthread_mutex_unlock(&m_events_mutex);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
STKPeer::STKPeer()
|
STKPeer::STKPeer()
|
||||||
{
|
{
|
||||||
m_peer = NULL;
|
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 = new uint32_t;
|
||||||
*m_client_server_token = 0;
|
*m_client_server_token = 0;
|
||||||
m_token_set = new bool;
|
m_token_set = new bool;
|
||||||
@ -36,7 +37,6 @@ STKPeer::STKPeer()
|
|||||||
|
|
||||||
STKPeer::STKPeer(const STKPeer& peer)
|
STKPeer::STKPeer(const STKPeer& peer)
|
||||||
{
|
{
|
||||||
Log::verbose("STKPeer", "Construction a copy of a STKPeer.");
|
|
||||||
m_peer = peer.m_peer;
|
m_peer = peer.m_peer;
|
||||||
m_player_profile = peer.m_player_profile;
|
m_player_profile = peer.m_player_profile;
|
||||||
m_client_server_token = peer.m_client_server_token;
|
m_client_server_token = peer.m_client_server_token;
|
||||||
|
@ -38,12 +38,13 @@ class STKPeer
|
|||||||
|
|
||||||
void setClientServerToken(const uint32_t& token) { *m_client_server_token = token; *m_token_set = true; }
|
void setClientServerToken(const uint32_t& token) { *m_client_server_token = token; *m_token_set = true; }
|
||||||
void unsetClientServerToken() { *m_token_set = false; }
|
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;
|
bool isConnected() const;
|
||||||
uint32_t getAddress() const;
|
uint32_t getAddress() const;
|
||||||
uint16_t getPort() 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; }
|
uint32_t getClientServerToken() const { return *m_client_server_token; }
|
||||||
bool isClientServerTokenSet() const { return *m_token_set; }
|
bool isClientServerTokenSet() const { return *m_token_set; }
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ class STKPeer
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ENetPeer* m_peer;
|
ENetPeer* m_peer;
|
||||||
NetworkPlayerProfile* m_player_profile;
|
NetworkPlayerProfile** m_player_profile;
|
||||||
uint32_t *m_client_server_token;
|
uint32_t *m_client_server_token;
|
||||||
bool *m_token_set;
|
bool *m_token_set;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user