Skip to content

Commit

Permalink
Save commander whenever he makes a transaction.
Browse files Browse the repository at this point in the history
  • Loading branch information
CmdrStardust committed Sep 16, 2016
1 parent 8878fae commit f230daf
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 14 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.phbouillon.android.games.alite"
android:versionCode="2206"
android:versionName="1.5.6"
android:versionCode="2207"
android:versionName="1.5.7"
android:installLocation="auto" xmlns:tools="http://schemas.android.com/tools">

<permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature"/>
Expand Down
4 changes: 4 additions & 0 deletions ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Alite is inspired by classic Elite, (c) Acornsoft, Bell & Braben.

Version History
---------------
Version 1.5.7 Bugfix: When pressing "Home", it might have happened that the
old Commander was replaced by a new one (introduced in 1.5.6)
this is now fixed. [09/17/2016]

Version 1.5.6 Bugfix: If the cobra is spinning endlessly in space, the state
is now reset after 10s. Bugfix: If leaving Alite by pressing
'Home' the game state is now saved again. Improvement: If
Expand Down
10 changes: 0 additions & 10 deletions src/de/phbouillon/android/games/alite/Alite.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public class Alite extends AndroidGame {
private static AliteScreen definingScreen;
private final FileUtils fileUtils;
private LaserManager laserManager;

private AliteFont font;
private static Alite alite;
private boolean saving = false;
Expand Down Expand Up @@ -354,15 +353,6 @@ protected void saveState() {

@Override
public void onPause() {
AliteLog.d("Alite.onPause", "onPause begin");
if (getCurrentScreen() != null && !(getCurrentScreen() instanceof FlightScreen)) {
try {
AliteLog.d("[ALITE]", "Performing autosave.");
getFileUtils().autoSave(this);
} catch (Exception e) {
AliteLog.e("[ALITE]", "Autosaving commander failed.", e);
}
}
try {
setSaving(true);
super.onPause();
Expand Down
2 changes: 1 addition & 1 deletion src/de/phbouillon/android/games/alite/AliteConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class AliteConfig {
public static final boolean HAS_EXTENSION_APK = true;
public static final int EXTENSION_FILE_VERSION = 2200;
public static final long EXTENSION_FILE_LENGTH = 427332161l;
public static final String VERSION_STRING = "1.5.6";
public static final String VERSION_STRING = "1.5.7";
public static final int ALITE_INTRO_B1920 = -1;//R.raw.alite_intro_b1920;
public static final int ALITE_INTRO_B1280 = -1;//R.raw.alite_intro_b1280;
public static final int ALITE_INTRO_B640 = -1;//R.raw.alite_intro_b640;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ public void performTrade(int row, int column) {
((Alite) game).getPlayer().setLegalValue(
((Alite) game).getPlayer().getLegalValue() + (int) (tradeGood.getLegalityType() * buyAmount));
}
try {
((Alite) game).getFileUtils().autoSave((Alite) game);
} catch (IOException e) {
AliteLog.e("Auto saving failed", e.getMessage(), e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ protected void performTrade(int row, int column) {
selection = null;
cashLeft = String.format("Cash left: %d.%d Cr", player.getCash() / 10, player.getCash() % 10);
equippedEquipment = equipment;
try {
((Alite) game).getFileUtils().autoSave((Alite) game);
} catch (IOException e) {
AliteLog.e("Auto saving failed", e.getMessage(), e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ public void performTrade(int row, int column) {
cashLeft = String.format("Cash: %d.%d Cr", player.getCash() / 10, player.getCash() % 10);
SoundManager.play(Assets.kaChing);
createButtons();
try {
((Alite) game).getFileUtils().autoSave((Alite) game);
} catch (IOException e) {
AliteLog.e("Auto saving failed", e.getMessage(), e);
}
}

public String getCashLeft() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ private void getAccelerometerData() {
}
float accelY = alite.getInput().getAccelY();
float accelZ = alite.getInput().getAccelZ();

deltaYawRollPitch.x = 0;
deltaYawRollPitch.y = -clamp((int) (accelY * 50.0f) / 10.0f, -2.0f, 2.0f);
deltaYawRollPitch.z = clamp((int) (accelZ * 30.0f) / 10.0f, -2.0f, 2.0f);
Expand Down

0 comments on commit f230daf

Please sign in to comment.