Skip to content

Commit

Permalink
Finishing touches
Browse files Browse the repository at this point in the history
  • Loading branch information
vampcat committed Dec 21, 2017
1 parent 75b2c44 commit 883f3ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion engine/src/main/java/org/destinationsol/game/ShipConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static ArrayList<ShipConfig> loadList(JsonValue shipListJson, HullConfigM
return res;
}

public static ShipConfig load(HullConfigManager hullConfigs, String shipName, ItemManager itemManager) {
public static ShipConfig load(HullConfigManager hullConfigs, String shipName, ItemManager itemManager, SolGame game) {
Set<ResourceUrn> configUrnList = Assets.getAssetHelper().list(Json.class, "[a-z]*:playerSpawnConfig");

ShipConfig shipConfig = null;
Expand All @@ -67,6 +67,7 @@ public static ShipConfig load(HullConfigManager hullConfigs, String shipName, It
for (JsonValue node : rootNode) {
if (node.name.equals(shipName)) {
shipConfig = load(hullConfigs, node, itemManager);
game.setShipName(node.getString("hull"));
break;
}
}
Expand Down
3 changes: 1 addition & 2 deletions engine/src/main/java/org/destinationsol/game/SolGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ public SolGame(SolApplication cmp, String shipName, boolean tut, CommonDrawer co
mountDetectDrawer = new MountDetectDrawer();
respawnItems = new ArrayList<>();
timeFactor = 1;
this.shipName = shipName;

// from this point we're ready!
planetManager.fill(solNames);
Expand All @@ -158,7 +157,7 @@ public SolGame(SolApplication cmp, String shipName, boolean tut, CommonDrawer co

// uh, this needs refactoring
private void createPlayer(String shipName) {
ShipConfig shipConfig = shipName == null ? SaveManager.readShip(hullConfigManager, itemManager, this) : ShipConfig.load(hullConfigManager, shipName, itemManager);
ShipConfig shipConfig = shipName == null ? SaveManager.readShip(hullConfigManager, itemManager, this) : ShipConfig.load(hullConfigManager, shipName, itemManager, this);

// Added temporarily to remove warnings. Handle this more gracefully inside the SaveManager.readShip and the ShipConfig.load methods
assert shipConfig != null;
Expand Down
12 changes: 6 additions & 6 deletions engine/src/main/java/org/destinationsol/menu/NewGameScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public class NewGameScreen implements SolUiScreen {

private final ArrayList<SolUiControl> controls = new ArrayList<>();
private final SolUiControl backControl;
private final SolUiControl previousControl;
private final SolUiControl continueControl;
private final SolUiControl newControl;

NewGameScreen(MenuLayout menuLayout, GameOptions gameOptions) {
previousControl = new SolUiControl(menuLayout.buttonRect(-1, 1), true, gameOptions.getKeyShoot());
previousControl.setDisplayName("Continue");
controls.add(previousControl);
continueControl = new SolUiControl(menuLayout.buttonRect(-1, 1), true, gameOptions.getKeyShoot());
continueControl.setDisplayName("Continue");
controls.add(continueControl);

newControl = new SolUiControl(menuLayout.buttonRect(-1, 2), true);
newControl.setDisplayName("New game");
Expand All @@ -62,7 +62,7 @@ public List<SolUiControl> getControls() {

@Override
public void onAdd(SolApplication solApplication) {
previousControl.setEnabled(SaveManager.hasPrevShip());
continueControl.setEnabled(SaveManager.hasPrevShip());
}

@Override
Expand All @@ -73,7 +73,7 @@ public void updateCustom(SolApplication solApplication, SolInputManager.InputPoi
im.setScreen(solApplication, screens.main);
return;
}
if (previousControl.isJustOff()) {
if (continueControl.isJustOff()) {
solApplication.loadNewGame(false, null);
return;
}
Expand Down

0 comments on commit 883f3ed

Please sign in to comment.