The Dink Network

Reply to Warp-bug found and fixed

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
September 20th 2012, 06:44 PM
anon.gif
shevek
Ghost They/Them
 
As I mentioned about historical hero 2, I noticed a bug that sometimes when warping out of a room, instead the game would hang. This was very hard to reproduce, though. With Dink and the 4 towers, it was a lot easier: almost always when leaving the first tower after beating the splitbug, the game hangs. So I grabbed my debugger and went hunting.

I've traced the bug to src/freedink.c, line 3876 (all this is copied from regular dink, so while the file will have a different name, the same problem should be in it, but probably on a different line number). There, it uses find_sprite to get a sprite number from an editor number, I think (could be the other way around). It uses the result to set the seq member, which should make the touch animation play before warping.

If the sprite is not found (not sure how that is possible, since it has just been touched, but it appearantly happens when too many sprites have recently been created, like with the splitbug), find_sprite will return 0. So far so good. It will check if spr[0].seq == 0, which it should be. But somehow isn't always.

My suggested fix is to change
if (spr[sprite].seq == 0)

into
if (sprite == 0 || spr[sprite].seq == 0)


It's a dirty fix, and probably doesn't fix the actual problem, but that means that sometimes an touch animation may not play. That's a lot better than hanging the game with no way to continue. I've tested this, and it works at least in Dink and the 4 towers.