More array code cleanup

svn-id: r14406
This commit is contained in:
Max Horn 2004-08-01 02:03:07 +00:00
parent 182dd48bd4
commit c87d33a102

View file

@ -407,18 +407,17 @@ ArrayHeader *ScummEngine_v6::defineArray(int array, int type, int dim2, int dim1
if (_heversion >= 60) { if (_heversion >= 60) {
// FIXME: Fingolfin asks: What is this change good for? It doesn't hurt, if (type == kBitArray || type == kNibbleArray)
// but it also has no effect whatsoever... type = kByteArray;
if (type == 1 || type == 2)
type = 3;
} else { } else {
// The following code basically turn all arrays except string arrays // NOTE: The following code turns all arrays except string arrays into
// into integer arrays. There seems to be no purpose in this, and it // integer arrays. There seems to be no reason for this, and it wastes
// wastes space. However, we can't just change this either, as that // space. However, we can't just remove this either, as that would
// would break savegame compatibility. So do not touch this unless you // break savegame compatibility. So do not touch this unless you are
// are adding code which updated old savegames, too. // also adding code which updated old savegames, too. And of course
if (type != 4) // readArray() and writeArray() would have to be updated, too...
type = 5; if (type != kStringArray)
type = kIntArray;
} }
nukeArray(array); nukeArray(array);
@ -514,7 +513,7 @@ int ScummEngine_v6::readArray(int array, int idx, int base) {
array, base, idx, FROM_LE_16(ah->dim1), FROM_LE_16(ah->dim2)); array, base, idx, FROM_LE_16(ah->dim1), FROM_LE_16(ah->dim2));
} }
if (FROM_LE_16(ah->type) == 4 || (_heversion >= 60 && FROM_LE_16(ah->type) == rtCostume)) { if (FROM_LE_16(ah->type) != kIntArray) {
return ah->data[offset]; return ah->data[offset];
} else if (_version == 8) { } else if (_version == 8) {
return (int32)READ_LE_UINT32(ah->data + offset * 4); return (int32)READ_LE_UINT32(ah->data + offset * 4);
@ -535,7 +534,7 @@ void ScummEngine_v6::writeArray(int array, int idx, int base, int value) {
array, base, idx, FROM_LE_16(ah->dim1), FROM_LE_16(ah->dim2)); array, base, idx, FROM_LE_16(ah->dim1), FROM_LE_16(ah->dim2));
} }
if (FROM_LE_16(ah->type) == rtSound || (_heversion >= 60 && FROM_LE_16(ah->type) == rtCostume)) { if (FROM_LE_16(ah->type) != kIntArray) {
ah->data[offset] = value; ah->data[offset] = value;
} else if (_version == 8) { } else if (_version == 8) {
WRITE_LE_UINT32(ah->data + offset * 4, value); WRITE_LE_UINT32(ah->data + offset * 4, value);