| 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 | |
| 481 | const 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); |
no test coverage detected