MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / FindMusic

Function FindMusic

engine/Poseidon/UI/OptionsUI.cpp:476–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474 // through LOG_WARN rather than WarningMessage — the latter is a no-op in the
475 // shipping app frame, which is why a bad `say`/sound surfaced only as the
476 // file server's context-free "Empty or nullptr name not allowed".)
477 LOG_WARN(Audio, "Sound '{}' not found in any CfgSounds — nothing will play", (const char*)name);
478 return nullptr;
479}
480
481const ParamEntry* FindMusic(RString name, SoundPars& pars)
482{
483 // find in mission
484 const ParamEntry* cls = ExtParsMission.FindEntry("CfgMusic");
485 const ParamEntry* entry = cls ? cls->FindEntry(name) : nullptr;
486 if (entry)
487 {
488 GetValue(pars, (*entry) >> "sound");
489 if (pars.name.GetLength() > 0)
490 {
491 pars.name = GetMissionDirectory() + pars.name;
492 }
493 return entry;
494 }
495
496 // find in campaign
497 cls = ExtParsCampaign.FindEntry("CfgMusic");
498 entry = cls ? cls->FindEntry(name) : nullptr;
499 if (entry)
500 {
501 GetValue(pars, (*entry) >> "sound");
502 if (pars.name.GetLength() > 0)
503 {
504 pars.name = BaseDirectory + RString("dtaExt\\") + pars.name;
505 }
506 return entry;
507 }
508
509 // find in config
510 cls = Pars.FindEntry("CfgMusic");
511 entry = cls ? cls->FindEntry(name) : nullptr;
512 if (entry)
513 {
514 GetValue(pars, (*entry) >> "sound");
515 return entry;
516 }
517
518 Poseidon::Foundation::WarningMessage("Music %s not found", (const char*)name);

Callers 4

OnActivateMethod · 0.85
ApplyEffectsFunction · 0.85
PlayMusicFunction · 0.85
ResolvePreviewMusicTrackFunction · 0.85

Calls 6

GetValueFunction · 0.85
GetMissionDirectoryFunction · 0.85
WarningMessageFunction · 0.85
RStringClass · 0.50
FindEntryMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected