For the last year and a half or so I've been working on a Soldat
clone, called Storm2D. (http://storm2d.net
Having released an alpha version of the game, on my latest video (http://www.youtube.com/watch?v=0Eb-4QJHHeQ
) two people have posted that the game crashes at a specific point, both using Windows 7 (same as me). Annoyingly, the problem doesn't happen on my computer, nor 3+ other computers I tested the program on, so it is hard to debug. One of the users helpfully posted the crash log (exception stack trace) and it leads me to believe (although I could be wrong, as the location of the crash is not where the actual problem is) that my problem has something to do with the way I am reading files with the Java scanner.
Note: I bundle the jre with my application so it isn't a problem with different versions of java.
when reading through one of my (biped) files needed for the game, at the start of the line I check if the first 'token' in the line is a number. If it is a number, it means I need to read an extra two parameters at the start. I read the line a slightly different way (because the line contains different parameters). For some reason I think the first token is not being recognized as a number on their machines which means that the first two tokens aren't handled and the whole line is read wrongly.
The code I use to check if the token is a number(note: any type of number, float,double, int etc) is below. Does this handle all cases? (apart from long, huge numbers won't occur)
if (scan.hasNextFloat() || scan.hasNextInt())
Alternatively I could use the below code and just use scanner.next() rather than using the other methods(hasNextFloat, etc), but I won't know if it works until one of the users that had the problem in the first place try it again.
public static boolean isNumeric(String str)
double d = Double.parseDouble(str);