Skip to content

Commit b22ffd0

Browse files
committed
up
1 parent a33bfad commit b22ffd0

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

kbe/src/server/cellapp/cellapp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,8 @@ void Cellapp::reqTeleportOtherCB(Mercury::Channel* pChannel, MemoryStream& s)
16151615

16161616
entity->changeToReal(0, s);
16171617
entity->onTeleportFailure();
1618+
1619+
s.opfini();
16181620
}
16191621

16201622
//-------------------------------------------------------------------------------------

kbe/src/server/cellapp/entity.cpp

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,7 +2317,9 @@ void Entity::teleportRefEntity(Entity* entity, Position3D& pos, Direction3D& dir
23172317
{
23182318
if(entity == NULL)
23192319
{
2320-
ERROR_MSG("Entity::teleport: nearbyEntityRef is null!\n");
2320+
ERROR_MSG(boost::format("%1%::teleport: %2%, nearbyEntityRef is null!\n") %
2321+
this->getScriptName() % getID());
2322+
23212323
onTeleportFailure();
23222324
return;
23232325
}
@@ -2360,11 +2362,13 @@ void Entity::teleportRefEntity(Entity* entity, Position3D& pos, Direction3D& dir
23602362
{
23612363
if(space != NULL)
23622364
{
2363-
ERROR_MSG("Entity::teleport: nearbyEntityRef is spaceEntity, spaceEntity is destroyed!\n");
2365+
ERROR_MSG(boost::format("%1%::teleport(): %2%, nearbyEntityRef is spaceEntity, spaceEntity is destroyed!\n") %
2366+
this->getScriptName() % getID());
23642367
}
23652368
else
23662369
{
2367-
ERROR_MSG(boost::format("Entity::teleport: not found space(%1%)!\n") % spaceID);
2370+
ERROR_MSG(boost::format("%1%::teleport(): %2%, not found space(%3%)!\n") %
2371+
this->getScriptName() % getID() % spaceID);
23682372
}
23692373

23702374
onTeleportFailure();
@@ -2407,14 +2411,18 @@ void Entity::onTeleportRefMailbox(EntityMailbox* nearbyMBRef, Position3D& pos, D
24072411
PyObject* pyret = PyObject_GetAttrString(nearbyMBRef, const_cast<char*>("cell"));
24082412
if(pyret == NULL)
24092413
{
2410-
ERROR_MSG("Entity::teleportRefMailbox: nearbyRef is error, not found cellMailbox!\n");
2414+
ERROR_MSG(boost::format("%1%::teleportRefMailbox(): %2%, nearbyRef is error, not found cellMailbox!\n") %
2415+
this->getScriptName() % getID());
2416+
24112417
onTeleportFailure();
24122418
return;
24132419
}
24142420

24152421
if(pyret == Py_None)
24162422
{
2417-
ERROR_MSG("Entity::teleportRefMailbox: nearbyRef is error, not found cellMailbox!\n");
2423+
ERROR_MSG(boost::format("%1%::teleportRefMailbox(): %2%, nearbyRef is error, not found cellMailbox!\n") %
2424+
this->getScriptName() % getID());
2425+
24182426
onTeleportFailure();
24192427
Py_DECREF(pyret);
24202428
return;
@@ -2463,7 +2471,9 @@ void Entity::onReqTeleportOtherAck(Mercury::Channel* pChannel, ENTITY_ID nearbyM
24632471
// 目的space错误
24642472
if(destSpaceID == 0)
24652473
{
2466-
ERROR_MSG("Entity::onReqTeleportOtherAck: not found destSpace!\n");
2474+
ERROR_MSG(boost::format("%1%::onReqTeleportOtherAck(): %2%, not found destSpace!\n") %
2475+
this->getScriptName() % getID());
2476+
24672477
onTeleportFailure();
24682478
return;
24692479
}
@@ -2570,7 +2580,9 @@ void Entity::teleport(PyObject_ptr nearbyMBRef, Position3D& pos, Direction3D& di
25702580
else
25712581
{
25722582
// 如果不是entity, 也不是mailbox同时也不是None? 那肯定是输入错误
2573-
ERROR_MSG("Entity::teleport: nearbyRef is error!\n");
2583+
ERROR_MSG(boost::format("%1%::teleport(): %2%, nearbyRef is error!\n") %
2584+
this->getScriptName() % getID());
2585+
25742586
onTeleportFailure();
25752587
}
25762588
}
@@ -2589,6 +2601,9 @@ void Entity::onTeleport()
25892601
//-------------------------------------------------------------------------------------
25902602
void Entity::onTeleportFailure()
25912603
{
2604+
ERROR_MSG(boost::format("%1%::onTeleportFailure(): entityID=%2%\n") %
2605+
this->getScriptName() % getID());
2606+
25922607
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
25932608

25942609
SCRIPT_OBJECT_CALL_ARGS0(this, const_cast<char*>("onTeleportFailure"));
@@ -2839,6 +2854,7 @@ void Entity::addToStream(KBEngine::MemoryStream& s)
28392854

28402855
uint32 size = witnesses_count_;
28412856
s << size;
2857+
28422858
std::list<ENTITY_ID>::iterator iter = witnesses_.begin();
28432859
for(; iter != witnesses_.end(); iter++)
28442860
{
@@ -2872,13 +2888,13 @@ void Entity::addToStream(KBEngine::MemoryStream& s)
28722888
//-------------------------------------------------------------------------------------
28732889
void Entity::createFromStream(KBEngine::MemoryStream& s)
28742890
{
2875-
ENTITY_SCRIPT_UID sid;
2891+
ENTITY_SCRIPT_UID scriptUType;
28762892
COMPONENT_ID baseMailboxComponentID;
28772893

2878-
s >> sid >> spaceID_ >> isDestroyed_ >> isOnGround_ >> topSpeed_ >>
2894+
s >> scriptUType >> spaceID_ >> isDestroyed_ >> isOnGround_ >> topSpeed_ >>
28792895
topSpeedY_ >> shouldAutoBackup_ >> layer_ >> baseMailboxComponentID;
28802896

2881-
this->scriptModule_ = EntityDef::findScriptModule(sid);
2897+
this->scriptModule_ = EntityDef::findScriptModule(scriptUType);
28822898

28832899
// 设置entity的baseMailbox
28842900
if(baseMailboxComponentID > 0)

0 commit comments

Comments
 (0)