I am creating a game engine from scratch with java, i have started work on a new save file instead of using imaages for maps:
Works and prints out every line:
while ((readString = buf.readLine()) != null) {
System.out.println("Failed to assign action to line: " + readString);
}
Doesnt work, prints out first 3 lines:
while ((readString = buf.readLine()) != null) {
if (readString.contains("Width:")){
readString.replace("Width:", "");
readString.trim();
Integer.parseInt(readString);
System.out.println(readString);
}else if (readString.contains("Height:")){
readString.replace("Height::", "");
readString.trim();
Integer.parseInt(readString);
System.out.println(readString);
}else{
System.out.println("Failed to assign action to line: " + readString);
}
}
As you can see, the top one is working and prints out every line to the console, the second one stops after reading the 3rd line. I haven't found anything while researching the problem, and my syntax appears to be correct. What's wrong with my code?