lcserverlist.cpp

来自「天之炼狱1服务器端源文件游戏服务端不完整」· C++ 代码 · 共 145 行

CPP
145
字号
//----------------------------------------------------------------------// // Filename    : LCServerList.cpp // Written By  : Reiot// Description :// //----------------------------------------------------------------------// include files#include "LCServerList.h"#include "PCSlayerInfo.h"#include "PCVampireInfo.h"//----------------------------------------------------------------------// constructor//----------------------------------------------------------------------LCServerList::LCServerList ()	throw (){	m_CurrentServerGroupID = 0;}//----------------------------------------------------------------------// destructor//----------------------------------------------------------------------LCServerList::~LCServerList ()	throw (){	__BEGIN_TRY	// 家加等 葛电 按眉甸阑 昏力茄促.	while ( !m_ServerGroupInfoList.empty() ) 	{		ServerGroupInfo * pServerGroupInfo = m_ServerGroupInfoList.front();		SAFE_DELETE(pServerGroupInfo);		m_ServerGroupInfoList.pop_front();	}	__END_CATCH}//----------------------------------------------------------------------// 涝仿胶飘覆(滚欺)栏肺何磐 单捞鸥甫 佬绢辑 菩哦阑 檬扁拳茄促.//----------------------------------------------------------------------void LCServerList::read ( SocketInputStream & iStream ) 	 throw ( ProtocolException , Error ){	__BEGIN_TRY	iStream.read( m_CurrentServerGroupID );	BYTE ListNum;    // 弥利拳 累诀矫 角力 农扁甫 疙矫窍档废 茄促.	iStream.read( ListNum );	for( int i = 0; i < ListNum; i++ ) {		ServerGroupInfo * pServerGroupInfo = new ServerGroupInfo();		pServerGroupInfo->read( iStream );		m_ServerGroupInfoList.push_back( pServerGroupInfo );	}		__END_CATCH}		    //////////////////////////////////////////////////////////////////////// 免仿胶飘覆(滚欺)栏肺 菩哦狼 官捞呈府 捞固瘤甫 焊辰促.//////////////////////////////////////////////////////////////////////void LCServerList::write ( SocketOutputStream & oStream ) const      throw ( ProtocolException , Error ){	__BEGIN_TRY	oStream.write( m_CurrentServerGroupID );	BYTE ListNum = m_ServerGroupInfoList.size();	// 弥利拳 累诀矫 角力 农扁甫 疙矫窍档废 茄促.	oStream.write( ListNum );	for ( list<ServerGroupInfo*>:: const_iterator itr = m_ServerGroupInfoList.begin(); itr!= m_ServerGroupInfoList.end(); itr++) {		(*itr)->write( oStream );	}		__END_CATCH}//////////////////////////////////////////////////////////////////////// execute packet's handler//////////////////////////////////////////////////////////////////////void LCServerList::execute ( Player * pPlayer ) 	 throw ( ProtocolException , Error ){	__BEGIN_TRY			LCServerListHandler::execute( this , pPlayer );			__END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////PacketSize_t LCServerList::getPacketSize () const 	throw (){	__BEGIN_TRY	// 府胶飘 牢磊狼 肮荐	PacketSize_t PacketSize = szServerGroupID + szBYTE;	for ( list< ServerGroupInfo* >::const_iterator itr = m_ServerGroupInfoList.begin() ; itr != m_ServerGroupInfoList.end() ; itr ++ ) {		PacketSize += (*itr)->getSize();	}	return PacketSize;	__END_CATCH}////////////////////////////////////////////////////////////////////////// get packet's debug string////////////////////////////////////////////////////////////////////////string LCServerList::toString () const       throw (){	__BEGIN_TRY	StringStream msg;	msg << "LCServerList( CurrentServerGroupID : " << (int)m_CurrentServerGroupID;	for ( list< ServerGroupInfo* >::const_iterator itr = m_ServerGroupInfoList.begin() ; itr != m_ServerGroupInfoList.end() ; itr ++ ) {		msg << (*itr)->toString();	}	msg << ")";	return msg.toString();	__END_CATCH}

⌨️ 快捷键说明

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