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

Method OnDeleteDoor

editor/WorldObjectsDoorDialog.cpp:580–631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578}
579
580void 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.

Callers

nothing calls this directly

Calls 11

mng_FindTrackLockFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_MakeLockerFunction · 0.85
mng_CheckIfPageOwnedFunction · 0.85
mng_FreeTrackLockFunction · 0.85
mng_DeletePageFunction · 0.85
mng_DeletePagelockFunction · 0.85
GetNextDoorFunction · 0.85
FreePolyModelFunction · 0.85
FreeDoorFunction · 0.85
mng_EraseLockerFunction · 0.85

Tested by

no test coverage detected