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

Function UndoCheckOutGamefile

editor/ScriptLevelInterface.cpp:1234–1281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1232}
1233
1234bool UndoCheckOutGamefile(char *tempbuffer) {
1235 int tl, n;
1236 mngs_Pagelock pl;
1237 mngs_gamefile_page gamefilepage;
1238
1239 for (n = 0; n < MAX_GAMEFILES; n++) {
1240 if (Gamefiles[n].used && (!stricmp(Gamefiles[n].name, tempbuffer))) {
1241 break;
1242 }
1243 }
1244
1245 if (n == MAX_GAMEFILES)
1246 return false;
1247
1248 // Should have this item locked
1249 if ((tl = mng_FindTrackLock(Gamefiles[n].name, PAGETYPE_GAMEFILE)) == -1)
1250 return false;
1251
1252 // Make sure its to be deleted
1253 if (OutrageMessageBox(MBOX_YESNO,
1254 "Are you sure you want to undo your lock on %s and lose any changes you may have made?",
1255 tempbuffer) != IDYES)
1256 return false;
1257
1258 strcpy(pl.name, Gamefiles[n].name);
1259 pl.pagetype = PAGETYPE_GAMEFILE;
1260
1261 mng_FreeTrackLock(tl);
1262
1263 // Delete local page
1264 if (!mng_DeletePage(Gamefiles[n].name, PAGETYPE_GAMEFILE, 1)) {
1265 mprintf(0, ErrorString);
1266 Int3();
1267 }
1268
1269 // Get old data from net
1270 if (!mng_FindSpecificGamefilePage(pl.name, &gamefilepage, 0)) {
1271 Int3();
1272 return false;
1273 }
1274
1275 if (!mng_AssignGamefilePageToGamefile(&gamefilepage, n)) {
1276 Int3();
1277 return false;
1278 }
1279
1280 return true;
1281}
1282
1283bool CScriptLevelInterface::DeleteLevel() {
1284 CCheckListBox *list = (CCheckListBox *)GetDlgItem(IDC_LIST_CHECKEDOUT);

Callers 2

UndoCheckOutScriptsMethod · 0.85
UndoCheckOutLevelsMethod · 0.85

Calls 6

mng_FindTrackLockFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_FreeTrackLockFunction · 0.85
mng_DeletePageFunction · 0.85

Tested by

no test coverage detected