diasurgical/devilutionX

[Issue Report]: Game loads endlessly

Chance4us opened this issue · 2 comments

Operating System

Linux x64

DevilutionX version

Custom build (commit baaa906)

Describe

Game can not be loaded.

To Reproduce

  1. Load attached game
    endless.zip
  2. Go trough blue portal
  3. Go through red portal
  4. Save the game
  5. Exit the game entirely
  6. Load the game again
  7. See that game can not be loaded

Expected Behavior

No endless loading

Additional context

Further events or possible causes have not yet been investigated

Problem appears to be rooted in PlaceUniqueMonst(), where an infinite loop is entered when attempting to place Lazarus:

if (InDungeonBounds({ x, y }) && CanPlaceMonster({ x, y })) {

CanPlaceMonster() returns false infinitely, deeming every iterated location as being Solid in IsTileOccupied() call via IsTileSolid(). I've confirmed that the SOLData global array is populated prior to attempting to place unique monsters, and it's quite absurd that the game was able to successfully place Lazarus in the level prior.

LoadL1Dungeon() calls LoadDungeonBase() before Pass3().

void LoadL1Dungeon(const char *path, Point spawn)
{
LoadDungeonBase(path, spawn, Floor, Dirt);
if (setlvltype == DTYPE_CATHEDRAL)
FillFloor();
Pass3();

LoadDungeonBase() calls SetMapMonsters() which begins by attempting to place Lazarus in the map. PlaceUniqueMonst() then runs that loop to find a random valid position to place him. However there are no valid positions because Pass3() hasn't been called yet, meaning dPiece is completely empty.