60 lines
2.1 KiB
C++
60 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <Singleton.h>
|
|
#include <SolarHashTable.h>
|
|
#include <MemoryPoolFactory.h>
|
|
|
|
class World; class Channel; class UnitServer;
|
|
|
|
typedef util::SolarHashTable<World *> WORLD_HASH;
|
|
typedef WORLD_HASH::iterator WORLD_HASH_ITR;
|
|
|
|
class WorldManager : public Singleton<WorldManager>
|
|
{
|
|
enum { DEFAULT_WORLD_POOL_SIZE = 10 };
|
|
public:
|
|
WorldManager();
|
|
~WorldManager();
|
|
|
|
World * AllocWorld( BYTE byWorldKey );
|
|
VOID FreeWorld( World *pWorld );
|
|
|
|
World * FindWorld( BYTE byWorldKey ) { return m_WorldHash.GetData( byWorldKey ); }
|
|
Channel * FindChannel( BYTE byWorldKey, BYTE byChannelKey );
|
|
UnitServer * FindUnitServer( BYTE byWorldKey, BYTE byChannelKey, DWORD dwUnitServerKey );
|
|
UnitServer * FindUnitServer( DWORD dwAgentKey, BYTE byServerType );
|
|
UnitServer * FindUnitServer( SERVER_KEY &ServerKey );
|
|
UnitServer * FindUnitServer( OLD_SERVER_KEY &ServerKey );
|
|
UnitServer * FindSunServer( BYTE byWorldKey );
|
|
#ifdef _NA_006543_20130318_HEARTBEAT
|
|
//AgentKey 하나로 그 Agent에 속한 채널,서버들을 알기 위한 함수들
|
|
UnitServer * FindFirstUnitServerByAgentKey(DWORD dwAgentKey); // 해당 agentkey를 가진 서버를 리턴
|
|
#endif
|
|
|
|
// ServerInfo를 이용해서 World를 구성한다.
|
|
VOID MakeWorld();
|
|
VOID Release();
|
|
VOID SerializeServerInfoStream( SERVER_TOTAL_INFO & OUT rServerTotInfo );
|
|
VOID SerializeServerInfoStreamForUser( SERVER_TOTAL_INFO & OUT rServerTotInfo, DWORD dwUserGUID );
|
|
VOID SerializeFtpInfoStreamForUser( FTP_TOTAL_INFO & OUT rFtpTotInfo, DWORD dwUserGUID );
|
|
#ifdef __20080312__SOLARAUTH_SERVER_PATCH
|
|
VOID SerializeScriptFolderInfoStream( SCRIPTFOLDER_TOTAL_INFO& OUT rSCFolderTotInfo, DWORD dwUserGUID );
|
|
#endif
|
|
|
|
// 서버 구동, 종료, 패치
|
|
VOID ExecuteStart( DWORD dwUserKey );
|
|
VOID ExecuteEnd( DWORD dwUserKey );
|
|
VOID ExecutePatch( DWORD dwUserKey );
|
|
VOID ExecuteForceDisconnect( DWORD dwUserKey );
|
|
VOID ChangeAllServerStatus( eSERVER_STATUS status );
|
|
BOOL CheckServerStatus( BYTE byWorldKey, eSERVER_STATUS CheckStatus );
|
|
BOOL CheckPatching( BYTE byWorldKey );
|
|
|
|
private:
|
|
WORLD_HASH m_WorldHash;
|
|
CMemoryPoolFactory<World> * m_pWorldPool;
|
|
};
|
|
|
|
|
|
|