(JSONObject meta)
| 415 | } |
| 416 | |
| 417 | public void setMeta(JSONObject meta){ |
| 418 | if(meta != null){ |
| 419 | MapPainterDefault mapPainter = (MapPainterDefault) getWorldPanel().getMappainter(); |
| 420 | if(meta.has("showPaths")) mapPainter.setShowPaths(meta.getBoolean("showPaths")); |
| 421 | if(meta.has("pathsCurved")) mapPainter.setPathsCurved(meta.getBoolean("pathsCurved")); |
| 422 | if(meta.has("showCursor")) getWorldPanel().setCursorEnabled(meta.getBoolean("showCursor")); |
| 423 | if(meta.has("showGrid")) mapPainter.setGridEnabled(meta.getBoolean("showGrid")); |
| 424 | if(meta.has("tileSize")) getWorldPanel().setTileSize(meta.getInt("tileSize")); |
| 425 | |
| 426 | LinkedList<WorldCoordinate> positionHistory = new LinkedList<>(); |
| 427 | |
| 428 | if(meta.has("history")){ |
| 429 | JSONArray history = meta.getJSONArray("history"); |
| 430 | Integer size = history.length(); |
| 431 | |
| 432 | for(Integer i = 0; i < size; ++i){ |
| 433 | JSONObject histEl = history.getJSONObject(i); |
| 434 | if(histEl.has("l") && histEl.has("x") && histEl.has("y")){ |
| 435 | Integer layer = histEl.getInt("l"); |
| 436 | Integer x = histEl.getInt("x"); |
| 437 | Integer y = histEl.getInt("y"); |
| 438 | positionHistory.add(new WorldCoordinate(layer, x, y)); |
| 439 | } |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | if(positionHistory.isEmpty()){ |
| 444 | positionHistory.push(new WorldCoordinate(worldPanel.getWorld().getHome())); |
| 445 | } |
| 446 | |
| 447 | worldPanel.setHistory(positionHistory); |
| 448 | } |
| 449 | } |
| 450 | } |
no test coverage detected