aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/intmap.h2
-rw-r--r--engines/sci/engine/savegame.cpp41
-rw-r--r--engines/sci/engine/seg_manager.h9
3 files changed, 26 insertions, 26 deletions
diff --git a/engines/sci/engine/intmap.h b/engines/sci/engine/intmap.h
index 4ada14542a..2cb4f69f1f 100644
--- a/engines/sci/engine/intmap.h
+++ b/engines/sci/engine/intmap.h
@@ -32,8 +32,6 @@
namespace Sci {
-
-
// Assumes that the ints are relatively evenly distributed
enum {
DCS_INT_HASH_MAX = 256
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 74ef6c9ccc..dba01f0c0f 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -92,10 +92,6 @@ static void sync_song_t(Common::Serializer &s, song_t &obj) {
}
}
-static void sync_IntMapper(Common::Serializer &s, IntMapper &obj) {
- obj.saveLoadWithSerializer(s);
-}
-
/**
* Sync a Common::Array using a Common::Serializer.
@@ -175,25 +171,25 @@ void Menubar::saveLoadWithSerializer(Common::Serializer &s) {
syncArray<Menu>(s, _menus);
}
-static void sync_SegManager(Common::Serializer &s, SegManager &obj) {
- int allocated_heap_size = obj.heap_size;
- s.syncAsSint32LE(obj.heap_size);
- s.syncAsSint32LE(obj.reserved_id);
- s.syncAsSint32LE(obj.exports_wide);
- s.syncAsSint32LE(obj.gc_mark_bits);
- s.syncAsUint32LE(obj.mem_allocated);
+void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
+ int allocated_heap_size = heap_size;
+ s.syncAsSint32LE(heap_size);
+ s.syncAsSint32LE(reserved_id);
+ s.syncAsSint32LE(exports_wide);
+ s.syncAsSint32LE(gc_mark_bits);
+ s.syncAsUint32LE(mem_allocated);
- sync_IntMapper(s, *obj.id_seg_map);
+ id_seg_map->saveLoadWithSerializer(s);
- assert(obj.heap);
- if (allocated_heap_size != obj.heap_size)
- obj.heap = (MemObject**)sci_realloc((void *)obj.heap, obj.heap_size * sizeof(MemObject *));
- for (int i = 0; i < obj.heap_size; ++i)
- sync_MemObjPtr(s, obj.heap[i]);
+ assert(heap);
+ if (allocated_heap_size != heap_size)
+ heap = (MemObject**)sci_realloc((void *)heap, heap_size * sizeof(MemObject *));
+ for (int i = 0; i < heap_size; ++i)
+ sync_MemObjPtr(s, heap[i]);
- s.syncAsSint32LE(obj.Clones_seg_id);
- s.syncAsSint32LE(obj.Lists_seg_id);
- s.syncAsSint32LE(obj.Nodes_seg_id);
+ s.syncAsSint32LE(Clones_seg_id);
+ s.syncAsSint32LE(Lists_seg_id);
+ s.syncAsSint32LE(Nodes_seg_id);
}
static void sync_SegManagerPtr(Common::Serializer &s, SegManager *&obj) {
@@ -212,7 +208,7 @@ static void sync_SegManagerPtr(Common::Serializer &s, SegManager *&obj) {
obj = new SegManager(sci11);
}
- sync_SegManager(s, *obj);
+ obj->saveLoadWithSerializer(s);
}
@@ -365,7 +361,8 @@ static void sync_Script(Common::Serializer &s, Script &obj) {
assert(s.isLoading());
obj.obj_indices = new IntMapper();
}
- sync_IntMapper(s, *obj.obj_indices);
+
+ obj.obj_indices->saveLoadWithSerializer(s);
s.syncAsSint32LE(obj.exports_nr);
s.syncAsSint32LE(obj.synonyms_nr);
diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h
index 9808d93d40..109c7a9332 100644
--- a/engines/sci/engine/seg_manager.h
+++ b/engines/sci/engine/seg_manager.h
@@ -26,6 +26,8 @@
#ifndef SCI_ENGINE_SEG_MANAGER_H
#define SCI_ENGINE_SEG_MANAGER_H
+#include "common/scummsys.h"
+#include "common/serializer.h"
#include "sci/engine/vm.h"
namespace Sci {
@@ -48,7 +50,7 @@ enum idFlag {
class SegInterface;
-class SegManager {
+class SegManager : public Common::Serializable {
public:
// Initialize the segment manager
SegManager(bool sci1_1);
@@ -56,6 +58,8 @@ public:
// Deallocate all memory associated with the segment manager
~SegManager();
+ virtual void saveLoadWithSerializer(Common::Serializer &ser);
+
// 1. Scripts
void freeScript(Script &scr);
@@ -381,8 +385,9 @@ public:
int scriptMarkedDeleted(int script_nr);
int initialiseScript(Script &scr, EngineState *s, int script_nr);
-public: // TODO: make private
+private:
IntMapper *id_seg_map; // id - script id; seg - index of heap
+public: // TODO: make private
MemObject **heap;
int heap_size; // size of the heap
int reserved_id;