CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.63k stars 4.18k forks source link

Crash when house burn #679

Closed Horadricat closed 11 years ago

Horadricat commented 11 years ago

http://ru.twitch.tv/geoscape/c/2208157 v.o4 Cata

fergus-dall commented 11 years ago

I can't replicate this on linux using 75d6319, even after setting several houses on fire, so it might be a windows specific thing. Does it happen every time?

HeatherSoron commented 11 years ago

Yeah, it sounds like something that's been inconsistently replicated. I've tried it, and didn't manage to get a crash.

If someone can maybe upload a save that's right before an expected crash, and tell us which version of the game it's for (important! save compatibility issues), that would be helpful.

HeatherSoron commented 11 years ago

I've managed to get the game unresponsive for a significant amount of time by dropping stacks of 1 million gasoline. However, it still hasn't actually crashed.

Maybe it does crash on systems that use catacurse, or something?

Shoes01 commented 11 years ago

In disease.cpp, there is a line fir DI_HOT_HEAD saying "one_in(15000 - p.temp_cur[bp_head])"

During my testing, when one_in() had a negative argument, the player "puked to death", that is he puked until a zombie beat him to death. I tested it last night, and for a solid 20 minutes my player would puke, but that game wouldn't crash.

Here is my fix for it : https://github.com/Shoes01/Cataclysm-DDA/compare/master...fire-head-fix

This may or may not be the cause :x I can't get it to crash though.

fergus-dall commented 11 years ago

I just managed to get a crash when lighting 10,000 9mm round on fire which seems very consistent. I'll see about fixing it.

fergus-dall commented 11 years ago

All right, it looks like exploding ammunition can cause terrain to create objects on the same tile, which somehow overwrites the ammunition, causing a crash when the game tries to check the ammo to determine how powerful to make the explosion.

Using a debugger shows the change happening in map.cpp on line 2261, in function map::add_item.

This could be the cause of the original bug, as I did mange to crash the game setting a gun shop on fire.

kevingranade commented 11 years ago

Well crap, this is similar to an issue molotov cocktails used to have, and when I made ammo explode I even tested for this specific thing, but I guess it was harder to trigger since the explosion is so small? That fix was 00a16235 On May 10, 2013 6:24 AM, "fergus-dall" notifications@github.com wrote:

All right, it looks like exploding ammunition can cause terrain to create objects on the same tile, which somehow overwrites the ammunition, causing a crash when the game tries to check the ammo to determine how powerful to make the explosion.

Using a debugger shows the change happening in map.cpp on line 2261, in function map::add_item.

This could be the cause of the original bug, as I did mange to crash the game setting a gun shop on fire.

— Reply to this email directly or view it on GitHubhttps://github.com/TheDarklingWolf/Cataclysm-DDA/issues/679#issuecomment-17715469 .

fergus-dall commented 11 years ago

I'm not sure if that's quite right, because the crash only happens when the explosion happens near smash-able terrain that spawns items on surrounding tiles (e.g. walls, but not benches). Setting off large amounts of ammo in the middle of a field works fine, apart from the lag.

fergus-dall commented 11 years ago

This seems to fix it, but I have no idea why.

Replacing the dynamic_cast with a static_cast in the call to game::explosion also worked, but again, I don't know why.

Technae commented 11 years ago

http://i1.wp.com/www.geeksaresexy.net/wp-content/uploads/2013/05/code.jpg?w=600

Seems to sum up this.

kevingranade commented 11 years ago

It's because "ammo_type" isn't destroyed in the explosion, but "it" is.