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:
@@ -191,7 +191,14 @@ public class DungeonPack
|
|||||||
return getRandomDungeon(random, candidates);
|
return getRandomDungeon(random, candidates);
|
||||||
}
|
}
|
||||||
//If we've reached this point, then a dungeon was not selected. Discard the type and try again.
|
//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);
|
while (nextType != null);
|
||||||
|
|||||||
Reference in New Issue
Block a user