Skip to content

Commit e5412a5

Browse files
Refac
1 parent bb41041 commit e5412a5

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

pacman-app-arcade-pacman/src/main/java/de/amr/pacmanfx/arcade/pacman/ArcadeCommon_GameModel.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,14 @@ public abstract class ArcadeCommon_GameModel extends AbstractGameModel {
3232
public static final int EXTRA_LIFE_SCORE = 10_000;
3333
public static final byte[] KILLED_GHOST_VALUE_FACTORS = {2, 4, 8, 16}; // points = factor * 100
3434

35-
protected final GameContext gameContext;
3635
protected MapSelector mapSelector;
3736
protected GateKeeper gateKeeper;
3837
protected Steering autopilot;
3938
protected Steering demoLevelSteering;
4039
protected int cruiseElroy;
4140

4241
protected ArcadeCommon_GameModel(GameContext gameContext) {
43-
this.gameContext = gameContext;
42+
super(gameContext);
4443
}
4544

4645
// GameEvents interface

pacman-app-tengen-mspacman/src/main/java/de/amr/pacmanfx/tengen/ms_pacman/model/TengenMsPacMan_GameModel.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ public Vector2i chasingTargetTile() {
215215
};
216216
}
217217

218-
private final GameContext gameContext;
219218
private final ScoreManager scoreManager;
220219
private final TengenMsPacMan_GameData hud = new TengenMsPacMan_GameData();
221220
private final TengenMsPacMan_MapSelector mapSelector;
@@ -234,7 +233,7 @@ public Vector2i chasingTargetTile() {
234233
private int numContinues;
235234

236235
public TengenMsPacMan_GameModel(GameContext gameContext, File highScoreFile) {
237-
this.gameContext = requireNonNull(gameContext);
236+
super(gameContext);
238237
scoreManager = new DefaultScoreManager(gameContext, highScoreFile);
239238
actorSpeedControl = new TengenActorSpeedControl();
240239
mapSelector = new TengenMsPacMan_MapSelector();

pacman-core/src/main/java/de/amr/pacmanfx/model/AbstractGameModel.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package de.amr.pacmanfx.model;
66

7+
import de.amr.pacmanfx.GameContext;
78
import de.amr.pacmanfx.event.GameEventManager;
89
import de.amr.pacmanfx.event.GameEventType;
910
import de.amr.pacmanfx.lib.timer.Pulse;
@@ -31,8 +32,13 @@ public abstract class AbstractGameModel implements Game {
3132
protected final BooleanProperty cutScenesEnabled = new SimpleBooleanProperty(true);
3233
protected final IntegerProperty initialLifeCount = new SimpleIntegerProperty(3);
3334
protected final SimulationStep simulationStep = new SimulationStep();
35+
protected final GameContext gameContext;
3436
protected GameLevel level;
3537

38+
protected AbstractGameModel(GameContext gameContext) {
39+
this.gameContext = gameContext;
40+
}
41+
3642
@Override
3743
public SimulationStep simulationStep() {
3844
return simulationStep;

0 commit comments

Comments
 (0)