| 323 | } |
| 324 | |
| 325 | void CWorldSoundsDialog::OnDeleteSound() { |
| 326 | int answer, tl; |
| 327 | mngs_Pagelock pl; |
| 328 | int n = D3EditState.current_sound; |
| 329 | |
| 330 | if (Num_sounds < 1) |
| 331 | return; |
| 332 | |
| 333 | Sound_system.BeginSoundFrame(); |
| 334 | Sound_system.StopAllSounds(); |
| 335 | Sound_system.EndSoundFrame(); |
| 336 | |
| 337 | // Check to see if we even have it locked |
| 338 | if ((tl = mng_FindTrackLock(Sounds[n].name, PAGETYPE_SOUND)) == -1) { |
| 339 | OutrageMessageBox("This sound is not yours to delete. Lock first."); |
| 340 | return; |
| 341 | } |
| 342 | |
| 343 | // Make sure its to be deleted |
| 344 | answer = MessageBox("Are you sure you want to delete this sound?", Sounds[n].name, MB_YESNO); |
| 345 | if (answer == IDNO) |
| 346 | return; |
| 347 | |
| 348 | if (!mng_MakeLocker()) |
| 349 | return; |
| 350 | |
| 351 | strcpy(pl.name, Sounds[n].name); |
| 352 | pl.pagetype = PAGETYPE_SOUND; |
| 353 | |
| 354 | // Check to see if this is a local sound only. If so, only delete it locally |
| 355 | if (mng_CheckIfPageOwned(&pl, TableUser) != 1) { |
| 356 | mng_FreeTrackLock(tl); |
| 357 | if (!mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 1)) { |
| 358 | mprintf(0, ErrorString); |
| 359 | Int3(); |
| 360 | } |
| 361 | } else // if its network, delete it from both the net and local drives |
| 362 | { |
| 363 | |
| 364 | mng_FreeTrackLock(tl); |
| 365 | mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 1); |
| 366 | mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 0); |
| 367 | |
| 368 | mng_DeletePagelock(Sounds[n].name, PAGETYPE_SOUND); |
| 369 | } |
| 370 | |
| 371 | // Advance to the next sound |
| 372 | D3EditState.current_sound = GetNextSound(n); |
| 373 | |
| 374 | FreeSound(n); |
| 375 | mng_EraseLocker(); |
| 376 | |
| 377 | OutrageMessageBox("Sound deleted."); |
| 378 | |
| 379 | RemapSounds(); |
| 380 | |
| 381 | UpdateDialog(); |
| 382 | } |
nothing calls this directly
no test coverage detected