Make it possible to restart race after going back to lobby
At the moment the token is reset by client after each restart
This commit is contained in:
parent
3290321c5d
commit
46416781fa
@ -712,6 +712,10 @@ void ClientLobby::raceFinished(Event* event)
|
|||||||
void ClientLobby::exitResultScreen(Event *event)
|
void ClientLobby::exitResultScreen(Event *event)
|
||||||
{
|
{
|
||||||
RaceResultGUI::getInstance()->backToLobby();
|
RaceResultGUI::getInstance()->backToLobby();
|
||||||
|
// Will be reset to linked if connected to server, see update(float dt)
|
||||||
|
m_game_setup = STKHost::get()->setupNewGame();
|
||||||
|
STKHost::get()->getServerPeerForClient()->unsetClientServerToken();
|
||||||
|
m_state = NONE;
|
||||||
} // exitResultScreen
|
} // exitResultScreen
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -283,6 +283,7 @@ void ServerLobby::update(float dt)
|
|||||||
pm->findAndTerminate(PROTOCOL_CONTROLLER_EVENTS);
|
pm->findAndTerminate(PROTOCOL_CONTROLLER_EVENTS);
|
||||||
pm->findAndTerminate(PROTOCOL_KART_UPDATE);
|
pm->findAndTerminate(PROTOCOL_KART_UPDATE);
|
||||||
pm->findAndTerminate(PROTOCOL_GAME_EVENTS);
|
pm->findAndTerminate(PROTOCOL_GAME_EVENTS);
|
||||||
|
setup();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DONE:
|
case DONE:
|
||||||
|
@ -710,6 +710,18 @@ STKPeer* STKHost::getPeer(ENetPeer *enet_peer)
|
|||||||
m_next_unique_host_id ++;
|
m_next_unique_host_id ++;
|
||||||
return peer;
|
return peer;
|
||||||
} // getPeer
|
} // getPeer
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** \brief Return the only server peer for client.
|
||||||
|
* \return STKPeer the STKPeer of server.
|
||||||
|
*/
|
||||||
|
STKPeer* STKHost::getServerPeerForClient() const
|
||||||
|
{
|
||||||
|
assert(m_peers.size() == 1);
|
||||||
|
assert(NetworkConfig::get()->isClient());
|
||||||
|
return m_peers[0];
|
||||||
|
} // getServerPeerForClient
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** \brief Tells if a peer is known and connected.
|
/** \brief Tells if a peer is known and connected.
|
||||||
* \return True if the peer is known and connected, false elseway.
|
* \return True if the peer is known and connected, false elseway.
|
||||||
|
@ -162,6 +162,7 @@ public:
|
|||||||
void removePeer(const STKPeer* peer);
|
void removePeer(const STKPeer* peer);
|
||||||
bool isConnectedTo(const TransportAddress& peer_address);
|
bool isConnectedTo(const TransportAddress& peer_address);
|
||||||
STKPeer *getPeer(ENetPeer *enet_peer);
|
STKPeer *getPeer(ENetPeer *enet_peer);
|
||||||
|
STKPeer *getServerPeerForClient() const;
|
||||||
std::vector<NetworkPlayerProfile*> getMyPlayerProfiles();
|
std::vector<NetworkPlayerProfile*> getMyPlayerProfiles();
|
||||||
int mustStopListening();
|
int mustStopListening();
|
||||||
uint16_t getPort() const;
|
uint16_t getPort() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user