actionsetposition.cpp

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

CPP
105
字号
////////////////////////////////////////////////////////////////////////////////// Filename    : ActionSetPosition.cpp// Written By  : // Description :////////////////////////////////////////////////////////////////////////////////#include "ActionSetPosition.h"#include "Zone.h"#include "NPC.h"#include "NPCInfo.h"#include <fstream>////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////void ActionSetPosition::read (PropertyBuffer & propertyBuffer)	throw (Error){	__BEGIN_TRY	try	{		m_ZoneID = propertyBuffer.getPropertyInt("ZoneID");		m_X      = propertyBuffer.getPropertyInt("X");		m_Y      = propertyBuffer.getPropertyInt("Y");		m_Dir    = propertyBuffer.getPropertyInt("Dir");	}	catch (NoSuchElementException & nsee)	{		throw Error(nsee.toString());	}	__END_CATCH}////////////////////////////////////////////////////////////////////////////////// 咀记阑 角青茄促.////////////////////////////////////////////////////////////////////////////////void ActionSetPosition::execute (Creature * pCreature1 , Creature * pCreature2) 	throw (Error){	__BEGIN_TRY	try {		Assert(pCreature1 != NULL);		Assert(pCreature2 == NULL);		Assert(!pCreature1->isPC());		////////////////////////////////////////////////////////////////////////////////		// 农府贸狼 粮阑 瘤沥茄促.		// 郴何俊辑 ZoneInfoManager, ZoneGroupManager 甫 		// 八祸秦辑 利例窍霸 粮 器牢磐甫 瘤沥秦霖促.		////////////////////////////////////////////////////////////////////////////////		pCreature1->setZoneID(m_ZoneID);		////////////////////////////////////////////////////////////////////////////////		// 粮俊 农府贸甫 眠啊茄促.		// 郴何俊辑 农府贸狼 谅钎, 规氢阑 瘤沥秦霖促.		////////////////////////////////////////////////////////////////////////////////		Zone * pZone = pCreature1->getZone();		Assert(pZone != NULL);		pZone->addCreature(pCreature1 , m_X , m_Y , m_Dir);		NPC* pNPC = dynamic_cast<NPC*>(pCreature1);		if (pNPC->isShowInMinimap())		{			NPCInfo* pNPCInfo = new NPCInfo();			pNPCInfo->setName(pNPC->getName());			pNPCInfo->setNPCID(pNPC->getNPCID());			pNPCInfo->setX(pNPC->getX());			pNPCInfo->setY(pNPC->getY());			pZone->addNPCInfo(pNPCInfo);		}	} catch (Throwable &t) {		cout << t.toString() << endl;		throw; // -_-;	}		__END_CATCH}////////////////////////////////////////////////////////////////////////////////// get debug string////////////////////////////////////////////////////////////////////////////////string ActionSetPosition::toString () const	throw (){	__BEGIN_TRY	StringStream msg;	msg << "ActionSetPosition("		<< "ZoneID:" << (int)m_ZoneID		<< ",X:"     << (int)m_X		<< ",Y:"     << (int)m_Y		<< ",Dir:"   << Dir2String[m_Dir]		<< ")";	return msg.toString();	__END_CATCH}

⌨️ 快捷键说明

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