| 578 | } |
| 579 | |
| 580 | void CWorldObjectsDoorDialog::OnDeleteDoor() { |
| 581 | int answer, tl; |
| 582 | mngs_Pagelock pl; |
| 583 | int n = D3EditState.current_door; |
| 584 | |
| 585 | if (Num_doors < 1) |
| 586 | return; |
| 587 | |
| 588 | // Check to see if we even have it locked |
| 589 | if ((tl = mng_FindTrackLock(Doors[n].name, PAGETYPE_DOOR)) == -1) { |
| 590 | OutrageMessageBox("This door is not yours to delete. Lock first."); |
| 591 | return; |
| 592 | } |
| 593 | |
| 594 | // Make sure its to be deleted |
| 595 | answer = MessageBox("Are you sure you want to delete this door?", Doors[n].name, MB_YESNO); |
| 596 | if (answer == IDNO) |
| 597 | return; |
| 598 | |
| 599 | if (!mng_MakeLocker()) |
| 600 | return; |
| 601 | |
| 602 | strcpy(pl.name, Doors[n].name); |
| 603 | pl.pagetype = PAGETYPE_DOOR; |
| 604 | |
| 605 | // Check to see if this is a local door only. If so, only delete it locally |
| 606 | if (mng_CheckIfPageOwned(&pl, TableUser) != 1) { |
| 607 | mng_FreeTrackLock(tl); |
| 608 | if (!mng_DeletePage(Doors[n].name, PAGETYPE_DOOR, 1)) { |
| 609 | mprintf(0, ErrorString); |
| 610 | Int3(); |
| 611 | } |
| 612 | } else // if its network, delete it from both the net and local drives |
| 613 | { |
| 614 | |
| 615 | mng_FreeTrackLock(tl); |
| 616 | mng_DeletePage(Doors[n].name, PAGETYPE_DOOR, 1); |
| 617 | mng_DeletePage(Doors[n].name, PAGETYPE_DOOR, 0); |
| 618 | |
| 619 | mng_DeletePagelock(Doors[n].name, PAGETYPE_DOOR); |
| 620 | } |
| 621 | |
| 622 | // Advance to the next door |
| 623 | D3EditState.current_door = GetNextDoor(n); |
| 624 | |
| 625 | FreePolyModel(Doors[n].model_handle); |
| 626 | FreeDoor(n); |
| 627 | mng_EraseLocker(); |
| 628 | |
| 629 | OutrageMessageBox("Door deleted."); |
| 630 | UpdateDialog(); |
| 631 | } |
| 632 | |
| 633 | // Gets a name from the user, making sure it's unique |
| 634 | // Returns true if got new name, false if cancelled. |
nothing calls this directly
no test coverage detected