lcworldlist.cpp

来自「dk1游戏的原代码文件,完整.编译系统redhat7.3,mysql 3.23 」· C++ 代码 · 共 145 行

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

⌨️ 快捷键说明

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