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

Function FindEnvSound

engine/Poseidon/UI/OptionsUI.cpp:262–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260 return dir;
261}
262
263void FindEnvSound(RString name, SoundPars& day, SoundPars& night)
264{
265 // ignore @ - not used now
266 if (name[0] == '@')
267 {
268 name = (const char*)name + 1;
269 }
270
271 // find in mission
272 const ParamEntry* cls = ExtParsMission.FindEntry("CfgEnvSounds");
273 const ParamEntry* entry = cls ? cls->FindEntry(name) : nullptr;
274 if (entry)
275 {
276 GetValue(day, (*entry) >> "sound");
277 if (day.name.GetLength() > 0)
278 {
279 day.name = GetMissionDirectory() + day.name;
280 }
281 GetValue(night, (*entry) >> "soundNight");
282 if (night.name.GetLength() > 0)
283 {
284 night.name = GetMissionDirectory() + night.name;
285 }
286 return;
287 }
288
289 // find in campaign
290 cls = ExtParsCampaign.FindEntry("CfgEnvSounds");
291 entry = cls ? cls->FindEntry(name) : nullptr;
292 if (entry)
293 {
294 GetValue(day, (*entry) >> "sound");
295 if (day.name.GetLength() > 0)
296 {
297 day.name = BaseDirectory + RString("dtaExt\\") + day.name;
298 }
299 GetValue(night, (*entry) >> "soundNight");
300 if (night.name.GetLength() > 0)
301 {
302 night.name = BaseDirectory + RString("dtaExt\\") + night.name;
303 }
304 return;
305 }
306
307 // find in config
308 cls = Pars.FindEntry("CfgEnvSounds");
309 entry = cls ? cls->FindEntry(name) : nullptr;
310 if (entry)
311 {
312 GetValue(day, (*entry) >> "sound");
313 GetValue(night, (*entry) >> "soundNight");
314 return;
315 }
316
317 Poseidon::Foundation::WarningMessage("Environmental sound %s not found", (const char*)name);
318}
319

Callers 2

OnActivateMethod · 0.85
ApplyEffectsFunction · 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