Automatically start game when all track votes have been received.
This commit is contained in:
parent
af3f72ae84
commit
637202077f
@ -692,6 +692,8 @@ void ServerLobbyRoomProtocol::playerTrackVote(Event* event)
|
||||
NetworkString prefix(1);
|
||||
prefix.ai8(LE_VOTE_TRACK); // prefix the token with the ype
|
||||
sendMessageToPeersChangingToken(prefix, other);
|
||||
if(m_setup->getRaceConfig()->getNumTrackVotes()==m_setup->getPlayerCount())
|
||||
startGame();
|
||||
} // playerTrackVote
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -447,3 +447,14 @@ const TrackInfo* RaceConfig::getNextTrackInfo() const
|
||||
} // getNextTrackInfo
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int RaceConfig::getNumTrackVotes() const
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (unsigned int i = 0; i < m_max_players; i++)
|
||||
{
|
||||
if (m_votes[i].hasVotedTrack())
|
||||
count ++;
|
||||
}
|
||||
return count;
|
||||
} // getNumTrackVotes
|
@ -115,6 +115,7 @@ public:
|
||||
const TrackInfo* getNextTrackInfo() const;
|
||||
bool getReverse() const;
|
||||
bool getLapCount() const;
|
||||
int getNumTrackVotes() const;
|
||||
|
||||
protected:
|
||||
std::vector<TrackInfo> m_tracks;
|
||||
|
Loading…
x
Reference in New Issue
Block a user