MCPcopy Create free account
hub / github.com/OpenArkStudio/ARK / CommonClassDestoryEvent

Method CommonClassDestoryEvent

src/server/game/src/AFCGameNetModule.cpp:445–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443}
444
445int AFCGameNetModule::CommonClassDestoryEvent(const AFGUID& self)
446{
447 auto pEntity = m_pKernelModule->GetEntity(self);
448 if (nullptr == pEntity)
449 {
450 return 0;
451 }
452
453 int map_id = pEntity->GetInt32(AFEntityMetaBaseEntity::map_id());
454 int map_inst_id = pEntity->GetInt32(AFEntityMetaBaseEntity::map_inst_id());
455
456 if (map_inst_id < 0)
457 {
458 return 0;
459 }
460
461 AFCDataList valueAllObjectList;
462 AFCDataList valueBroadCaseList;
463 AFCDataList valueBroadListNoSelf;
464 m_pMapModule->GetInstEntityList(map_id, map_inst_id, valueAllObjectList);
465
466 for (size_t i = 0; i < valueAllObjectList.GetCount(); i++)
467 {
468 AFGUID identBC = valueAllObjectList.Int64(i);
469 auto pBCEntity = m_pKernelModule->GetEntity(identBC);
470 if (nullptr == pBCEntity)
471 {
472 continue;
473 }
474
475 const std::string& class_name = pBCEntity->GetClassName();
476
477 if (AFEntityMetaPlayer::self_name() == class_name)
478 {
479 valueBroadCaseList << identBC;
480
481 if (identBC != self)
482 {
483 valueBroadListNoSelf << identBC;
484 }
485 }
486 }
487
488 OnEntityListLeave(valueBroadListNoSelf, AFCDataList() << self);
489 return 0;
490}
491
492int AFCGameNetModule::OnCommonClassEvent(
493 const AFGUID& self, const std::string& strClassName, const ArkEntityEvent eClassEvent, const AFIDataList& var)

Callers

nothing calls this directly

Calls 5

GetEntityMethod · 0.80
GetInstEntityListMethod · 0.80
Int64Method · 0.80
GetInt32Method · 0.45
GetCountMethod · 0.45

Tested by

no test coverage detected