MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / fireAddEntity

Method fireAddEntity

source/entities/Creature.cpp:2531–2564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2529}
2530
2531void Creature::fireAddEntity(Seat* seat, bool async)
2532{
2533 if(async)
2534 {
2535 ServerNotification serverNotification(
2536 ServerNotificationType::addEntity, seat->getPlayer());
2537 exportHeadersToPacket(serverNotification.mPacket);
2538 exportToPacket(serverNotification.mPacket, seat);
2539 ODServer::getSingleton().sendAsyncMsg(serverNotification);
2540
2541 if(mCarriedEntity != nullptr)
2542 {
2543 OD_LOG_ERR("Trying to fire add creature in async mode name=" + getName() + " while carrying " + mCarriedEntity->getName());
2544 }
2545 return;
2546 }
2547
2548 ServerNotification* serverNotification = new ServerNotification(
2549 ServerNotificationType::addEntity, seat->getPlayer());
2550 exportHeadersToPacket(serverNotification->mPacket);
2551 exportToPacket(serverNotification->mPacket, seat);
2552 ODServer::getSingleton().queueServerNotification(serverNotification);
2553
2554 if(mCarriedEntity != nullptr)
2555 {
2556 mCarriedEntity->addSeatWithVision(seat, false);
2557
2558 serverNotification = new ServerNotification(
2559 ServerNotificationType::carryEntity, seat->getPlayer());
2560 serverNotification->mPacket << getName() << mCarriedEntity->getObjectType();
2561 serverNotification->mPacket << mCarriedEntity->getName();
2562 ODServer::getSingleton().queueServerNotification(serverNotification);
2563 }
2564}
2565
2566void Creature::fireRemoveEntity(Seat* seat)
2567{

Callers

nothing calls this directly

Calls 5

sendAsyncMsgMethod · 0.80
addSeatWithVisionMethod · 0.80
getPlayerMethod · 0.45
getObjectTypeMethod · 0.45

Tested by

no test coverage detected