Ok, I've got a problem here, I have a piece of code that reads:
public static void drawThisPath()
{
pointer = 0;
System.out.println("Start Position : " + begin.getAsString());
while (pointer < pathLength) {
// Create a reDraw position from x-1 y-1, this is because the links the road makes with
// other road sections means that not simply the square affected will have to redrawn, so a 3x3 redraw area
// will be required
XYValue reDrawPos = path[pointer];
// Only deduct one from the values if they are above zero. This will cause problems at the far Right/Bottom of the
// Map. Will need to look into this. Maybe some level of protection in the redraw routine may be more appropriate
if (reDrawPos.getXValue() > 0) {
reDrawPos.decX();
}
if (reDrawPos.getYValue() > 0) {
reDrawPos.decY();
}
// Now draw the map section around the selected square
mZone.drawTerrainSection(reDrawPos, new XYValue(3, 3));
pointer ++;
}
}
It's attached to a Mouse-movement listener, but the code for that doesn't touch the begin variable at all, that was set by a mouse-click listener that is removed once it has been activated.
As you can see from that code, there is nothing in there that alters the value of the 'begin' value (an XYValue is simply two integers stored in a handy little receptacle) similar to dimension, but a little more flexible.
However, when I run this code, the screen-out looks like this...
Start Position : 6, 8
Start Position : 5, 7
Start Position : 4, 6
Start Position : 3, 5
Start Position : 2, 4
Start Position : 1, 3
Start Position : 0, 2
Start Position : 0, 1
Start Position : 0, 0
Start Position : 0, 0
Start Position : 0, 0
BUILD SUCCESSFUL (total time: 13 seconds)
Now, the only value that should be decremented is the reDrawPos, which simply creates a 3 x 3 area box to redraw the terrain around the path being created, begin is not affected at all, and I've checked the XYValue code through, it all seems secure, besides if it was some kind of overflow, it would carry on below zero, that zero check is only applied in that code.
I'm totally at a loss at what is causing this...