Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SInt32 DeleteFaceGenData(StaticFunctionTag*, TESNPC * npc)
- {
- SInt32 ret = 0;
- if (!npc) {
- _ERROR("%s - invalid actorbase.", __FUNCTION__);
- return -1;
- }
- char * modName = NULL;
- UInt8 modIndex = npc->formID >> 24;
- UInt32 modForm = (npc->formID & 0xFFFFFF);
- DataHandler * dataHandler = DataHandler::GetSingleton();
- if (dataHandler) {
- ModInfo * modInfo = dataHandler->modList.modInfoList.GetNthItem(modIndex);
- if (modInfo)
- modName = modInfo->name;
- }
- enum
- {
- kReturnDeletedNif = 1,
- kReturnDeletedDDS = 2
- };
- char tempPath[MAX_PATH];
- sprintf_s(tempPath, "Data\\Meshes\\Actors\\Character\\FaceGenData\\FaceGeom\\%s\\%08X.nif", modName, modForm);
- if (!DeleteFile(tempPath)) {
- UInt32 lastError = GetLastError();
- switch (lastError) {
- case ERROR_FILE_NOT_FOUND: // We don't need to display a message for this
- break;
- case ERROR_ACCESS_DENIED:
- _ERROR("%s - access denied could not delete %s", __FUNCTION__, tempPath);
- break;
- default:
- _ERROR("%s - error deleting file %s (Error %d)", __FUNCTION__, tempPath, lastError);
- break;
- }
- }
- else
- ret |= kReturnDeletedNif;
- sprintf_s(tempPath, "Data\\Textures\\Actors\\Character\\FaceGenData\\FaceTint\\%s\\%08X.dds", modName, modForm);
- if (!DeleteFile(tempPath)) {
- UInt32 lastError = GetLastError();
- switch (lastError) {
- case ERROR_FILE_NOT_FOUND: // We don't need to display a message for this
- break;
- case ERROR_ACCESS_DENIED:
- _ERROR("%s - access denied could not delete %s", __FUNCTION__, tempPath);
- break;
- default:
- _ERROR("%s - error deleting file %s (Error %d)", __FUNCTION__, tempPath, lastError);
- break;
- }
- }
- else
- ret |= kReturnDeletedDDS;
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement