aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/script.cpp6
-rw-r--r--engines/sci/engine/script.h2
-rw-r--r--engines/sci/engine/seg_manager.cpp2
3 files changed, 6 insertions, 4 deletions
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index 4932c16e73..5191c1a7d8 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -47,7 +47,7 @@ Script::~Script() {
freeScript();
}
-void Script::freeScript() {
+void Script::freeScript(const bool keepLocalsSegment) {
_nr = 0;
_buf.clear();
@@ -59,7 +59,9 @@ void Script::freeScript() {
_numSynonyms = 0;
_localsOffset = 0;
- _localsSegment = 0;
+ if (!keepLocalsSegment) {
+ _localsSegment = 0;
+ }
_localsBlock = NULL;
_localsCount = 0;
diff --git a/engines/sci/engine/script.h b/engines/sci/engine/script.h
index b59f87f13a..1befef1c8a 100644
--- a/engines/sci/engine/script.h
+++ b/engines/sci/engine/script.h
@@ -132,7 +132,7 @@ public:
Script();
~Script();
- void freeScript();
+ void freeScript(const bool keepLocalsSegment = false);
void load(int script_nr, ResourceManager *resMan, ScriptPatcher *scriptPatcher);
virtual bool isValidOffset(uint32 offset) const;
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 168303684d..3cf9d08ceb 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -1017,7 +1017,7 @@ int SegManager::instantiateScript(int scriptNum) {
scr->incrementLockers();
return segmentId;
} else {
- scr->freeScript();
+ scr->freeScript(true);
}
} else {
scr = allocateScript(scriptNum, &segmentId);