cxong / cdogs-sdl

Classic overhead run-and-gun game
https://cxong.github.io/cdogs-sdl/
GNU General Public License v2.0
891 stars 114 forks source link

Game sometimes crashes when player catches fire #307

Closed Wuzzy2 closed 10 years ago

Wuzzy2 commented 10 years ago

The 2nd mission in Death Incorporated (sorry, I don’t know the password) involves guys with molotovs and guys with freeze guns or whatever these things which turn you into stone are.

Sometimes, but not reliably so, the game crashes in this mission when the player catches fire from one of those molotov cocktails. Sometimes the game works properly. I don’t know if it just in this mission or a general bug.

When the game crashes, I get this text on my console:

cdogs-sdl: /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs/map.c:1281: MapSearchTileAround: Assertion `0' failed.

I also have a trace from the GNU Debugger:

#0  0xffffe424 in __kernel_vsyscall ()
#1  0xb7cc9297 in raise () from /usr/lib/libc.so.6
#2  0xb7cca8ea in abort () from /usr/lib/libc.so.6
#3  0xb7cc22f7 in __assert_fail_base () from /usr/lib/libc.so.6
#4  0xb7cc237b in __assert_fail () from /usr/lib/libc.so.6
#5  0x08084af1 in MapSearchTileAround (map=0x814ccc0 <gMap>, start=..., func=0x8067cd0 <IsTileWalkable>)
    at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs/map.c:1281
#6  0x08068821 in AIGoto (actor=0xc5269a0, p=..., ignoreObjects=true)
    at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs/ai_utils.c:630
#7  0x0806635d in CommandBadGuys (ticks=1) at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs/ai.c:444
#8  0x0805b35a in RunGameUpdate (data=0xbfffb1bc) at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/game.c:567
#9  0x0807be2e in GameLoop (data=0xbfffb398) at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs/game_loop.c:91
#10 0x0805c5b6 in RunGame (m=0x814c4c0 <gMission>, map=0x814ccc0 <gMap>) at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/game.c:454
#11 0x08059ee3 in Game (graphics=0x814cc40 <gGraphicsDevice>, co=0x814c540 <gCampaign>)
    at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs.c:295
#12 0x0805a1bb in Campaign (graphics=0x814cc40 <gGraphicsDevice>, co=0x814c540 <gCampaign>)
    at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs.c:376
#13 0x0805a4b0 in MainLoop (creditsDisplayer=0xbfffb4f8, campaigns=0xbfffb518)
    at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs.c:478
#14 0x080566a6 in main (argc=1, argv=0xbffff644) at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs.c:830

This bug was experienced in 02fb968d019fd98ad90e7bb3ae903fd246d63df3 on a GNU/Linux system.

cxong commented 10 years ago

Try the latest commit:https://github.com/cxong/cdogs-sdl/commit/0b59e2ec85f33502faf6669e825f1cc0ab26ccda

I haven't tested this, but I'm guessing this happens at the exact moment the player dies, and there's AI trying to go to the player's position.

If an AI is trying to go to a player who is dead, the default action should be that the AI's own position is returned, that is, they don't move. Unfortunately the old version was returning a position that wasn't correctly converted, which then causes the subsequent search to fail (it's basically looking around a position that's off the map). It's a bit confusing but seems like the problem here.

Wuzzy2 commented 10 years ago

Okay, I have made 20 subsequent tries to reproduce the same bug, as described above, with the new commit. The bug never happened again. I consider this bug “fixed”.

cxong commented 10 years ago

Great, thanks for reporting!