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

Method carryEntity

source/entities/Creature.cpp:2428–2449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2426}
2427
2428void Creature::carryEntity(GameEntity* carriedEntity)
2429{
2430 if(!getIsOnServerMap())
2431 return;
2432
2433 OD_ASSERT_TRUE(carriedEntity != nullptr);
2434 OD_ASSERT_TRUE(mCarriedEntity == nullptr);
2435 mCarriedEntity = nullptr;
2436 if(carriedEntity == nullptr)
2437 return;
2438
2439 // We remove the carried entity from the clients gamemaps as well as the carrier
2440 // and we send the carrier creation message (that will embed the carried)
2441 carriedEntity->fireRemoveEntityToSeatsWithVision();
2442 // We only notify seats that already had vision. We copy the seats with vision list
2443 // because fireRemoveEntityToSeatsWithVision will empty it.
2444 std::vector<Seat*> seatsWithVision = mSeatsWithVisionNotified;
2445 // We remove ourself and send the creation
2446 fireRemoveEntityToSeatsWithVision();
2447 mCarriedEntity = carriedEntity;
2448 notifySeatsWithVision(seatsWithVision);
2449}
2450
2451void Creature::releaseCarriedEntity()
2452{

Callers 1

Tested by

no test coverage detected