📄 effectadditem.cpp
字号:
//----------------------------------------------------------------------//// Filename : EffectAddItem.cpp// Written by : Reiot////----------------------------------------------------------------------// include files#include "Assert.h"#include "EffectAddItem.h"#include "Gpackets/GCDeleteObject.h"#include "Tile.h"#include "Zone.h"#include "Item.h"#include "ZoneUtil.h"#include "ParkingCenter.h"#include "item/Motorcycle.h"#include <stdio.h>//----------------------------------------------------------------------// constructor//----------------------------------------------------------------------EffectAddItem::EffectAddItem (Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Item* pItem , Turn_t delay, bool bAllowCreature) throw (Error): Effect(pZone,x,y,pItem,delay) { __BEGIN_TRY // 辑滚 傈侩 Effect捞促. by sigi. 2002.11.14 m_bBroadcastingEffect = false; Assert(getZone() != NULL); Assert(getTarget() != NULL); //m_ObjectID = pItem->getObjectID(); m_ObjectID = pItem->getObjectID(); m_bAllowCreature = bAllowCreature; __END_CATCH}//----------------------------------------------------------------------// destructor//----------------------------------------------------------------------EffectAddItem::~EffectAddItem () throw (Error){ __BEGIN_TRY unaffect(m_pZone , m_X , m_Y , m_pTarget); __END_CATCH} //----------------------------------------------------------------------// affect to target// 捞 捞棋飘绰 鸥老俊 辆加登瘤 臼栏骨肺, affect()绰 龋免登瘤 臼绰促.// 恐衬窍搁, target篮 积己磊俊辑 瘤沥登哥, 酒公繁 老档 窍瘤 臼扁 锭巩捞促.//----------------------------------------------------------------------void EffectAddItem::affect (Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Object* pTarget) throw (Error){ __BEGIN_TRY// throw UnsupportedError(); __END_CATCH}//----------------------------------------------------------------------// remove effect from target//----------------------------------------------------------------------void EffectAddItem::unaffect (Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Object* pTarget) throw (Error){ __BEGIN_TRY //cout << "EffectAddItem::unaffect (Zone* pZone , ZoneCoord_t x , ZoneCoord_t y , Object* pTarget)" << endl; // 棵官弗 谅钎捞绢具 茄促. Assert(pTarget!=NULL); Assert(isValidZoneCoord(pZone, x, y)); Item* pItem = dynamic_cast<Item*>(pTarget); if (pItem!=NULL) { pZone->getObjectRegistry().registerObject(pItem); //TPOINT pt = pZone->addItem(pItem, x, y, m_bAllowCreature); } else { SAFE_DELETE(pTarget); throw Error("EffectAddItem牢单 item捞 酒囱啊?"); } pTarget = NULL; __END_CATCH}//----------------------------------------------------------------------// unaffect()//----------------------------------------------------------------------void EffectAddItem::unaffect () throw (Error){ __BEGIN_TRY __END_CATCH}//----------------------------------------------------------------------// unaffect()//----------------------------------------------------------------------void EffectAddItem::unaffect (Creature* pCreature) throw (Error){ __BEGIN_TRY __END_CATCH}//----------------------------------------------------------------------// get debug string//----------------------------------------------------------------------string EffectAddItem::toString () const throw (){ StringStream msg; msg << "EffectAddItem(" << "ZoneID:" << (int)m_pZone->getZoneID() << ",X:" << (int)getX() << ",Y:" << (int)getY(); if (m_pTarget) msg << ",Target:" << m_pTarget->toString(); else msg << ",Target:NULL"; msg << ",Deadline:" << (int)m_Deadline.tv_sec << "." << (int)m_Deadline.tv_usec; msg << ")"; return msg.toString();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -