mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Reduce compilation warnings from code inspection rules.
(Reduce visibilities to private, add final where applicable)
This commit is contained in:
@@ -36,7 +36,7 @@ public final class AndorsTrailApplication extends Application {
|
||||
public static AndorsTrailApplication getApplicationFromActivityContext(Context context) {
|
||||
return getApplicationFromActivity(getActivityFromActivityContext(context));
|
||||
}
|
||||
public static Activity getActivityFromActivityContext(Context context) {
|
||||
private static Activity getActivityFromActivityContext(Context context) {
|
||||
return (Activity) context;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ public final class Dialogs {
|
||||
}
|
||||
|
||||
public static void showGroundLoot(final MainActivity mainActivity, final ViewContext view, final WorldContext world, final Loot loot, final String msg) {
|
||||
showLoot(mainActivity, view, world, loot, Collections.singletonList(loot), R.string.dialog_monsterloot_title, msg);
|
||||
showLoot(mainActivity, view, world, loot, Collections.singletonList(loot), R.string.dialog_groundloot_title, msg);
|
||||
}
|
||||
|
||||
private static void showLoot(final MainActivity mainActivity, final ViewContext view, final WorldContext world, final Loot combinedLoot, final Iterable<Loot> lootBags, final int title, final String msg) {
|
||||
@@ -302,8 +302,8 @@ public final class Dialogs {
|
||||
public static void showBulkDroppingInterface(HeroinfoActivity_Inventory currentActivity, String itemTypeID, int totalAvailableAmount) {
|
||||
showBulkSelectionInterface(currentActivity, itemTypeID, totalAvailableAmount, BulkSelectionInterface.BULK_INTERFACE_DROP, MainActivity.INTENTREQUEST_BULKSELECT_DROP);
|
||||
}
|
||||
|
||||
public static void showBulkSelectionInterface(Activity currentActivity, String itemTypeID, int totalAvailableAmount, int interfaceType, int requestCode) {
|
||||
|
||||
private static void showBulkSelectionInterface(Activity currentActivity, String itemTypeID, int totalAvailableAmount, int interfaceType, int requestCode) {
|
||||
Intent intent = new Intent(currentActivity, BulkSelectionInterface.class);
|
||||
intent.putExtra("itemTypeID", itemTypeID);
|
||||
intent.putExtra("totalAvailableAmount", totalAvailableAmount);
|
||||
|
||||
@@ -58,8 +58,7 @@ public final class ConversationActivity extends Activity implements OnKeyListene
|
||||
private ArrayList<ConversationStatement> conversationHistory = new ArrayList<ConversationStatement>();
|
||||
private StatementContainerAdapter listAdapter;
|
||||
private Button nextButton;
|
||||
private Button leaveButton;
|
||||
private ListView statementList;
|
||||
private ListView statementList;
|
||||
private Monster npc;
|
||||
private RadioGroup replyGroup;
|
||||
private OnCheckedChangeListener radioButtonListener;
|
||||
@@ -84,7 +83,7 @@ public final class ConversationActivity extends Activity implements OnKeyListene
|
||||
this.npc = Dialogs.getMonsterFromIntent(getIntent(), world);
|
||||
displayActors = (npc != null);
|
||||
|
||||
phraseID = uri.getLastPathSegment().toString();
|
||||
phraseID = uri.getLastPathSegment();
|
||||
if (savedInstanceState != null) {
|
||||
applyPhraseRewards = false;
|
||||
phraseID = savedInstanceState.getString("phraseID");
|
||||
@@ -109,13 +108,13 @@ public final class ConversationActivity extends Activity implements OnKeyListene
|
||||
statementList.setAdapter(listAdapter);
|
||||
|
||||
nextButton = (Button) findViewById(R.id.conversation_next);
|
||||
leaveButton = (Button) findViewById(R.id.conversation_leave);
|
||||
Button leaveButton = (Button) findViewById(R.id.conversation_leave);
|
||||
leaveButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ConversationActivity.this.finish();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ConversationActivity.this.finish();
|
||||
}
|
||||
});
|
||||
|
||||
radioButtonListener = new OnCheckedChangeListener() {
|
||||
@Override
|
||||
@@ -354,7 +353,7 @@ public final class ConversationActivity extends Activity implements OnKeyListene
|
||||
}
|
||||
s.text = text;
|
||||
s.color = color;
|
||||
s.isPlayerActor = actor != null ? actor == player : false;
|
||||
s.isPlayerActor = actor != null && actor == player;
|
||||
conversationHistory.add(s);
|
||||
statementList.clearFocus();
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
||||
@@ -74,7 +74,10 @@ public final class DisplayWorldMapActivity extends Activity {
|
||||
|
||||
WorldMapSegment segment = world.maps.worldMapSegments.get(worldMapSegmentName);
|
||||
WorldMapSegmentMap map = segment.maps.get(world.model.currentMap.name);
|
||||
if (map == null) this.finish();
|
||||
if (map == null) {
|
||||
this.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
String url = "file://" + worldmap.getAbsolutePath() + '?'
|
||||
+ (world.model.player.position.x + map.worldPosition.x) * WorldMapController.WORLDMAP_DISPLAY_TILESIZE
|
||||
|
||||
@@ -18,12 +18,12 @@ import java.util.Collections;
|
||||
|
||||
public final class ItemInfoActivity extends Activity {
|
||||
|
||||
public static int ITEMACTION_NONE = 1;
|
||||
public static int ITEMACTION_USE = 2;
|
||||
public static int ITEMACTION_EQUIP = 3;
|
||||
public static int ITEMACTION_UNEQUIP = 4;
|
||||
public static int ITEMACTION_BUY = 5;
|
||||
public static int ITEMACTION_SELL = 6;
|
||||
public static final int ITEMACTION_NONE = 1;
|
||||
public static final int ITEMACTION_USE = 2;
|
||||
public static final int ITEMACTION_EQUIP = 3;
|
||||
public static final int ITEMACTION_UNEQUIP = 4;
|
||||
public static final int ITEMACTION_BUY = 5;
|
||||
public static final int ITEMACTION_SELL = 6;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
@@ -64,11 +64,11 @@ public final class MainActivity extends Activity implements PlayerMovementListen
|
||||
|
||||
private ViewContext view;
|
||||
private WorldContext world;
|
||||
|
||||
public MainView mainview;
|
||||
public StatusView statusview;
|
||||
public CombatView combatview;
|
||||
public QuickitemView quickitemview;
|
||||
|
||||
private MainView mainview;
|
||||
private StatusView statusview;
|
||||
private CombatView combatview;
|
||||
private QuickitemView quickitemview;
|
||||
private DisplayActiveActorConditionIcons activeConditions;
|
||||
private ToolboxView toolboxview;
|
||||
private VirtualDpadView dpad;
|
||||
|
||||
@@ -99,9 +99,9 @@ public final class StartScreenActivity extends Activity {
|
||||
}
|
||||
});
|
||||
|
||||
TextView development_version = (TextView) findViewById(R.id.startscreen_dev_version);
|
||||
if (AndorsTrailApplication.DEVELOPMENT_INCOMPATIBLE_SAVEGAMES) {
|
||||
development_version.setVisibility(View.VISIBLE);
|
||||
TextView development_version = (TextView) findViewById(R.id.startscreen_dev_version);
|
||||
development_version.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
final Resources res = getResources();
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class ViewContext {
|
||||
public final SkillController skillController;
|
||||
|
||||
public final AndorsTrailPreferences preferences;
|
||||
public final WeakReference<AndorsTrailApplication> app;
|
||||
private final WeakReference<AndorsTrailApplication> app;
|
||||
|
||||
public ViewContext(AndorsTrailApplication app, WorldContext world) {
|
||||
this.app = new WeakReference<AndorsTrailApplication>(app);
|
||||
|
||||
@@ -25,8 +25,8 @@ public final class Constants {
|
||||
public static final int ATTACK_ANIMATION_FPS = 10;
|
||||
|
||||
public static final int TICK_DELAY = 500;
|
||||
public static final int ROUND_DURATION = 6000;
|
||||
public static final int FULLROUND_DURATION = 25000;
|
||||
private static final int ROUND_DURATION = 6000;
|
||||
private static final int FULLROUND_DURATION = 25000;
|
||||
public static final int TICKS_PER_ROUND = ROUND_DURATION / TICK_DELAY;
|
||||
public static final int TICKS_PER_FULLROUND = FULLROUND_DURATION / TICK_DELAY;
|
||||
public static final int SPLATTER_DURATION_MS = 20000;
|
||||
|
||||
@@ -108,7 +108,7 @@ public final class ConversationController {
|
||||
|
||||
public static String getDisplayMessage(Phrase phrase, Player player) { return replacePlayerName(phrase.message, player); }
|
||||
public static String getDisplayMessage(Reply reply, Player player) { return replacePlayerName(reply.text, player); }
|
||||
public static String replacePlayerName(String s, Player player) {
|
||||
private static String replacePlayerName(String s, Player player) {
|
||||
return s.replace(Constants.PLACEHOLDER_PLAYERNAME, player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public final class ItemController {
|
||||
SkillController.applySkillEffectsFromItemProficiencies(player);
|
||||
SkillController.applySkillEffectsFromFightingStyles(player);
|
||||
}
|
||||
public static ItemType getMainWeapon(Player player) {
|
||||
private static ItemType getMainWeapon(Player player) {
|
||||
ItemType itemType = player.inventory.wear[Inventory.WEARSLOT_WEAPON];
|
||||
if (itemType != null) return itemType;
|
||||
itemType = player.inventory.wear[Inventory.WEARSLOT_SHIELD];
|
||||
|
||||
@@ -81,7 +81,7 @@ public final class SkillController {
|
||||
}
|
||||
|
||||
|
||||
public static boolean canLevelupSkillWithQuest(Player player, SkillInfo skill) {
|
||||
private static boolean canLevelupSkillWithQuest(Player player, SkillInfo skill) {
|
||||
final int playerSkillLevel = player.getSkillLevel(skill.id);
|
||||
if (skill.hasMaxLevel()) {
|
||||
if (playerSkillLevel >= skill.maxLevel) return false;
|
||||
|
||||
@@ -36,8 +36,8 @@ import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
public final class WorldMapController {
|
||||
|
||||
public static int WORLDMAP_SCREENSHOT_TILESIZE = 8;
|
||||
public static int WORLDMAP_DISPLAY_TILESIZE = WORLDMAP_SCREENSHOT_TILESIZE;
|
||||
private static final int WORLDMAP_SCREENSHOT_TILESIZE = 8;
|
||||
public static final int WORLDMAP_DISPLAY_TILESIZE = WORLDMAP_SCREENSHOT_TILESIZE;
|
||||
|
||||
public static void updateWorldMap(final WorldContext world, final PredefinedMap map, final LayeredTileMap mapTiles, final TileCollection cachedTiles, final Resources res) {
|
||||
|
||||
@@ -148,11 +148,11 @@ public final class WorldMapController {
|
||||
File noMediaFile = new File(dir, ".nomedia");
|
||||
if (!noMediaFile.exists()) noMediaFile.createNewFile();
|
||||
}
|
||||
public static File getFileForMap(PredefinedMap map) { return getFileForMap(map.name); }
|
||||
public static File getFileForMap(String mapName) {
|
||||
private static File getFileForMap(PredefinedMap map) { return getFileForMap(map.name); }
|
||||
private static File getFileForMap(String mapName) {
|
||||
return new File(getWorldmapDirectory(), mapName + ".png");
|
||||
}
|
||||
public static File getWorldmapDirectory() {
|
||||
private static File getWorldmapDirectory() {
|
||||
File dir = Environment.getExternalStorageDirectory();
|
||||
dir = new File(dir, Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||
return new File(dir, Constants.FILENAME_WORLDMAP_DIRECTORY);
|
||||
@@ -165,7 +165,7 @@ public final class WorldMapController {
|
||||
File f = WorldMapController.getFileForMap(mapName);
|
||||
return f.exists();
|
||||
}
|
||||
private static String getWorldMapSegmentAsHtml(Resources res, WorldContext world, String segmentName) throws IOException {
|
||||
private static String getWorldMapSegmentAsHtml(Resources res, WorldContext world, String segmentName) {
|
||||
WorldMapSegment segment = world.maps.worldMapSegments.get(segmentName);
|
||||
|
||||
Collection<String> displayedMapNames = new HashSet<String>();
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.gpl.rpg.AndorsTrail.conversation;
|
||||
import com.gpl.rpg.AndorsTrail.model.quest.QuestProgress;
|
||||
|
||||
public final class Phrase {
|
||||
public static final Reply[] NO_REPLIES = new Reply[0];
|
||||
private static final Reply[] NO_REPLIES = new Reply[0];
|
||||
|
||||
public final String message;
|
||||
public final Reply[] replies;
|
||||
|
||||
@@ -12,10 +12,10 @@ import com.gpl.rpg.AndorsTrail.model.actor.MonsterType;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||
|
||||
public final class GameStatistics {
|
||||
public int deaths = 0;
|
||||
public final HashMap<String, Integer> killedMonsters = new HashMap<String, Integer>();
|
||||
public final HashMap<String, Integer> usedItems = new HashMap<String, Integer>();
|
||||
public int spentGold = 0;
|
||||
private int deaths = 0;
|
||||
private final HashMap<String, Integer> killedMonsters = new HashMap<String, Integer>();
|
||||
private final HashMap<String, Integer> usedItems = new HashMap<String, Integer>();
|
||||
private int spentGold = 0;
|
||||
|
||||
public GameStatistics() { }
|
||||
public void addMonsterKill(String monsterTypeID) {
|
||||
|
||||
@@ -69,10 +69,10 @@ public final class SkillCollection {
|
||||
public static final int CONCUSSION_THRESHOLD = 50;
|
||||
public static final int PER_SKILLPOINT_INCREASE_CONCUSSION_CHANCE = 15;
|
||||
|
||||
public static final int MAX_LEVEL_BARTER = (int) Math.floor((float) Constants.MARKET_PRICEFACTOR_PERCENT / PER_SKILLPOINT_INCREASE_BARTER_PRICEFACTOR_PERCENTAGE);
|
||||
public static final int MAX_LEVEL_BARKSKIN = 5;
|
||||
public static final int MAX_LEVEL_SPEED = 2;
|
||||
public static final int MAX_LEVEL_EVASION = Math.max(
|
||||
private static final int MAX_LEVEL_BARTER = (int) Math.floor((float) Constants.MARKET_PRICEFACTOR_PERCENT / PER_SKILLPOINT_INCREASE_BARTER_PRICEFACTOR_PERCENTAGE);
|
||||
private static final int MAX_LEVEL_BARKSKIN = 5;
|
||||
private static final int MAX_LEVEL_SPEED = 2;
|
||||
private static final int MAX_LEVEL_EVASION = Math.max(
|
||||
Constants.FLEE_FAIL_CHANCE_PERCENT / PER_SKILLPOINT_INCREASE_EVASION_FLEE_CHANCE_PERCENTAGE
|
||||
,Constants.MONSTER_AGGRESSION_CHANCE_PERCENT / PER_SKILLPOINT_INCREASE_EVASION_MONSTER_ATTACK_CHANCE_PERCENTAGE
|
||||
);
|
||||
|
||||
@@ -40,7 +40,6 @@ public final class Monster extends Actor {
|
||||
this.name = monsterType.name;
|
||||
this.ap.max = monsterType.maxAP;
|
||||
this.health.max = monsterType.maxHP;
|
||||
this.position.set(position);
|
||||
this.moveCost = monsterType.moveCost;
|
||||
this.attackCost = monsterType.attackCost;
|
||||
this.attackChance = monsterType.attackChance;
|
||||
@@ -105,7 +104,7 @@ public final class Monster extends Actor {
|
||||
return new Monster(src, world, fileversion, monsterType);
|
||||
}
|
||||
|
||||
public Monster(DataInputStream src, WorldContext world, int fileversion, MonsterType monsterType) throws IOException {
|
||||
private Monster(DataInputStream src, WorldContext world, int fileversion, MonsterType monsterType) throws IOException {
|
||||
this(monsterType);
|
||||
|
||||
boolean readCombatTraits = true;
|
||||
|
||||
@@ -190,7 +190,7 @@ public final class Player extends Actor {
|
||||
public boolean nextLevelAddsNewSkillpoint() {
|
||||
return thisLevelAddsNewSkillpoint(level + 1);
|
||||
}
|
||||
public static boolean thisLevelAddsNewSkillpoint(int level) {
|
||||
private static boolean thisLevelAddsNewSkillpoint(int level) {
|
||||
return ((level - Constants.FIRST_SKILL_POINT_IS_GIVEN_AT_LEVEL) % Constants.NEW_SKILL_POINT_EVERY_N_LEVELS == 0);
|
||||
}
|
||||
public boolean hasAvailableSkillpoints() {
|
||||
|
||||
@@ -10,7 +10,7 @@ public final class ItemCategory {
|
||||
public final String displayName;
|
||||
public final int inventorySlot;
|
||||
private final int actionType;
|
||||
public final int size;
|
||||
private final int size;
|
||||
|
||||
public ItemCategory(String id, String displayName, int actionType, int inventorySlot, int size) {
|
||||
this.id = id;
|
||||
|
||||
@@ -91,9 +91,8 @@ public final class ItemType {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int calculateCost() { return calculateCost(category, effects_equip, effects_use); }
|
||||
public static int calculateCost(ItemCategory category, ItemTraits_OnEquip effects_equip, ItemTraits_OnUse effects_use) {
|
||||
|
||||
private static int calculateCost(ItemCategory category, ItemTraits_OnEquip effects_equip, ItemTraits_OnUse effects_use) {
|
||||
final int costEquipStats = effects_equip == null ? 0 : effects_equip.calculateCost(category.isWeapon());
|
||||
final int costUse = effects_use == null ? 0 : effects_use.calculateCost();
|
||||
//final int costHit = effects_hit == null ? 0 : effects_hit.calculateCost();
|
||||
|
||||
@@ -25,8 +25,8 @@ public final class Loot {
|
||||
this.position = new Coord();
|
||||
this.isVisible = isVisible;
|
||||
}
|
||||
|
||||
public void add(Loot l) {
|
||||
|
||||
private void add(Loot l) {
|
||||
this.exp += l.exp;
|
||||
this.gold += l.gold;
|
||||
this.items.add(l.items);
|
||||
|
||||
@@ -17,14 +17,12 @@ public final class LayeredTileMap {
|
||||
private static final ColorFilter colorFilterBlack40 = createGrayScaleColorFilter(0.4f);
|
||||
private static final ColorFilter colorFilterBlack60 = createGrayScaleColorFilter(0.6f);
|
||||
private static final ColorFilter colorFilterBlack80 = createGrayScaleColorFilter(0.8f);
|
||||
|
||||
public final Size size;
|
||||
|
||||
public final MapLayer[] layers;
|
||||
public final Collection<Integer> usedTileIDs;
|
||||
public final String colorFilter;
|
||||
|
||||
public LayeredTileMap(Size size, MapLayer[] layers, Collection<Integer> usedTileIDs, String colorFilter) {
|
||||
this.size = size;
|
||||
assert(size.width > 0);
|
||||
assert(size.height > 0);
|
||||
assert(layers.length == 3);
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
public final class MapLayer {
|
||||
public final Size size;
|
||||
private final Size size;
|
||||
public final int[][] tiles;
|
||||
|
||||
public MapLayer(Size size) {
|
||||
|
||||
@@ -30,12 +30,12 @@ public final class PredefinedMap {
|
||||
public boolean visited = false;
|
||||
public long lastVisitTime = VISIT_RESET;
|
||||
public int lastVisitVersion = 0;
|
||||
public final boolean isOutdoors;
|
||||
private final boolean isOutdoors;
|
||||
|
||||
public final boolean[][] isWalkable;
|
||||
private final boolean[][] isWalkable;
|
||||
public final ArrayList<BloodSplatter> splatters = new ArrayList<BloodSplatter>();
|
||||
|
||||
public PredefinedMap(int xmlResourceId, String name, Size size, boolean[][] isWalkable, MapObject[] eventObjects, MonsterSpawnArea[] spawnAreas, boolean hasFOW, boolean isOutdoors) {
|
||||
public PredefinedMap(int xmlResourceId, String name, Size size, boolean[][] isWalkable, MapObject[] eventObjects, MonsterSpawnArea[] spawnAreas, boolean isOutdoors) {
|
||||
this.xmlResourceId = xmlResourceId;
|
||||
this.name = name;
|
||||
this.size = size;
|
||||
|
||||
@@ -211,7 +211,7 @@ public final class TMXMapFileParser {
|
||||
}
|
||||
}
|
||||
|
||||
private static TMXProperty readTMXProperty(XmlResourceParser xrp) throws XmlPullParserException, IOException {
|
||||
private static TMXProperty readTMXProperty(XmlResourceParser xrp) {
|
||||
final TMXProperty property = new TMXProperty();
|
||||
property.name = xrp.getAttributeValue(null, "name");
|
||||
property.value = xrp.getAttributeValue(null, "value");
|
||||
@@ -255,7 +255,7 @@ public final class TMXMapFileParser {
|
||||
public String orientation;
|
||||
public int tilewidth;
|
||||
public int tileheight;
|
||||
public ArrayList<TMXObjectGroup> objectGroups = new ArrayList<TMXObjectGroup>();
|
||||
public final ArrayList<TMXObjectGroup> objectGroups = new ArrayList<TMXObjectGroup>();
|
||||
}
|
||||
public static class TMXLayerMap {
|
||||
public int width;
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
import android.content.res.Resources;
|
||||
|
||||
public final class TMXMapTranslator {
|
||||
private ArrayList<TMXMap> maps = new ArrayList<TMXMap>();
|
||||
private final ArrayList<TMXMap> maps = new ArrayList<TMXMap>();
|
||||
|
||||
public void read(Resources r, int xmlResourceId, String name) {
|
||||
maps.add(TMXMapFileParser.read(r, xmlResourceId, name));
|
||||
@@ -123,16 +123,11 @@ public final class TMXMapTranslator {
|
||||
ArrayList<MonsterType> types = monsterTypes.getMonsterTypesFromSpawnGroup(object.name);
|
||||
int maxQuantity = 1;
|
||||
int spawnChance = 10;
|
||||
boolean isUnique = false;
|
||||
for (TMXProperty p : object.properties) {
|
||||
if (p.name.equalsIgnoreCase("quantity")) {
|
||||
maxQuantity = Integer.parseInt(p.value);
|
||||
} else if (p.name.equalsIgnoreCase("spawnchance")) {
|
||||
spawnChance = Integer.parseInt(p.value);
|
||||
} else if (p.name.equalsIgnoreCase("respawn")) {
|
||||
isUnique = !Boolean.parseBoolean(p.value);
|
||||
} else if (p.name.equalsIgnoreCase("unique")) {
|
||||
isUnique = Boolean.parseBoolean(p.value);
|
||||
} else if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
|
||||
L.log("OPTIMIZE: Map " + m.name + ", spawn " + object.name + " has unrecognized property \"" + p.name + "\".");
|
||||
}
|
||||
@@ -146,7 +141,7 @@ public final class TMXMapTranslator {
|
||||
}
|
||||
|
||||
String[] monsterTypeIDs = new String[types.size()];
|
||||
isUnique = types.get(0).isUnique;
|
||||
boolean isUnique = types.get(0).isUnique;
|
||||
for (int i = 0; i < monsterTypeIDs.length; ++i) {
|
||||
monsterTypeIDs[i] = types.get(i).id;
|
||||
}
|
||||
@@ -192,7 +187,7 @@ public final class TMXMapTranslator {
|
||||
MonsterSpawnArea[] _spawnAreas = new MonsterSpawnArea[spawnAreas.size()];
|
||||
_spawnAreas = spawnAreas.toArray(_spawnAreas);
|
||||
|
||||
result.add(new PredefinedMap(m.xmlResourceId, m.name, mapSize, isWalkable, _eventObjects, _spawnAreas, false, isOutdoors));
|
||||
result.add(new PredefinedMap(m.xmlResourceId, m.name, mapSize, isWalkable, _eventObjects, _spawnAreas, isOutdoors));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -213,7 +208,7 @@ public final class TMXMapTranslator {
|
||||
}
|
||||
HashSet<Integer> usedTileIDs = new HashSet<Integer>();
|
||||
for (TMXLayer layer : map.layers) {
|
||||
int ixMapLayer = -2;
|
||||
int ixMapLayer;
|
||||
String layerName = layer.name;
|
||||
assert(layerName != null);
|
||||
assert(layerName.length() > 0);
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.gpl.rpg.AndorsTrail.resource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
|
||||
public class ResourceFileTokenizer {
|
||||
private static final Pattern rowPattern = Pattern.compile("\\{(.+?)\\};", Pattern.MULTILINE | Pattern.DOTALL);
|
||||
private static final String columnSeparator = "\\|";
|
||||
private static final String fieldPattern = "([^\\|]*?|\\{\\s*\\{.*?\\}\\s*\\})" + columnSeparator;
|
||||
private static String repeat(String s, int count) {
|
||||
StringBuilder result = new StringBuilder(s);
|
||||
for(int i = 1; i < count; ++i) result.append(s);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
private final int columns;
|
||||
private final Pattern pattern;
|
||||
private final String[] parts;
|
||||
|
||||
public ResourceFileTokenizer(int columns) {
|
||||
this.columns = columns;
|
||||
this.pattern = Pattern.compile('^' + repeat(fieldPattern, columns) + '$', Pattern.MULTILINE | Pattern.DOTALL);
|
||||
this.parts = new String[columns];
|
||||
}
|
||||
|
||||
private <T> void tokenizeRows(String input, ArrayList<T> dest, ResourceObjectParser<T> parser) {
|
||||
Matcher rowMatcher = rowPattern.matcher(input);
|
||||
while (rowMatcher.find()) {
|
||||
tokenizeRow(rowMatcher.group(1), dest, parser);
|
||||
}
|
||||
}
|
||||
|
||||
public final <T> Collection<String> tokenizeRows(String input, HashMap<String, T> dest, ResourceObjectParser<Pair<String, T>> parser) {
|
||||
HashSet<String> ids = new HashSet<String>();
|
||||
ArrayList<Pair<String, T>> objects = new ArrayList<Pair<String, T>>();
|
||||
tokenizeRows(input, objects, parser);
|
||||
|
||||
for (Pair<String, T> o : objects) {
|
||||
final String id = o.first;
|
||||
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
|
||||
if (id == null || id.length() <= 0) {
|
||||
L.log("WARNING: Entity " + o.second.toString() + " has empty id.");
|
||||
} else if (dest.containsKey(id)) {
|
||||
L.log("WARNING: Entity " + id + " is duplicated.");
|
||||
}
|
||||
}
|
||||
dest.put(id, o.second);
|
||||
ids.add(id);
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
private <T> void tokenizeRow(String input, ArrayList<T> dest, ResourceObjectParser<T> parser) {
|
||||
Matcher groups = pattern.matcher(input);
|
||||
if (!groups.find()) return;
|
||||
if (groups.groupCount() < columns) return;
|
||||
for(int i = 0; i < columns; ++i) {
|
||||
parts[i] = groups.group(i + 1);
|
||||
}
|
||||
T obj = parser.parseRow(parts);
|
||||
if (obj != null) dest.add(obj);
|
||||
}
|
||||
|
||||
|
||||
private static final Pattern outerPattern = Pattern.compile("^\\{(.*)\\}$", Pattern.MULTILINE | Pattern.DOTALL);
|
||||
private static final Pattern innerPattern = Pattern.compile("\\{(.*?)\\}", Pattern.MULTILINE | Pattern.DOTALL);
|
||||
|
||||
public final <T> void tokenizeArray(String input, ArrayList<T> dest, ResourceObjectParser<T> parser) {
|
||||
Matcher matcher = outerPattern.matcher(input);
|
||||
if (!matcher.find()) return;
|
||||
|
||||
matcher = innerPattern.matcher(matcher.group(1));
|
||||
while (matcher.find()) {
|
||||
tokenizeRow(matcher.group(1), dest, parser);
|
||||
}
|
||||
}
|
||||
|
||||
public static interface ResourceObjectParser<T> {
|
||||
T parseRow(String[] parts);
|
||||
}
|
||||
|
||||
public abstract static class ResourceParserFor<T> extends ResourceFileTokenizer implements ResourceObjectParser<Pair<String, T>> {
|
||||
protected ResourceParserFor(int columns) {
|
||||
super(columns);
|
||||
}
|
||||
|
||||
public Collection<String> parseRows(String input, HashMap<String, T> dest) {
|
||||
return tokenizeRows(input, dest, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public final class ResourceLoader {
|
||||
InputStream is = r.openRawResource(resourceID);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
StringBuilder sb = new StringBuilder(1000);
|
||||
String line = "";
|
||||
String line;
|
||||
try {
|
||||
while((line = br.readLine()) != null) sb.append(line);
|
||||
br.close();
|
||||
|
||||
@@ -54,9 +54,8 @@ public final class TileManager {
|
||||
public static final int iconID_splatter_brown_2b = 17;
|
||||
public static final int iconID_splatter_white_1a = 18;
|
||||
public static final int iconID_splatter_white_1b = 19;
|
||||
|
||||
private float density;
|
||||
public int tileSize;
|
||||
|
||||
public int tileSize;
|
||||
|
||||
public int viewTileSize;
|
||||
public float scale;
|
||||
@@ -114,7 +113,7 @@ public final class TileManager {
|
||||
}
|
||||
|
||||
public void setDensity(Resources r) {
|
||||
density = r.getDisplayMetrics().density;
|
||||
float density = r.getDisplayMetrics().density;
|
||||
tileSize = (int) (32 * density);
|
||||
}
|
||||
|
||||
@@ -197,7 +196,7 @@ public final class TileManager {
|
||||
tileCache.loadTilesFor(preloadedTileIDs, r, preloadedTiles);
|
||||
}
|
||||
|
||||
private HashMap<String, HashSet<Integer>> tileIDsPerMap = new HashMap<String, HashSet<Integer>>();
|
||||
private final HashMap<String, HashSet<Integer>> tileIDsPerMap = new HashMap<String, HashSet<Integer>>();
|
||||
private void addTileIDsFor(HashSet<Integer> dest, String mapName, final Resources res, final WorldContext world) {
|
||||
HashSet<Integer> cachedTileIDs = tileIDsPerMap.get(mapName);
|
||||
if (cachedTileIDs == null) {
|
||||
|
||||
@@ -19,6 +19,9 @@ public final class Range {
|
||||
public boolean equals(Range r) {
|
||||
return max == r.max && current == r.current;
|
||||
}
|
||||
public boolean equals(ConstRange r) {
|
||||
return max == r.max && current == r.current;
|
||||
}
|
||||
|
||||
public void set(Range r) {
|
||||
this.max = r.max;
|
||||
|
||||
@@ -56,8 +56,8 @@ public final class ActorConditionEffectList extends LinearLayout {
|
||||
this.addView(tv, layoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
public static String describeEffect(Resources res, ActorConditionEffect effect) {
|
||||
|
||||
private static String describeEffect(Resources res, ActorConditionEffect effect) {
|
||||
String msg = describeEffect(res, effect.conditionType, effect.magnitude, effect.duration);
|
||||
if (effect.chance.isMax()) return msg;
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public final class MainView extends SurfaceView
|
||||
|
||||
private final int tileSize;
|
||||
private float scale;
|
||||
public int scaledTileSize;
|
||||
private int scaledTileSize;
|
||||
|
||||
private Size screenSizeTileCount = null;
|
||||
private final Coord screenOffset = new Coord(); // pixel offset where the image begins
|
||||
|
||||
@@ -73,7 +73,7 @@ public final class SkillListAdapter extends ArrayAdapter<SkillInfo> {
|
||||
title.setText(skillTitle);
|
||||
description.setText(getSkillShortDescriptionResourceID(skillID));
|
||||
|
||||
boolean enabled = true;
|
||||
boolean enabled;
|
||||
if (player.hasAvailableSkillpoints()) {
|
||||
enabled = SkillController.canLevelupSkillManually(player, skill);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user