Store all players of each game in the database.

This commit is contained in:
lotodore
2010-08-08 10:23:40 +00:00
parent 0646bc9d2e
commit 76d5317299
4 changed files with 59 additions and 16 deletions
+15 -3
View File
@@ -23,7 +23,7 @@
#include <boost/enable_shared_from_this.hpp>
#include <third_party/boost/timers.hpp>
#include <deque>
#include <map>
#include <net/sessionmanager.h>
#include <db/serverdbcallback.h>
@@ -92,12 +92,22 @@ public:
protected:
typedef std::deque<SessionWrapper> SessionQueue;
struct RankingData
{
RankingData() : dbid(DB_ID_INVALID), place(0) {}
RankingData(DB_id i, int p = 0) : dbid(i), place(p) {}
DB_id dbid;
int place;
};
typedef std::map<unsigned, RankingData> RankingMap;
void TimerVoteKick(const boost::system::error_code &ec);
void InternalStartGame();
void ResetGame();
void InitRankingMap(const PlayerDataList &playerDataList);
void SetPlayerPlace(unsigned playerId, int place);
void InternalEndGame();
void InternalKickPlayer(unsigned playerId);
void InternalAskVoteKick(SessionWrapper byWhom, unsigned playerIdWho, unsigned timeoutSec);
@@ -153,6 +163,8 @@ private:
PlayerIdList m_playerInvitationList;
mutable boost::mutex m_playerInvitationListMutex;
RankingMap m_rankingMap;
unsigned m_adminPlayerId;
boost::shared_ptr<VoteKickData> m_voteKickData;