Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
96 lines
2.4 KiB
C++
96 lines
2.4 KiB
C++
#ifndef _MANAGE_TOOL_SERVER_USER_STATISTICS_H_
|
|
#define _MANAGE_TOOL_SERVER_USER_STATISTICS_H_
|
|
|
|
#pragma warning(disable:4800)
|
|
|
|
#include <map>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <list>
|
|
#include <tchar.h>
|
|
#include <Thread/Lock.h>
|
|
#include <Network/Address/INET_Addr.h>
|
|
|
|
#include <boost/pool/pool_alloc.hpp>
|
|
|
|
// forward decl.
|
|
namespace ServerManage
|
|
{
|
|
struct UserNumPair;
|
|
}
|
|
|
|
struct PktBase;
|
|
|
|
|
|
class CUserStatistics
|
|
{
|
|
public:
|
|
|
|
static CUserStatistics& GetInstance();
|
|
|
|
bool Load();
|
|
void SetSetupFileName(const TCHAR* szFileName);
|
|
|
|
void SetUserNum(unsigned long dwRunID, unsigned long dwServerID, int nCurrentUserNum)
|
|
{
|
|
StatisticsLock::Syncronize sync(m_Lock);
|
|
InternalSetUserNum(dwRunID, dwServerID, nCurrentUserNum);
|
|
}
|
|
|
|
int GetUserNum(unsigned long dwServerID);
|
|
int GetTotalUserNum();
|
|
int GetGroupUserNum(char cGroupNum);
|
|
|
|
void ClearRunID_UserNum(unsigned long dwRunID)
|
|
{
|
|
StatisticsLock::Syncronize sync(m_Lock);
|
|
InternalClearRunID_UserNum(dwRunID);
|
|
}
|
|
void ClearGroupUserNum(unsigned char cGroupNum)
|
|
{
|
|
StatisticsLock::Syncronize sync(m_Lock);
|
|
InternalClearGroupUserNum(cGroupNum);
|
|
}
|
|
|
|
void CheckClearUser(PktBase* lpPktBase);
|
|
|
|
void SerializeIn(unsigned long dwRunID,
|
|
ServerManage::UserNumPair* lpUserNumPair, unsigned long dwPairNum);
|
|
|
|
void SendStatisticsToHanGame();
|
|
void SendStatisticsToStatServer();
|
|
|
|
private:
|
|
|
|
CUserStatistics();
|
|
~CUserStatistics();
|
|
|
|
void InternalSetUserNum(unsigned long dwRunID, unsigned long dwServerID, int nCurrentUserNum);
|
|
void InternalClearRunID_UserNum(unsigned long dwRunID);
|
|
void InternalClearGroupUserNum(unsigned char cGroupNum);
|
|
|
|
typedef CCSLock StatisticsLock;
|
|
|
|
typedef std::map<unsigned long, int, std::less<unsigned long>,
|
|
boost::fast_pool_allocator<std::pair<unsigned long, int> > > UserNumTable;
|
|
|
|
typedef std::multimap<unsigned long, UserNumTable::iterator, std::less<unsigned long>,
|
|
boost::fast_pool_allocator<std::pair<unsigned long, UserNumTable::iterator> > > RunIDTable;
|
|
|
|
|
|
typedef std::map<unsigned long, std::string> ServerGroupNames;
|
|
typedef std::list<INET_Addr> AddressList;
|
|
|
|
StatisticsLock m_Lock;
|
|
CACHE_PAD(StatisticsLockPad, sizeof(StatisticsLock));
|
|
|
|
UserNumTable m_CurrentUsers;
|
|
RunIDTable m_RunIDTable;
|
|
|
|
ServerGroupNames m_ServerGroupNames;
|
|
AddressList m_HangameAddress;
|
|
|
|
TCHAR m_szSetupFileName[MAX_PATH];
|
|
};
|
|
|
|
#endif |