fixed the 'too many verbs' bug: verbid is 16 bits but was stored in save games as a byte. This means that existing savegames are still affected by the bug

svn-id: r6376
This commit is contained in:
Max Horn 2003-01-09 22:53:21 +00:00
parent 86dea678e2
commit c3657ff637
3 changed files with 20 additions and 13 deletions

View File

@ -322,7 +322,10 @@ void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion)
MKLINE(VerbSlot, oldtop, sleInt16, VER_V8),
MKLINE(VerbSlot, oldright, sleInt16, VER_V8),
MKLINE(VerbSlot, oldbottom, sleInt16, VER_V8),
MKLINE(VerbSlot, verbid, sleByte, VER_V8),
MKLINE_OLD(VerbSlot, verbid, sleByte, VER_V8, VER_V11),
MKLINE(VerbSlot, verbid, sleInt16, VER_V12),
MKLINE(VerbSlot, color, sleByte, VER_V8),
MKLINE(VerbSlot, hicolor, sleByte, VER_V8),
MKLINE(VerbSlot, dimcolor, sleByte, VER_V8),

View File

@ -25,13 +25,14 @@
// Support for "old" savegames (made with 2501 CVS build)
// Can be useful for other ports too :)
#define VER_V12 12
#define VER_V11 11
#define VER_V10 10
#define VER_V9 9
#define VER_V8 8
#define VER_V7 7
#define CURRENT_VER VER_V11
#define CURRENT_VER VER_V12
// To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,

View File

@ -37,7 +37,6 @@
void Scumm_v8::setupOpcodes()
{
// TODO: any of the o6_ entries are potentially wrong and pure guesses :-)
static const OpcodeEntryV8 opcodes[256] = {
/* 00 */
OPCODE(o6_invalid),
@ -1154,16 +1153,21 @@ void Scumm_v8::o8_verbOps()
_verbRedraw = true;
if (0 <= _curVerbSlot && _curVerbSlot < _maxVerbs)
vs = &_verbs[_curVerbSlot];
if (subOp != 0x96)
assert(vs);
switch (subOp) {
case 0x96: // SO_VERB_INIT Choose verb number for editing
if (subOp == 0x96) {
_curVerb = pop();
_curVerbSlot = getVerbSlot(_curVerb, 0);
checkRange(_maxVerbs - 1, 0, _curVerbSlot, "Illegal new verb slot %d");
//printf("Setting current actor to %d\n", _curActor);
return;
}
assert(0 <= _curVerbSlot && _curVerbSlot < _maxVerbs);
vs = &_verbs[_curVerbSlot];
assert(vs);
switch (subOp) {
case 0x96: // SO_VERB_INIT Choose verb number for editing
// handled above!
break;
case 0x97: // SO_VERB_NEW New verb
if (_curVerbSlot == 0) {
@ -1171,9 +1175,8 @@ void Scumm_v8::o8_verbOps()
if (_verbs[slot].verbid == 0)
break;
}
if (slot == _maxVerbs) {
warning("Too many verbs");
break;
if (slot >= _maxVerbs) {
error("Too many verbs");
}
_curVerbSlot = slot;
}