Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Clear explosions at the end of vehicle turret test

Open BrettDong opened this issue 3 years ago • 4 comments

Summary

None

Purpose of change

#60004 uncovers that some out of bounds (in local coordinates) explosions exist in explosion tests. A majority of them originates from the vehicle turret test, in which some explosions are enqueued but not processed in the test case and are left over to subsequent tests.

Describe the solution

Process pending explosions at the end of the vehicle turret test. But this may break the legs of the avatar and cause pedal tests to fail, so reset avatar too after processing explosions.

Describe alternatives you've considered

Testing

GCC 9 LTO test seems to be passing again.

Additional context

BrettDong avatar Aug 08 '22 14:08 BrettDong

https://github.com/CleverRaven/Cataclysm-DDA/runs/7729199405?check_suite_focus=true#step:10:316

ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\explosion.cpp:877 [process_explosions] Explosion origin (218, 113, -9) is out-of-bounds
ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\explosion.cpp:877 [process_explosions] Explosion origin (227, 117, -9) is out-of-bounds
ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\explosion.cpp:877 [process_explosions] Explosion origin (226, 120, -9) is out-of-bounds
ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\explosion.cpp:877 [process_explosions] Explosion origin (231, 118, -9) is out-of-bounds
ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\explosion.cpp:877 [process_explosions] Explosion origin (231, 121, -9) is out-of-bounds
ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\explosion.cpp:877 [process_explosions] Explosion origin (222, 128, -9) is out-of-bounds
ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\explosion.cpp:877 [process_explosions] Explosion origin (228, 126, -9) is out-of-bounds
ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\explosion.cpp:877 [process_explosions] Explosion origin (221, 124, -9) is out-of-bounds
ERROR : D:\a\Cataclysm-DDA\Cataclysm-DDA\src\explosion.cpp:877 [process_explosions] Explosion origin (222, 124, -9) is out-of-bounds

The out of (x,y) local coordinates bounds explosions at level -9 are from mapgen in the overmap_terrain_coverage test. I'm thinking of adding explosion_handler::process_explosions() after each map::generate() or at the end of the overmap_terrain_coverage test, but @jbytheway may have better insight into this issue.

BrettDong avatar Aug 09 '22 02:08 BrettDong

Well done for figuring this out. We could add a workaround, but I worry that this could happen in-game too, if for example an update mapgen happens far away from the player. Should mapgen be inserting explosions into this list at all?

jbytheway avatar Aug 09 '22 21:08 jbytheway

I think a good short-term workaround is to just clear the pending explosions at the end of overmap_terrain_coverage. This issue is a symptom of the fact that we conflate mapgen with map loading in a way that's not helpful. But fixing that is not a near-term goal.

jbytheway avatar Aug 10 '22 00:08 jbytheway

I set a breakpoint in explosion creation and this is the stack trace during mapgen:

  * frame #0: 0x0000000100cd636c cata_test`explosion_handler::explosion(tripoint const&, explosion_data const&)
    frame #1: 0x0000000101085e58 cata_test`explosion_iuse::use(Character&, item&, bool, tripoint const&) const + 320
    frame #2: 0x0000000101005f44 cata_test`itype::invoke(Character&, item&, tripoint const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const + 156
    frame #3: 0x0000000101005e6c cata_test`itype::invoke(Character&, item&, tripoint const&) const + 232
    frame #4: 0x0000000100f39554 cata_test`item::process_tool(Character*, tripoint const&) + 420
    frame #5: 0x0000000100f39e18 cata_test`item::process_internal(map&, Character*, tripoint const&, float, temperature_flag, float) + 1312
    frame #6: 0x00000001011710b8 cata_test`process_map_items(map&, item_stack&, safe_reference<item>&, tripoint const&, float, temperature_flag, float) + 92
    frame #7: 0x0000000101171000 cata_test`map::process_items_in_submap(submap&, tripoint const&) + 268
    frame #8: 0x0000000101178f34 cata_test`map::actualize(tripoint const&) + 124
    frame #9: 0x0000000101178d10 cata_test`map::load(coords::coord_point<tripoint, (coords::origin)1, (coords::scale)1> const&, bool, bool) + 548
    frame #10: 0x00000001004e3b70 cata_test`____C_A_T_C_H____T_E_S_T____17() + 3452

The explosive is crater bomb from #59717.

BrettDong avatar Aug 10 '22 05:08 BrettDong