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

Method OnLockSound

editor/WorldSoundsDialog.cpp:384–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384void CWorldSoundsDialog::OnLockSound() {
385 int n = D3EditState.current_sound;
386 mngs_Pagelock temp_pl;
387 mngs_sound_page soundpage;
388 int r;
389
390 if (Num_sounds < 1)
391 return;
392
393 if (!mng_MakeLocker())
394 return;
395
396 // Make sure it can be locked
397 strcpy(temp_pl.name, Sounds[n].name);
398 temp_pl.pagetype = PAGETYPE_SOUND;
399
400 r = mng_CheckIfPageLocked(&temp_pl);
401 if (r == 2) {
402 int answer;
403 answer = OutrageMessageBox(MBOX_YESNO, "This page is not even in the table file, or the database maybe corrupt. "
404 "Override to 'Unlocked'? (Select NO if you don't know what you're doing)");
405 if (answer == IDYES) {
406 strcpy(temp_pl.holder, "UNLOCKED");
407 if (!mng_ReplacePagelock(temp_pl.name, &temp_pl))
408 MessageBox(ErrorString, "Error!");
409 }
410
411 } else if (r < 0)
412 OutrageMessageBox(ErrorString);
413 else if (r == 1)
414 OutrageMessageBox(InfoString);
415 else {
416
417 // Everything is ok. Tell the network we're locking it and get a copy to
418 // our local drive
419
420 strcpy(temp_pl.holder, TableUser);
421 if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) {
422 MessageBox(ErrorString, "Error!");
423 mng_EraseLocker();
424 return;
425 } else {
426 // Search thru the net pagefile and get a new copy in RAM in case anyone
427 // changed it since we started the editor
428 if (mng_FindSpecificSoundPage(temp_pl.name, &soundpage)) {
429 if (mng_AssignSoundPageToSound(&soundpage, n)) {
430 if (!mng_ReplacePage(Sounds[n].name, Sounds[n].name, n, PAGETYPE_SOUND, 1)) {
431 OutrageMessageBox("There was problem writing that page locally!");
432 mng_EraseLocker();
433 return;
434 }
435 OutrageMessageBox("Sound locked.");
436
437 } else
438 OutrageMessageBox(
439 "There was a problem loading this sound. You might encounter problems in dealing with it. Good luck!");
440
441 mng_AllocTrackLock(Sounds[n].name, PAGETYPE_SOUND);

Callers

nothing calls this directly

Calls 9

mng_MakeLockerFunction · 0.85
mng_CheckIfPageLockedFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_ReplacePagelockFunction · 0.85
mng_EraseLockerFunction · 0.85
mng_ReplacePageFunction · 0.85
mng_AllocTrackLockFunction · 0.85

Tested by

no test coverage detected