[Scummvm-cvs-logs] CVS: scummvm/scumm script_v2.cpp,2.115,2.116 script_v5.cpp,1.95,1.96
Max Horn
fingolfin at users.sourceforge.net
Thu May 22 17:23:06 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv4950
Modified Files:
script_v2.cpp script_v5.cpp
Log Message:
some well placed asserts (triggering any of those means with 99% a bug in some other place; so don't just remove the asserts if you trigger one of 'em!
Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.115
retrieving revision 2.116
diff -u -d -r2.115 -r2.116
--- script_v2.cpp 23 May 2003 00:04:17 -0000 2.115
+++ script_v2.cpp 23 May 2003 00:22:41 -0000 2.116
@@ -642,7 +642,9 @@
}
void Scumm_v2::o2_waitForActor() {
- if (derefActorSafe(getVarOrDirectByte(0x80), "o2_waitForActor")->moving) {
+ Actor *a = derefActorSafe(getVarOrDirectByte(0x80), "o2_waitForActor");
+ assert(a);
+ if (a->moving) {
_scriptPointer -= 2;
o5_breakHere();
}
@@ -672,6 +674,8 @@
_opcode = fetchScriptByte();
if (!a) {
+ // This case happens in the Zak/MM bootscript exactly once each, to
+ // set the default talk color (9).
return;
}
@@ -983,10 +987,11 @@
int x, y;
Actor *a;
a = derefActorSafe(getVarOrDirectByte(0x80), "o2_walkActorTo");
+ assert(a);
+
x = getVarOrDirectByte(0x40) * 8;
y = getVarOrDirectByte(0x20) * 2;
- assert(a);
a->startWalkActor(x, y, -1);
}
@@ -1050,9 +1055,7 @@
int elevation = getVarOrDirectByte(0x40);
Actor *a = derefActorSafe(act, "o2_setActorElevation");
- if (!a)
- return;
-
+ assert(a);
a->elevation = elevation;
}
@@ -1061,9 +1064,7 @@
int anim = getVarOrDirectByte(0x40);
Actor *a = derefActorSafe(act, "o2_animateActor");
- if (!a)
- return;
-
+ assert(a);
a->animateActor(anim);
}
@@ -1114,6 +1115,7 @@
room = getVarOrDirectByte(0x40);
a = derefActorSafe(VAR(VAR_EGO), "o2_loadRoomWithEgo");
+ assert(a);
a->putActor(0, 0, room);
_egoPositioned = false;
@@ -1364,10 +1366,8 @@
Actor *a;
getResultPos();
a = derefActorSafe(getVarOrDirectByte(0x80), "o2_getActorWalkbox");
- if (a)
- setResult(a->walkbox);
- else
- setResult(0);
+ assert(a);
+ setResult(a->walkbox);
}
void Scumm_v2::o2_dummy() {
Index: script_v5.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v5.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- script_v5.cpp 22 May 2003 14:10:19 -0000 1.95
+++ script_v5.cpp 23 May 2003 00:22:41 -0000 1.96
@@ -2358,8 +2358,7 @@
int nr;
int nr2 = getVarOrDirectByte(0x80);
a = derefActorSafe(nr2, "o5_walkActorToActor");
- if (!a)
- return;
+ assert(a);
if (!a->isInCurrentRoom()) {
getVarOrDirectByte(0x40);
@@ -2375,8 +2374,7 @@
}
// warning("walk actor %d to actor %d", nr, nr2);
a2 = derefActorSafe(nr, "o5_walkActorToActor(2)");
- if (!a2)
- return;
+ assert(a2);
if (!a2->isInCurrentRoom()) {
fetchScriptByte();
More information about the Scummvm-git-logs
mailing list