CleverRaven / Cataclysm-DDA

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

Mafia Boss Desert Eagle is bugged #76178

Open ssmdev opened 2 months ago

ssmdev commented 2 months ago

Describe the bug

Desert Eagle cannot be fired, trying to unload the pistol and the mag, and then reload the empty mag while it's inside the pistol results in a segfault. Both Desert Eagles spawned by the debug menu exhibit the same behavior, as well as the Golden Desert Eagle.

Backtrace:

#0  0x00000ad60897d6cf in __lower_bound<string_id<ammunition_type> > () at /usr/include/c++/v1/__tree:2567
#1  find<string_id<ammunition_type> > () at /usr/include/c++/v1/__tree:2489
#2  find () at /usr/include/c++/v1/map:1454
#3  ammo_capacity () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/item_pocket.cpp:734
#4  0x00000ad6088cb0c9 in ammo_capacity () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/item_contents.cpp:1270
#5  0x00000ad60882eb91 in remaining_ammo_capacity () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/item.cpp:10809
#6  0x00000ad608832037 in qty () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/item.cpp:11604
#7  0x00000ad608831d51 in reload_option () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/item.cpp:11569
#8  0x00000ad60865a629 in operator() () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/game_inventory.cpp:2819
#9  __invoke<(lambda at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/game_inventory.cpp:2818:26) &, const item_location &>(void) ()
    at /usr/include/c++/v1/__functional/invoke.h:394
#10 0x00000ad60865a563 in __call<(lambda at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/game_inventory.cpp:2818:26) &, const item_location &> () at /usr/include/c++/v1/__functional/invoke.h:478
#11 operator() () at /usr/include/c++/v1/__functional/function.h:185
#12 operator() () at /usr/include/c++/v1/__functional/function.h:356
#13 0x00000ad6087ab7ae in operator() () at /usr/include/c++/v1/__functional/function.h:510
#14 operator() () at /usr/include/c++/v1/__functional/function.h:1156
#15 operator() () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:792
#16 __invoke<(lambda at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:790:73) &, const inventory_entry &> ()
    at /usr/include/c++/v1/__functional/invoke.h:394
#17 __call<(lambda at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:790:73) &, const inventory_entry &> ()
    at /usr/include/c++/v1/__functional/invoke.h:478
#18 operator() () at /usr/include/c++/v1/__functional/function.h:185
#19 operator() () at /usr/include/c++/v1/__functional/function.h:356
#20 0x00000ad6087879e8 in operator() () at /usr/include/c++/v1/__functional/function.h:510
#21 operator() () at /usr/include/c++/v1/__functional/function.h:1156
#22 get_text () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:812
#23 get_cell_text () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:736
#24 0x00000ad608789901 in make_entry_cell_cache () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:996
#25 0x00000ad608789447 in get_entry_cell_cache () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:1011
#26 get_entry_cell_width () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:957
#27 0x00000ad608789d83 in expand_to_fit () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:1080
#28 0x00000ad608789ef0 in reset_width () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:1103
#29 0x00000ad6087955d3 in prepare_layout () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:2311
#30 0x00000ad608794979 in prepare_layout () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:2376
#31 0x00000ad6098884dc in operator() () at /usr/include/c++/v1/__functional/function.h:510
#32 operator() () at /usr/include/c++/v1/__functional/function.h:1156
#33 redraw_invalidated () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/ui_manager.cpp:381
#34 0x00000ad6087a1055 in execute () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/inventory_ui.cpp:3400
#35 0x00000ad608635ee5 in select_ammo () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/game_inventory.cpp:2933
#36 0x00000ad607e19553 in select_ammo () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/avatar.cpp:1462
#37 0x00000ad60858e350 in reload () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/game.cpp:9787
#38 0x00000ad60858bdc2 in inventory_item_menu () at /usr/include/c++/v1/__memory/shared_ptr.h:744
#39 0x00000ad608622962 in common () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/game_inventory.cpp:279
#40 0x00000ad60867cc45 in do_regular_action () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/handle_action.cpp:2376
#41 0x00000ad6086913b6 in handle_action () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/handle_action.cpp:3122
#42 0x00000ad6083d19f0 in do_turn () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/do_turn.cpp:536
#43 0x00000ad609a8f8d0 in main () at /usr/ports/pobj/cataclysm-dda-0.H/Cataclysm-DDA-cdda-0.H-2024-09-01-2220/src/main.cpp:851

Attach save file

N/A

Steps to reproduce

  1. Create a Mafia Boss
  2. Desert Eagle does not shoot
  3. Put empty magazine in the gun and try to reload the magazine with bullets, should crash

Expected behavior

The gun works normally

Screenshots

No response

Versions and configuration

The tag used is cdda-0.H-2024-09-01-2220

Additional context

Built on OpenBSD with clang 16.0.6

GuardianDll commented 2 months ago

how can you reload empty mag in the gun if gun cannot accept magazines without bore (and i think lack of bore what makes you not able to shoot) since #75644