| 410 | } |
| 411 | |
| 412 | void CAmbientSoundPattern::OnASPCheckIn() { |
| 413 | // Write the updated data to the file |
| 414 | WriteAmbientData(); |
| 415 | |
| 416 | // Find where it is in the files index |
| 417 | int n = FindGamefileName(AMBIENT_FILE_NAME); |
| 418 | |
| 419 | if (n == -1) { |
| 420 | Int3(); // Get Matt or Jason - AMBIENT file name is no longer in the table file! |
| 421 | return; |
| 422 | } |
| 423 | |
| 424 | mngs_Pagelock temp_pl; |
| 425 | int r; |
| 426 | |
| 427 | // Lock the network table file |
| 428 | if (!mng_MakeLocker()) |
| 429 | return; |
| 430 | |
| 431 | // Make sure we own this gamefile |
| 432 | strcpy(temp_pl.name, Gamefiles[n].name); |
| 433 | temp_pl.pagetype = PAGETYPE_GAMEFILE; |
| 434 | |
| 435 | r = mng_CheckIfPageOwned(&temp_pl, TableUser); |
| 436 | if (r < 0) |
| 437 | OutrageMessageBox(ErrorString); |
| 438 | else if (r == 0) |
| 439 | OutrageMessageBox(InfoString); |
| 440 | else { |
| 441 | // Change the pagelock state to UNLOCKED |
| 442 | strcpy(temp_pl.holder, "UNLOCKED"); |
| 443 | if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) { |
| 444 | MessageBox(ErrorString, "Error!"); |
| 445 | mng_EraseLocker(); |
| 446 | return; |
| 447 | } else { |
| 448 | // Now actually replace the copy on the net with our local one |
| 449 | |
| 450 | if (!mng_ReplacePage(Gamefiles[n].name, Gamefiles[n].name, n, PAGETYPE_GAMEFILE, 0)) |
| 451 | OutrageMessageBox(ErrorString); |
| 452 | else { |
| 453 | // Save this gamefile file to the network for all |
| 454 | |
| 455 | char destname[100], srcname[100]; |
| 456 | |
| 457 | ddio_MakePath(srcname, LocalD3Dir, "data", Gamefiles[n].dir_name, Gamefiles[n].name, NULL); |
| 458 | ddio_MakePath(destname, NetD3Dir, "data", Gamefiles[n].dir_name, Gamefiles[n].name, NULL); |
| 459 | |
| 460 | cf_CopyFile(destname, srcname); |
| 461 | |
| 462 | OutrageMessageBox("File checked in."); |
| 463 | |
| 464 | // Delete it from local pagefile if its there |
| 465 | int dret = mng_DeletePage(Gamefiles[n].name, PAGETYPE_GAMEFILE, 1); |
| 466 | ASSERT(dret == 1); |
| 467 | mng_EraseLocker(); |
| 468 | |
| 469 | // Free the tracklock |
nothing calls this directly
no test coverage detected