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

Swapping positions with a friendly monster in a vehicle result in error in map::board_vehicle #31538

Closed
l29ah opened this issue Jun 16, 2019 · 0 comments · Fixed by #35556
Closed
Assignees
Labels
<Bug> This needs to be fixed Monsters Monsters both friendly and unfriendly. Vehicles Vehicles, parts, mechanics & interactions
Milestone

Comments

@l29ah
Copy link
Contributor

l29ah commented Jun 16, 2019

src/game.cpp:4145: game:monmove: Labrador mutt can't move to its location! (119:122:0), long grass
01:36:48.632 ERROR : (error message will follow backtrace)
	cataclysm(_Z21debug_write_backtraceRSo+0x3a) [0x55eb1d9bf64a]
	cataclysm(_Z8DebugLog10DebugLevel10DebugClass+0x260) [0x55eb1d9c0fc0]
	cataclysm(_Z12realDebugmsgPKcS0_S0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x6f) [0x55eb1d9c2f4f]
	cataclysm(_ZN3map15unboard_vehicleERK15vpart_referenceP6playerb+0xb4) [0x55eb1dd8c514]
	cataclysm(_ZN3map15unboard_vehicleERK8tripointb+0x79) [0x55eb1dd8e919]
	cataclysm(_ZN4game12place_playerERK8tripoint+0x309) [0x55eb1dae80c9]
	cataclysm(_ZN4game9walk_moveERK8tripoint+0x545) [0x55eb1db01885]
	cataclysm(_ZN13avatar_action4moveER6avatarR3mapiii+0x12d8) [0x55eb1d890aa8]
	cataclysm(_ZN4game13handle_actionEv+0x37d0) [0x55eb1db4e130]
	cataclysm(_ZN4game7do_turnEv+0x56c) [0x55eb1dafd82c]
	cataclysm(main+0xcf9) [0x55eb1d759669]
	/lib64/libc.so.6(__libc_start_main+0xeb) [0x7ffa770d6ecb]
	cataclysm(_start+0x2a) [0x55eb1d7a765a]

	Attempting to repeat stack trace using debug symbols...
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(nm) failed
	backtrace: popen(addr2line) failed
Backtrace emission took 0 seconds.
src/map.cpp:937 [void map::unboard_vehicle(const vpart_reference&, player*, bool)] map::unboard_vehicle: passenger not found
01:36:59.450 ERROR : src/map.cpp:915 [void map::board_vehicle(const tripoint&, player*)] map::board_vehicle: passenger (America Coffman) is already there
01:37:21.121 ERROR : src/map.cpp:937 [void map::unboard_vehicle(const vpart_reference&, player*, bool)] map::unboard_vehicle: passenger not found
01:37:25.174 ERROR : src/map.cpp:915 [void map::board_vehicle(const tripoint&, player*)] map::board_vehicle: passenger (America Coffman) is already there
01:37:35.474 ERROR : src/map.cpp:937 [void map::unboard_vehicle(const vpart_reference&, player*, bool)] map::unboard_vehicle: passenger not found
01:37:39.290 ERROR : src/map.cpp:915 [void map::board_vehicle(const tripoint&, player*)] map::board_vehicle: passenger (America Coffman) is already there

Steps To Reproduce

Steps to reproduce the behavior:

  1. Load the saved game.
  2. Come to a dog nearby.
  3. examine it
  4. s Swap positions until You swap positions with your Labrador mutt.
  5. Move anywhere and observe the error message.

Versions and configuration

  • "Main menu (ESC) > Debug Menu > Info > Generate game report" to generate this report.

Still doesn't work.

  • Game Version: 0.D-4522-g4d34142d4c-dirty
  • Mods loaded: alternative map key

Additional context

2019.06.14-4.zip

@l29ah l29ah changed the title Swapping positions with a friendly NPC in a vehicle result in error in map::board_vehicle Swapping positions with a friendly monster in a vehicle result in error in map::board_vehicle Jun 16, 2019
@Night-Pryanik Night-Pryanik added <Bug> This needs to be fixed Monsters Monsters both friendly and unfriendly. Vehicles Vehicles, parts, mechanics & interactions labels Jun 18, 2019
@kevingranade kevingranade added this to the 0.E milestone Sep 5, 2019
@mlangsdorf mlangsdorf self-assigned this Sep 6, 2019
mlangsdorf added a commit to mlangsdorf/Cataclysm-DDA that referenced this issue Nov 16, 2019
Fixes CleverRaven#31538

the swap option in the pet menu wasn't unboarding the player
correctly because it was rolling its own logic for swapping position.
Use swap_critters() instead.
ZhilkinSerg pushed a commit that referenced this issue Nov 16, 2019
…5556)

* game: don't dereference null pointers in swap_critters()

swap_critters() dynamically casts the second creature to player * as
other_npc and then checks if other_npc is in a vehicle.  This will
cause a crash if the second creature isn't a subclass of player,
such as when the creature is a monster.

Check for the validity of other_npc before derefencing it.

* monster: use swap_critters() to swap a pet position in the pet menu

Fixes #31538

the swap option in the pet menu wasn't unboarding the player
correctly because it was rolling its own logic for swapping position.
Use swap_critters() instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Monsters Monsters both friendly and unfriendly. Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants