From 597ed977280986e52b73dcf64539199274e4f4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 25 May 2020 23:12:46 +0200 Subject: BoardScreen : show adjacent on reset, do not crash --- test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java b/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java index 086133d..a5ec9f9 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java +++ b/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java @@ -60,8 +60,10 @@ public class BoardScreen extends AbstractScreen public void reset() { - pos.set(0, 0); tilesToDraw.clear(); + v.set(0, 0); + pos.set(0, 0); + handleAdjacents(); board.centerOf(0, 0, v); panzer.centerOn(v.x, v.y); panzer.setRotation(Orientation.DEFAULT.r()); @@ -108,6 +110,7 @@ public class BoardScreen extends AbstractScreen private Tile getTile(int x, int y) { + if (!board.isOnMap(x, y)) return null; return tileStorage.getTile(x, y, board::genKey, this::buildTile); } -- cgit v1.1-2-g2b99