From febed0cd77a74737ca0e6f7a680a33b8f454f9f1 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Thu, 7 Nov 2024 14:31:39 +0100 Subject: [PATCH] NavigationBetweenViewController: fields -> local variables --- .../controllers/NavigationBetweenViewController.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/fr/enssat/BoulderDash/controllers/NavigationBetweenViewController.java b/src/fr/enssat/BoulderDash/controllers/NavigationBetweenViewController.java index ebd25084..9ed721f0 100644 --- a/src/fr/enssat/BoulderDash/controllers/NavigationBetweenViewController.java +++ b/src/fr/enssat/BoulderDash/controllers/NavigationBetweenViewController.java @@ -16,9 +16,7 @@ public class NavigationBetweenViewController implements ActionListener { private LevelEditorController levelEditorController; private MenuView menuView; private AudioLoadHelper audioLoadHelper; - private LevelModel levelModelForGame, levelModelForEditor; private GameController gameController; - private String pickedLevelIdentifier; /** * Class constructor @@ -47,8 +45,8 @@ public class NavigationBetweenViewController implements ActionListener { case "editor": // New blank model for editor - this.levelModelForEditor = new LevelModel(audioLoadHelper); - this.levelEditorController = new LevelEditorController(this.levelModelForEditor, this); + LevelModel levelModelForEditor = new LevelModel(audioLoadHelper); + this.levelEditorController = new LevelEditorController(levelModelForEditor, this); this.levelEditorController.getLevelEditorView().setVisible(true); this.levelEditorController.getLevelEditorView().getLevelEditorGroundView().grabFocus(); @@ -61,9 +59,8 @@ public class NavigationBetweenViewController implements ActionListener { case "game": // Reinit the levelModelForGame... - pickedLevelIdentifier = this.menuView.getLevelIdentifier(); - - this.levelModelForGame = new LevelModel(pickedLevelIdentifier, audioLoadHelper); + String pickedLevelIdentifier = this.menuView.getLevelIdentifier(); + LevelModel levelModelForGame = new LevelModel(pickedLevelIdentifier, audioLoadHelper); this.gameController = new GameController(levelModelForGame, audioLoadHelper, this); if (levelEditorController != null) {