| 331 | } |
| 332 | |
| 333 | void CAmbientSoundPattern::OnASPLock() { |
| 334 | int n; |
| 335 | mngs_Pagelock temp_pl; |
| 336 | mngs_gamefile_page gamefilepage; |
| 337 | int r; |
| 338 | |
| 339 | // Find where it is in the list |
| 340 | n = FindGamefileName(AMBIENT_FILE_NAME); |
| 341 | |
| 342 | if (n == -1) { |
| 343 | Int3(); // Get Matt or Jason - AMBIENT file name is no longer in the table file! |
| 344 | return; |
| 345 | } |
| 346 | |
| 347 | if (!mng_MakeLocker()) |
| 348 | return; |
| 349 | |
| 350 | // Make sure it can be locked |
| 351 | strcpy(temp_pl.name, AMBIENT_FILE_NAME); |
| 352 | temp_pl.pagetype = PAGETYPE_GAMEFILE; |
| 353 | |
| 354 | r = mng_CheckIfPageLocked(&temp_pl); |
| 355 | if (r == 2) { |
| 356 | int answer; |
| 357 | answer = OutrageMessageBox(MBOX_YESNO, "This page is not even in the table file, or the database maybe corrupt. " |
| 358 | "Override to 'Unlocked'? (Select NO if you don't know what you're doing)"); |
| 359 | if (answer == IDYES) { |
| 360 | strcpy(temp_pl.holder, "UNLOCKED"); |
| 361 | if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) |
| 362 | MessageBox(ErrorString, "Error!"); |
| 363 | } |
| 364 | } else if (r < 0) |
| 365 | OutrageMessageBox(ErrorString); |
| 366 | else if (r == 1) |
| 367 | OutrageMessageBox(InfoString); |
| 368 | else { |
| 369 | |
| 370 | // Everything is ok. Tell the network we're locking it and get a copy to |
| 371 | // our local drive |
| 372 | strcpy(temp_pl.holder, TableUser); |
| 373 | |
| 374 | // Search thru the net pagefile and get a new copy in RAM in case anyone |
| 375 | // changed it since we started the editor |
| 376 | if (mng_FindSpecificGamefilePage(temp_pl.name, &gamefilepage, 0)) { |
| 377 | |
| 378 | if (mng_AssignGamefilePageToGamefile(&gamefilepage, n)) { |
| 379 | if (!mng_ReplacePage(Gamefiles[n].name, Gamefiles[n].name, n, PAGETYPE_GAMEFILE, 1)) { |
| 380 | OutrageMessageBox("There was problem writing that page locally!"); |
| 381 | mng_EraseLocker(); |
| 382 | return; |
| 383 | } else { |
| 384 | |
| 385 | if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) { |
| 386 | MessageBox(ErrorString, "Error!"); |
| 387 | mng_EraseLocker(); |
| 388 | return; |
| 389 | } |
| 390 | } |
nothing calls this directly
no test coverage detected