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

Method OnGenericDelete

editor/WorldObjectsGenericDialog.cpp:848–911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

846}
847
848void CWorldObjectsGenericDialog::OnGenericDelete() {
849 int answer, tl;
850 mngs_Pagelock pl;
851 int old_current;
852
853 if (m_current == -1)
854 return;
855
856 // Check to see if we even have it locked
857 if ((tl = mng_FindTrackLock(Object_info[m_current].name, PAGETYPE_GENERIC)) == -1) {
858 OutrageMessageBox("This object is not yours to delete. Lock first.");
859 return;
860 }
861
862 // Make sure its to be deleted
863 answer = MessageBox("Are you sure you want to delete this object?", Object_info[m_current].name, MB_YESNO);
864 if (answer == IDNO)
865 return;
866
867 if (!mng_MakeLocker())
868 return;
869
870 strcpy(pl.name, Object_info[m_current].name);
871 pl.pagetype = PAGETYPE_GENERIC;
872
873 // Check to see if this is a local object only. If so, only delete it locally
874 if (mng_CheckIfPageOwned(&pl, TableUser) != 1) {
875 mng_FreeTrackLock(tl);
876 if (!mng_DeletePage(Object_info[m_current].name, PAGETYPE_GENERIC, 1)) {
877 mprintf(0, ErrorString);
878 Int3();
879 }
880 } else // if its network, delete it from both the net and local drives
881 {
882
883 mng_FreeTrackLock(tl);
884 mng_DeletePage(Object_info[m_current].name, PAGETYPE_GENERIC, 0);
885 mng_DeletePage(Object_info[m_current].name, PAGETYPE_GENERIC, 1);
886
887 mng_DeletePagelock(Object_info[m_current].name, PAGETYPE_GENERIC);
888 }
889
890 // Advance to the next object
891 old_current = m_current;
892 m_current = GetNextObjectID(m_current);
893 if (m_current == old_current)
894 m_current = -1;
895
896 FreePolyModel(Object_info[old_current].render_handle);
897
898 if (Object_info[old_current].med_render_handle != -1)
899 FreePolyModel(Object_info[old_current].med_render_handle);
900 if (Object_info[old_current].lo_render_handle != -1)
901 FreePolyModel(Object_info[old_current].lo_render_handle);
902
903 FreeObjectID(old_current);
904 mng_EraseLocker();
905

Callers

nothing calls this directly

Calls 12

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
GetNextObjectIDFunction · 0.85
FreePolyModelFunction · 0.85
FreeObjectIDFunction · 0.85
mng_EraseLockerFunction · 0.85
RemapStaticIDsFunction · 0.85

Tested by

no test coverage detected