diff --git a/AndorsTrail/res/drawable/ui_debug_background.xml b/AndorsTrail/res/drawable/ui_debug_background.xml
deleted file mode 100644
index c74f0ced0..000000000
--- a/AndorsTrail/res/drawable/ui_debug_background.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/AndorsTrail/res/drawable/ui_progress_ap.xml b/AndorsTrail/res/drawable/ui_progress_ap.xml
deleted file mode 100644
index 435b0278f..000000000
--- a/AndorsTrail/res/drawable/ui_progress_ap.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- -
-
- -
-
-
- -
-
-
-
diff --git a/AndorsTrail/res/layout/about.xml b/AndorsTrail/res/layout/about.xml
index 794d3f325..3eebd04fa 100644
--- a/AndorsTrail/res/layout/about.xml
+++ b/AndorsTrail/res/layout/about.xml
@@ -35,7 +35,7 @@
android:id="@+id/about_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="version"
+ android:text="@android:string/unknownName"
/>
diff --git a/AndorsTrail/res/layout/heroinfo_stats.xml b/AndorsTrail/res/layout/heroinfo_stats.xml
index b65734994..c6d37601a 100644
--- a/AndorsTrail/res/layout/heroinfo_stats.xml
+++ b/AndorsTrail/res/layout/heroinfo_stats.xml
@@ -25,7 +25,7 @@
android:layout_height="wrap_content"
style="@style/titleWithIcon"
android:drawableLeft="@drawable/char_hero"
- android:text="Name"
+ android:text="@android:string/unknownName"
/>
-
+
-
+
diff --git a/AndorsTrail/res/layout/inventoryitemview.xml b/AndorsTrail/res/layout/inventoryitemview.xml
index a2d8aaaf5..2ed92e6b3 100644
--- a/AndorsTrail/res/layout/inventoryitemview.xml
+++ b/AndorsTrail/res/layout/inventoryitemview.xml
@@ -5,5 +5,5 @@
android:layout_height="wrap_content"
style="@style/textWithIcon"
android:drawableLeft="@drawable/equip_weapon"
- android:text="Name"
+ android:text="@android:string/unknownName"
/>
diff --git a/AndorsTrail/res/layout/loadsave.xml b/AndorsTrail/res/layout/loadsave.xml
index e242f038b..b8ef59983 100644
--- a/AndorsTrail/res/layout/loadsave.xml
+++ b/AndorsTrail/res/layout/loadsave.xml
@@ -36,7 +36,7 @@
android:id="@+id/loadsave_slot_n"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="1."
+ android:text="@android:string/unknownName"
/>
diff --git a/AndorsTrail/res/values/authors.xml b/AndorsTrail/res/values/authors.xml
index a5287ef72..72d9e17eb 100644
--- a/AndorsTrail/res/values/authors.xml
+++ b/AndorsTrail/res/values/authors.xml
@@ -3,7 +3,7 @@
- Copyright (C) 2010-2013 Oskar Wiksten<br /><br />
+ Copyright © 2010–2013 Oskar Wiksten<br /><br />
Programming by Oskar Wiksten<br />
<a href="http://andorstrail.com/">Web site provided by Scott Devaney</a><br />
diff --git a/AndorsTrail/res/values/strings.xml b/AndorsTrail/res/values/strings.xml
index d72d14c34..5b95c043b 100644
--- a/AndorsTrail/res/values/strings.xml
+++ b/AndorsTrail/res/values/strings.xml
@@ -4,19 +4,15 @@
Andor\'s Trail
Quest-driven fantasy RPG
- Exit
Exit to menu
- Pause
Preferences
Save
- Load
Game was saved to slot %1$d
Failed to save game! Is the SD card mounted and writable?
Save game
Load saved game
Select slot
- (empty)
level %1$d, %2$d exp, %3$d gold
Loading resources…
@@ -26,27 +22,17 @@
Close
- Exit
- Are you sure you want to exit?
-
- Paused
- Game is paused
- Resume
-
Encounter
Do you want to attack?\nDifficulty: %1$s
Info
HP:
- MP:
AP:
Level:
Overview
Items
- Equipped
Skills
- Spells
Level up
Level
Total experience
@@ -59,7 +45,6 @@
Attack (%1$d AP)
Move (%1$d AP)
Use item
- Spell
End turn
Flee
@@ -108,10 +93,7 @@
Class:
Difficulty:
Health:
- Attacks/turn:
- Movement/turn:
Attack:
- Critical hit:
Defense:
Move cost (AP):
Base combat statistics (without equipment and skills)
@@ -135,18 +117,6 @@
Equip (%1$d AP)
Unequip (%1$d AP)
- Money
- Weapon
- Shield
- Wearable (head)
- Wearable (body)
- Wearable (hands)
- Wearable (feet)
- Wearable (neck)
- Wearable (ring)
- Potion
- Other
-
Continue current game
New game
You will lose your current game and your current character, are you sure you want to start a new game?
@@ -228,7 +198,6 @@
Thanks for all the feedback!
- Quests
Select quests to show
Hide completed quests
Include completed quests
diff --git a/AndorsTrail/res/values/ui_colors.xml b/AndorsTrail/res/values/ui_colors.xml
index 85dcc413e..098cbc9c2 100644
--- a/AndorsTrail/res/values/ui_colors.xml
+++ b/AndorsTrail/res/values/ui_colors.xml
@@ -1,5 +1,4 @@
- #80000000
#423921
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/WorldSetup.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/WorldSetup.java
index 0a7349887..8750a87d0 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/WorldSetup.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/WorldSetup.java
@@ -26,7 +26,7 @@ public final class WorldSetup {
public int loadFromSlot = Savegames.SLOT_QUICKSAVE;
public boolean isSceneReady = false;
public String newHeroName;
- private int loadResult;
+ private Savegames.LoadSavegameResult loadResult;
public WorldSetup(WorldContext world, ControllerContext controllers, Context androidContext) {
this.world = world;
@@ -105,7 +105,7 @@ public final class WorldSetup {
if (world.model != null) world.resetForNewGame();
if (createNewCharacter) {
createNewWorld();
- loadResult = Savegames.LOAD_RESULT_SUCCESS;
+ loadResult = Savegames.LoadSavegameResult.success;
} else {
loadResult = continueWorld();
}
@@ -126,7 +126,7 @@ public final class WorldSetup {
onSceneLoadedListener = null;
if (o == null) return;
- if (loadResult == Savegames.LOAD_RESULT_SUCCESS) {
+ if (loadResult == Savegames.LoadSavegameResult.success) {
o.onSceneLoaded();
} else {
o.onSceneLoadFailed(loadResult);
@@ -136,7 +136,7 @@ public final class WorldSetup {
}).execute();
}
- private int continueWorld() {
+ private Savegames.LoadSavegameResult continueWorld() {
Context ctx = androidContext.get();
return Savegames.loadWorld(world, controllers, ctx, loadFromSlot);
}
@@ -154,7 +154,7 @@ public final class WorldSetup {
public interface OnSceneLoadedListener {
void onSceneLoaded();
- void onSceneLoadFailed(int loadResult);
+ void onSceneLoadFailed(Savegames.LoadSavegameResult loadResult);
}
public interface OnResourcesLoadedListener {
void onResourcesLoaded();
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/ConversationActivity.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/ConversationActivity.java
index 401239b02..c4edc6532 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/ConversationActivity.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/ConversationActivity.java
@@ -49,7 +49,7 @@ public final class ConversationActivity
private WorldContext world;
private Player player;
- private ArrayList conversationHistory = new ArrayList();
+ private final ArrayList conversationHistory = new ArrayList();
private ConversationController.ConversationStatemachine conversationState;
private StatementContainerAdapter listAdapter;
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/LoadSaveActivity.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/LoadSaveActivity.java
index d62782d42..07da04227 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/LoadSaveActivity.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/LoadSaveActivity.java
@@ -58,7 +58,7 @@ public final class LoadSaveActivity extends Activity implements OnClickListener
slotList.removeView(slotTemplateButton);
slotList.removeView(createNewSlot);
- addSavegameSlotButtons(slotList, params, Savegames.getUsedSavegameSlots(this));
+ addSavegameSlotButtons(slotList, params, Savegames.getUsedSavegameSlots());
if (!isLoading) {
Button b = new Button(this);
@@ -86,7 +86,7 @@ public final class LoadSaveActivity extends Activity implements OnClickListener
public void loadsave(int slot) {
if (slot == SLOT_NUMBER_CREATE_NEW_SLOT) {
- List usedSlots = Savegames.getUsedSavegameSlots(this);
+ List usedSlots = Savegames.getUsedSavegameSlots();
if (usedSlots.isEmpty()) slot = SLOT_NUMBER_FIRST_SLOT;
else slot = Collections.max(usedSlots) + 1;
}
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/LoadingActivity.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/LoadingActivity.java
index c5b565656..2d87be8e8 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/LoadingActivity.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/LoadingActivity.java
@@ -55,9 +55,9 @@ public final class LoadingActivity extends Activity implements OnResourcesLoaded
}
@Override
- public void onSceneLoadFailed(int loadResult) {
+ public void onSceneLoadFailed(Savegames.LoadSavegameResult loadResult) {
progressDialog.dismiss();
- if (loadResult == Savegames.LOAD_RESULT_FUTURE_VERSION) {
+ if (loadResult == Savegames.LoadSavegameResult.savegameIsFromAFutureVersion) {
showLoadingFailedDialog(R.string.dialog_loading_failed_incorrectversion);
} else {
showLoadingFailedDialog(R.string.dialog_loading_failed_message);
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/StartScreenActivity.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/StartScreenActivity.java
index 077e810b9..e9f0991f5 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/StartScreenActivity.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/StartScreenActivity.java
@@ -22,7 +22,7 @@ import com.gpl.rpg.AndorsTrail.savegames.Savegames.FileHeader;
public final class StartScreenActivity extends Activity {
- public static final int INTENTREQUEST_PREFERENCES = 7;
+ private static final int INTENTREQUEST_PREFERENCES = 7;
public static final int INTENTREQUEST_LOADGAME = 9;
private boolean hasExistingGame = false;
@@ -161,7 +161,7 @@ public final class StartScreenActivity extends Activity {
Dialogs.showNewVersion(this);
}
- boolean hasSavegames = !Savegames.getUsedSavegameSlots(this).isEmpty();
+ boolean hasSavegames = !Savegames.getUsedSavegameSlots().isEmpty();
startscreen_load.setEnabled(hasSavegames);
}
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/ConversationController.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/ConversationController.java
index c56b2c8e9..020d35b1c 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/ConversationController.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/ConversationController.java
@@ -283,7 +283,7 @@ public final class ConversationController {
private String phraseID;
private Phrase currentPhrase;
private Monster npc;
- public ConversationStateListener listener;
+ public final ConversationStateListener listener;
public ConversationStatemachine(WorldContext world, ControllerContext controllers, ConversationStateListener listener) {
this.world = world;
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/PathFinder.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/PathFinder.java
index be32ef6d3..68f5017b6 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/PathFinder.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/PathFinder.java
@@ -11,7 +11,6 @@ public class PathFinder {
private final boolean visited[];
private final ListOfCoords visitQueue;
private final EvaluateWalkable map;
- public int iterations = 0;
public PathFinder(int maxWidth, int maxHeight, EvaluateWalkable map) {
this.maxWidth = maxWidth;
@@ -26,7 +25,7 @@ public class PathFinder {
}
public boolean findPathBetween(final CoordRect from, final Coord to, CoordRect nextStep) {
- iterations = 0;
+ int iterations = 0;
if (from.equals(to)) return false;
Coord measureDistanceTo = from.topLeft;
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/MapObject.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/MapObject.java
index b804a5145..24fcb2250 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/MapObject.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/MapObject.java
@@ -26,7 +26,7 @@ public final class MapObject {
public final String id; //placeName on this map or phraseID
public final String map;
public final String place;
- public final String group;
+ private final String group;
public final Requirement enteringRequirement;
public final DropList dropList;
public final MapObjectEvaluationType evaluateWhen;
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/MonsterSpawnArea.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/MonsterSpawnArea.java
index 7940f1356..c57783698 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/MonsterSpawnArea.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/MonsterSpawnArea.java
@@ -21,7 +21,7 @@ public final class MonsterSpawnArea {
public final String[] monsterTypeIDs;
public final ArrayList monsters = new ArrayList();
public final boolean isUnique; // unique == non-respawnable
- public final String group;
+ private final String group;
public boolean isSpawning;
public final boolean isSpawningForNewGame;
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/ReplaceableMapSection.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/ReplaceableMapSection.java
index 92232584c..2ad5c5fb3 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/ReplaceableMapSection.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/map/ReplaceableMapSection.java
@@ -8,7 +8,7 @@ public final class ReplaceableMapSection {
public final CoordRect replacementArea;
public final MapSection replaceLayersWith;
public final QuestProgress requireQuestStage;
- public final String group;
+ private final String group;
public ReplaceableMapSection(
CoordRect replacementArea
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/parsers/json/JsonArrayParserFor.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/parsers/json/JsonArrayParserFor.java
index 5887b5ef8..20d9d5e70 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/parsers/json/JsonArrayParserFor.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/parsers/json/JsonArrayParserFor.java
@@ -19,6 +19,11 @@ public abstract class JsonArrayParserFor extends JsonParserFor {
final ArrayList arrayList = new ArrayList(array.length());
parseRows(array, arrayList);
if (arrayList.isEmpty()) return null;
- return arrayList.toArray((T[]) Array.newInstance(classType, arrayList.size()));
+ return arrayList.toArray(newArray(arrayList.size()));
+ }
+
+ @SuppressWarnings("unchecked")
+ private T[] newArray(int size) {
+ return (T[]) Array.newInstance(classType, size);
}
}
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/tiles/TileManager.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/tiles/TileManager.java
index 05e141b1d..407047796 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/tiles/TileManager.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/resource/tiles/TileManager.java
@@ -163,10 +163,6 @@ public final class TileManager {
public void setImageViewTile(ImageView imageView, ActorConditionType conditionType) { imageView.setImageBitmap(preloadedTiles.getBitmap(conditionType.iconID)); }
public void setImageViewTileForUIIcon(ImageView imageView, int iconID) { imageView.setImageBitmap(preloadedTiles.getBitmap(iconID)); }
- public void setImageViewTileForSingleItemType(Resources res, ImageView imageView, ItemType itemType) {
- final Bitmap icon = tileCache.loadSingleTile(itemType.iconID, res);
- setImageViewTile(res, imageView, itemType, icon);
- }
public void setImageViewTile(Resources res, ImageView imageView, ItemType itemType, TileCollection itemTileCollection) {
final Bitmap icon = itemTileCollection.getBitmap(itemType.iconID);
setImageViewTile(res, imageView, itemType, icon);
diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/savegames/Savegames.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/savegames/Savegames.java
index ea33128b3..a1f9b0451 100644
--- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/savegames/Savegames.java
+++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/savegames/Savegames.java
@@ -20,9 +20,11 @@ import java.util.regex.Pattern;
public final class Savegames {
public static final int SLOT_QUICKSAVE = 0;
- public static final int LOAD_RESULT_SUCCESS = 0;
- public static final int LOAD_RESULT_UNKNOWN_ERROR = 1;
- public static final int LOAD_RESULT_FUTURE_VERSION = 2;
+ public static enum LoadSavegameResult {
+ success
+ , unknownError
+ , savegameIsFromAFutureVersion
+ }
public static boolean saveWorld(WorldContext world, Context androidContext, int slot, String displayInfo) {
try {
@@ -42,10 +44,10 @@ public final class Savegames {
return false;
}
}
- public static int loadWorld(WorldContext world, ControllerContext controllers, Context androidContext, int slot) {
+ public static LoadSavegameResult loadWorld(WorldContext world, ControllerContext controllers, Context androidContext, int slot) {
try {
FileInputStream fos = getInputFile(androidContext, slot);
- int result = loadWorld(androidContext.getResources(), world, controllers, fos);
+ LoadSavegameResult result = loadWorld(androidContext.getResources(), world, controllers, fos);
fos.close();
return result;
} catch (IOException e) {
@@ -56,7 +58,7 @@ public final class Savegames {
e.printStackTrace(pw);
L.log("Load error: " + sw.toString());
}
- return LOAD_RESULT_UNKNOWN_ERROR;
+ return LoadSavegameResult.unknownError;
}
}
@@ -99,10 +101,10 @@ public final class Savegames {
dest.close();
}
- public static int loadWorld(Resources res, WorldContext world, ControllerContext controllers, InputStream inState) throws IOException {
+ public static LoadSavegameResult loadWorld(Resources res, WorldContext world, ControllerContext controllers, InputStream inState) throws IOException {
DataInputStream src = new DataInputStream(inState);
final FileHeader header = new FileHeader(src);
- if (header.fileversion > AndorsTrailApplication.CURRENT_VERSION) return LOAD_RESULT_FUTURE_VERSION;
+ if (header.fileversion > AndorsTrailApplication.CURRENT_VERSION) return LoadSavegameResult.savegameIsFromAFutureVersion;
world.maps.readFromParcel(src, world, controllers, header.fileversion);
world.model = new ModelContainer(src, world, controllers, header.fileversion);
@@ -110,7 +112,7 @@ public final class Savegames {
onWorldLoaded(res, world, controllers);
- return LOAD_RESULT_SUCCESS;
+ return LoadSavegameResult.success;
}
private static void onWorldLoaded(Resources res, WorldContext world, ControllerContext controllers) {
@@ -138,7 +140,7 @@ public final class Savegames {
}
private static final Pattern savegameFilenamePattern = Pattern.compile(Constants.FILENAME_SAVEGAME_FILENAME_PREFIX + "(\\d+)");
- public static List getUsedSavegameSlots(Context androidContext) {
+ public static List getUsedSavegameSlots() {
try {
final List result = new ArrayList();
getSavegameDirectory().listFiles(new FilenameFilter() {
@@ -164,12 +166,6 @@ public final class Savegames {
public final String playerName;
public final String displayInfo;
- public FileHeader(String playerName, String displayInfo) {
- this.fileversion = AndorsTrailApplication.CURRENT_VERSION;
- this.playerName = playerName;
- this.displayInfo = displayInfo;
- }
-
public String describe() {
return playerName + ", " + displayInfo;
}