From b9be9d1065fd68deecd985b6557d54411eebc71c Mon Sep 17 00:00:00 2001 From: James Brown Date: Wed, 8 May 2002 06:57:27 +0000 Subject: [PATCH] Fix a mistake in the resource loader. svn-id: r4239 --- resource.cpp | 11 +++++++---- script_v1.cpp | 10 ++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/resource.cpp b/resource.cpp index 9cf71057189..a617595c519 100644 --- a/resource.cpp +++ b/resource.cpp @@ -470,7 +470,7 @@ int Scumm::loadResource(int type, int idx) uint32 fileOffs; uint32 size, tag; -// debug(1, "loadResource(%s,%d)", resTypeFromId(type),idx); + // debug(1, "loadResource(%s,%d)", resTypeFromId(type),idx); if (type == rtCharset && (_features & GF_SMALL_HEADER)) { loadCharset(idx); @@ -478,9 +478,12 @@ int Scumm::loadResource(int type, int idx) } roomNr = getResourceRoomNr(type, idx); - if (roomNr == 0 || idx >= res.num[type]) { - error("%s %d undefined", res.name[type], idx); - } + + if (idx >= res.num[type]) + error("%s %d undefined %d %d", res.name[type], idx, res.num[type], roomNr); + + if (roomNr == 0) + roomNr = _roomResource; if (type == rtRoom) { fileOffs = 0; diff --git a/script_v1.cpp b/script_v1.cpp index 87ddf658a54..aaf2de02c0d 100644 --- a/script_v1.cpp +++ b/script_v1.cpp @@ -825,19 +825,17 @@ void Scumm::o5_actorSetClass() { int act = getVarOrDirectWord(0x80); int newClass; - + while ((_opcode = fetchScriptByte()) != 0xFF) { newClass = getVarOrDirectWord(0x80); if (newClass == 0) { _classData[act] = 0; - - if( _features & GF_SMALL_HEADER) + if((_features & GF_SMALL_HEADER) && act <= NUM_ACTORS) { Actor *a; - a=derefActor(act); + a = derefActorSafe(act, "actorSetClass"); a->forceClip=0; - } - + } continue; }