CleverRaven / Cataclysm-DDA

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

Menu exception in custom character creating after saving and exiting previous game #49404

Open Kappamalone opened 3 years ago

Kappamalone commented 3 years ago

Describe the bug

Scrolling down the PROFESSION tab when creating a custom character after saving and exiting to menu causes an exception to be thrown. The game does not crash afterwards. Saving and exiting a game is required for the bug to show up.

Steps To Reproduce

Can be done on a fresh install, since I just started playing the game when I encountered the bug

  1. [New Game] -> [Play Now! (Fixed Scenario)] To create a character
  2. Save and Exit to menu
  3. [New Game] -> [Custom Character]
  4. Navigate to [PROFESSION] and scroll down/up
  5. It should now crash when around halfway through the list of professions

Expected behavior

Screenshots

image

Versions and configuration

Additional context

debug.log

The debug message: DEBUG : requested mission with uid 1 does not exist

FUNCTION : static mission* mission::find(int) FILE : src/mission.cpp LINE : 80

pehamm commented 3 years ago

Can replicate, the game throws an exception during character creation if

  1. The world is not new/reset. It does not have be occupied, as long as world end handling is set to "keep" and a character existed there before so turns have passed
  2. A save was loaded/the game played since last opening the app (probably some optimization artifact)
  3. The player hovers a profession that carries a map, i.e. Tourist or Major General.

It lookes like previously a fix was put in, but it does not catch this specific case as the aforementioned steps allow us to open the character creation and call item::display_name with a calendar::turn_zero that does not equal 0: https://github.com/CleverRaven/Cataclysm-DDA/blob/3560737d78e4fb3cd0080e1ae4b0137a288eb86c/src/item.cpp#L5036-L5047

Side note on point 2 above: For testing purposes, I have created a world with setting "keep", created and killed off a character after a few seconds. If I open the application and create a new character directly after opening the map, hovering the Major General profession shows a "military operations map" in his inventory and no issue thrown. If I load any save, then quit back to the menu and try the same thing, the game throws the same exception as in the OP, only that the item is now called a "Holden military operations map", probably town nearest to the last character on that map.

I also attached a debug.log from by build with debug symbols. The version is a few weeks old as I have not submitted any PRs in a while, but I replicated it on a build from the weekend as well.

debug_with_symbols.log