| 657 | } |
| 658 | |
| 659 | void CWorldObjectsDoorDialog::OnDoorChangeName() { |
| 660 | int n = D3EditState.current_door; |
| 661 | char name[PAGENAME_LEN]; |
| 662 | mngs_Pagelock pl; |
| 663 | |
| 664 | // Make sure we have this door locked, if not reset name and bail |
| 665 | int p = mng_FindTrackLock(Doors[n].name, PAGETYPE_DOOR); |
| 666 | if (p == -1) { |
| 667 | OutrageMessageBox("You must lock this door if you wish to change its name."); |
| 668 | return; |
| 669 | } |
| 670 | |
| 671 | // Get new name |
| 672 | strcpy(name, Doors[n].name); |
| 673 | if (!InputDoorName(name, sizeof(name), "Door name", "Enter a new name for this door:", this)) |
| 674 | return; |
| 675 | |
| 676 | if (!mng_MakeLocker()) |
| 677 | return; |
| 678 | |
| 679 | // Check to see if this page exists on the network. If so, we have to |
| 680 | // rename it so we can prevent havoc |
| 681 | strcpy(pl.name, Doors[n].name); |
| 682 | pl.pagetype = PAGETYPE_DOOR; |
| 683 | |
| 684 | int ret = mng_CheckIfPageOwned(&pl, TableUser); |
| 685 | if (ret < 0) |
| 686 | OutrageMessageBox(ErrorString); |
| 687 | else if (ret == 1) |
| 688 | mng_RenamePage(Doors[n].name, name, PAGETYPE_DOOR); |
| 689 | else if (ret == 2) { |
| 690 | // This page has never been checked in, replace only local copy |
| 691 | |
| 692 | char oldname[PAGENAME_LEN]; |
| 693 | strcpy(oldname, Doors[n].name); |
| 694 | strcpy(Doors[n].name, name); |
| 695 | mng_ReplacePage(oldname, Doors[n].name, n, PAGETYPE_DOOR, 1); |
| 696 | } else if (ret == 0) { |
| 697 | OutrageMessageBox("You don't own this page. Get Jason now!"); |
| 698 | mng_FreeTrackLock(p); |
| 699 | return; |
| 700 | } |
| 701 | |
| 702 | // Finally, copy our new name to the appropriate arrays |
| 703 | strcpy(GlobalTrackLocks[p].name, name); |
| 704 | strcpy(Doors[n].name, name); |
| 705 | UpdateDialog(); |
| 706 | mng_EraseLocker(); |
| 707 | } |
| 708 | |
| 709 | void CWorldObjectsDoorDialog::OnDoorNext() { |
| 710 | D3EditState.current_door = GetNextDoor(D3EditState.current_door); |
nothing calls this directly
no test coverage detected