Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autosave: The bane of my existence! #13

Merged
merged 1 commit into from
Jan 17, 2013
Merged

Autosave: The bane of my existence! #13

merged 1 commit into from
Jan 17, 2013

Conversation

wito
Copy link
Contributor

@wito wito commented Jan 17, 2013

This is a bugfix for a double-time bug introduced with the autosave changes.

TheDarklingWolf added a commit that referenced this pull request Jan 17, 2013
Autosave: The bane of my existence!
@TheDarklingWolf TheDarklingWolf merged commit 57c5151 into CleverRaven:master Jan 17, 2013
@fubeca fubeca mentioned this pull request Aug 8, 2016
kevingranade pushed a commit that referenced this pull request Jun 1, 2017
Rivet-the-Zombie pushed a commit that referenced this pull request Jul 17, 2018
@kevingranade kevingranade mentioned this pull request Sep 8, 2018
ZhilkinSerg pushed a commit that referenced this pull request Apr 29, 2019
kevingranade pushed a commit that referenced this pull request Jun 2, 2019
I-am-Erk pushed a commit that referenced this pull request Dec 16, 2019
ZhilkinSerg pushed a commit that referenced this pull request Apr 2, 2020
@Noomene Noomene mentioned this pull request Apr 7, 2020
@rtxyd rtxyd mentioned this pull request Feb 4, 2024
@PGR-14 PGR-14 mentioned this pull request Feb 21, 2024
Procyonae pushed a commit to Procyonae/Cataclysm-DDA that referenced this pull request May 14, 2024
If melee_actori.is_grab is false grab.exclusive_grab and grab.respect_seatbelts
were not initialized. This was causing errors under -fsanitize=undefined

The solution initialize the booleans to value that match their defaults

```C++
src/mattack_actors.h:75:8: runtime error: load of value 190, which is not a valid value for type 'bool'
    #0 0x5a9b6fe in grab::grab(grab const&) src/mattack_actors.h:75
    CleverRaven#1 0x5ab7635 in melee_actor::melee_actor(melee_actor const&) src/mattack_actors.h:106
    CleverRaven#2 0x5ab8412 in std::__detail::_MakeUniq<melee_actor>::__single_object std::make_unique<melee_actor, melee_actor const&>(melee_actor const&) /usr/include/c++/13/bits/unique_ptr.h:1070
    CleverRaven#3 0x5a87e4c in melee_actor::clone() const src/mattack_actors.cpp:962
    CleverRaven#4 0x207632c in cata::clone_ptr<mattack_actor>::clone_ptr(cata::clone_ptr<mattack_actor> const&) src/clone_ptr.h:18
    CleverRaven#5 0x6085941 in mtype_special_attack::mtype_special_attack(mtype_special_attack const&) src/mattack_common.h:47
    CleverRaven#6 0x6085941 in std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack, true>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_pair.h:559
    CleverRaven#7 0x6085a2b in void std::__new_allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::construct<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/new_allocator.h:187
    CleverRaven#8 0x6085a2b in void std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > > >::construct<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >&, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/alloc_traits.h:537
    CleverRaven#9 0x6085a2b in void std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::_M_construct_node<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_tree.h:597
    CleverRaven#10 0x6085b06 in std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >* std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::_M_create_node<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_tree.h:614
    CleverRaven#11 0x6085b71 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::_Auto_node::_Auto_node<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_tree.h:1637
    CleverRaven#12 0x6085c9d in std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::_M_emplace_hint_unique<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::_Rb_tree_const_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_tree.h:2462
    CleverRaven#13 0x608618f in std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mtype_special_attack, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::emplace_hint<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::_Rb_tree_const_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_map.h:640
    CleverRaven#14 0x608618f in std::pair<std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, bool> std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mtype_special_attack, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::emplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_map.h:601
    CleverRaven#15 0x5ff3881 in MonsterGenerator::add_attack(mtype_special_attack const&) src/monstergenerator.cpp:1312
    CleverRaven#16 0x5ffafa5 in MonsterGenerator::load_monster_attack(JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) src/monstergenerator.cpp:1376
    CleverRaven#17 0x4262e91 in operator() src/init.cpp:466
    CleverRaven#18 0x4262e91 in __invoke_impl<void, DynamicDataLoader::initialize()::<lambda(const JsonObject&, const std::string&)>&, const JsonObject&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> /usr/include/c++/13/bits/invoke.h:61
    CleverRaven#19 0x4262e91 in __invoke_r<void, DynamicDataLoader::initialize()::<lambda(const JsonObject&, const std::string&)>&, const JsonObject&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> /usr/include/c++/13/bits/invoke.h:111
    CleverRaven#20 0x4262e91 in _M_invoke /usr/include/c++/13/bits/std_function.h:290
    CleverRaven#21 0x4290ce9 in std::function<void (JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /usr/include/c++/13/bits/std_function.h:591
    CleverRaven#22 0x42693bf in operator() src/init.cpp:227
    CleverRaven#23 0x42693bf in __invoke_impl<void, DynamicDataLoader::add(const std::string&, const std::function<void(const JsonObject&, const std::__cxx11::basic_string<char>&)>&)::<lambda(const JsonObject&, const std::string&, const cata_path&, const cata_path&)>&, const JsonObject&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const cata_path&, const cata_path&> /usr/include/c++/13/bits/invoke.h:61
    CleverRaven#24 0x42693bf in __invoke_r<void, DynamicDataLoader::add(const std::string&, const std::function<void(const JsonObject&, const std::__cxx11::basic_string<char>&)>&)::<lambda(const JsonObject&, const std::string&, const cata_path&, const cata_path&)>&, const JsonObject&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const cata_path&, const cata_path&> /usr/include/c++/13/bits/invoke.h:111
    CleverRaven#25 0x42693bf in _M_invoke /usr/include/c++/13/bits/std_function.h:290
    CleverRaven#26 0x4290563 in std::function<void (JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cata_path const&, cata_path const&)>::operator()(JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cata_path const&, cata_path const&) const /usr/include/c++/13/bits/std_function.h:591
    CleverRaven#27 0x42849b9 in DynamicDataLoader::load_object(JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cata_path const&, cata_path const&) src/init.cpp:137
    CleverRaven#28 0x4285ca2 in DynamicDataLoader::load_all_from_json(JsonValue const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, loading_ui&, cata_path const&, cata_path const&) src/init.cpp:540
    CleverRaven#29 0x42867b4 in DynamicDataLoader::load_data_from_path(cata_path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, loading_ui&) src/init.cpp:521
    CleverRaven#30 0x3ca266a in game::load_data_from_dir(cata_path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, loading_ui&) src/game.cpp:571
    CleverRaven#31 0x3d211a0 in game::load_packs(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<string_id<MOD_INFORMATION>, std::allocator<string_id<MOD_INFORMATION> > > const&, loading_ui&) src/game.cpp:3265
    CleverRaven#32 0x3d51925 in game::load_world_modfiles(loading_ui&) src/game.cpp:3235
    CleverRaven#33 0x3e05640 in game::setup() src/game.cpp:756
    CleverRaven#34 0x5111d33 in main_menu::new_character_tab() src/main_menu.cpp:972
    CleverRaven#35 0x5127b5a in main_menu::opening_screen() src/main_menu.cpp:863
    CleverRaven#36 0x50f1ece in main src/main.cpp:792
    CleverRaven#37 0x7fdc43fa9b89 in __libc_start_call_main (/lib64/libc.so.6+0x27b89) (BuildId: f888be5f5e7d58e04cabb8c675c7ab94e77dd68c)
    CleverRaven#38 0x7fdc43fa9c4a in __libc_start_main_alias_2 (/lib64/libc.so.6+0x27c4a) (BuildId: f888be5f5e7d58e04cabb8c675c7ab94e77dd68c)
    CleverRaven#39 0x1bec874 in _start (/home/cdda/git/Cataclysm-DDA/cataclysm-tiles+0x1bec874) (BuildId: be24990d1723c8da00f3e8701793ab983cf64dcc)
```
kevingranade pushed a commit that referenced this pull request May 14, 2024
If melee_actori.is_grab is false grab.exclusive_grab and grab.respect_seatbelts
were not initialized. This was causing errors under -fsanitize=undefined

The solution initialize the booleans to value that match their defaults

```C++
src/mattack_actors.h:75:8: runtime error: load of value 190, which is not a valid value for type 'bool'
    #0 0x5a9b6fe in grab::grab(grab const&) src/mattack_actors.h:75
    #1 0x5ab7635 in melee_actor::melee_actor(melee_actor const&) src/mattack_actors.h:106
    #2 0x5ab8412 in std::__detail::_MakeUniq<melee_actor>::__single_object std::make_unique<melee_actor, melee_actor const&>(melee_actor const&) /usr/include/c++/13/bits/unique_ptr.h:1070
    #3 0x5a87e4c in melee_actor::clone() const src/mattack_actors.cpp:962
    #4 0x207632c in cata::clone_ptr<mattack_actor>::clone_ptr(cata::clone_ptr<mattack_actor> const&) src/clone_ptr.h:18
    #5 0x6085941 in mtype_special_attack::mtype_special_attack(mtype_special_attack const&) src/mattack_common.h:47
    #6 0x6085941 in std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack, true>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_pair.h:559
    #7 0x6085a2b in void std::__new_allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::construct<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/new_allocator.h:187
    #8 0x6085a2b in void std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > > >::construct<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::allocator<std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >&, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/alloc_traits.h:537
    #9 0x6085a2b in void std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::_M_construct_node<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_tree.h:597
    #10 0x6085b06 in std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >* std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::_M_create_node<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_tree.h:614
    #11 0x6085b71 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::_Auto_node::_Auto_node<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_tree.h:1637
    #12 0x6085c9d in std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack>, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::_M_emplace_hint_unique<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::_Rb_tree_const_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_tree.h:2462
    #13 0x608618f in std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mtype_special_attack, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::emplace_hint<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::_Rb_tree_const_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_map.h:640
    #14 0x608618f in std::pair<std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> >, bool> std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, mtype_special_attack, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, mtype_special_attack> > >::emplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mtype_special_attack const&) /usr/include/c++/13/bits/stl_map.h:601
    #15 0x5ff3881 in MonsterGenerator::add_attack(mtype_special_attack const&) src/monstergenerator.cpp:1312
    #16 0x5ffafa5 in MonsterGenerator::load_monster_attack(JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) src/monstergenerator.cpp:1376
    #17 0x4262e91 in operator() src/init.cpp:466
    #18 0x4262e91 in __invoke_impl<void, DynamicDataLoader::initialize()::<lambda(const JsonObject&, const std::string&)>&, const JsonObject&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> /usr/include/c++/13/bits/invoke.h:61
    #19 0x4262e91 in __invoke_r<void, DynamicDataLoader::initialize()::<lambda(const JsonObject&, const std::string&)>&, const JsonObject&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&> /usr/include/c++/13/bits/invoke.h:111
    #20 0x4262e91 in _M_invoke /usr/include/c++/13/bits/std_function.h:290
    #21 0x4290ce9 in std::function<void (JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /usr/include/c++/13/bits/std_function.h:591
    #22 0x42693bf in operator() src/init.cpp:227
    #23 0x42693bf in __invoke_impl<void, DynamicDataLoader::add(const std::string&, const std::function<void(const JsonObject&, const std::__cxx11::basic_string<char>&)>&)::<lambda(const JsonObject&, const std::string&, const cata_path&, const cata_path&)>&, const JsonObject&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const cata_path&, const cata_path&> /usr/include/c++/13/bits/invoke.h:61
    #24 0x42693bf in __invoke_r<void, DynamicDataLoader::add(const std::string&, const std::function<void(const JsonObject&, const std::__cxx11::basic_string<char>&)>&)::<lambda(const JsonObject&, const std::string&, const cata_path&, const cata_path&)>&, const JsonObject&, const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, const cata_path&, const cata_path&> /usr/include/c++/13/bits/invoke.h:111
    #25 0x42693bf in _M_invoke /usr/include/c++/13/bits/std_function.h:290
    #26 0x4290563 in std::function<void (JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cata_path const&, cata_path const&)>::operator()(JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cata_path const&, cata_path const&) const /usr/include/c++/13/bits/std_function.h:591
    #27 0x42849b9 in DynamicDataLoader::load_object(JsonObject const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cata_path const&, cata_path const&) src/init.cpp:137
    #28 0x4285ca2 in DynamicDataLoader::load_all_from_json(JsonValue const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, loading_ui&, cata_path const&, cata_path const&) src/init.cpp:540
    #29 0x42867b4 in DynamicDataLoader::load_data_from_path(cata_path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, loading_ui&) src/init.cpp:521
    #30 0x3ca266a in game::load_data_from_dir(cata_path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, loading_ui&) src/game.cpp:571
    #31 0x3d211a0 in game::load_packs(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<string_id<MOD_INFORMATION>, std::allocator<string_id<MOD_INFORMATION> > > const&, loading_ui&) src/game.cpp:3265
    #32 0x3d51925 in game::load_world_modfiles(loading_ui&) src/game.cpp:3235
    #33 0x3e05640 in game::setup() src/game.cpp:756
    #34 0x5111d33 in main_menu::new_character_tab() src/main_menu.cpp:972
    #35 0x5127b5a in main_menu::opening_screen() src/main_menu.cpp:863
    #36 0x50f1ece in main src/main.cpp:792
    #37 0x7fdc43fa9b89 in __libc_start_call_main (/lib64/libc.so.6+0x27b89) (BuildId: f888be5f5e7d58e04cabb8c675c7ab94e77dd68c)
    #38 0x7fdc43fa9c4a in __libc_start_main_alias_2 (/lib64/libc.so.6+0x27c4a) (BuildId: f888be5f5e7d58e04cabb8c675c7ab94e77dd68c)
    #39 0x1bec874 in _start (/home/cdda/git/Cataclysm-DDA/cataclysm-tiles+0x1bec874) (BuildId: be24990d1723c8da00f3e8701793ab983cf64dcc)
```

Co-authored-by: hexagon-recursion <[email protected]>
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 8, 2024
Prevents referencing `visibility_cache` using out-of-bounds array
indexes such as negative values. Using out-of-bound indexes for this
array previously caused crashes when compiled with
`-D_GLIBCXX_ASSERTIONS`.

The function `pixel_minimap::render_critters` is, for example, called
with `center=(64,59,-5)`, which gives `start=(4,-1)` and then
`p=(4,-1,-5)`, which previously crashed because
`visibility_cache[p.x][p.y]` then gives a negative array index. Such
values were seen when peeking using `X` at a submap boundary.

Gdb backtrace of previous crash being fixed:
```
(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 CleverRaven#1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 CleverRaven#2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 CleverRaven#3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 CleverRaven#4  0x00007ffff7ad30be in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 CleverRaven#5  0x000055555668a04e in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 CleverRaven#6  0x000055555668ab7a in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 CleverRaven#7  pixel_minimap::render_critters (this=this@entry=0x555558108960, center=...) at src/pixel_minimap.cpp:521
 CleverRaven#8  0x000055555668ada2 in pixel_minimap::render (this=0x555558108960, center=...) at src/pixel_minimap.cpp:447
 CleverRaven#9  0x000055555668bb69 in pixel_minimap::draw (this=<optimized out>, screen_rect=..., center=...) at src/pixel_minimap.cpp:555
 CleverRaven#10 0x0000555555b3fd5c in cata_tiles::draw_minimap (this=this@entry=0x555558093020, dest=..., center=..., width=width@entry=352, height=height@entry=352) at src/cata_tiles.cpp:1919
 CleverRaven#11 0x00005555567f43d3 in cata_cursesport::curses_drawwindow (w=...) at src/sdltiles.cpp:1428
 CleverRaven#12 0x000055555666f5e2 in std::function<void(draw_args const&)>::operator() (__args#0=..., this=<optimized out>) at /usr/include/c++/13/bits/std_function.h:591
 CleverRaven#13 operator() (d=..., __closure=<optimized out>) at src/panels.cpp:54
 CleverRaven#14 std::__invoke_impl<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__f=...) at /usr/include/c++/13/bits/invoke.h:61
 CleverRaven#15 std::__invoke_r<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__fn=...) at /usr/include/c++/13/bits/invoke.h:114
 CleverRaven#16 std::_Function_handler<int(const draw_args&), window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)> >::_M_invoke(const std::_Any_data &, const draw_args &) (__functor=...,     __args#0=...) at /usr/include/c++/13/bits/std_function.h:290
 CleverRaven#17 0x0000555555e7c9ec in std::function<int(draw_args const&)>::operator() (__args#0=..., this=0x55559461d638) at /usr/include/c++/13/bits/std_function.h:591
 CleverRaven#18 game::draw_panels (this=this@entry=0x555558276c40, force_draw=force_draw@entry=true) at src/game.cpp:4006
 CleverRaven#19 0x0000555555e984f8 in game::draw (this=0x555558276c40, ui=...) at src/game.cpp:3960
 CleverRaven#20 0x000055555695df35 in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#21 0x000055555695e039 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#22 0x000055555695e060 in ui_manager::redraw () at src/ui_manager.cpp:506
 CleverRaven#23 0x0000555555ea95cf in game::look_around (this=this@entry=0x555558276c40, show_window=show_window@entry=true, center=..., start_point=..., has_first_point=has_first_point@entry=false, select_zone=false, peeking=true, is_moving_zone=<optimized out>, end_point=..., change_lv=true) at src/game.cpp:7529
 CleverRaven#24 0x0000555555eadd32 in game::look_around (this=this@entry=0x555558276c40, looka_params=...) at src/game.cpp:7697
 CleverRaven#25 0x0000555555eadecb in game::peek (this=this@entry=0x555558276c40, p=...) at src/game.cpp:6071
 CleverRaven#26 0x0000555555ec441a in game::peek (this=this@entry=0x555558276c40) at src/game.cpp:6050
 CleverRaven#27 0x0000555555f124ec in game::do_regular_action (this=this@entry=0x555558276c40, act=@0x7fffffffd104: ACTION_PEEK, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2432
 CleverRaven#28 0x0000555555f15b09 in game::handle_action (this=0x555558276c40) at src/handle_action.cpp:3174
 CleverRaven#29 0x0000555555d8a108 in do_turn () at /usr/include/c++/13/bits/unique_ptr.h:199
 CleverRaven#30 0x0000555555781b4e in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873

(gdb) frame 7
(gdb) print p
$1 = {static dimension = 3, x = 4, y = -1, z = -5}
(gdb) print center
$2 = (const tripoint &) @0x7fffffffbda8: {static dimension = 3, x = 64, y = 59, z = -5}
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 8, 2024
Prevents referencing `visibility_cache` using out-of-bounds array
indexes such as negative values. Using out-of-bound indexes for this
array previously caused crashes when compiled with
`-D_GLIBCXX_ASSERTIONS`.

The function `pixel_minimap::render_critters` is, for example, called
with `center=(64,59,-5)`, which gives `start=(4,-1)` and then
`p=(4,-1,-5)`, which previously crashed because
`visibility_cache[p.x][p.y]` then gives a negative array index. Such
values were seen when peeking using `X` at a submap boundary.

Gdb backtrace of previous crash being fixed:
```
(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 CleverRaven#1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 CleverRaven#2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 CleverRaven#3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 CleverRaven#4  0x00007ffff7ad30be in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 CleverRaven#5  0x000055555668a04e in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 CleverRaven#6  0x000055555668ab7a in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 CleverRaven#7  pixel_minimap::render_critters (this=this@entry=0x555558108960, center=...) at src/pixel_minimap.cpp:521
 CleverRaven#8  0x000055555668ada2 in pixel_minimap::render (this=0x555558108960, center=...) at src/pixel_minimap.cpp:447
 CleverRaven#9  0x000055555668bb69 in pixel_minimap::draw (this=<optimized out>, screen_rect=..., center=...) at src/pixel_minimap.cpp:555
 CleverRaven#10 0x0000555555b3fd5c in cata_tiles::draw_minimap (this=this@entry=0x555558093020, dest=..., center=..., width=width@entry=352, height=height@entry=352) at src/cata_tiles.cpp:1919
 CleverRaven#11 0x00005555567f43d3 in cata_cursesport::curses_drawwindow (w=...) at src/sdltiles.cpp:1428
 CleverRaven#12 0x000055555666f5e2 in std::function<void(draw_args const&)>::operator() (__args#0=..., this=<optimized out>) at /usr/include/c++/13/bits/std_function.h:591
 CleverRaven#13 operator() (d=..., __closure=<optimized out>) at src/panels.cpp:54
 CleverRaven#14 std::__invoke_impl<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__f=...) at /usr/include/c++/13/bits/invoke.h:61
 CleverRaven#15 std::__invoke_r<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__fn=...) at /usr/include/c++/13/bits/invoke.h:114
 CleverRaven#16 std::_Function_handler<int(const draw_args&), window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)> >::_M_invoke(const std::_Any_data &, const draw_args &) (__functor=...,     __args#0=...) at /usr/include/c++/13/bits/std_function.h:290
 CleverRaven#17 0x0000555555e7c9ec in std::function<int(draw_args const&)>::operator() (__args#0=..., this=0x55559461d638) at /usr/include/c++/13/bits/std_function.h:591
 CleverRaven#18 game::draw_panels (this=this@entry=0x555558276c40, force_draw=force_draw@entry=true) at src/game.cpp:4006
 CleverRaven#19 0x0000555555e984f8 in game::draw (this=0x555558276c40, ui=...) at src/game.cpp:3960
 CleverRaven#20 0x000055555695df35 in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#21 0x000055555695e039 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#22 0x000055555695e060 in ui_manager::redraw () at src/ui_manager.cpp:506
 CleverRaven#23 0x0000555555ea95cf in game::look_around (this=this@entry=0x555558276c40, show_window=show_window@entry=true, center=..., start_point=..., has_first_point=has_first_point@entry=false, select_zone=false, peeking=true, is_moving_zone=<optimized out>, end_point=..., change_lv=true) at src/game.cpp:7529
 CleverRaven#24 0x0000555555eadd32 in game::look_around (this=this@entry=0x555558276c40, looka_params=...) at src/game.cpp:7697
 CleverRaven#25 0x0000555555eadecb in game::peek (this=this@entry=0x555558276c40, p=...) at src/game.cpp:6071
 CleverRaven#26 0x0000555555ec441a in game::peek (this=this@entry=0x555558276c40) at src/game.cpp:6050
 CleverRaven#27 0x0000555555f124ec in game::do_regular_action (this=this@entry=0x555558276c40, act=@0x7fffffffd104: ACTION_PEEK, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2432
 CleverRaven#28 0x0000555555f15b09 in game::handle_action (this=0x555558276c40) at src/handle_action.cpp:3174
 CleverRaven#29 0x0000555555d8a108 in do_turn () at /usr/include/c++/13/bits/unique_ptr.h:199
 CleverRaven#30 0x0000555555781b4e in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873

(gdb) frame 7
(gdb) print p
$1 = {static dimension = 3, x = 4, y = -1, z = -5}
(gdb) print center
$2 = (const tripoint &) @0x7fffffffbda8: {static dimension = 3, x = 64, y = 59, z = -5}
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 13, 2024
Prevents referencing `visibility_cache` using out-of-bounds array
indexes such as negative values. Using out-of-bound indexes for this
array previously caused crashes when compiled with
`-D_GLIBCXX_ASSERTIONS`.

The function `pixel_minimap::render_critters` is, for example, called
with `center=(64,59,-5)`, which gives `start=(4,-1)` and then
`p=(4,-1,-5)`, which previously crashed because
`visibility_cache[p.x][p.y]` then gives a negative array index. Such
values were seen when peeking using `X` at a submap boundary.

Gdb backtrace of previous crash being fixed:
```
(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 CleverRaven#1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 CleverRaven#2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 CleverRaven#3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 CleverRaven#4  0x00007ffff7ad30be in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 CleverRaven#5  0x000055555668a04e in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 CleverRaven#6  0x000055555668ab7a in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 CleverRaven#7  pixel_minimap::render_critters (this=this@entry=0x555558108960, center=...) at src/pixel_minimap.cpp:521
 CleverRaven#8  0x000055555668ada2 in pixel_minimap::render (this=0x555558108960, center=...) at src/pixel_minimap.cpp:447
 CleverRaven#9  0x000055555668bb69 in pixel_minimap::draw (this=<optimized out>, screen_rect=..., center=...) at src/pixel_minimap.cpp:555
 CleverRaven#10 0x0000555555b3fd5c in cata_tiles::draw_minimap (this=this@entry=0x555558093020, dest=..., center=..., width=width@entry=352, height=height@entry=352) at src/cata_tiles.cpp:1919
 CleverRaven#11 0x00005555567f43d3 in cata_cursesport::curses_drawwindow (w=...) at src/sdltiles.cpp:1428
 CleverRaven#12 0x000055555666f5e2 in std::function<void(draw_args const&)>::operator() (__args#0=..., this=<optimized out>) at /usr/include/c++/13/bits/std_function.h:591
 CleverRaven#13 operator() (d=..., __closure=<optimized out>) at src/panels.cpp:54
 CleverRaven#14 std::__invoke_impl<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__f=...) at /usr/include/c++/13/bits/invoke.h:61
 CleverRaven#15 std::__invoke_r<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__fn=...) at /usr/include/c++/13/bits/invoke.h:114
 CleverRaven#16 std::_Function_handler<int(const draw_args&), window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)> >::_M_invoke(const std::_Any_data &, const draw_args &) (__functor=...,     __args#0=...) at /usr/include/c++/13/bits/std_function.h:290
 CleverRaven#17 0x0000555555e7c9ec in std::function<int(draw_args const&)>::operator() (__args#0=..., this=0x55559461d638) at /usr/include/c++/13/bits/std_function.h:591
 CleverRaven#18 game::draw_panels (this=this@entry=0x555558276c40, force_draw=force_draw@entry=true) at src/game.cpp:4006
 CleverRaven#19 0x0000555555e984f8 in game::draw (this=0x555558276c40, ui=...) at src/game.cpp:3960
 CleverRaven#20 0x000055555695df35 in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#21 0x000055555695e039 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#22 0x000055555695e060 in ui_manager::redraw () at src/ui_manager.cpp:506
 CleverRaven#23 0x0000555555ea95cf in game::look_around (this=this@entry=0x555558276c40, show_window=show_window@entry=true, center=..., start_point=..., has_first_point=has_first_point@entry=false, select_zone=false, peeking=true, is_moving_zone=<optimized out>, end_point=..., change_lv=true) at src/game.cpp:7529
 CleverRaven#24 0x0000555555eadd32 in game::look_around (this=this@entry=0x555558276c40, looka_params=...) at src/game.cpp:7697
 CleverRaven#25 0x0000555555eadecb in game::peek (this=this@entry=0x555558276c40, p=...) at src/game.cpp:6071
 CleverRaven#26 0x0000555555ec441a in game::peek (this=this@entry=0x555558276c40) at src/game.cpp:6050
 CleverRaven#27 0x0000555555f124ec in game::do_regular_action (this=this@entry=0x555558276c40, act=@0x7fffffffd104: ACTION_PEEK, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2432
 CleverRaven#28 0x0000555555f15b09 in game::handle_action (this=0x555558276c40) at src/handle_action.cpp:3174
 CleverRaven#29 0x0000555555d8a108 in do_turn () at /usr/include/c++/13/bits/unique_ptr.h:199
 CleverRaven#30 0x0000555555781b4e in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873

(gdb) frame 7
(gdb) print p
$1 = {static dimension = 3, x = 4, y = -1, z = -5}
(gdb) print center
$2 = (const tripoint &) @0x7fffffffbda8: {static dimension = 3, x = 64, y = 59, z = -5}
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 13, 2024
Prevents division by zero crash when displaying widgets with defined
break levels.

Example of where previous crash from div-by-zero happened:
* Provided save used the `zenfs_thick_sidebar`, which includes widget
  `zenfs_mana_bar_14_no_label` that defines break levels.
* When running the provided save, mana value is usually at `v=201` with
  `min=0` `max=201`.
* Those values are computed by `known_magic::max_mana` where internal
  values are `bionic_penalty=999` `mana_base=1000` `int_bonus=200`.
* But when int falls (because of tiredness), then
  `known_magic::max_mana` will return `0` because `int_bonus=-100`.
* This leads to `_var_max=0` in `widget::value_color` and thus
  `var_range=0` which causes the div by zero.

Backtrace of previous crash beng fixed:
```
Thread 1 "cataclysm-tiles" received signal SIGFPE, Arithmetic exception.
0x0000555556a9c54e in widget::value_color (this=this@entry=0x7fffffffb8d8, value=value@entry=201) at src/widget.cpp:1310
1310            const int value_offset = ( 100 * ( value - _var_min ) ) / var_range;

(gdb) bt
 #0  0x0000555556a9c54e in widget::value_color (this=this@entry=0x7fffffffb8d8, value=value@entry=201) at src/widget.cpp:1310
 CleverRaven#1  0x0000555556aa37dc in widget::color_value_string[abi:cxx11](int, int) (this=this@entry=0x7fffffffb8d8, value=201, width_max=width_max@entry=14) at src/widget.cpp:1262
 CleverRaven#2  0x0000555556aa38ca in widget::show[abi:cxx11](avatar const&, unsigned int) (this=this@entry=0x7fffffffb8d8, ava=..., max_width=max_width@entry=14) at src/widget.cpp:890
 CleverRaven#3  0x0000555556aa497f in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffb8d8, ava=..., max_width=<optimized out>, label_width=label_width@entry=0, skip_pad=false) at src/widget.cpp:1834
 CleverRaven#4  0x0000555556aa42c2 in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffbe88, ava=..., max_width=<optimized out>, label_width=label_width@entry=9, skip_pad=false) at src/widget.cpp:1794
 CleverRaven#5  0x0000555556aa3cfa in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffc438, ava=..., max_width=<optimized out>, label_width=label_width@entry=0, skip_pad=false) at src/widget.cpp:1724
 CleverRaven#6  0x0000555556aa42c2 in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffc9e8, ava=..., max_width=<optimized out>, label_width=label_width@entry=0, skip_pad=false) at src/widget.cpp:1794
 CleverRaven#7  0x0000555556aa42c2 in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x555562c47160, ava=..., max_width=<optimized out>, max_width@entry=64, label_width=<optimized out>, skip_pad=skip_pad@entry=false) at src/widget.cpp:1794
 CleverRaven#8  0x0000555556aa5222 in custom_draw_func (args=...) at src/widget.cpp:970
 CleverRaven#9  0x0000555555ec4360 in std::function<int(draw_args const&)>::operator() (this=0x555597eb1780, __args#0=...) at /usr/include/c++/14/bits/std_function.h:591
 CleverRaven#10 game::draw_panels (this=this@entry=0x55555827ef50, force_draw=force_draw@entry=true) at src/game.cpp:4007
 CleverRaven#11 0x0000555555eed1ac in game::draw (this=0x55555827ef50, ui=...) at src/game.cpp:3961
 CleverRaven#12 0x00005555569a962c in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#13 0x00005555569a96e9 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#14 0x00005555569a9710 in ui_manager::redraw () at src/ui_manager.cpp:506
 CleverRaven#15 0x0000555555dd0850 in do_turn () at src/do_turn.cpp:712
 CleverRaven#16 0x00005555557a138d in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873

(gdb) print var_range
$1 = 0
(gdb) print value
$2 = 201
(gdb) print _var_min
$3 = 0
(gdb) print _var_max
$4 = 0
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 13, 2024
Prevents division by zero crash when displaying widgets with defined
break levels.

Example of where previous crash from div-by-zero happened:
* Provided save used the `zenfs_thick_sidebar`, which includes widget
  `zenfs_mana_bar_14_no_label` that defines break levels.
* When running the provided save, mana value is usually at `v=201` with
  `min=0` `max=201`.
* Those values are computed by `known_magic::max_mana` where internal
  values are `bionic_penalty=999` `mana_base=1000` `int_bonus=200`.
* But when int falls (because of tiredness), then
  `known_magic::max_mana` will return `0` because `int_bonus=-100`.
* This leads to `_var_max=0` in `widget::value_color` and thus
  `var_range=0` which causes the div by zero.

Backtrace of previous crash beng fixed:
```
Thread 1 "cataclysm-tiles" received signal SIGFPE, Arithmetic exception.
0x0000555556a9c54e in widget::value_color (this=this@entry=0x7fffffffb8d8, value=value@entry=201) at src/widget.cpp:1310
1310            const int value_offset = ( 100 * ( value - _var_min ) ) / var_range;

(gdb) bt
 #0  0x0000555556a9c54e in widget::value_color (this=this@entry=0x7fffffffb8d8, value=value@entry=201) at src/widget.cpp:1310
 CleverRaven#1  0x0000555556aa37dc in widget::color_value_string[abi:cxx11](int, int) (this=this@entry=0x7fffffffb8d8, value=201, width_max=width_max@entry=14) at src/widget.cpp:1262
 CleverRaven#2  0x0000555556aa38ca in widget::show[abi:cxx11](avatar const&, unsigned int) (this=this@entry=0x7fffffffb8d8, ava=..., max_width=max_width@entry=14) at src/widget.cpp:890
 CleverRaven#3  0x0000555556aa497f in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffb8d8, ava=..., max_width=<optimized out>, label_width=label_width@entry=0, skip_pad=false) at src/widget.cpp:1834
 CleverRaven#4  0x0000555556aa42c2 in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffbe88, ava=..., max_width=<optimized out>, label_width=label_width@entry=9, skip_pad=false) at src/widget.cpp:1794
 CleverRaven#5  0x0000555556aa3cfa in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffc438, ava=..., max_width=<optimized out>, label_width=label_width@entry=0, skip_pad=false) at src/widget.cpp:1724
 CleverRaven#6  0x0000555556aa42c2 in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffc9e8, ava=..., max_width=<optimized out>, label_width=label_width@entry=0, skip_pad=false) at src/widget.cpp:1794
 CleverRaven#7  0x0000555556aa42c2 in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x555562c47160, ava=..., max_width=<optimized out>, max_width@entry=64, label_width=<optimized out>, skip_pad=skip_pad@entry=false) at src/widget.cpp:1794
 CleverRaven#8  0x0000555556aa5222 in custom_draw_func (args=...) at src/widget.cpp:970
 CleverRaven#9  0x0000555555ec4360 in std::function<int(draw_args const&)>::operator() (this=0x555597eb1780, __args#0=...) at /usr/include/c++/14/bits/std_function.h:591
 CleverRaven#10 game::draw_panels (this=this@entry=0x55555827ef50, force_draw=force_draw@entry=true) at src/game.cpp:4007
 CleverRaven#11 0x0000555555eed1ac in game::draw (this=0x55555827ef50, ui=...) at src/game.cpp:3961
 CleverRaven#12 0x00005555569a962c in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#13 0x00005555569a96e9 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#14 0x00005555569a9710 in ui_manager::redraw () at src/ui_manager.cpp:506
 CleverRaven#15 0x0000555555dd0850 in do_turn () at src/do_turn.cpp:712
 CleverRaven#16 0x00005555557a138d in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873

(gdb) print var_range
$1 = 0
(gdb) print value
$2 = 201
(gdb) print _var_min
$3 = 0
(gdb) print _var_max
$4 = 0
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 14, 2024
Prevents referencing `visibility_cache` using out-of-bounds array
indexes such as negative values. Using out-of-bound indexes for this
array previously caused crashes when compiled with
`-D_GLIBCXX_ASSERTIONS`.

The function `pixel_minimap::render_critters` is, for example, called
with `center=(64,59,-5)`, which gives `start=(4,-1)` and then
`p=(4,-1,-5)`, which previously crashed because
`visibility_cache[p.x][p.y]` then gives a negative array index. Such
values were seen when peeking using `X` at a submap boundary.

Gdb backtrace of previous crash being fixed:
```
(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 CleverRaven#1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 CleverRaven#2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 CleverRaven#3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 CleverRaven#4  0x00007ffff7ad30be in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 CleverRaven#5  0x000055555668a04e in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 CleverRaven#6  0x000055555668ab7a in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 CleverRaven#7  pixel_minimap::render_critters (this=this@entry=0x555558108960, center=...) at src/pixel_minimap.cpp:521
 CleverRaven#8  0x000055555668ada2 in pixel_minimap::render (this=0x555558108960, center=...) at src/pixel_minimap.cpp:447
 CleverRaven#9  0x000055555668bb69 in pixel_minimap::draw (this=<optimized out>, screen_rect=..., center=...) at src/pixel_minimap.cpp:555
 CleverRaven#10 0x0000555555b3fd5c in cata_tiles::draw_minimap (this=this@entry=0x555558093020, dest=..., center=..., width=width@entry=352, height=height@entry=352) at src/cata_tiles.cpp:1919
 CleverRaven#11 0x00005555567f43d3 in cata_cursesport::curses_drawwindow (w=...) at src/sdltiles.cpp:1428
 CleverRaven#12 0x000055555666f5e2 in std::function<void(draw_args const&)>::operator() (__args#0=..., this=<optimized out>) at /usr/include/c++/13/bits/std_function.h:591
 CleverRaven#13 operator() (d=..., __closure=<optimized out>) at src/panels.cpp:54
 CleverRaven#14 std::__invoke_impl<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__f=...) at /usr/include/c++/13/bits/invoke.h:61
 CleverRaven#15 std::__invoke_r<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__fn=...) at /usr/include/c++/13/bits/invoke.h:114
 CleverRaven#16 std::_Function_handler<int(const draw_args&), window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)> >::_M_invoke(const std::_Any_data &, const draw_args &) (__functor=...,     __args#0=...) at /usr/include/c++/13/bits/std_function.h:290
 CleverRaven#17 0x0000555555e7c9ec in std::function<int(draw_args const&)>::operator() (__args#0=..., this=0x55559461d638) at /usr/include/c++/13/bits/std_function.h:591
 CleverRaven#18 game::draw_panels (this=this@entry=0x555558276c40, force_draw=force_draw@entry=true) at src/game.cpp:4006
 CleverRaven#19 0x0000555555e984f8 in game::draw (this=0x555558276c40, ui=...) at src/game.cpp:3960
 CleverRaven#20 0x000055555695df35 in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#21 0x000055555695e039 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#22 0x000055555695e060 in ui_manager::redraw () at src/ui_manager.cpp:506
 CleverRaven#23 0x0000555555ea95cf in game::look_around (this=this@entry=0x555558276c40, show_window=show_window@entry=true, center=..., start_point=..., has_first_point=has_first_point@entry=false, select_zone=false, peeking=true, is_moving_zone=<optimized out>, end_point=..., change_lv=true) at src/game.cpp:7529
 CleverRaven#24 0x0000555555eadd32 in game::look_around (this=this@entry=0x555558276c40, looka_params=...) at src/game.cpp:7697
 CleverRaven#25 0x0000555555eadecb in game::peek (this=this@entry=0x555558276c40, p=...) at src/game.cpp:6071
 CleverRaven#26 0x0000555555ec441a in game::peek (this=this@entry=0x555558276c40) at src/game.cpp:6050
 CleverRaven#27 0x0000555555f124ec in game::do_regular_action (this=this@entry=0x555558276c40, act=@0x7fffffffd104: ACTION_PEEK, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2432
 CleverRaven#28 0x0000555555f15b09 in game::handle_action (this=0x555558276c40) at src/handle_action.cpp:3174
 CleverRaven#29 0x0000555555d8a108 in do_turn () at /usr/include/c++/13/bits/unique_ptr.h:199
 CleverRaven#30 0x0000555555781b4e in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873

(gdb) frame 7
(gdb) print p
$1 = {static dimension = 3, x = 4, y = -1, z = -5}
(gdb) print center
$2 = (const tripoint &) @0x7fffffffbda8: {static dimension = 3, x = 64, y = 59, z = -5}
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 15, 2024
Prevents crashes that previously happened from using references to
`explosion_data` that had been invalidated.

The problem before happened when killing "unfolded impossibility" in
LIXA facility with a grenade, since this monster runs an eoc that
switches maps. That led to `explosion_handler::process_explosions` being
called twice recursively. First invocation iterates references, and the
second invocation might append to the vector, and most certaily will
clear the vector, thus invalidating references for the first invocation.

Example crash being fixed by this commit, notice how
`explosion_handler::process_explosions` occurs twice in the callstack:

```
Thread 1 "cataclysm-tiles" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44

(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 CleverRaven#1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 CleverRaven#2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 CleverRaven#3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 CleverRaven#4  0x00007ffff7ad501e in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 CleverRaven#5  0x000055555688b471 in std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*> >::operator[] (this=<optimized out>, __n=1967424379) at /usr/include/c++/14/bits/stl_vector.h:1128
 CleverRaven#6  std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*> >::operator[] (this=<optimized out>, __n=1967424379) at /usr/include/c++/14/bits/stl_vector.h:1128
 CleverRaven#7  string_identity_static::get_interned_string[abi:cxx11](int) (id=1967424379) at src/string_id.cpp:51
 CleverRaven#8  0x0000555555fffed7 in string_identity_static::str[abi:cxx11]() const (this=<optimized out>) at src/string_id.h:140
 CleverRaven#9  0x0000555556057423 in string_id<itype>::c_str (this=this@entry=0x5555a126a718) at src/string_id.h:253
 CleverRaven#10 0x00005555560be56a in Item_factory::find_template (this=0x55555751cad0, id=...) at src/item_factory.cpp:2563
 CleverRaven#11 0x0000555555e4b0c5 in explosion_handler::_make_explosion (source=<optimized out>, p=..., ex=...) at /usr/include/c++/14/bits/unique_ptr.h:193
 CleverRaven#12 0x0000555555e4b704 in explosion_handler::process_explosions () at src/explosion.cpp:923
 CleverRaven#13 0x0000555556246e97 in map::actualize (this=this@entry=0x5555a12bf890, grid=...) at src/map.cpp:9168
 CleverRaven#14 0x00005555562472c0 in map::load (this=this@entry=0x5555a12bf890, w=..., update_vehicle=update_vehicle@entry=true, pump_events=pump_events@entry=false) at src/map.cpp:8387
 CleverRaven#15 0x0000555555de2546 in tinymap::load (this=this@entry=0x5555a12bf890, w=..., update_vehicles=update_vehicles@entry=true, pump_events=pump_events@entry=false) at src/map.h:2765
 CleverRaven#16 0x00005555562a7e6f in update_mapgen_function_json::update_map (this=0x55555a8ce8f0, omt_pos=..., args=..., offset=..., miss=miss@entry=0x0, verify=verify@entry=true, mirror_horizontal=false, mirror_vertical=false, rotation=0) at src/mapgen.cpp:8015
 CleverRaven#17 0x00005555562a81e3 in run_mapgen_update_func (update_mapgen_id=..., omt_pos=..., args=..., miss=miss@entry=0x0, cancel_on_collision=cancel_on_collision@entry=true, mirror_horizontal=mirror_horizontal@entry=false, mirror_vertical=false, rotation=0) at src/mapgen.cpp:8117
 CleverRaven#18 0x00005555565a0250 in operator() (__closure=<optimized out>, d=...) at src/npctalk.cpp:3964
 CleverRaven#19 0x000055555659c7a4 in talk_effect_t::apply (this=this@entry=0x55555d5211d8, d=...) at src/npctalk.cpp:6526
 CleverRaven#20 0x0000555555e0c9ba in effect_on_condition::activate (this=0x55555d521160, d=..., require_callstack_check=require_callstack_check@entry=true) at src/effect_on_condition.cpp:329
 CleverRaven#21 0x00005555561f9693 in spell_effect::effect_on_condition (sp=..., caster=..., target=...) at src/magic_spell_effect.cpp:1806
 CleverRaven#22 0x00005555561d101e in spell::cast_all_effects (this=0x7fffffffc788, source=..., target=...) at src/magic.cpp:1907
 CleverRaven#23 0x0000555556463bec in monster::die (this=0x55559c7fc0a0, nkiller=0x0) at src/monster.cpp:2941
 CleverRaven#24 0x0000555555d33386 in Creature::deal_projectile_attack (this=0x55559c7fc0a0, source=0x0, attack=..., print_messages=<optimized out>, wp_attack=...) at src/creature.cpp:1311
 CleverRaven#25 0x0000555556465049 in monster::deal_projectile_attack (this=this@entry=0x55559c7fc0a0, source=source@entry=0x0, attack=..., print_messages=print_messages@entry=false, wp_attack=...) at src/monster.cpp:2212
 CleverRaven#26 0x0000555555e4a9d9 in explosion_handler::shrapnel (range=-1, source=<optimized out>, src=..., power=<optimized out>, casing_mass=<optimized out>, per_fragment_mass=<optimized out>) at src/explosion.cpp:463
 CleverRaven#27 explosion_handler::_make_explosion (source=<optimized out>, p=..., ex=...) at src/explosion.cpp:536
 CleverRaven#28 0x0000555555e4b704 in explosion_handler::process_explosions () at src/explosion.cpp:923
 CleverRaven#29 0x0000555555dcf46f in do_turn () at src/do_turn.cpp:648
 CleverRaven#30 0x00005555557a1227 in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873
```

In the crash above, the `explosion_data` has been invalidated:
```
(gdb) frame 11
193           pointer    _M_ptr() const noexcept { return std::get<0>(_M_t); }

(gdb) print ex
$1 = (const explosion_data &) @0x5555a126a6f8: {power = 1.75295132e+25, distance_factor = 2.76847299e+20, max_noise = 1667855474, fire = 117, shrapnel = {casing_mass = 1936026889, fragment_mass = 6.82915174e+22, recovery = -1584519120, drop = {_version = 13059389229367304, _cid = 2019155690, _id = {
        _id = 1967424379}}}}

(gdb) print ex.shrapnel.drop
$2 = {_version = 13059389229367304, _cid = 2019155690, _id = {_id = 1967424379}}
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 15, 2024
Prevents crashes that previously happened from using references to
`explosion_data` that had been invalidated.

The problem before happened when killing "unfolded impossibility" in
LIXA facility with a grenade, since this monster runs an eoc that
switches maps. That led to `explosion_handler::process_explosions` being
called twice recursively. First invocation iterates references, and the
second invocation might append to the vector, and most certaily will
clear the vector, thus invalidating references for the first invocation.

Example crash being fixed by this commit, notice how
`explosion_handler::process_explosions` occurs twice in the callstack:

```
Thread 1 "cataclysm-tiles" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44

(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 CleverRaven#1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 CleverRaven#2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 CleverRaven#3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 CleverRaven#4  0x00007ffff7ad501e in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 CleverRaven#5  0x000055555688b471 in std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*> >::operator[] (this=<optimized out>, __n=1967424379) at /usr/include/c++/14/bits/stl_vector.h:1128
 CleverRaven#6  std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*> >::operator[] (this=<optimized out>, __n=1967424379) at /usr/include/c++/14/bits/stl_vector.h:1128
 CleverRaven#7  string_identity_static::get_interned_string[abi:cxx11](int) (id=1967424379) at src/string_id.cpp:51
 CleverRaven#8  0x0000555555fffed7 in string_identity_static::str[abi:cxx11]() const (this=<optimized out>) at src/string_id.h:140
 CleverRaven#9  0x0000555556057423 in string_id<itype>::c_str (this=this@entry=0x5555a126a718) at src/string_id.h:253
 CleverRaven#10 0x00005555560be56a in Item_factory::find_template (this=0x55555751cad0, id=...) at src/item_factory.cpp:2563
 CleverRaven#11 0x0000555555e4b0c5 in explosion_handler::_make_explosion (source=<optimized out>, p=..., ex=...) at /usr/include/c++/14/bits/unique_ptr.h:193
 CleverRaven#12 0x0000555555e4b704 in explosion_handler::process_explosions () at src/explosion.cpp:923
 CleverRaven#13 0x0000555556246e97 in map::actualize (this=this@entry=0x5555a12bf890, grid=...) at src/map.cpp:9168
 CleverRaven#14 0x00005555562472c0 in map::load (this=this@entry=0x5555a12bf890, w=..., update_vehicle=update_vehicle@entry=true, pump_events=pump_events@entry=false) at src/map.cpp:8387
 CleverRaven#15 0x0000555555de2546 in tinymap::load (this=this@entry=0x5555a12bf890, w=..., update_vehicles=update_vehicles@entry=true, pump_events=pump_events@entry=false) at src/map.h:2765
 CleverRaven#16 0x00005555562a7e6f in update_mapgen_function_json::update_map (this=0x55555a8ce8f0, omt_pos=..., args=..., offset=..., miss=miss@entry=0x0, verify=verify@entry=true, mirror_horizontal=false, mirror_vertical=false, rotation=0) at src/mapgen.cpp:8015
 CleverRaven#17 0x00005555562a81e3 in run_mapgen_update_func (update_mapgen_id=..., omt_pos=..., args=..., miss=miss@entry=0x0, cancel_on_collision=cancel_on_collision@entry=true, mirror_horizontal=mirror_horizontal@entry=false, mirror_vertical=false, rotation=0) at src/mapgen.cpp:8117
 CleverRaven#18 0x00005555565a0250 in operator() (__closure=<optimized out>, d=...) at src/npctalk.cpp:3964
 CleverRaven#19 0x000055555659c7a4 in talk_effect_t::apply (this=this@entry=0x55555d5211d8, d=...) at src/npctalk.cpp:6526
 CleverRaven#20 0x0000555555e0c9ba in effect_on_condition::activate (this=0x55555d521160, d=..., require_callstack_check=require_callstack_check@entry=true) at src/effect_on_condition.cpp:329
 CleverRaven#21 0x00005555561f9693 in spell_effect::effect_on_condition (sp=..., caster=..., target=...) at src/magic_spell_effect.cpp:1806
 CleverRaven#22 0x00005555561d101e in spell::cast_all_effects (this=0x7fffffffc788, source=..., target=...) at src/magic.cpp:1907
 CleverRaven#23 0x0000555556463bec in monster::die (this=0x55559c7fc0a0, nkiller=0x0) at src/monster.cpp:2941
 CleverRaven#24 0x0000555555d33386 in Creature::deal_projectile_attack (this=0x55559c7fc0a0, source=0x0, attack=..., print_messages=<optimized out>, wp_attack=...) at src/creature.cpp:1311
 CleverRaven#25 0x0000555556465049 in monster::deal_projectile_attack (this=this@entry=0x55559c7fc0a0, source=source@entry=0x0, attack=..., print_messages=print_messages@entry=false, wp_attack=...) at src/monster.cpp:2212
 CleverRaven#26 0x0000555555e4a9d9 in explosion_handler::shrapnel (range=-1, source=<optimized out>, src=..., power=<optimized out>, casing_mass=<optimized out>, per_fragment_mass=<optimized out>) at src/explosion.cpp:463
 CleverRaven#27 explosion_handler::_make_explosion (source=<optimized out>, p=..., ex=...) at src/explosion.cpp:536
 CleverRaven#28 0x0000555555e4b704 in explosion_handler::process_explosions () at src/explosion.cpp:923
 CleverRaven#29 0x0000555555dcf46f in do_turn () at src/do_turn.cpp:648
 CleverRaven#30 0x00005555557a1227 in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873
```

In the crash above, the `explosion_data` has been invalidated:
```
(gdb) frame 11
193           pointer    _M_ptr() const noexcept { return std::get<0>(_M_t); }

(gdb) print ex
$1 = (const explosion_data &) @0x5555a126a6f8: {power = 1.75295132e+25, distance_factor = 2.76847299e+20, max_noise = 1667855474, fire = 117, shrapnel = {casing_mass = 1936026889, fragment_mass = 6.82915174e+22, recovery = -1584519120, drop = {_version = 13059389229367304, _cid = 2019155690, _id = {
        _id = 1967424379}}}}

(gdb) print ex.shrapnel.drop
$2 = {_version = 13059389229367304, _cid = 2019155690, _id = {_id = 1967424379}}
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 16, 2024
Prevents the crash listed below that previously happened when searching
for zones to add, but the search yielded no results:

```
Thread 1 "cataclysm-tiles" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44

(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 CleverRaven#1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 CleverRaven#2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 CleverRaven#3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 CleverRaven#4  0x00007ffff7ad501e in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 CleverRaven#5  0x0000555555de2639 in std::vector<uilist_entry, std::allocator<uilist_entry> >::operator[] (this=<optimized out>, __n=<optimized out>) at /usr/include/c++/14/bits/stl_vector.h:1130
 CleverRaven#6  std::vector<uilist_entry, std::allocator<uilist_entry> >::operator[] (this=<optimized out>, __n=<optimized out>) at /usr/include/c++/14/bits/stl_vector.h:1128
 CleverRaven#7  0x000055555699deac in uilist_impl::draw_controls (this=0x555599a181d0) at src/ui.cpp:138
 CleverRaven#8  0x0000555555b7c312 in cataimgui::window::draw (this=0x555599a181d0) at src/cata_imgui.cpp:631
 CleverRaven#9  cataimgui::window::draw (this=0x555599a181d0) at src/cata_imgui.cpp:600
 CleverRaven#10 0x00005555569a2b1c in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#11 0x00005555569a2bd9 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#12 0x00005555569a2c00 in ui_manager::redraw () at src/ui_manager.cpp:508
 CleverRaven#13 0x000055555699bfa4 in uilist::inputfilter (this=this@entry=0x7fffffffb9c8) at src/ui.cpp:531
 CleverRaven#14 0x000055555699ead4 in uilist::query (this=this@entry=0x7fffffffb9c8, loop=loop@entry=true, timeout=timeout@entry=-1, allow_unfiltered_hotkeys=allow_unfiltered_hotkeys@entry=false) at src/ui.cpp:865
 CleverRaven#15 0x0000555555c610d4 in zone_manager::query_type (this=this@entry=0x555557274060 <zone_manager::get_manager()::manager>, personal=personal@entry=false) at src/clzones.cpp:621
 CleverRaven#16 0x0000555555ef3894 in game::zones_manager (this=this@entry=0x555558291db0) at src/game.cpp:6944
 CleverRaven#17 0x0000555555f5d279 in game::do_regular_action (this=this@entry=0x555558291db0, act=@0x7fffffffcfec: ACTION_ZONES, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2438
 CleverRaven#18 0x0000555555f60769 in game::handle_action (this=0x555558291db0) at src/handle_action.cpp:3172
 CleverRaven#19 0x0000555555dcf14d in do_turn () at src/do_turn.cpp:579
 CleverRaven#20 0x00005555557a1217 in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873
```

gdb shows that `parent.selected` was negative:
```
(gdb) frame 7
138                                           parent.entries[parent.selected].desc.c_str()
(gdb) print parent.selected
$1 = -1
(gdb) print parent.entries.size()
$2 = 63
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 16, 2024
Prevents the crash listed below that previously happened when searching
for zones to add, but the search yielded no results:

```
Thread 1 "cataclysm-tiles" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44

(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 CleverRaven#1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 CleverRaven#2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 CleverRaven#3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 CleverRaven#4  0x00007ffff7ad501e in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 CleverRaven#5  0x0000555555de2639 in std::vector<uilist_entry, std::allocator<uilist_entry> >::operator[] (this=<optimized out>, __n=<optimized out>) at /usr/include/c++/14/bits/stl_vector.h:1130
 CleverRaven#6  std::vector<uilist_entry, std::allocator<uilist_entry> >::operator[] (this=<optimized out>, __n=<optimized out>) at /usr/include/c++/14/bits/stl_vector.h:1128
 CleverRaven#7  0x000055555699deac in uilist_impl::draw_controls (this=0x555599a181d0) at src/ui.cpp:138
 CleverRaven#8  0x0000555555b7c312 in cataimgui::window::draw (this=0x555599a181d0) at src/cata_imgui.cpp:631
 CleverRaven#9  cataimgui::window::draw (this=0x555599a181d0) at src/cata_imgui.cpp:600
 CleverRaven#10 0x00005555569a2b1c in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#11 0x00005555569a2bd9 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#12 0x00005555569a2c00 in ui_manager::redraw () at src/ui_manager.cpp:508
 CleverRaven#13 0x000055555699bfa4 in uilist::inputfilter (this=this@entry=0x7fffffffb9c8) at src/ui.cpp:531
 CleverRaven#14 0x000055555699ead4 in uilist::query (this=this@entry=0x7fffffffb9c8, loop=loop@entry=true, timeout=timeout@entry=-1, allow_unfiltered_hotkeys=allow_unfiltered_hotkeys@entry=false) at src/ui.cpp:865
 CleverRaven#15 0x0000555555c610d4 in zone_manager::query_type (this=this@entry=0x555557274060 <zone_manager::get_manager()::manager>, personal=personal@entry=false) at src/clzones.cpp:621
 CleverRaven#16 0x0000555555ef3894 in game::zones_manager (this=this@entry=0x555558291db0) at src/game.cpp:6944
 CleverRaven#17 0x0000555555f5d279 in game::do_regular_action (this=this@entry=0x555558291db0, act=@0x7fffffffcfec: ACTION_ZONES, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2438
 CleverRaven#18 0x0000555555f60769 in game::handle_action (this=0x555558291db0) at src/handle_action.cpp:3172
 CleverRaven#19 0x0000555555dcf14d in do_turn () at src/do_turn.cpp:579
 CleverRaven#20 0x00005555557a1217 in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873
```

gdb shows that `parent.selected` was negative:
```
(gdb) frame 7
138                                           parent.entries[parent.selected].desc.c_str()
(gdb) print parent.selected
$1 = -1
(gdb) print parent.entries.size()
$2 = 63
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 16, 2024
Prevents the crash listed below that previously happened when searching
for zones to add, but the search yielded no results:

```
Thread 1 "cataclysm-tiles" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44

(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 CleverRaven#1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 CleverRaven#2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 CleverRaven#3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 CleverRaven#4  0x00007ffff7ad501e in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 CleverRaven#5  0x0000555555de2639 in std::vector<uilist_entry, std::allocator<uilist_entry> >::operator[] (this=<optimized out>, __n=<optimized out>) at /usr/include/c++/14/bits/stl_vector.h:1130
 CleverRaven#6  std::vector<uilist_entry, std::allocator<uilist_entry> >::operator[] (this=<optimized out>, __n=<optimized out>) at /usr/include/c++/14/bits/stl_vector.h:1128
 CleverRaven#7  0x000055555699deac in uilist_impl::draw_controls (this=0x555599a181d0) at src/ui.cpp:138
 CleverRaven#8  0x0000555555b7c312 in cataimgui::window::draw (this=0x555599a181d0) at src/cata_imgui.cpp:631
 CleverRaven#9  cataimgui::window::draw (this=0x555599a181d0) at src/cata_imgui.cpp:600
 CleverRaven#10 0x00005555569a2b1c in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#11 0x00005555569a2bd9 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#12 0x00005555569a2c00 in ui_manager::redraw () at src/ui_manager.cpp:508
 CleverRaven#13 0x000055555699bfa4 in uilist::inputfilter (this=this@entry=0x7fffffffb9c8) at src/ui.cpp:531
 CleverRaven#14 0x000055555699ead4 in uilist::query (this=this@entry=0x7fffffffb9c8, loop=loop@entry=true, timeout=timeout@entry=-1, allow_unfiltered_hotkeys=allow_unfiltered_hotkeys@entry=false) at src/ui.cpp:865
 CleverRaven#15 0x0000555555c610d4 in zone_manager::query_type (this=this@entry=0x555557274060 <zone_manager::get_manager()::manager>, personal=personal@entry=false) at src/clzones.cpp:621
 CleverRaven#16 0x0000555555ef3894 in game::zones_manager (this=this@entry=0x555558291db0) at src/game.cpp:6944
 CleverRaven#17 0x0000555555f5d279 in game::do_regular_action (this=this@entry=0x555558291db0, act=@0x7fffffffcfec: ACTION_ZONES, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2438
 CleverRaven#18 0x0000555555f60769 in game::handle_action (this=0x555558291db0) at src/handle_action.cpp:3172
 CleverRaven#19 0x0000555555dcf14d in do_turn () at src/do_turn.cpp:579
 CleverRaven#20 0x00005555557a1217 in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873
```

gdb shows that `parent.selected` was negative:
```
(gdb) frame 7
138                                           parent.entries[parent.selected].desc.c_str()
(gdb) print parent.selected
$1 = -1
(gdb) print parent.entries.size()
$2 = 63
```
dseguin pushed a commit that referenced this pull request Aug 18, 2024
Prevents crashes that previously happened from using references to
`explosion_data` that had been invalidated.

The problem before happened when killing "unfolded impossibility" in
LIXA facility with a grenade, since this monster runs an eoc that
switches maps. That led to `explosion_handler::process_explosions` being
called twice recursively. First invocation iterates references, and the
second invocation might append to the vector, and most certaily will
clear the vector, thus invalidating references for the first invocation.

Example crash being fixed by this commit, notice how
`explosion_handler::process_explosions` occurs twice in the callstack:

```
Thread 1 "cataclysm-tiles" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44

(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 #1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 #2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 #3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 #4  0x00007ffff7ad501e in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 #5  0x000055555688b471 in std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*> >::operator[] (this=<optimized out>, __n=1967424379) at /usr/include/c++/14/bits/stl_vector.h:1128
 #6  std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*> >::operator[] (this=<optimized out>, __n=1967424379) at /usr/include/c++/14/bits/stl_vector.h:1128
 #7  string_identity_static::get_interned_string[abi:cxx11](int) (id=1967424379) at src/string_id.cpp:51
 #8  0x0000555555fffed7 in string_identity_static::str[abi:cxx11]() const (this=<optimized out>) at src/string_id.h:140
 #9  0x0000555556057423 in string_id<itype>::c_str (this=this@entry=0x5555a126a718) at src/string_id.h:253
 #10 0x00005555560be56a in Item_factory::find_template (this=0x55555751cad0, id=...) at src/item_factory.cpp:2563
 #11 0x0000555555e4b0c5 in explosion_handler::_make_explosion (source=<optimized out>, p=..., ex=...) at /usr/include/c++/14/bits/unique_ptr.h:193
 #12 0x0000555555e4b704 in explosion_handler::process_explosions () at src/explosion.cpp:923
 #13 0x0000555556246e97 in map::actualize (this=this@entry=0x5555a12bf890, grid=...) at src/map.cpp:9168
 #14 0x00005555562472c0 in map::load (this=this@entry=0x5555a12bf890, w=..., update_vehicle=update_vehicle@entry=true, pump_events=pump_events@entry=false) at src/map.cpp:8387
 #15 0x0000555555de2546 in tinymap::load (this=this@entry=0x5555a12bf890, w=..., update_vehicles=update_vehicles@entry=true, pump_events=pump_events@entry=false) at src/map.h:2765
 #16 0x00005555562a7e6f in update_mapgen_function_json::update_map (this=0x55555a8ce8f0, omt_pos=..., args=..., offset=..., miss=miss@entry=0x0, verify=verify@entry=true, mirror_horizontal=false, mirror_vertical=false, rotation=0) at src/mapgen.cpp:8015
 #17 0x00005555562a81e3 in run_mapgen_update_func (update_mapgen_id=..., omt_pos=..., args=..., miss=miss@entry=0x0, cancel_on_collision=cancel_on_collision@entry=true, mirror_horizontal=mirror_horizontal@entry=false, mirror_vertical=false, rotation=0) at src/mapgen.cpp:8117
 #18 0x00005555565a0250 in operator() (__closure=<optimized out>, d=...) at src/npctalk.cpp:3964
 #19 0x000055555659c7a4 in talk_effect_t::apply (this=this@entry=0x55555d5211d8, d=...) at src/npctalk.cpp:6526
 #20 0x0000555555e0c9ba in effect_on_condition::activate (this=0x55555d521160, d=..., require_callstack_check=require_callstack_check@entry=true) at src/effect_on_condition.cpp:329
 #21 0x00005555561f9693 in spell_effect::effect_on_condition (sp=..., caster=..., target=...) at src/magic_spell_effect.cpp:1806
 #22 0x00005555561d101e in spell::cast_all_effects (this=0x7fffffffc788, source=..., target=...) at src/magic.cpp:1907
 #23 0x0000555556463bec in monster::die (this=0x55559c7fc0a0, nkiller=0x0) at src/monster.cpp:2941
 #24 0x0000555555d33386 in Creature::deal_projectile_attack (this=0x55559c7fc0a0, source=0x0, attack=..., print_messages=<optimized out>, wp_attack=...) at src/creature.cpp:1311
 #25 0x0000555556465049 in monster::deal_projectile_attack (this=this@entry=0x55559c7fc0a0, source=source@entry=0x0, attack=..., print_messages=print_messages@entry=false, wp_attack=...) at src/monster.cpp:2212
 #26 0x0000555555e4a9d9 in explosion_handler::shrapnel (range=-1, source=<optimized out>, src=..., power=<optimized out>, casing_mass=<optimized out>, per_fragment_mass=<optimized out>) at src/explosion.cpp:463
 #27 explosion_handler::_make_explosion (source=<optimized out>, p=..., ex=...) at src/explosion.cpp:536
 #28 0x0000555555e4b704 in explosion_handler::process_explosions () at src/explosion.cpp:923
 #29 0x0000555555dcf46f in do_turn () at src/do_turn.cpp:648
 #30 0x00005555557a1227 in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873
```

In the crash above, the `explosion_data` has been invalidated:
```
(gdb) frame 11
193           pointer    _M_ptr() const noexcept { return std::get<0>(_M_t); }

(gdb) print ex
$1 = (const explosion_data &) @0x5555a126a6f8: {power = 1.75295132e+25, distance_factor = 2.76847299e+20, max_noise = 1667855474, fire = 117, shrapnel = {casing_mass = 1936026889, fragment_mass = 6.82915174e+22, recovery = -1584519120, drop = {_version = 13059389229367304, _cid = 2019155690, _id = {
        _id = 1967424379}}}}

(gdb) print ex.shrapnel.drop
$2 = {_version = 13059389229367304, _cid = 2019155690, _id = {_id = 1967424379}}
```
inogenous added a commit to inogenous/Cataclysm-DDA that referenced this pull request Aug 19, 2024
Prevents referencing `visibility_cache` using out-of-bounds array
indexes such as negative values. Using out-of-bound indexes for this
array previously caused crashes when compiled with
`-D_GLIBCXX_ASSERTIONS`.

The function `pixel_minimap::render_critters` is, for example, called
with `center=(64,59,-5)`, which gives `start=(4,-1)` and then
`p=(4,-1,-5)`, which previously crashed because
`visibility_cache[p.x][p.y]` then gives a negative array index. Such
values were seen when peeking using `X` at a submap boundary.

Gdb backtrace of previous crash being fixed:
```
(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 CleverRaven#1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 CleverRaven#2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 CleverRaven#3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 CleverRaven#4  0x00007ffff7ad30be in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 CleverRaven#5  0x000055555668a04e in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 CleverRaven#6  0x000055555668ab7a in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 CleverRaven#7  pixel_minimap::render_critters (this=this@entry=0x555558108960, center=...) at src/pixel_minimap.cpp:521
 CleverRaven#8  0x000055555668ada2 in pixel_minimap::render (this=0x555558108960, center=...) at src/pixel_minimap.cpp:447
 CleverRaven#9  0x000055555668bb69 in pixel_minimap::draw (this=<optimized out>, screen_rect=..., center=...) at src/pixel_minimap.cpp:555
 CleverRaven#10 0x0000555555b3fd5c in cata_tiles::draw_minimap (this=this@entry=0x555558093020, dest=..., center=..., width=width@entry=352, height=height@entry=352) at src/cata_tiles.cpp:1919
 CleverRaven#11 0x00005555567f43d3 in cata_cursesport::curses_drawwindow (w=...) at src/sdltiles.cpp:1428
 CleverRaven#12 0x000055555666f5e2 in std::function<void(draw_args const&)>::operator() (__args#0=..., this=<optimized out>) at /usr/include/c++/13/bits/std_function.h:591
 CleverRaven#13 operator() (d=..., __closure=<optimized out>) at src/panels.cpp:54
 CleverRaven#14 std::__invoke_impl<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__f=...) at /usr/include/c++/13/bits/invoke.h:61
 CleverRaven#15 std::__invoke_r<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__fn=...) at /usr/include/c++/13/bits/invoke.h:114
 CleverRaven#16 std::_Function_handler<int(const draw_args&), window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)> >::_M_invoke(const std::_Any_data &, const draw_args &) (__functor=...,     __args#0=...) at /usr/include/c++/13/bits/std_function.h:290
 CleverRaven#17 0x0000555555e7c9ec in std::function<int(draw_args const&)>::operator() (__args#0=..., this=0x55559461d638) at /usr/include/c++/13/bits/std_function.h:591
 CleverRaven#18 game::draw_panels (this=this@entry=0x555558276c40, force_draw=force_draw@entry=true) at src/game.cpp:4006
 CleverRaven#19 0x0000555555e984f8 in game::draw (this=0x555558276c40, ui=...) at src/game.cpp:3960
 CleverRaven#20 0x000055555695df35 in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#21 0x000055555695e039 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#22 0x000055555695e060 in ui_manager::redraw () at src/ui_manager.cpp:506
 CleverRaven#23 0x0000555555ea95cf in game::look_around (this=this@entry=0x555558276c40, show_window=show_window@entry=true, center=..., start_point=..., has_first_point=has_first_point@entry=false, select_zone=false, peeking=true, is_moving_zone=<optimized out>, end_point=..., change_lv=true) at src/game.cpp:7529
 CleverRaven#24 0x0000555555eadd32 in game::look_around (this=this@entry=0x555558276c40, looka_params=...) at src/game.cpp:7697
 CleverRaven#25 0x0000555555eadecb in game::peek (this=this@entry=0x555558276c40, p=...) at src/game.cpp:6071
 CleverRaven#26 0x0000555555ec441a in game::peek (this=this@entry=0x555558276c40) at src/game.cpp:6050
 CleverRaven#27 0x0000555555f124ec in game::do_regular_action (this=this@entry=0x555558276c40, act=@0x7fffffffd104: ACTION_PEEK, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2432
 CleverRaven#28 0x0000555555f15b09 in game::handle_action (this=0x555558276c40) at src/handle_action.cpp:3174
 CleverRaven#29 0x0000555555d8a108 in do_turn () at /usr/include/c++/13/bits/unique_ptr.h:199
 CleverRaven#30 0x0000555555781b4e in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873

(gdb) frame 7
(gdb) print p
$1 = {static dimension = 3, x = 4, y = -1, z = -5}
(gdb) print center
$2 = (const tripoint &) @0x7fffffffbda8: {static dimension = 3, x = 64, y = 59, z = -5}
```
dseguin pushed a commit that referenced this pull request Aug 20, 2024
Prevents referencing `visibility_cache` using out-of-bounds array
indexes such as negative values. Using out-of-bound indexes for this
array previously caused crashes when compiled with
`-D_GLIBCXX_ASSERTIONS`.

The function `pixel_minimap::render_critters` is, for example, called
with `center=(64,59,-5)`, which gives `start=(4,-1)` and then
`p=(4,-1,-5)`, which previously crashed because
`visibility_cache[p.x][p.y]` then gives a negative array index. Such
values were seen when peeking using `X` at a submap boundary.

Gdb backtrace of previous crash being fixed:
```
(gdb) bt
 #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
 #1  0x00007ffff787840f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
 #2  0x00007ffff78294f2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
 #3  0x00007ffff78124ed in __GI_abort () at ./stdlib/abort.c:79
 #4  0x00007ffff7ad30be in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
 #5  0x000055555668a04e in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 #6  0x000055555668ab7a in std::array<lit_level, 132ul>::operator[] (__n=18446744073709551615, this=0x555599f30348) at /usr/include/c++/13/array:211
 #7  pixel_minimap::render_critters (this=this@entry=0x555558108960, center=...) at src/pixel_minimap.cpp:521
 #8  0x000055555668ada2 in pixel_minimap::render (this=0x555558108960, center=...) at src/pixel_minimap.cpp:447
 #9  0x000055555668bb69 in pixel_minimap::draw (this=<optimized out>, screen_rect=..., center=...) at src/pixel_minimap.cpp:555
 #10 0x0000555555b3fd5c in cata_tiles::draw_minimap (this=this@entry=0x555558093020, dest=..., center=..., width=width@entry=352, height=height@entry=352) at src/cata_tiles.cpp:1919
 #11 0x00005555567f43d3 in cata_cursesport::curses_drawwindow (w=...) at src/sdltiles.cpp:1428
 #12 0x000055555666f5e2 in std::function<void(draw_args const&)>::operator() (__args#0=..., this=<optimized out>) at /usr/include/c++/13/bits/std_function.h:591
 #13 operator() (d=..., __closure=<optimized out>) at src/panels.cpp:54
 #14 std::__invoke_impl<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__f=...) at /usr/include/c++/13/bits/invoke.h:61
 #15 std::__invoke_r<int, window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)>&, const draw_args&> (__fn=...) at /usr/include/c++/13/bits/invoke.h:114
 #16 std::_Function_handler<int(const draw_args&), window_panel::window_panel(const std::function<void(const draw_args&)>&, const std::string&, const translation&, int, int, bool, const std::function<bool()>&, bool)::<lambda(const draw_args&)> >::_M_invoke(const std::_Any_data &, const draw_args &) (__functor=...,     __args#0=...) at /usr/include/c++/13/bits/std_function.h:290
 #17 0x0000555555e7c9ec in std::function<int(draw_args const&)>::operator() (__args#0=..., this=0x55559461d638) at /usr/include/c++/13/bits/std_function.h:591
 #18 game::draw_panels (this=this@entry=0x555558276c40, force_draw=force_draw@entry=true) at src/game.cpp:4006
 #19 0x0000555555e984f8 in game::draw (this=0x555558276c40, ui=...) at src/game.cpp:3960
 #20 0x000055555695df35 in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 #21 0x000055555695e039 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 #22 0x000055555695e060 in ui_manager::redraw () at src/ui_manager.cpp:506
 #23 0x0000555555ea95cf in game::look_around (this=this@entry=0x555558276c40, show_window=show_window@entry=true, center=..., start_point=..., has_first_point=has_first_point@entry=false, select_zone=false, peeking=true, is_moving_zone=<optimized out>, end_point=..., change_lv=true) at src/game.cpp:7529
 #24 0x0000555555eadd32 in game::look_around (this=this@entry=0x555558276c40, looka_params=...) at src/game.cpp:7697
 #25 0x0000555555eadecb in game::peek (this=this@entry=0x555558276c40, p=...) at src/game.cpp:6071
 #26 0x0000555555ec441a in game::peek (this=this@entry=0x555558276c40) at src/game.cpp:6050
 #27 0x0000555555f124ec in game::do_regular_action (this=this@entry=0x555558276c40, act=@0x7fffffffd104: ACTION_PEEK, player_character=..., mouse_target=std::optional [no contained value]) at src/handle_action.cpp:2432
 #28 0x0000555555f15b09 in game::handle_action (this=0x555558276c40) at src/handle_action.cpp:3174
 #29 0x0000555555d8a108 in do_turn () at /usr/include/c++/13/bits/unique_ptr.h:199
 #30 0x0000555555781b4e in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873

(gdb) frame 7
(gdb) print p
$1 = {static dimension = 3, x = 4, y = -1, z = -5}
(gdb) print center
$2 = (const tripoint &) @0x7fffffffbda8: {static dimension = 3, x = 64, y = 59, z = -5}
```
RenechCDDA pushed a commit to RenechCDDA/Cataclysm-DDA that referenced this pull request Oct 6, 2024
Prevents division by zero crash when displaying widgets with defined
break levels.

Example of where previous crash from div-by-zero happened:
* Provided save used the `zenfs_thick_sidebar`, which includes widget
  `zenfs_mana_bar_14_no_label` that defines break levels.
* When running the provided save, mana value is usually at `v=201` with
  `min=0` `max=201`.
* Those values are computed by `known_magic::max_mana` where internal
  values are `bionic_penalty=999` `mana_base=1000` `int_bonus=200`.
* But when int falls (because of tiredness), then
  `known_magic::max_mana` will return `0` because `int_bonus=-100`.
* This leads to `_var_max=0` in `widget::value_color` and thus
  `var_range=0` which causes the div by zero.

Backtrace of previous crash beng fixed:
```
Thread 1 "cataclysm-tiles" received signal SIGFPE, Arithmetic exception.
0x0000555556a9c54e in widget::value_color (this=this@entry=0x7fffffffb8d8, value=value@entry=201) at src/widget.cpp:1310
1310            const int value_offset = ( 100 * ( value - _var_min ) ) / var_range;

(gdb) bt
 #0  0x0000555556a9c54e in widget::value_color (this=this@entry=0x7fffffffb8d8, value=value@entry=201) at src/widget.cpp:1310
 #1  0x0000555556aa37dc in widget::color_value_string[abi:cxx11](int, int) (this=this@entry=0x7fffffffb8d8, value=201, width_max=width_max@entry=14) at src/widget.cpp:1262
 #2  0x0000555556aa38ca in widget::show[abi:cxx11](avatar const&, unsigned int) (this=this@entry=0x7fffffffb8d8, ava=..., max_width=max_width@entry=14) at src/widget.cpp:890
 CleverRaven#3  0x0000555556aa497f in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffb8d8, ava=..., max_width=<optimized out>, label_width=label_width@entry=0, skip_pad=false) at src/widget.cpp:1834
 CleverRaven#4  0x0000555556aa42c2 in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffbe88, ava=..., max_width=<optimized out>, label_width=label_width@entry=9, skip_pad=false) at src/widget.cpp:1794
 CleverRaven#5  0x0000555556aa3cfa in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffc438, ava=..., max_width=<optimized out>, label_width=label_width@entry=0, skip_pad=false) at src/widget.cpp:1724
 CleverRaven#6  0x0000555556aa42c2 in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x7fffffffc9e8, ava=..., max_width=<optimized out>, label_width=label_width@entry=0, skip_pad=false) at src/widget.cpp:1794
 CleverRaven#7  0x0000555556aa42c2 in widget::layout[abi:cxx11](avatar const&, unsigned int, int, bool) (this=this@entry=0x555562c47160, ava=..., max_width=<optimized out>, max_width@entry=64, label_width=<optimized out>, skip_pad=skip_pad@entry=false) at src/widget.cpp:1794
 CleverRaven#8  0x0000555556aa5222 in custom_draw_func (args=...) at src/widget.cpp:970
 CleverRaven#9  0x0000555555ec4360 in std::function<int(draw_args const&)>::operator() (this=0x555597eb1780, __args#0=...) at /usr/include/c++/14/bits/std_function.h:591
 CleverRaven#10 game::draw_panels (this=this@entry=0x55555827ef50, force_draw=force_draw@entry=true) at src/game.cpp:4007
 CleverRaven#11 0x0000555555eed1ac in game::draw (this=0x55555827ef50, ui=...) at src/game.cpp:3961
 CleverRaven#12 0x00005555569a962c in ui_adaptor::redraw_invalidated () at src/ui_manager.cpp:440
 CleverRaven#13 0x00005555569a96e9 in ui_adaptor::redraw () at src/ui_manager.cpp:345
 CleverRaven#14 0x00005555569a9710 in ui_manager::redraw () at src/ui_manager.cpp:506
 CleverRaven#15 0x0000555555dd0850 in do_turn () at src/do_turn.cpp:712
 CleverRaven#16 0x00005555557a138d in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873

(gdb) print var_range
$1 = 0
(gdb) print value
$2 = 201
(gdb) print _var_min
$3 = 0
(gdb) print _var_max
$4 = 0
```
@DPurple DPurple mentioned this pull request Oct 18, 2024
sonphantrung added a commit to sonphantrung/Cataclysm-DDA that referenced this pull request Nov 2, 2024
# This is the 1st commit message:

ios build

# This is the commit message #2:

Add legacy handling and overmapbuffer::is_in_city

# This is the commit message #3:

Correct doc example

# This is the commit message #4:

Correct distance calc

Not sure why I were checking 2 thick circles?

# This is the commit message #5:

Appease our clang overlords

# This is the commit message #6:

It helps if you add save/load handling

# This is the commit message CleverRaven#7:

Remove unnecessary project

Co-authored-by: ehughsbaird <[email protected]>
# This is the commit message CleverRaven#8:

Fix minor typos in keybdings.json
# This is the commit message CleverRaven#9:

Update data/raw/keybindings.json
# This is the commit message CleverRaven#10:

Added imgui_freetype.cpp to vcxproj to fix broken build.

# This is the commit message CleverRaven#11:

Fixing compile error related to map::get_field usage

# This is the commit message CleverRaven#12:

Adding a welding store (CleverRaven#77279)

* First draft

* Add the store

* Make it spawn

* Final touches
# This is the commit message CleverRaven#13:

fix NPCs stealing player default name

# This is the commit message CleverRaven#14:

Update materials.json

# This is the commit message CleverRaven#15:

Update dreamer_procgen.json (CleverRaven#77179)


# This is the commit message CleverRaven#16:

Fix the Dream magick hobbies (CleverRaven#76912)


# This is the commit message CleverRaven#17:

cody shows her math skills (CleverRaven#77303)


# This is the commit message CleverRaven#18:

Set `last_item` after the end of picking up

Also remoced mention of zombie spawning in `"LESSON_GOT_WEAPON` snippet.

# This is the commit message CleverRaven#19:

Normalize body stats on start of the tutorial

# This is the commit message CleverRaven#20:

fix zoo scenario spawn (CleverRaven#77237)

* zoo ZONE_START_POINT

* Update start_locations.json

* Update scenarios.json

* fix DinoMod

* fix Xedra

* Fix Limb WIP mod

* Fix deadly bites mod

* Update scenarios.json
# This is the commit message CleverRaven#21:

Unify all run_eocs in a single eoc function (CleverRaven#77000)

* Unify all run_eocs in a single eoc function

* add test suite

* fix typo

* handle condition better

* Simplify code, move few big stuff into it's own functions

* fix incorrect return

* fix mistakes that prevent eoc from firing

* rename iteration to iterations

* reflect changes in documentation

* change iteration to iterations in json

* please clang
# This is the commit message CleverRaven#22:

fix recent regression of CleverRaven#77191

Fixes CleverRaven#77191

# This is the commit message CleverRaven#23:

remove migo_bio_tech from spawns (CleverRaven#76940)


# This is the commit message CleverRaven#24:

Introduced untyped coordinate operations to typed ones (CleverRaven#77098)

* Introduced untyped coordinate operations to typed ones

* Missed rotate usages

* demanded changes
# This is the commit message CleverRaven#25:

fix 5 round magazine having 20 rounds
# This is the commit message CleverRaven#26:

Fix edges

# This is the commit message CleverRaven#27:

Allow debug revealing any OM

# This is the commit message CleverRaven#28:

Swap the order of the bind labels to a guess at most used -> least used

# This is the commit message CleverRaven#29:

Add ability to place terrain/special without exiting placement

# This is the commit message CleverRaven#30:

Revert "Swap the order of the bind labels to a guess at most used -> least used"

This reverts commit 05cf094.

# This is the commit message CleverRaven#31:

Revert "Allow debug revealing any OM"

This reverts commit 5d1fc0a.

# This is the commit message CleverRaven#32:

"all" option for distraction manager (CleverRaven#77342)

* distraction manager option for toggling all

* Update src/distraction_manager.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# This is the commit message CleverRaven#33:

Beaver audit (CleverRaven#77283)

* beavere big

* baby creature

* feaver

* dambreaker

* reproduction

* butchery

* monstergroups

* factions

* Update mammal.json

* Update monster_factions.json

* Update monster_factions.json
# This is the commit message CleverRaven#34:

Update electronic_parts.json

# This is the commit message CleverRaven#35:

Add a new widget to display weight with the format "##.#/##.#[unit]" (CleverRaven#77212)

* Add two new widgets to display weight with the format "##.#/##.# kg" and "##.#/##.# lb", and add the widgets to the legacy labels sidebar

* Apply suggestions from code review

I don't format goodly

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Remove imperial version of the feature, and modify the metric version to read users mass setting and adjust the display accordingly

* Apply suggestions from code review

Formatting

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Updated per IdleSol suggestion

* I think I forgot to pull before pushing and I don't understand git so I think it ate this space in the merge :(

* I'll get it right one day

* Update to use functions I didn't know existed, removing a few lines of code.

* Update src/display.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# This is the commit message CleverRaven#36:

Add Vitamin C Supplements (CleverRaven#77363)

* Add VitC Supplement

* Create Drug Spawn Groups

* Add VitC to softdrugs itemgroup

* Full vitC bottle Added to Doctor shopkeep

* Add VitC to vitamin_shop itemgroup

* Add VitC to SUS bathroom vitamins

* I really fucked up that last copy paste, fixed?
# This is the commit message CleverRaven#37:

Fixed broken Android build due to missing FreeType library

# This is the commit message CleverRaven#38:

wrap long text in the menu for choosing the type of faction camp to create

# This is the commit message CleverRaven#39:

[ Aftershock ] Make Flesh Golem heart a mission item 


# This is the commit message CleverRaven#40:

Routine i18n updates on 26 October 2024

# This is the commit message CleverRaven#41:

Fix cotton patch being unusable to stop bleeding

# This is the commit message CleverRaven#42:

First Draft

Update en.credits

# This is the commit message CleverRaven#43:

Update data/credits/en.credits
# This is the commit message CleverRaven#44:

Update data/credits/en.credits

Co-authored-by: David Seguin <[email protected]>
# This is the commit message CleverRaven#45:

Update data/credits/en.credits
# This is the commit message CleverRaven#46:

Update data/credits/en.credits

Co-authored-by: Binrui Dong <[email protected]>
# This is the commit message CleverRaven#47:

Apply suggestions from code review

Co-authored-by: RenechCDDA <[email protected]>
# This is the commit message CleverRaven#48:

Update en.credits

Overhauled the Main Developers section.
Reordered special thanks alphabetically.
# This is the commit message CleverRaven#49:

Add links to tileset contributor lists.
# This is the commit message CleverRaven#50:

Removed heating elements drop from smashing the fume hood

# This is the commit message CleverRaven#51:

Add freetype, clean up 3rd-party CMake file

# This is the commit message CleverRaven#52:

[MoM/Magiclysm interaction] Synchronize anti-Stare powers, Thought Shield spell protects from telepathy (CleverRaven#77277)

* Create miscellaneous.json

* Create flags.json

* Acount for TEEPSHIELD

* Create eoc_misc.json

* Add MAGICAL_MIND_PROTECTION to thought shield

* Add mind protection to thought shields

* TEEPSHIELD effect

* Update data/mods/MindOverMatter/mod_interactions/magiclysm/item_overrides.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fixes

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# This is the commit message CleverRaven#53:

Decrement spawn quantity when no monster is selected in sub group

# This is the commit message CleverRaven#54:

Set mon_found properly when select monster from subgroup

# This is the commit message CleverRaven#55:

Update src/mongroup.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# This is the commit message CleverRaven#56:

Update ballistic_armor.json

# This is the commit message CleverRaven#57:

Factions don't mind the player smashing zombie corpses

# This is the commit message CleverRaven#58:

[Xedra Evolve] Add Ruach counter to sidebars (CleverRaven#77422)

* Update sidebar.json

* Create ruach_counter.json

* Initial commit

* Add to sidebars
# This is the commit message CleverRaven#59:

Forbid drinking liquids underwater for characters with `WATERSLEEP` and `UNDINE_SLEEP_WATER` mutations

# This is the commit message CleverRaven#60:

Characters with `UNDINE_SLEEP_WATER` mutation sleep less in water

# This is the commit message CleverRaven#61:

Fix recent clang-tidy errors.

# This is the commit message CleverRaven#62:

Set owner for new appliances (CleverRaven#77211)


# This is the commit message CleverRaven#63:

Lever action rifles (CleverRaven#77409)

* Add Rio Bravo

* Henry Golden Boy

* Add .44 R92

* Adds Uberti 1873

* Added sources

* 357 R92

* Minor fixes

* fix in ammo count for nested r92

* Spelling fixes

* Apply suggestions from code review

Co-authored-by: TheShadowFerret <[email protected]>

* Apply suggestions from code review

Co-authored-by: Anton Burmistrov <[email protected]>

---------

Co-authored-by: TheShadowFerret <[email protected]>
Co-authored-by: Anton Burmistrov <[email protected]>
# This is the commit message CleverRaven#64:

Add myself
# This is the commit message CleverRaven#65:

Initial commit (CleverRaven#77414)


# This is the commit message CleverRaven#66:

Minor gun fixes

# This is the commit message CleverRaven#67:

Update spells.json
# This is the commit message CleverRaven#68:

Feral Agent fix and loot update (CleverRaven#77421)

* Feral Agent fix and loot update

Co-Authored-By: gettingusedto <[email protected]>

* Update data/mods/Xedra_Evolved/itemgroups/monster_drops.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: gettingusedto <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# This is the commit message CleverRaven#69:

Apply copy-from to mod scenarios (CleverRaven#77417)

* Apply copy-from to mod scensarios

* apply to Limb_WIP

* Mind Over Matter

* Xedra

* Update scenarios.json

* document
# This is the commit message CleverRaven#70:

Mutations can have a custom activation message

# This is the commit message CleverRaven#71:

Changed implementation of battery chargers to make them work outside the reality bubble.

# This is the commit message CleverRaven#72:

Added last_charged to serialize and deserialize

# This is the commit message CleverRaven#73:

Prevent overflow

# This is the commit message CleverRaven#74:

Moved dischargeable check earlier to catch situations when dischargeable is 0 from the beginning

# This is the commit message CleverRaven#75:

[MoM] Move Mirror-mask bonus to effect, obsolete mutations (CleverRaven#72370)

* Obsolete old mutations

* Obsolete switcher EoC

* Move switcher EoC

* Move effect to enchantment

* Remove rather than obsolete mutations

* lint

* Fixes + documentation

* Linting
# This is the commit message CleverRaven#76:

Reworked check for flammability

# This is the commit message CleverRaven#77:

Changed text to mention a non-lit cig

# This is the commit message CleverRaven#78:

Refactoring armor ordering

# This is the commit message CleverRaven#79:

migo sideplates

# This is the commit message CleverRaven#80:

[Xedra Evolved] Require Traverse the Wilds to target a tree as the endpoint (CleverRaven#72655)

* Require teleporting to a tree

* Edit description

* Update data/mods/Xedra_Evolved/mutations/paraclesians/arvore_eocs.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update EoC for map_run_eocs

* Update spell

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# This is the commit message CleverRaven#81:

[Xedra Evolved] More Lilin powers (CleverRaven#77269)

* Initial commit

* Add more powers

* Fix n_vitamin

* Add the Evil Eye

* Duration edits, increase ruach cost of Reap the Whirlwind

* Fix math

* Cry of the Night Bird reduces speed by percentage, not flat number

* Those who have the evil eye are immune to the evil eye

* Add Owl's Wisdom

* Update xe_lilin.json

* Add The Pestilence that Stalks in Darkness

* Add Stand Before the Cold

* Add more abilities

* Various updates

* Increase cost of Neither Sleep nor Slumber

* Add strix to dictionary

* Fix typos

* Fix ruach cost
# This is the commit message CleverRaven#82:

modify random NPC starting equipment based on time passed

-some very basic item groups for now, needs to be expanded on later
-add_profession_items(): replace raw inv with i_add()
-very minor edits to some professions

# This is the commit message CleverRaven#83:

[DinoMod] mountable and harnessable audit (CleverRaven#77391)

* [DinoMod] riding and harness audit

* juvenile fixes

* rem harnessable

* Remove harnessable

* juvenile fixes

* flag spellcheck
# This is the commit message CleverRaven#84:

Use corner symbols for vehicle Corner variations
# This is the commit message CleverRaven#85:

Removing and/or using some unused itemgroup IDs (CleverRaven#77356)

* ``accessory_ring``

* unused

* Update drugs.json

* I told you to remove them

* cinnamon groups

* yeast

* seasoning salt

* flour bags

* Update druid_tower.json
# This is the commit message CleverRaven#86:

Use parametrized carpets where appropriate (CleverRaven#77287)

* Add the carpet palette

* Nested basements

* Make the carpet not fallback

* Fix oopsie

* Fix oopsie

* Switch palette name to be clearer

* Carpets in nests

* First few buildings

* Most of the maps

* bungalow08

* Use correct palette name

* Last few touch-ups

* Remove old palette

* Use correct palette name
# This is the commit message CleverRaven#87:

Update urban_20_house.json

# This is the commit message CleverRaven#88:

Initial commit

# This is the commit message CleverRaven#89:

add terminal punctuation to bulletin board examination message

# This is the commit message CleverRaven#90:

Allowed throwing items while piloting mechs

# This is the commit message CleverRaven#91:

Fix CleverRaven#77179 and a Book in Magiclysm (CleverRaven#77408)

* Update dreamer_procgen.json

* Update recipe_books.json

* Update data/mods/Xedra_Evolved/procgen/dreamer_procgen.json

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
# This is the commit message CleverRaven#92:

eoc: clear deferred math on error

# This is the commit message CleverRaven#93:

fix scenario spawns (CleverRaven#77451)

* fix scenario spawns

* road mayhem start

* wild party

* update sloc hospital entry

* revert road sloc terrain

* simplify road terrain

* Try TYPE for crash sloc
# This is the commit message CleverRaven#94:

Add recommended palettes

# This is the commit message CleverRaven#95:

Stop 20x Melatonin Spawns (CleverRaven#77347)

* Fix Up Melatonin

* Woops, too much deleted
# This is the commit message CleverRaven#96:

Refugee center cleanups (CleverRaven#77331)

* dino dave

* door position

* lobby cleanup
# This is the commit message CleverRaven#97:

Remove Calcium from Rare Drugs (CleverRaven#77349)


# This is the commit message CleverRaven#98:

eoc: clean up run_eocs

# This is the commit message CleverRaven#99:

eoc/run_eocs: don't allow queue+loop in one invocation

# This is the commit message CleverRaven#100:

eoc/run_eocs: add test for talker mixes

# This is the commit message CleverRaven#101:

Allow any grade of steel ofr the metal axe head

# This is the commit message CleverRaven#102:

Switch relationship to enum class

# This is the commit message CleverRaven#103:

Faction relationships can be modiifed through dialogue

# This is the commit message CleverRaven#104:

Asking for a bed gives you permission to sleep there

# This is the commit message CleverRaven#105:

Update lumbermill map+dialogue
-Outer fence is no longer permalocked with no way in
-You can ask for a gate to be opened.

# This is the commit message CleverRaven#106:

Appease clang, the one true overlord

# This is the commit message CleverRaven#107:

Fix food calcs for items with non-food components

# This is the commit message CleverRaven#108:

Flush debug log writes immediately
# This is the commit message CleverRaven#109:

fix two supressors in m4_cqbr
# This is the commit message CleverRaven#110:

magus.json description change

This is my first contribution/change. I apologize if it isn't formatted or done correctly.

I noticed that magus_slow had the same description as magus_haste.

Slow should indicate that it slows the target's speed.

# This is the commit message CleverRaven#111:

less loopy conversation loops

# This is the commit message CleverRaven#112:

found another

# This is the commit message CleverRaven#113:

math: improve diag_value constructors

# This is the commit message CleverRaven#114:

math: add monostate to diag_value

# This is the commit message CleverRaven#115:

math: add kwarg_or helper function

# This is the commit message CleverRaven#116:

Repeat survey missions without leaving interface

# This is the commit message CleverRaven#117:

Made game recognize burst fire mode as well as full auto when pressing 'Burst fire wielded weapon'

# This is the commit message CleverRaven#118:

simple knife spear quest options (CleverRaven#77335)

* options

and random word choice

* just spears then
# This is the commit message CleverRaven#119:

Rejecting some area threats near safe locations

# This is the commit message CleverRaven#120:

Globally unique -> prio 1 and SAFE_AT_WORLDGEN

# This is the commit message CleverRaven#121:

Use global coordinates in global calls...

# This is the commit message CleverRaven#122:

Removed remaining development variable

# This is the commit message CleverRaven#123:

fix: -Werror=range-loop-construct (CleverRaven#77302)


# This is the commit message CleverRaven#124:

some mistake fixing
# This is the commit message CleverRaven#125:

:pray:
# This is the commit message CleverRaven#126:

idk
# This is the commit message CleverRaven#127:

heh
# This is the commit message CleverRaven#128:

cmon do something
# This is the commit message CleverRaven#129:

astyle

# This is the commit message CleverRaven#130:

try to deal with undefined type
# This is the commit message CleverRaven#131:

i'm desperate
# This is the commit message CleverRaven#132:

resorting
# This is the commit message CleverRaven#133:

idk what's happening
# This is the commit message CleverRaven#134:

dunno
# This is the commit message CleverRaven#135:

stupid resorting
# This is the commit message CleverRaven#136:

Update input_context.h
# This is the commit message CleverRaven#137:

attempt to workaround 'inaccessible member'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants