Fix cgear skin import loop

byte 255->0 overflow infinite loop if too many tiles are unique
https://projectpokemon.org/home/forums/topic/63828-c-gear-skin-editor-crash/?do=findComment&comment=285181
This commit is contained in:
Kurt 2023-08-30 04:44:40 -07:00
parent 78e7536459
commit 0aa4a15851

View file

@ -231,12 +231,12 @@ public sealed class CGearBackground
private static void FindPossibleRotatedTile(Tile t, IList<Tile> tilelist, TileMap tm, int tileIndex) private static void FindPossibleRotatedTile(Tile t, IList<Tile> tilelist, TileMap tm, int tileIndex)
{ {
// Test all tiles currently in the list // Test all tiles currently in the list
for (byte i = 0; i < tilelist.Count; i++) for (int i = 0; i < tilelist.Count; i++)
{ {
var rotVal = t.GetRotationValue(tilelist[i].ColorChoices); var rotVal = t.GetRotationValue(tilelist[i].ColorChoices);
if (rotVal == Tile.ROTATION_BAD) if (rotVal == Tile.ROTATION_BAD)
continue; continue;
tm.TileChoices[tileIndex] = i; tm.TileChoices[tileIndex] = (byte)i;
tm.Rotations[tileIndex] = rotVal; tm.Rotations[tileIndex] = rotVal;
return; return;
} }