| 382 | } |
| 383 | |
| 384 | void 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); |
nothing calls this directly
no test coverage detected