Shatterhand
2014-10-21 09:11:07
I am trying to make a game settings debug for my java client.
I have a method called getSettingArray() which gets all the game setting values in an array. The method getSpecial() uses the prevous method and returns a number from that array.
I have fields for storing the previous values and I compare them to the current values in the canvas paint loop (called very often). So basically when a game setting value changes it should write it out on the console.
fields in the class
code in the canvas paint method
The problem is when I use a weapon special (special attack value changes, game setting value changes), it writes it out with first syso, but not with the second one. The array comparison doesnt work.
Any ideas?
I have a method called getSettingArray() which gets all the game setting values in an array. The method getSpecial() uses the prevous method and returns a number from that array.
I have fields for storing the previous values and I compare them to the current values in the canvas paint loop (called very often). So basically when a game setting value changes it should write it out on the console.
fields in the class
private int[] settings;
private int spec;code in the canvas paint method
//FIRST PART: int comparison
int currentSpec = Reflection.getSpecial();
if (currentSpec != 0 && spec != 0) {
if (currentSpec != spec) {
System.out.println(String.format("Spec %d changed to %d", spec, currentSpec));
}
}
spec = currentSpec;
//SECOND PART: array comparison
int[] currentSettings = Reflection.getSettingArray();
if (currentSettings != null && settings != null) {
for (int i=0; i<currentSettings.length; i++) {
if (currentSettings[i] != settings[i]) {
System.out.println(String.format("Settings[%d] %d changed to %d", i, settings[i], currentSettings[i]));
}
}
}
settings = currentSettings;The problem is when I use a weapon special (special attack value changes, game setting value changes), it writes it out with first syso, but not with the second one. The array comparison doesnt work.
Any ideas?