Greetings again,
I’ve spent some hours trying to solve it, rechecking all the classes etc, but I can’t seem to find where the problem is. So I believe after some Trail-And-Error that it was the Three DImension Array itself. The problem is that an item that is added to the Array i.e.
inventorySpells[0][0][0]
gets duped to
inventorySpells[0][0][n]
Initialize:
inventorySpells = new InventoryCell[INV_WIDTH][INV_HEIGHT][2];
for (InventoryCell[][] square: inventorySpells) {
for (InventoryCell[] line : square) {
Arrays.fill(line, new InventoryCell(null));
}
}
Adding a new element:
inventorySpells[x][y][0].setItem(spell);
u:[/u] This is the only function that adds something to the InventoryCell[][][]
With some good old System.out.print, I’ve found that
inventorySpells[0][0][0] = inventorySpells[0][0][n∞]//Well it isn't infinity because it can get a max value of 1, but you get the clue
So the problem is that the Third Dimension doesn’t matter at all, because changing a z-value, will result in the same x-value and y-value.
I really the three dimension array, it’s much cleaner and uses less lines than using multiple Two Dimensional Arrays…
Anyone know what this problem is all about? If there is something not clear, just ask me.
-RoseSlayer