gearinfo.cpp
来自「天之炼狱1服务器端源文件游戏服务端不完整」· C++ 代码 · 共 136 行
CPP
136 行
//////////////////////////////////////////////////////////////////////// // Filename : GearInfo.cpp // Written By : elca@ewestsoft.com// Description : 磊脚俊霸 静绰 扁贱狼 己傍阑 舅府扁 困茄 菩哦 努贰胶狼// 糕滚 沥狼.// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// include files//////////////////////////////////////////////////////////////////////#include "GearInfo.h"#include "SocketInputStream.h"#include "SocketOutputStream.h"#include "Assert.h"//////////////////////////////////////////////////////////////////////// constructor//////////////////////////////////////////////////////////////////////GearInfo::GearInfo () throw (){ __BEGIN_TRY m_ListNum = 0; __END_CATCH} //////////////////////////////////////////////////////////////////////// destructor//////////////////////////////////////////////////////////////////////GearInfo::~GearInfo () throw (){ __BEGIN_TRY // 家加等 葛电 按眉甸阑 昏力茄促. while ( !m_GearSlotInfoList.empty() ) { GearSlotInfo * pGearSlotInfo = m_GearSlotInfoList.front(); SAFE_DELETE(pGearSlotInfo); m_GearSlotInfoList.pop_front(); } __END_CATCH}//////////////////////////////////////////////////////////////////////// 涝仿胶飘覆(滚欺)栏肺何磐 单捞鸥甫 佬绢辑 菩哦阑 檬扁拳茄促.//////////////////////////////////////////////////////////////////////void GearInfo::read ( SocketInputStream & iStream ) throw ( ProtocolException , Error ){ __BEGIN_TRY // 弥利拳 累诀矫 角力 农扁甫 疙矫窍档废 茄促. iStream.read( m_ListNum ); for( int i = 0; i < m_ListNum; i++ ) { GearSlotInfo * pGearSlotInfo = new GearSlotInfo(); pGearSlotInfo->read( iStream ); m_GearSlotInfoList.push_back( pGearSlotInfo ); } __END_CATCH} //////////////////////////////////////////////////////////////////////// 免仿胶飘覆(滚欺)栏肺 菩哦狼 官捞呈府 捞固瘤甫 焊辰促.//////////////////////////////////////////////////////////////////////void GearInfo::write ( SocketOutputStream & oStream ) const throw ( ProtocolException , Error ){ __BEGIN_TRY // 弥利拳 累诀矫 角力 农扁甫 疙矫窍档废 茄促. oStream.write( m_ListNum ); for ( list<GearSlotInfo*>:: const_iterator itr = m_GearSlotInfoList.begin(); itr!= m_GearSlotInfoList.end(); itr++) { Assert( *itr != NULL ); (*itr)->write( oStream ); } __END_CATCH}//--------------------------------------------------------------------// getSize//--------------------------------------------------------------------PacketSize_t GearInfo::getSize() throw(){ PacketSize_t PacketSize = szBYTE; for ( list< GearSlotInfo* >::const_iterator itr = m_GearSlotInfoList.begin() ; itr != m_GearSlotInfoList.end() ; itr ++ ) { PacketSize += (*itr)->getSize(); } return PacketSize;}////////////////////////////////////////////////////////////////////////// get packet's debug string////////////////////////////////////////////////////////////////////////string GearInfo::toString () const throw (){ __BEGIN_TRY StringStream msg; msg << "GearInfo( ListNum:" << (int)m_ListNum << " ListSet( " ; for ( list<GearSlotInfo*>::const_iterator itr = m_GearSlotInfoList.begin(); itr!= m_GearSlotInfoList.end() ; itr++ ) { Assert( *itr != NULL ); msg << (*itr)->toString() << ","; } msg << ")"; return msg.toString(); __END_CATCH}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?