File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -467,6 +467,7 @@ class Entity : public script::ScriptObject
467
467
获取entity所在节点
468
468
*/
469
469
INLINE EntityCoordinateNode* pEntityCoordinateNode ()const ;
470
+ INLINE void pEntityCoordinateNode (EntityCoordinateNode* pNode);
470
471
471
472
/* *
472
473
安装卸载节点
Original file line number Diff line number Diff line change @@ -174,6 +174,12 @@ INLINE EntityCoordinateNode* Entity::pEntityCoordinateNode()const
174
174
return pEntityCoordinateNode_;
175
175
}
176
176
177
+ // -------------------------------------------------------------------------------------
178
+ INLINE void Entity::pEntityCoordinateNode (EntityCoordinateNode* pNode)
179
+ {
180
+ pEntityCoordinateNode_ = pNode;
181
+ }
182
+
177
183
// -------------------------------------------------------------------------------------
178
184
INLINE void Entity::isOnGround (bool v)
179
185
{
Original file line number Diff line number Diff line change @@ -345,7 +345,20 @@ bool Space::destroy(ENTITY_ID entityID)
345
345
346
346
// 最后销毁创建者
347
347
if (creator)
348
- creator->destroyEntity ();
348
+ {
349
+ if (Cellapp::getSingleton ().findEntity (creator->getID ()) != NULL )
350
+ {
351
+ creator->destroyEntity ();
352
+ }
353
+ else
354
+ {
355
+ // 之所以会这样是因为可能spaceEntity在调用destroy销毁的时候onDestroy中调用了destroySpace
356
+ // 那么就会出现在spaceEntity-destroy过程中导致这里继续调用creator->destroyEntity()
357
+ // 此时就会出现EntityApp::destroyEntity: not found.
358
+ // 然后再spaceEntity析构的时候销毁pEntityCoordinateNode_会出错, 这里应该设置为NULL。
359
+ creator->pEntityCoordinateNode (NULL );
360
+ }
361
+ }
349
362
350
363
pNavHandle_.clear ();
351
364
entities_.clear ();
You can’t perform that action at this time.
0 commit comments