MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / SetFromDesc

Method SetFromDesc

Source/Objects/ambientsoundobject.cpp:66–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66bool AmbientSoundObject::SetFromDesc(const EntityDescription& desc) {
67 bool ret = Object::SetFromDesc(desc);
68 if (ret) {
69 for (const auto& field : desc.fields) {
70 switch (field.type) {
71 case EDF_FILE_PATH: {
72 std::string type_file;
73 field.ReadString(&type_file);
74 if (!as_ref.valid() || as_ref->path_ != obj_file) {
75 // as_ref = AmbientSounds::Instance()->ReturnRef(type_file);
76 as_ref = Engine::Instance()->GetAssetManager()->LoadSync<AmbientSound>(type_file);
77 if (as_ref->GetSoundType() == _occasional) {
78 delay = as_ref->GetDelayNoLower();
79 }
80 }
81 break;
82 }
83 }
84 }
85 }
86 return ret;
87}
88
89void AmbientSoundObject::Moved(Object::MoveType type) {
90 Object::Moved(type);

Callers

nothing calls this directly

Calls 5

GetAssetManagerMethod · 0.80
GetSoundTypeMethod · 0.80
GetDelayNoLowerMethod · 0.80
ReadStringMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected