rapiz1 / DungeonRush

πŸ‘ΎπŸ A opensource game inspired by Snake, written in pure C with SDL
GNU General Public License v3.0
2k stars 294 forks source link

Fix edge case: negative number in task text #6

Closed dungpt3003 closed 4 years ago

dungpt3003 commented 4 years ago

Bug description:

When the length of the snake exceeds the GAME_WIN_NUM, the screen shows negative number of heroes to find.

Steps to reproduce:

When your snake length equals to GAME_WIN_NUM - 1

before eating

Two or more heroes join the snake at nearly same time

image333

Fix

Never show negative number in task text, show zero whenever it reaches the GAME_WIN_NUM.

rapiz1 commented 4 years ago

It's surprising that you can find such a bug because the game should end shortly after the target is achieved and it's difficult to notice. Also, the possibility is so small. Thanks for your contribution!

dungpt3003 commented 4 years ago

@Rapiz1 You are welcome. I played your game with my friends and we are all impressed by your work.