| 356 | } |
| 357 | |
| 358 | void CFilePageDialog::OnLockFile() { |
| 359 | int r, n; |
| 360 | mngs_Pagelock temp_pl; |
| 361 | mngs_gamefile_page gamefilepage; |
| 362 | |
| 363 | if (Num_gamefiles < 1) |
| 364 | return; |
| 365 | |
| 366 | int *listbox_map; |
| 367 | int listbox_count = CreateIndexMap(&listbox_map, IDC_FILELIST); |
| 368 | if (!listbox_count) |
| 369 | return; |
| 370 | |
| 371 | if (!mng_MakeLocker()) { |
| 372 | mem_free(listbox_map); |
| 373 | return; |
| 374 | } |
| 375 | |
| 376 | CCheckListBox *list = (CCheckListBox *)GetDlgItem(IDC_FILELIST); |
| 377 | char buffer[_MAX_PATH], ext[_MAX_EXT]; |
| 378 | |
| 379 | for (int i = 0; i < listbox_count; i++) { |
| 380 | list->GetText(listbox_map[i], buffer); |
| 381 | ddio_SplitPath(buffer, NULL, NULL, ext); |
| 382 | if ((!stricmp(ext, ".d3l")) || (!stricmp(ext, ".cpp"))) { |
| 383 | if (MessageBox("Tisk Tisk, Now there you go, ignoring Jeff when he told you not to check levels and scripts\nout " |
| 384 | "through this dialog. Are you sure you want to ignore Jeff?\n(He doesn't like to be ignored)", |
| 385 | buffer, MB_YESNO) != IDYES) |
| 386 | continue; |
| 387 | } |
| 388 | |
| 389 | n = FindGameFile(buffer); |
| 390 | if (n == -1) |
| 391 | continue; |
| 392 | |
| 393 | // Make sure it can be locked |
| 394 | strcpy(temp_pl.name, Gamefiles[n].name); |
| 395 | temp_pl.pagetype = PAGETYPE_GAMEFILE; |
| 396 | |
| 397 | r = mng_CheckIfPageLocked(&temp_pl); |
| 398 | if (r == 2) { |
| 399 | int answer; |
| 400 | answer = OutrageMessageBox(MBOX_YESNO, "This page is not even in the table file, or the database maybe corrupt. " |
| 401 | "Override to 'Unlocked'? (Select NO if you don't know what you're doing)"); |
| 402 | if (answer == IDYES) { |
| 403 | strcpy(temp_pl.holder, "UNLOCKED"); |
| 404 | if (!mng_ReplacePagelock(temp_pl.name, &temp_pl)) |
| 405 | MessageBox(ErrorString, "Error!"); |
| 406 | } |
| 407 | } else if (r < 0) |
| 408 | OutrageMessageBox(ErrorString); |
| 409 | else if (r == 1) |
| 410 | OutrageMessageBox(InfoString); |
| 411 | else { |
| 412 | |
| 413 | // Everything is ok. Tell the network we're locking it and get a copy to |
| 414 | // our local drive |
| 415 | strcpy(temp_pl.holder, TableUser); |
nothing calls this directly
no test coverage detected