aboutsummaryrefslogtreecommitdiff
path: root/sword2/startup.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-09-08 07:10:54 +0000
committerTorbjörn Andersson2004-09-08 07:10:54 +0000
commit412f7105f06343c6a592a58df4b575fd64b74024 (patch)
tree70a5b6f55392470120ea4329c84f8f4ffa355251 /sword2/startup.cpp
parentd662863db152e85c85f82220e37eed20d89d7fdd (diff)
downloadscummvm-rg350-412f7105f06343c6a592a58df4b575fd64b74024.tar.gz
scummvm-rg350-412f7105f06343c6a592a58df4b575fd64b74024.tar.bz2
scummvm-rg350-412f7105f06343c6a592a58df4b575fd64b74024.zip
Fixed evil regression #2. Restarting the game, or using the "start" debug
command, would close the global script variables and player object resources, without reopening them again. This made them fair game for the resource expiration mechanism. The player object is probably referenced often enough to stay alive, but the variables died on me pretty quickly, causing ScummVM to crash. I've also added a "reslist" debug command to make this sort of things easier to spot. By default it only lists resources with refCount > 0. Use "reslist 0" to see all the cached resources as well. svn-id: r14958
Diffstat (limited to 'sword2/startup.cpp')
-rw-r--r--sword2/startup.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/sword2/startup.cpp b/sword2/startup.cpp
index f5899c1dc9..c7b5a49ac3 100644
--- a/sword2/startup.cpp
+++ b/sword2/startup.cpp
@@ -21,6 +21,7 @@
#include "common/file.h"
#include "sword2/sword2.h"
#include "sword2/console.h"
+#include "sword2/defs.h"
#include "sword2/interpreter.h"
#include "sword2/logic.h"
#include "sword2/maketext.h"
@@ -188,8 +189,8 @@ void Logic::conStart(int start) {
_vm->_resman->removeAll();
- // Reopen global variables resource and send address to interpreter
- _vm->_logic->resetScriptVars();
+ // Reopen global variables resource and player object
+ _vm->setupPersistentResources();
// Free all the route memory blocks from previous game
_router->freeAllRouteMem();
@@ -201,7 +202,7 @@ void Logic::conStart(int start) {
}
// Open George
- char *raw_data_ad = (char *) _vm->_resman->openResource(8);
+ char *raw_data_ad = (char *) _vm->_resman->openResource(CUR_PLAYER_ID);
char *raw_script = (char *) _vm->_resman->openResource(_startList[start].start_res_id);
// Denotes script to run
@@ -211,7 +212,7 @@ void Logic::conStart(int start) {
runScript(raw_script, raw_data_ad, &null_pc);
_vm->_resman->closeResource(_startList[start].start_res_id);
- _vm->_resman->closeResource(8);
+ _vm->_resman->closeResource(CUR_PLAYER_ID);
// Make sure there's a mouse, in case restarting while mouse not
// available