| 266 | } |
| 267 | |
| 268 | void CWorldSoundsDialog::OnCheckinSound() { |
| 269 | int n = D3EditState.current_sound; |
| 270 | mngs_Pagelock temp_pl; |
| 271 | int r; |
| 272 | |
| 273 | if (Num_sounds < 1) |
| 274 | return; |
| 275 | |
| 276 | if (!mng_MakeLocker()) |
| 277 | return; |
| 278 | |
| 279 | // Make sure we own this sound |
| 280 | strcpy(temp_pl.name, Sounds[n].name); |
| 281 | temp_pl.pagetype = PAGETYPE_SOUND; |
| 282 | |
| 283 | r = mng_CheckIfPageOwned(&temp_pl, TableUser); |
| 284 | if (r < 0) |
| 285 | OutrageMessageBox(ErrorString); |
| 286 | else if (r == 0) |
| 287 | OutrageMessageBox(InfoString); |
| 288 | else { |
| 289 | // Change the pagelock state to UNLOCKED |
| 290 | strcpy(temp_pl.holder, "UNLOCKED"); |
| 291 | if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) { |
| 292 | MessageBox(ErrorString, "Error!"); |
| 293 | mng_EraseLocker(); |
| 294 | return; |
| 295 | } else { |
| 296 | // Now actually replace the copy on the net with our local one |
| 297 | |
| 298 | if (!mng_ReplacePage(Sounds[n].name, Sounds[n].name, n, PAGETYPE_SOUND, 0)) |
| 299 | OutrageMessageBox(ErrorString); |
| 300 | else { |
| 301 | // Save this sound raw to the network for all |
| 302 | |
| 303 | std::filesystem::path srcname = LocalSoundsDir / SoundFiles[Sounds[n].sample_index].name; |
| 304 | std::filesystem::path destname = NetSoundsDir / SoundFiles[Sounds[n].sample_index].name; |
| 305 | |
| 306 | cf_CopyFile(destname, srcname); |
| 307 | |
| 308 | OutrageMessageBox("Sound checked in."); |
| 309 | |
| 310 | // Delete it from local pagefile if its there |
| 311 | int dret = mng_DeletePage(Sounds[n].name, PAGETYPE_SOUND, 1); |
| 312 | ASSERT(dret == 1); |
| 313 | mng_EraseLocker(); |
| 314 | |
| 315 | // Free the tracklock |
| 316 | int p = mng_FindTrackLock(Sounds[n].name, PAGETYPE_SOUND); |
| 317 | ASSERT(p != -1); |
| 318 | mng_FreeTrackLock(p); |
| 319 | UpdateDialog(); |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | void CWorldSoundsDialog::OnDeleteSound() { |
nothing calls this directly
no test coverage detected