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

Method OnASPUndoLock

editor/AmbientSoundPattern.cpp:481–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479}
480
481void CAmbientSoundPattern::OnASPUndoLock() {
482 int tl;
483 mngs_Pagelock pl;
484 mngs_gamefile_page page;
485
486 // Should have this item locked
487 if ((tl = mng_FindTrackLock(AMBIENT_FILE_NAME, PAGETYPE_GAMEFILE)) == -1)
488 return;
489
490 if (OutrageMessageBox(MBOX_YESNO,
491 "Are you sure you want to undo your lock and lose any changes you may have made?") != IDYES)
492 return;
493
494 if (!mng_MakeLocker())
495 return;
496
497 // Find where it is in the files index
498 int n = FindGamefileName(AMBIENT_FILE_NAME);
499
500 if (n == -1) {
501 Int3(); // Get Matt or Jason - AMBIENT file name is no longer in the table file!
502 return;
503 }
504
505 strcpy(pl.name, AMBIENT_FILE_NAME);
506 pl.pagetype = PAGETYPE_GAMEFILE;
507
508 mng_FreeTrackLock(tl);
509
510 // Delete local page
511 if (!mng_DeletePage(AMBIENT_FILE_NAME, PAGETYPE_GAMEFILE, 1)) {
512 mprintf(0, ErrorString);
513 Int3();
514 }
515
516 // Get old data from net
517 if (!mng_FindSpecificGamefilePage(pl.name, &page))
518 Int3();
519
520 // Copy old get into our local array
521 if (!mng_AssignGamefilePageToGamefile(&page, n))
522 Int3();
523
524 // We're done
525 mng_EraseLocker();
526
527 // Re-read old data
528 ReadAmbientData();
529
530 m_current_asp = -1;
531 m_locked = 0;
532
533 UpdateDialog();
534}

Callers

nothing calls this directly

Calls 10

mng_FindTrackLockFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_MakeLockerFunction · 0.85
FindGamefileNameFunction · 0.85
mng_FreeTrackLockFunction · 0.85
mng_DeletePageFunction · 0.85
mng_EraseLockerFunction · 0.85
ReadAmbientDataFunction · 0.85

Tested by

no test coverage detected