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)
|
||||
{
|
||||
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
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -283,6 +283,7 @@ void ServerLobby::update(float dt)
|
||||
pm->findAndTerminate(PROTOCOL_CONTROLLER_EVENTS);
|
||||
pm->findAndTerminate(PROTOCOL_KART_UPDATE);
|
||||
pm->findAndTerminate(PROTOCOL_GAME_EVENTS);
|
||||
setup();
|
||||
}
|
||||
break;
|
||||
case DONE:
|
||||
|
@ -710,6 +710,18 @@ STKPeer* STKHost::getPeer(ENetPeer *enet_peer)
|
||||
m_next_unique_host_id ++;
|
||||
return peer;
|
||||
} // 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.
|
||||
* \return True if the peer is known and connected, false elseway.
|
||||
|
@ -162,6 +162,7 @@ public:
|
||||
void removePeer(const STKPeer* peer);
|
||||
bool isConnectedTo(const TransportAddress& peer_address);
|
||||
STKPeer *getPeer(ENetPeer *enet_peer);
|
||||
STKPeer *getServerPeerForClient() const;
|
||||
std::vector<NetworkPlayerProfile*> getMyPlayerProfiles();
|
||||
int mustStopListening();
|
||||
uint16_t getPort() const;
|
||||
|
Loading…
Reference in New Issue
Block a user