MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnDeleteSound

Method OnDeleteSound

editor/WorldSoundsDialog.cpp:325–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325void CWorldSoundsDialog::OnDeleteSound() {
326 int answer, tl;
327 mngs_Pagelock pl;
328 int n = D3EditState.current_sound;
329
330 if (Num_sounds < 1)
331 return;
332
333 Sound_system.BeginSoundFrame();
334 Sound_system.StopAllSounds();
335 Sound_system.EndSoundFrame();
336
337 // Check to see if we even have it locked
338 if ((tl = mng_FindTrackLock(Sounds[n].name, PAGETYPE_SOUND)) == -1) {
339 OutrageMessageBox("This sound is not yours to delete. Lock first.");
340 return;
341 }
342
343 // Make sure its to be deleted
344 answer = MessageBox("Are you sure you want to delete this sound?", Sounds[n].name, MB_YESNO);
345 if (answer == IDNO)
346 return;
347
348 if (!mng_MakeLocker())
349 return;
350
351 strcpy(pl.name, Sounds[n].name);
352 pl.pagetype = PAGETYPE_SOUND;
353
354 // Check to see if this is a local sound only. If so, only delete it locally
355 if (mng_CheckIfPageOwned(&pl, TableUser) != 1) {
356 mng_FreeTrackLock(tl);
357 if (!mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 1)) {
358 mprintf(0, ErrorString);
359 Int3();
360 }
361 } else // if its network, delete it from both the net and local drives
362 {
363
364 mng_FreeTrackLock(tl);
365 mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 1);
366 mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 0);
367
368 mng_DeletePagelock(Sounds[n].name, PAGETYPE_SOUND);
369 }
370
371 // Advance to the next sound
372 D3EditState.current_sound = GetNextSound(n);
373
374 FreeSound(n);
375 mng_EraseLocker();
376
377 OutrageMessageBox("Sound deleted.");
378
379 RemapSounds();
380
381 UpdateDialog();
382}

Callers

nothing calls this directly

Calls 14

mng_FindTrackLockFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_MakeLockerFunction · 0.85
mng_CheckIfPageOwnedFunction · 0.85
mng_FreeTrackLockFunction · 0.85
mng_DeletePageFunction · 0.85
mng_DeletePagelockFunction · 0.85
GetNextSoundFunction · 0.85
FreeSoundFunction · 0.85
mng_EraseLockerFunction · 0.85
RemapSoundsFunction · 0.85
BeginSoundFrameMethod · 0.80

Tested by

no test coverage detected