fixing segfault and comparison operators
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13171 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
3c3868210f
commit
b00bb5c050
@ -145,12 +145,15 @@ void ServerLobbyRoomProtocol::update()
|
|||||||
|
|
||||||
void ServerLobbyRoomProtocol::kartDisconnected(Event* event)
|
void ServerLobbyRoomProtocol::kartDisconnected(Event* event)
|
||||||
{
|
{
|
||||||
|
Log::info("ServerLobbyRoomProtocol", "Player disconnected.");
|
||||||
if (event->peer->getPlayerProfile() != NULL) // others knew him
|
if (event->peer->getPlayerProfile() != NULL) // others knew him
|
||||||
{
|
{
|
||||||
NetworkString msg;
|
NetworkString msg;
|
||||||
msg.ai8(0x02).ai8(1).ai8(event->peer->getPlayerProfile()->race_id);
|
msg.ai8(0x02).ai8(1).ai8(event->peer->getPlayerProfile()->race_id);
|
||||||
m_listener->sendMessage(this, msg);
|
m_listener->sendMessage(this, msg);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
Log::info("ServerLobbyRoomProtocol", "Peer not registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -32,7 +32,6 @@ STKPeer::~STKPeer()
|
|||||||
{
|
{
|
||||||
if (m_peer)
|
if (m_peer)
|
||||||
{
|
{
|
||||||
free(m_peer);
|
|
||||||
m_peer = NULL;
|
m_peer = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,7 +84,20 @@ bool STKPeer::isConnected() const
|
|||||||
Log::info("STKPeer", "The peer state is %i\n", m_peer->state);
|
Log::info("STKPeer", "The peer state is %i\n", m_peer->state);
|
||||||
return (m_peer->state == ENET_PEER_STATE_CONNECTED);
|
return (m_peer->state == ENET_PEER_STATE_CONNECTED);
|
||||||
}
|
}
|
||||||
|
bool STKPeer::operator==(const STKPeer* peer) const
|
||||||
|
{
|
||||||
|
return peer->m_peer==m_peer;
|
||||||
|
}
|
||||||
|
bool STKPeer::operator!=(const STKPeer* peer) const
|
||||||
|
{
|
||||||
|
return peer->m_peer!=m_peer;
|
||||||
|
}
|
||||||
bool STKPeer::operator==(const ENetPeer* peer) const
|
bool STKPeer::operator==(const ENetPeer* peer) const
|
||||||
{
|
{
|
||||||
return peer==m_peer;
|
return peer==m_peer;
|
||||||
}
|
}
|
||||||
|
bool STKPeer::operator!=(const ENetPeer* peer) const
|
||||||
|
{
|
||||||
|
return peer!=m_peer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,10 @@ class STKPeer
|
|||||||
bool isClientServerTokenSet() const { return m_token_set; }
|
bool isClientServerTokenSet() const { return m_token_set; }
|
||||||
NetworkPlayerProfile* getPlayerProfile() { return m_player_profile; }
|
NetworkPlayerProfile* getPlayerProfile() { return m_player_profile; }
|
||||||
|
|
||||||
|
bool operator==(const STKPeer* peer) const;
|
||||||
bool operator==(const ENetPeer* peer) const;
|
bool operator==(const ENetPeer* peer) const;
|
||||||
|
bool operator!=(const STKPeer* peer) const;
|
||||||
|
bool operator!=(const ENetPeer* peer) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ENetPeer* m_peer;
|
ENetPeer* m_peer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user