CleverRaven / Cataclysm-DDA

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

Game freeze near FEMA camp with Only Wildlife mod #75212

Open cknight828 opened 2 months ago

cknight828 commented 2 months ago

Describe the bug

I try to reach FEMA camp and CDDA freeze when Only Wildlife is enabled. Teleporting to the camp also cause freeze.

Attach save file

nomonster-trimmed.tar.gz

Steps to reproduce

  1. Load attached save
  2. go one step north

Expected behavior

Player should be able to reach FEMA camp without freeze

Screenshots

No response

Versions and configuration

Additional context

No response

PatrikLundell commented 2 months ago

It seems the code is in a loop trying to spawn monsters. It seems to be in an infinite loop trying to spawn some specific kind of monster (a list of one entry). MonsterGroupManager::GetResultFromGroup doesn't decrement the quantity parameter, and the loop continues until it has been reduced to a non positive number... For some reason the entry.is_group branch doesn't reduce the quantity while the other branches do. It claims to have found a monster but then delivers an empty list, thus bypassing the logic intended to decrement the count when nothing was found. Some default value is placed in the list, so something is still returned, but the value doesn't decrement.

The loop seems to be in mapgen.cpp operation map::place_spawns.

How to fix this mess? I don't know. That's probably for someone who understands how this convoluted mess is supposed to work (decrease quantity if spawn_details is empty, rather than if a monster is claimed not to be found?).