⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serversessionmanager.cpp

📁 奇迹世界 部分源代码奇迹世界 部分源代码奇迹世界 部分源代码
💻 CPP
字号:
#include "stdafx.h"
#include "ServerSessionManager.h"
#include "ServerSession.h"
#include <assert.h>

ServerSessionManager::ServerSessionManager()
{
	m_pMasterServer	= NULL;
	m_pGameDBProxy = NULL;
}

ServerSessionManager::~ServerSessionManager()
{
}

VOID ServerSessionManager::AddServer( ServerSession * pServer )
{
	assert( FindServer( pServer->GetSessionIndex() ) == NULL );
	m_mapSessions.insert( SERVER_SESSION_PAIR( pServer->GetSessionIndex(), pServer ) );

	switch( pServer->GetServerType() )
	{
	case MASTER_SERVER:
		m_pMasterServer = pServer;	break;
	case GAME_DBPROXY:
		m_pGameDBProxy = pServer;	break;
	}
}

VOID ServerSessionManager::RemoveServer( DWORD dwSessionIndex )
{
	SERVER_SESSION_MAP_ITER it = m_mapSessions.find( dwSessionIndex );
	assert( it != m_mapSessions.end() );
	ServerSession *pServer = it->second;
	m_mapSessions.erase( it );

	switch( pServer->GetServerType() )
	{
	case MASTER_SERVER:
		m_pMasterServer = NULL;		break;
	case GAME_DBPROXY:
		m_pGameDBProxy = NULL;		break;
	}
}

ServerSession *	ServerSessionManager::FindServer( DWORD dwSessionIndex )
{
	SERVER_SESSION_MAP_ITER it = m_mapSessions.find( dwSessionIndex );

	if( it == m_mapSessions.end() ) return NULL;

	return it->second;
}

VOID ServerSessionManager::Update()
{
	SERVER_SESSION_MAP_ITER it;

	for( it = m_mapSessions.begin(); it != m_mapSessions.end(); ++it )
	{
		it->second->Update();
	}
}

ServerSession* ServerSessionManager::GetGuildServer()
{
	SERVER_SESSION_MAP_ITER it;

	for( it = m_mapSessions.begin(); it != m_mapSessions.end(); ++it )
	{
		if( it->second->GetServerType() == GUILD_SERVER )
		{
			return it->second;
		}
	}

	return NULL;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -