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

Function DeleteGamefile

editor/ScriptLevelInterface.cpp:1020–1062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1018}
1019
1020bool DeleteGamefile(char *tempbuffer) {
1021 int tl;
1022 mngs_Pagelock pl;
1023 bool removed = false;
1024
1025 // verify that we have it locked
1026 if ((tl = mng_FindTrackLock(tempbuffer, PAGETYPE_GAMEFILE)) == -1) {
1027 OutrageMessageBox("%s is not yours to delete. Hmmm. Get Jeff", tempbuffer);
1028 Int3();
1029 return false;
1030 }
1031
1032 strcpy(pl.name, tempbuffer);
1033 pl.pagetype = PAGETYPE_GAMEFILE;
1034
1035 // Check to see if this is a local gamefile only. If so, only delete it locally
1036 if (mng_CheckIfPageOwned(&pl, TableUser) != 1) {
1037 mng_FreeTrackLock(tl);
1038 if (!mng_DeletePage(tempbuffer, PAGETYPE_GAMEFILE, 1)) {
1039 mprintf(0, ErrorString);
1040 Int3();
1041 } else {
1042 removed = true;
1043 }
1044 } else { // if its network, delete it from both the net and local drives
1045 mng_FreeTrackLock(tl);
1046 mng_DeletePage(tempbuffer, PAGETYPE_GAMEFILE, 1);
1047 mng_DeletePage(tempbuffer, PAGETYPE_GAMEFILE, 0);
1048 mng_DeletePagelock(tempbuffer, PAGETYPE_GAMEFILE);
1049 removed = true;
1050 }
1051
1052 if (removed) {
1053 for (int gf = 0; gf < MAX_GAMEFILES; gf++) {
1054 if (Gamefiles[gf].used && (!stricmp(tempbuffer, Gamefiles[gf].name))) {
1055 FreeGamefile(gf);
1056 break;
1057 }
1058 }
1059 }
1060
1061 return true;
1062}
1063
1064bool AddNewGameFile(char *fullpath, char *directory) {
1065 char cur_name[100];

Callers 2

DeleteLevelMethod · 0.85
DeleteScriptMethod · 0.85

Calls 7

mng_FindTrackLockFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_CheckIfPageOwnedFunction · 0.85
mng_FreeTrackLockFunction · 0.85
mng_DeletePageFunction · 0.85
mng_DeletePagelockFunction · 0.85
FreeGamefileFunction · 0.85

Tested by

no test coverage detected