raze/source/common/compositesaveame.h
Christoph Oelckers ba117554b0 - fixed savegame issues.
Since the code is extremely volatile I changed the setup so that the save is a zip file with the regular snapshot plus all added data as separate entries.
This allows compressing everything properly without savegame breaking interference.

Blood does not yet load its savegames, need to check.
2019-11-14 21:07:43 +01:00

39 lines
755 B
C++

#pragma once
#include <assert.h>
#include "files.h"
#include "zstring.h"
#include "tarray.h"
#include "filesystem/resourcefile.h"
class CompositeSavegameWriter
{
FString filename;
TDeletingArray<BufferWriter*> subfiles;
TArray<FString> subfilenames;
TArray<bool> isCompressed;
FCompressedBuffer CompressElement(BufferWriter* element, bool compress);
public:
void Clear()
{
subfiles.Reset();
subfilenames.Reset();
isCompressed.Reset();
}
void SetFileName(const char* fn)
{
filename = fn;
}
void SetFileName(const FString& fn)
{
filename = fn;
}
~CompositeSavegameWriter()
{
assert(subfiles.Size() == 0); // must be written out.
}
FileWriter& NewElement(const char* filename, bool compress = true);
bool WriteToFile();
};