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

Method fireCreatureSound

source/entities/Creature.cpp:2780–2825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2778}
2779
2780void Creature::fireCreatureSound(CreatureSound sound)
2781{
2782 Tile* posTile = getPositionTile();
2783 if(posTile == nullptr)
2784 return;
2785
2786 std::string soundFamily;
2787 switch(sound)
2788 {
2789 case CreatureSound::Pickup:
2790 soundFamily = getDefinition()->getSoundFamilyPickup();
2791 break;
2792 case CreatureSound::Drop:
2793 soundFamily = getDefinition()->getSoundFamilyDrop();
2794 break;
2795 case CreatureSound::Attack:
2796 soundFamily = getDefinition()->getSoundFamilyAttack();
2797 break;
2798 case CreatureSound::Die:
2799 soundFamily = getDefinition()->getSoundFamilyDie();
2800 break;
2801 case CreatureSound::Slap:
2802 soundFamily = getDefinition()->getSoundFamilySlap();
2803 break;
2804 case CreatureSound::Dig:
2805 soundFamily = "Default/Dig";
2806 break;
2807 default:
2808 OD_LOG_ERR("Wrong CreatureSound value=" + Helper::toString(static_cast<uint32_t>(sound)));
2809 return;
2810 }
2811
2812 std::string soundComplete = "Creatures/" + soundFamily;
2813 for(Seat* seat : mSeatsWithVisionNotified)
2814 {
2815 if(seat->getPlayer() == nullptr)
2816 continue;
2817 if(!seat->getPlayer()->getIsHuman())
2818 continue;
2819
2820 ServerNotification *serverNotification = new ServerNotification(
2821 ServerNotificationType::playSpatialSound, seat->getPlayer());
2822 serverNotification->mPacket << soundComplete << posTile->getX() << posTile->getY();
2823 ODServer::getSingleton().queueServerNotification(serverNotification);
2824 }
2825}
2826
2827void Creature::itsPayDay()
2828{

Callers 1

handleDigTileMethod · 0.80

Calls 6

getIsHumanMethod · 0.80
toStringFunction · 0.50
getPlayerMethod · 0.45
getXMethod · 0.45
getYMethod · 0.45

Tested by

no test coverage detected