MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnDoorChangeName

Method OnDoorChangeName

editor/WorldObjectsDoorDialog.cpp:659–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657}
658
659void 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
709void CWorldObjectsDoorDialog::OnDoorNext() {
710 D3EditState.current_door = GetNextDoor(D3EditState.current_door);

Callers

nothing calls this directly

Calls 9

mng_FindTrackLockFunction · 0.85
OutrageMessageBoxFunction · 0.85
InputDoorNameFunction · 0.85
mng_MakeLockerFunction · 0.85
mng_CheckIfPageOwnedFunction · 0.85
mng_RenamePageFunction · 0.85
mng_ReplacePageFunction · 0.85
mng_FreeTrackLockFunction · 0.85
mng_EraseLockerFunction · 0.85

Tested by

no test coverage detected