floooh/pacman.zig

eating powerup causes panic when starting with `const DbgStartRound >= 16`

Closed this issue · 4 comments

on macos 10.15.7 with zig 0.8.0.
setting DbgStartRound in [0,2,8,12,14,15] all work fine but values in [16,32,64] cause an integer overflow panic as soon as i eat a powerup.
The panic appears to be somewhere in gameUpdateSprites() but i can't tell exactly where because of this.

BTW I love this code! ❤️

Oh interesting, I haven't even tested such high values for the start round :) Yeah I noticed the broken stack traces on macOS too, I'll check whether testing on Windows is more helpful. Thanks for the bug report :)

Ok, this should fix it. There was an integer underflow in higher levels when computing the end tick when frightened ghosts should start blinking (because in higher levels ghosts don't enter frightened mode at all)

PS: stack traces worked fine on Windows btw

you can get good stack traces on macos by attaching the process to lldb (as a workaround while we wait for the fix to land in zig)

@floooh fixed! thanks, even though the game is much harder now...

@kristoff-it Good idea. That works for me.