Saveload: Add special proc op for whether to save chunk

This commit is contained in:
Jonathan G Rennison
2023-03-21 18:57:50 +00:00
parent b4f32e44d9
commit a57a909deb
2 changed files with 6 additions and 0 deletions

View File

@@ -2310,6 +2310,10 @@ static void SlSaveChunk(const ChunkHandler &ch)
/* Don't save any chunk information if there is no save handler. */ /* Don't save any chunk information if there is no save handler. */
if (proc == nullptr) return; if (proc == nullptr) return;
if (ch.special_proc != nullptr) {
if (ch.special_proc(ch.id, CSLSO_SHOULD_SAVE_CHUNK) == CSLSOR_DONT_SAVE_CHUNK) return;
}
SlWriteUint32(ch.id); SlWriteUint32(ch.id);
DEBUG(sl, 2, "Saving chunk %c%c%c%c", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id); DEBUG(sl, 2, "Saving chunk %c%c%c%c", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id);

View File

@@ -85,10 +85,12 @@ void SlUnreachablePlaceholder();
enum ChunkSaveLoadSpecialOp { enum ChunkSaveLoadSpecialOp {
CSLSO_PRE_LOAD, CSLSO_PRE_LOAD,
CSLSO_PRE_LOADCHECK, CSLSO_PRE_LOADCHECK,
CSLSO_SHOULD_SAVE_CHUNK,
}; };
enum ChunkSaveLoadSpecialOpResult { enum ChunkSaveLoadSpecialOpResult {
CSLSOR_NONE, CSLSOR_NONE,
CSLSOR_LOAD_CHUNK_CONSUMED, CSLSOR_LOAD_CHUNK_CONSUMED,
CSLSOR_DONT_SAVE_CHUNK,
}; };
typedef ChunkSaveLoadSpecialOpResult ChunkSaveLoadSpecialProc(uint32, ChunkSaveLoadSpecialOp); typedef ChunkSaveLoadSpecialOpResult ChunkSaveLoadSpecialProc(uint32, ChunkSaveLoadSpecialOp);