MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Osiris_SaveMemoryChunks

Function Osiris_SaveMemoryChunks

Descent3/OsirisLoadandBind.cpp:3005–3028  ·  view source on GitHub ↗

Osiris_SaveMemoryChunks Purpose: Saves out the 'auto manage' script memory to file

Source from the content-addressed store, hash-verified

3003// Purpose:
3004// Saves out the 'auto manage' script memory to file
3005void Osiris_SaveMemoryChunks(CFILE *file) {
3006 tOSIRISMEMNODE *curr;
3007 curr = Osiris_mem_root;
3008
3009 while (curr) {
3010 cf_WriteInt(file, curr->chunk_id.size);
3011 cf_WriteByte(file, curr->chunk_id.my_id.type);
3012 switch (curr->chunk_id.my_id.type) {
3013 case OBJECT_SCRIPT:
3014 cf_WriteInt(file, curr->chunk_id.my_id.objhandle);
3015 break;
3016 case TRIGGER_SCRIPT:
3017 cf_WriteInt(file, curr->chunk_id.my_id.triggernum);
3018 break;
3019 case LEVEL_SCRIPT:
3020 break;
3021 }
3022 cf_WriteInt(file, curr->chunk_id.id);
3023 cf_WriteBytes((uint8_t *)curr->memory, curr->chunk_id.size, file);
3024 curr = curr->next;
3025 }
3026
3027 cf_WriteInt(file, 0);
3028}
3029
3030// Osiris_RestoreMemoryChunks
3031// Purpose:

Callers 1

Osiris_SaveSystemStateFunction · 0.85

Calls 3

cf_WriteIntFunction · 0.85
cf_WriteByteFunction · 0.85
cf_WriteBytesFunction · 0.85

Tested by

no test coverage detected