📄 gcnpcaskvariable.cpp
字号:
//////////////////////////////////////////////////////////////////////////////// Filename : GCNPCAskVariable.cpp // Written By : Reiot// Description : //////////////////////////////////////////////////////////////////////////////#include "GCNPCAskVariable.h"////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////GCNPCAskVariable::GCNPCAskVariable() throw (){ __BEGIN_TRY __END_CATCH}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////GCNPCAskVariable::~GCNPCAskVariable() throw (){ __BEGIN_TRY clearScriptParameters(); __END_CATCH}//////////////////////////////////////////////////////////////////////////////// 涝仿胶飘覆(滚欺)栏肺何磐 单捞鸥甫 佬绢辑 菩哦阑 檬扁拳茄促.//////////////////////////////////////////////////////////////////////////////void GCNPCAskVariable::read ( SocketInputStream & iStream ) throw ( ProtocolException , Error ){ __BEGIN_TRY iStream.read( m_ObjectID ); iStream.read( m_ScriptID ); BYTE szParameters; iStream.read( szParameters ); for ( int i = 0; i < szParameters ; i++ ) { ScriptParameter* pParam = new ScriptParameter(); pParam->read( iStream ); addScriptParameter( pParam ); } __END_CATCH} //////////////////////////////////////////////////////////////////////////////// 免仿胶飘覆(滚欺)栏肺 菩哦狼 官捞呈府 捞固瘤甫 焊辰促.//////////////////////////////////////////////////////////////////////////////void GCNPCAskVariable::write ( SocketOutputStream & oStream ) const throw ( ProtocolException , Error ){ __BEGIN_TRY oStream.write( m_ObjectID ); oStream.write( m_ScriptID ); BYTE szParam = m_ScriptParameters.size(); oStream.write( szParam ); HashMapScriptParameterConstItor itr = m_ScriptParameters.begin(); for( ; itr != m_ScriptParameters.end() ; itr++ ) { (itr->second)->write( oStream ); } __END_CATCH}void GCNPCAskVariable::addScriptParameter( ScriptParameter* pParam ) throw(DuplicatedException){ __BEGIN_TRY HashMapScriptParameterItor itr = m_ScriptParameters.find( pParam->getName() ); if ( itr != m_ScriptParameters.end() ) { throw DuplicatedException( "Dup Parameter Variable name" ); return; } m_ScriptParameters[pParam->getName()] = pParam; __END_CATCH}void GCNPCAskVariable::clearScriptParameters() throw(){ __BEGIN_TRY HashMapScriptParameterItor itr = m_ScriptParameters.begin(); for ( ; itr != m_ScriptParameters.end(); itr++ ) { SAFE_DELETE( itr->second ); } m_ScriptParameters.clear(); __END_CATCH}string GCNPCAskVariable::getValue( const string& name ) const throw( NoSuchElementException ){ __BEGIN_TRY HashMapScriptParameterConstItor itr = m_ScriptParameters.find( name ); if ( itr == m_ScriptParameters.end() ) { // name 捞 绝绰 版快促. NoSuchElement 甫 带廉具窍唱 // 傲 name 阑 倒妨林档废 茄促. return name; } return (itr->second)->getValue(); __END_CATCH}//////////////////////////////////////////////////////////////////////////////// execute packet's handler//////////////////////////////////////////////////////////////////////////////void GCNPCAskVariable::execute ( Player * pPlayer ) throw ( ProtocolException , Error ){ __BEGIN_TRY GCNPCAskVariableHandler::execute( this , pPlayer ); __END_CATCH}PacketSize_t GCNPCAskVariable::getPacketSize() const throw(){ __BEGIN_TRY PacketSize_t result = 0; result += szObjectID + szScriptID + szBYTE; HashMapScriptParameterConstItor itr = m_ScriptParameters.begin(); for ( ; itr != m_ScriptParameters.end() ; itr++ ) { result += (itr->second)->getSize(); } return result; __END_CATCH}//////////////////////////////////////////////////////////////////////////////// get packet's debug string//////////////////////////////////////////////////////////////////////////////string GCNPCAskVariable::toString () const throw (){ __BEGIN_TRY StringStream msg; msg << "GCNPCAskVariable(" << "ObjectID:" << m_ObjectID << ",ScriptID: " << m_ScriptID << ",Parameters: (" ; HashMapScriptParameterConstItor itr = m_ScriptParameters.begin(); for( ; itr != m_ScriptParameters.end() ; itr++ ) { msg << (itr->second)->toString() << ", "; } msg << ")"; return msg.toString(); __END_CATCH}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -