Saveload: Add special proc op for whether to save chunk
This commit is contained in:
@@ -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);
|
||||||
|
|
||||||
|
@@ -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);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user