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:
parent
7687a77332
commit
13458029b4
1 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue