Another question that might solve itself shortly after posting, but I've set up a little debugging thing to let me know how far this gets before stopping. The problem is that it executes correctly when loading the tiles, but stops before actually placing them in the world. The game does not freeze at all, the player can still move around and do things, there's just no tiles loaded anywhere.
The terminal says
"pre-tileY
post-tileY
pre-break1
pre-tileY
post-tileY
pre-break1" etc...
Meaning it's only reaching pre-break1. Is the line "working = working.substring(0, working.indexOf(','));" causing problems?
Any help is appreciated.
public void addTile(String tileType, String tileData) { String tileXst = tileData; tileXst = tileXst.substring(0, tileXst.indexOf(',')); String bufLineText = tileData.substring(tileXst.length() + 1); String tileYst = bufLineText; int tileX = Integer.parseInt(tileXst); int tileY = Integer.parseInt(tileYst); List<String> tileInfo = new ArrayList(); String working = new String(); System.out.println("pre-tileY"); if(tileYst.contains(",")) { tileYst = tileYst.substring(0, tileYst.indexOf(',')); bufLineText = tileData.substring(tileYst.length() + 1); working = bufLineText; } System.out.println("post-tileY"); for(int i = 0; i < 50; i++) //50 times max { System.out.println("pre-break1"); working = working.substring(0, working.indexOf(',')); System.out.println("pre-break2"); tileInfo.add(working); System.out.println("pre-break3"); bufLineText = tileData.substring(working.length() + 1); System.out.println("pre-break4"); if(!bufLineText.contains(",")) { tileInfo.add(bufLineText); break; } } System.out.println("post-break"); if(tileTypes.indexOf(tileType) >= 0) { try { worldObject tileToAdd = (worldObject)(tileClasses.get(tileTypes.indexOf(tileType)).newInstance()); addObject(tileToAdd, tileX*PersistentStorage.tileSize, tileY*PersistentStorage.tileSize); tileToAdd.loadData(tileInfo); tileToAdd.partOfWorld = true; } catch(Exception e) { System.err.println("Caught Exception: " + e.getMessage()); } } }