Certain seeds cause dungeon generation to get stuck in an infinite loop

Author: kpyrkoszCreated Sep 15, 2022Updated Aug 12, 2026
Labelssavegame attachedvanilla

Operating System

Linux x64

DevilutionX version

1.4.1 (latest release)

Describe

Some seeds, such as the 3 in the attached test case cause the program to hang during dungeon generation. I've attached a test case demonstrating the issue.

To Reproduce

TEST(Drlg_l2, seeds_stuck_in_an_infinite_loop)
{
        leveltype = GetLevelType(5);
        int bad_seeds[3] = { 606, 5248, 1054405 };

        for (int i = 0; i < 3; ++i) {
                pMegaTiles = std::make_unique<MegaTile[]>(GetTileCount(leveltype));
                CreateDungeon(bad_seeds[i], ENTRY_MAIN);
        }
}

Expected Behavior

Program does not hang

Additional context

No response