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

📄 inventoryinfo.cpp

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 CPP
字号:
//////////////////////////////////////////////////////////////////////////////// Filename    : InventoryInfo.cpp // Written By  : elca@ewestsoft.com// Description ://////////////////////////////////////////////////////////////////////////////#include "InventoryInfo.h"#include "SocketInputStream.h"#include "SocketOutputStream.h"//////////////////////////////////////////////////////////////////////////////// constructor//////////////////////////////////////////////////////////////////////////////InventoryInfo::InventoryInfo ()      throw (){	__BEGIN_TRY	m_ListNum = 0;	__END_CATCH}	//////////////////////////////////////////////////////////////////////////////// destructor//////////////////////////////////////////////////////////////////////////////InventoryInfo::~InventoryInfo ()     throw (){	__BEGIN_TRY	while ( !m_InventorySlotInfoList.empty() ) 	{		InventorySlotInfo * pInventorySlotInfo = m_InventorySlotInfoList.front();		SAFE_DELETE(pInventorySlotInfo);		m_InventorySlotInfoList.pop_front();	}	__END_CATCH}//////////////////////////////////////////////////////////////////////////////// 涝仿胶飘覆(滚欺)栏肺何磐 单捞鸥甫 佬绢辑 菩哦阑 檬扁拳茄促.//////////////////////////////////////////////////////////////////////////////void InventoryInfo::read ( SocketInputStream & iStream ) 	 throw ( ProtocolException , Error ){	__BEGIN_TRY			iStream.read( m_ListNum );	for( int i = 0; i < m_ListNum; i++ ) 	{		InventorySlotInfo * pInventorySlotInfo = new InventorySlotInfo();		pInventorySlotInfo->read( iStream );		m_InventorySlotInfoList.push_back( pInventorySlotInfo );	}	__END_CATCH}		    //////////////////////////////////////////////////////////////////////////////// 免仿胶飘覆(滚欺)栏肺 菩哦狼 官捞呈府 捞固瘤甫 焊辰促.//////////////////////////////////////////////////////////////////////////////void InventoryInfo::write ( SocketOutputStream & oStream )      const throw ( ProtocolException , Error ){	__BEGIN_TRY			oStream.write( m_ListNum );	list<InventorySlotInfo*>:: const_iterator itr = m_InventorySlotInfoList.begin();    for (; itr!= m_InventorySlotInfoList.end(); itr++) 	{		(*itr)->write( oStream );	}	__END_CATCH}//////////////////////////////////////////////////////////////////////////////// getSize//////////////////////////////////////////////////////////////////////////////PacketSize_t InventoryInfo::getSize()	throw(){	PacketSize_t PacketSize = szBYTE;	for ( list< InventorySlotInfo* >::const_iterator itr = m_InventorySlotInfoList.begin() ; itr != m_InventorySlotInfoList.end() ; itr ++ ) {		PacketSize += (*itr)->getSize();	}	return PacketSize;}//////////////////////////////////////////////////////////////////////////////// get packet's debug string//////////////////////////////////////////////////////////////////////////////string InventoryInfo::toString () 	const throw (){	__BEGIN_TRY	StringStream msg;	msg << "InventoryInfo( ListNum:" << (int)m_ListNum 		<< " ListSet( " ;	for ( list<InventorySlotInfo*>::const_iterator itr = m_InventorySlotInfoList.begin(); itr!= m_InventorySlotInfoList.end() ; itr++ ) {		msg << (*itr)->toString() << ",";	}	msg << ")";	return msg.toString();	__END_CATCH}

⌨️ 快捷键说明

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