diff --git a/src/main/scala/fr/ynerant/leveleditor/editor/GMap.scala b/src/main/scala/fr/ynerant/leveleditor/editor/GMap.scala index 2018ff1..9a438c5 100644 --- a/src/main/scala/fr/ynerant/leveleditor/editor/GMap.scala +++ b/src/main/scala/fr/ynerant/leveleditor/editor/GMap.scala @@ -36,11 +36,11 @@ class GMap(val raw: RawMap) { def getHeight: Int = height - def getCase(x: Int, y: Int): Case = casesMap.getOrElse(x, Map())(y) + def getCase(x: Int, y: Int): Case = casesMap.getOrElse(x, Map()).getOrElse(y, null) def getAllCases: List[Case] = { - val list = Nil: List[Case] - casesMap.values.foreach(l => list.appendedAll(l.values)) + var list = Nil: List[Case] + casesMap.values.foreach(l => list = list.appendedAll(l.values)) list } diff --git a/src/main/scala/fr/ynerant/leveleditor/frame/listeners/MapMouseListener.scala b/src/main/scala/fr/ynerant/leveleditor/frame/listeners/MapMouseListener.scala index 7692b5c..aff973d 100644 --- a/src/main/scala/fr/ynerant/leveleditor/frame/listeners/MapMouseListener.scala +++ b/src/main/scala/fr/ynerant/leveleditor/frame/listeners/MapMouseListener.scala @@ -29,7 +29,6 @@ class MapMouseListener(val panel: MapPanel, val frame: EditorFrame) extends Mous case _ => n = c - } map.setCase(n.getPosX, n.getPosY, n) panel.repaint()