[]KAOS[]Casey wrote on Oct 15
th, 2015 at 4:19pm:
Now I'm wondering why I didn't think of using conforming
Took me actually a few months to come up with that solution. Before I tried all kinds of stuff like checking/fixing/netroles, etc, ... just a lot of awful trial and error.
However I have no special handling for MyLevel, basically just:
FString SaveDir = SaveDirString( DirectoryIndex );
FString IniFile = SaveDir + TEXT("\\Save.ini");
GFileManager->MakeDirectory( *SaveDir );
FString ConformPackage, ConformFile;
INT Generation = 0;
GConfig->GetInt( TEXT("Generations"), *(LevelInfo->MapName), Generation, *IniFile );
ConformPackage = LevelInfo->MapName + TEXT("_OLD");
ConformFile = FString::Printf( TEXT("..\\Maps\\%s.dx"), *(LevelInfo->MapName) );
FString SaveFile = FString::Printf( TEXT("%s\\%s.s%02d"), *SaveDir, *(LevelInfo->MapName), Generation + 1 );
BeginLoad();
ULinkerLoad* OldLinker = GetPackageLinker( CreatePackage( NULL, *ConformPackage ), *ConformFile, LOAD_NoWarn | LOAD_NoVerify, NULL, NULL );
EndLoad();
One thing which is still odd, is that I can't overwrite the current loaded map (save) package, so I need to increment the filename/extension and keep track of it manually.
However one approach could be to save it to a temporary name and move it once the new map is loaded.