GNOME Bugzilla – Bug 733429
Check worm length after each turn
Last modified: 2014-08-19 00:49:52 UTC
Better to crash immediately and trigger distro bug reporting tools than force the player to die on invisible worms. Best if this helps us figure out what's going wrong.
Created attachment 281210 [details] [review] Regularly assert each worm is the proper length No bug can withstand the awesome power of invariants! Yeah!
Created attachment 281211 [details] [review] Fix worm length after respawn We accidentally leave a one-space invisible position of death behind our worm at all times after the worm respawns (for the duration of the current map). Invisible positions of death are bad so let's get rid of it.
(In reply to comment #2) > We accidentally leave a one-space invisible position of death behind our > worm at all times after the worm respawns ...even with this patch, this still happens sometimes. :/
Created attachment 281258 [details] [review] Add a couple more good assertions After we finish moving, the square our tail is on ought to be marked as such. This assertion likes to fail when we trigger the teleporter bug.
(In reply to comment #4) > After we finish moving, the square our tail is on ought to be marked as > such. This assertion likes to fail when we trigger the teleporter bug. FYI: this should not be pushed (at least not yet) since it triggers EVERY time we go through a teleporter
(In reply to comment #5) > FYI: this should not be pushed (at least not yet) since it triggers EVERY time > we go through a teleporter Safe now, after applying all patches in bug #654072
Created attachment 281270 [details] [review] Fix corner-case handling of tail teleportation What we do here is really insane. After our tail moves into the teleporter, we erase it from the text board and remove its clutter actor, but then intentionally leave the tail pointer stationary, trusting to the gnibbles_worm_get_tail_direction function to position it properly on the next turn, then warping and moving the tail pointer an extra time on that turn. This kind of works because gnibbles_worm_get_tail_direction() operates on the clutter actors, which are stored in a linked list and do know their position. But it's also super fragile if we do anything interesting with the teleporters (e.g. teleport immediately on the next move, because we came at a teleporter from a particular direction). So instead of this don't-move-then-move-twice nonsense, assume that if we ever do not know which direction to move in it's because we're at a teleporter, and try to use it. Also, add a couple sensible assertions to make sure this assumption always holds. Very pleased with this patch; I think there is still a problem if we teleport onto ourselves or another worm, which I still need to fix, but I THINK everything else is resolved. (A little worried there may still be a problem when respawning, but not sure because it's rare.)
Comment on attachment 281270 [details] [review] Fix corner-case handling of tail teleportation Wrong bug.
Two remaining problems here: * You can respawn on top of another worm * Respawns randomly and rarely fail horribly, not sure why