Fixed ClassCastException in DungeonPack

Fixed a bug in DungeonPack that would trigger a rare ClassCastException
during dungeon selection. We were comparing instances of DungeonType
against WeightedContainer<DungeonType>. This wouldn't break dungeon
generation because DD falls back on selecting a random dungeon if
rule-based selection fails. It would allow duplicate dungeons to appear
in the same chain, though.
This commit is contained in:
SenseiKiwi 2013-12-20 01:10:55 -04:00
parent 7687a77332
commit 13458029b4

View file

@ -191,7 +191,14 @@ public class DungeonPack
return getRandomDungeon(random, candidates);
}
//If we've reached this point, then a dungeon was not selected. Discard the type and try again.
products.remove(nextType);
for (index = 0; index < products.size(); index++)
{
if (products.get(index).getData().equals(nextType))
{
products.remove(index);
break;
}
}
}
}
while (nextType != null);