MCPcopy Create free account
hub / github.com/diasurgical/devilution / SFileCloseArchive

Function SFileCloseArchive

3rdParty/StormLib/src/SFileOpenArchive.cpp:593–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

591//
592
593bool STORMAPI SFileCloseArchive(HANDLE hMpq)
594{
595 TMPQArchive * ha = IsValidMpqHandle(hMpq);
596 bool bResult = true;
597
598 // Only if the handle is valid
599 if(ha == NULL)
600 {
601 SetLastError(ERROR_INVALID_HANDLE);
602 return false;
603 }
604
605 // Invalidate the add file callback so it won't be called
606 // when saving (listfile) and (attributes)
607 ha->pfnAddFileCB = NULL;
608 ha->pvAddFileUserData = NULL;
609
610#ifdef FULL
611 // Flush all unsaved data to the storage
612 bResult = SFileFlushArchive(hMpq);
613#endif
614
615 // Free all memory used by MPQ archive
616 FreeArchiveHandle(ha);
617 return bResult;
618}

Callers 2

init_cleanupFunction · 0.85
pfile_SFileCloseArchiveFunction · 0.85

Calls 4

IsValidMpqHandleFunction · 0.85
SetLastErrorFunction · 0.85
SFileFlushArchiveFunction · 0.85
FreeArchiveHandleFunction · 0.85

Tested by

no test coverage detected