DOTT: Fix for intro crash (regression)
|Reported by:||eriktorbjorn||Owned by:||aquadran|
|Cc:||Game:||Day of the Tentacle|
I don't know if this is the right fix - and it uses 'goto' - but...
In recent CVS snapshots, the DOTT intro crashes with a failed assertion right after Dr. Fred says "To the time machine!" This bug was introduced when the following line
if ((uint) sx >= NUM_STRIPS)
was changed into
if (sx >= _numStrips)
This breaks because sx may be a negative number, so to preserve the old behaviour it should really be
if (sx < 0 || sx >= _numStrips)
But this condition is used to terminate the loop, which doesn't make sense to me in the case where sx < 0. Shouldn't it skip to the next iteration, in case sx becomes >= 0 later on? I don't have any test case to demonstrate this, so I don't know if it makes any practical difference.
Ticket imported from: #629413. Ticket imported from: patches/216.