Vote kick kind of working. Only the forward case - no timeout, no error handling, no display update.

This commit is contained in:
lotodore
2008-11-25 22:18:17 +00:00
parent 10ba70291e
commit b236fa9d62
13 changed files with 109 additions and 15 deletions
+30
View File
@@ -264,6 +264,21 @@ ClientThread::SendAskKickPlayer(unsigned playerId)
m_outPacketList.push_back(ask);
}
void
ClientThread::SendVoteKick(bool doKick)
{
boost::shared_ptr<NetPacket> vote(new NetPacketVoteKickPlayer);
NetPacketVoteKickPlayer::Data voteData;
{
boost::mutex::scoped_lock lock(m_curPetitionIdMutex);
voteData.petitionId = m_curPetitionId;
}
voteData.vote = doKick ? KICK_VOTE_IN_FAVOUR : KICK_VOTE_AGAINST;
static_cast<NetPacketVoteKickPlayer *>(vote.get())->SetData(voteData);
boost::mutex::scoped_lock lock(m_outPacketListMutex);
m_outPacketList.push_back(vote);
}
GameInfo
ClientThread::GetGameInfo(unsigned gameId) const
{
@@ -1007,6 +1022,21 @@ ClientThread::ClearGameInfoMap()
m_gameInfoMap.clear();
}
void
ClientThread::StartPetition(unsigned petitionId, unsigned proposingPlayerId, unsigned kickPlayerId, int timeoutSec, int numVotesToKick)
{
{
boost::mutex::scoped_lock lock(m_curPetitionIdMutex);
m_curPetitionId = petitionId;
}
GetGui().startVoteOnKick(kickPlayerId, timeoutSec, numVotesToKick);
if (GetGuiPlayerId() != kickPlayerId
&& GetGuiPlayerId() != proposingPlayerId)
{
GetGui().changeVoteOnKickButtonsState(true);
}
}
void
ClientThread::UpdateStatData(const ServerStats &stats)
{