Minor bugfixes to resource loaders

* Fail harder when TileManager hasn't allocated enough tiles for the preloaded icons.
* Minor tweak to misplaced tile on hauntedhouse3
* Weaken "strength" condition (prefer to control effect through magnitude instead)
* Load icons for "items_weapons_2".
* Do not require items to have "base market cost" (for example, when they are automatically priced)
This commit is contained in:
Oskar Wiksten
2013-03-29 20:03:33 +01:00
parent 84d01e1aed
commit c8de0c8f77
9 changed files with 59 additions and 50 deletions

View File

@@ -30,8 +30,8 @@
"isPositive": 1,
"abilityEffect": {
"increaseAttackDamage": {
"min": 2,
"max": 2
"min": 1,
"max": 1
}
}
},

View File

@@ -1,129 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map SYSTEM "http://mapeditor.org/dtd/1.0/map.dtd">
<map version="1.0" orientation="orthogonal" width="25" height="20" tilewidth="32" tileheight="32">
<tileset firstgid="1" name="map_bed_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_bed_1.png"/>
<image source="../drawable/map_bed_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="129" name="map_border_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_border_1.png"/>
<image source="../drawable/map_border_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="257" name="map_bridge_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_bridge_1.png"/>
<image source="../drawable/map_bridge_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="385" name="map_broken_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_broken_1.png"/>
<image source="../drawable/map_broken_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="513" name="map_cavewall_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_cavewall_1.png"/>
<image source="../drawable/map_cavewall_1.png" width="576" height="192"/>
</tileset>
<tileset firstgid="621" name="map_cavewall_2" tilewidth="32" tileheight="32">
<image source="../drawable/map_cavewall_2.png"/>
<image source="../drawable/map_cavewall_2.png" width="576" height="192"/>
</tileset>
<tileset firstgid="729" name="map_cavewall_3" tilewidth="32" tileheight="32">
<image source="../drawable/map_cavewall_3.png"/>
<image source="../drawable/map_cavewall_3.png" width="576" height="192"/>
</tileset>
<tileset firstgid="837" name="map_chair_table_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_chair_table_1.png"/>
<image source="../drawable/map_chair_table_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="965" name="map_crate_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_crate_1.png"/>
<image source="../drawable/map_crate_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="1093" name="map_cupboard_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_cupboard_1.png"/>
<image source="../drawable/map_cupboard_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="1221" name="map_curtain_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_curtain_1.png"/>
<image source="../drawable/map_curtain_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="1349" name="map_entrance_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_entrance_1.png"/>
<image source="../drawable/map_entrance_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="1477" name="map_fence_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_fence_1.png"/>
<image source="../drawable/map_fence_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="1605" name="map_fence_2" tilewidth="32" tileheight="32">
<image source="../drawable/map_fence_2.png"/>
<image source="../drawable/map_fence_2.png" width="512" height="256"/>
</tileset>
<tileset firstgid="1733" name="map_ground_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_ground_1.png"/>
<image source="../drawable/map_ground_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="1861" name="map_ground_2" tilewidth="32" tileheight="32">
<image source="../drawable/map_ground_2.png"/>
<image source="../drawable/map_ground_2.png" width="512" height="256"/>
</tileset>
<tileset firstgid="1989" name="map_ground_3" tilewidth="32" tileheight="32">
<image source="../drawable/map_ground_3.png"/>
<image source="../drawable/map_ground_3.png" width="512" height="256"/>
</tileset>
<tileset firstgid="2117" name="map_ground_4" tilewidth="32" tileheight="32">
<image source="../drawable/map_ground_4.png"/>
<image source="../drawable/map_ground_4.png" width="512" height="256"/>
</tileset>
<tileset firstgid="2245" name="map_ground_5" tilewidth="32" tileheight="32">
<image source="../drawable/map_ground_5.png"/>
<image source="../drawable/map_ground_5.png" width="512" height="256"/>
</tileset>
<tileset firstgid="2373" name="map_ground_6" tilewidth="32" tileheight="32">
<image source="../drawable/map_ground_6.png"/>
<image source="../drawable/map_ground_6.png" width="512" height="256"/>
</tileset>
<tileset firstgid="2501" name="map_ground_7" tilewidth="32" tileheight="32">
<image source="../drawable/map_ground_7.png"/>
<image source="../drawable/map_ground_7.png" width="512" height="256"/>
</tileset>
<tileset firstgid="2629" name="map_ground_8" tilewidth="32" tileheight="32">
<image source="../drawable/map_ground_8.png"/>
<image source="../drawable/map_ground_8.png" width="512" height="256"/>
</tileset>
<tileset firstgid="2757" name="map_indoor_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_indoor_1.png"/>
<image source="../drawable/map_indoor_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="2885" name="map_kitchen_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_kitchen_1.png"/>
<image source="../drawable/map_kitchen_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="3013" name="map_outdoor_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_outdoor_1.png"/>
<image source="../drawable/map_outdoor_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="3141" name="map_pillar_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_pillar_1.png"/>
<image source="../drawable/map_pillar_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="3269" name="map_plant_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_plant_1.png"/>
<image source="../drawable/map_plant_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="3397" name="map_rock_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_rock_1.png"/>
<image source="../drawable/map_rock_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="3525" name="map_roof_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_roof_1.png"/>
<image source="../drawable/map_roof_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="3653" name="map_roof_2" tilewidth="32" tileheight="32">
<image source="../drawable/map_roof_2.png"/>
<image source="../drawable/map_roof_2.png" width="512" height="256"/>
</tileset>
<tileset firstgid="3781" name="map_shop_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_shop_1.png"/>
<image source="../drawable/map_shop_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="3909" name="map_sign_ladder_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_sign_ladder_1.png"/>
<image source="../drawable/map_sign_ladder_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="4037" name="map_table_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_table_1.png"/>
<image source="../drawable/map_table_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="4165" name="map_trail_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_trail_1.png"/>
<image source="../drawable/map_trail_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="4293" name="map_tree_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_tree_1.png"/>
<image source="../drawable/map_tree_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="4421" name="map_wall_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_wall_1.png"/>
<image source="../drawable/map_wall_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="4549" name="map_wall_2" tilewidth="32" tileheight="32">
<image source="../drawable/map_wall_2.png"/>
<image source="../drawable/map_wall_2.png" width="480" height="256"/>
</tileset>
<tileset firstgid="4669" name="map_wall_3" tilewidth="32" tileheight="32">
<image source="../drawable/map_wall_3.png"/>
<image source="../drawable/map_wall_3.png" width="480" height="256"/>
</tileset>
<tileset firstgid="4789" name="map_window_1" tilewidth="32" tileheight="32">
<image source="../drawable/map_window_1.png"/>
<image source="../drawable/map_window_1.png" width="512" height="256"/>
</tileset>
<tileset firstgid="4917" name="map_window_2" tilewidth="32" tileheight="32">
<image source="../drawable/map_window_2.png"/>
<image source="../drawable/map_window_2.png" width="512" height="256"/>
</tileset>
<layer name="Ground" width="25" height="20">
<data encoding="base64" compression="zlib">
eJydVcENgzAMjIrUKbICdISEESgrdFhG6Qh9tohYOlk+2+rjxINzzj4fod9K6QNLAt1AVPMEtKB2VXzBHGi8Bt5TKZuhKbzHDzvwEZYG9nncL3ym64m1G9SvwNXQGjjv7NRhvczAON68ol8BWHv6JxpeHziv5rJdoX8ZDTwrq4HeWxrWWS2p0cf5u6PB+kW/mIZkQe9Wa7B+mT5qSBZYrnS/nob2Osq+9d7yhOU8yv5C3rOdsJ1bM1f1TWU88XLFMog5y3hy7qkRX1FD7kXhWjnz5t8SuZR7UbhWzjwNb6cZ7j91+G1kz8YsZOr0HVUDsH9chv8FpO/wcw==
eJydVdsJwzAQMw10Cq+QdAQ7I6RZocNmlI7QzzbEB+I43R39EIVGsu6hOP1WSh9YEugGIs0T0ALtqviCOfB4DbynUjbDU3iPH3bgIywPrPO4X/hM1y9qN9CvwNXQHtjv7OhQLz0wjtev+FcAas/5iYdXB/aruWxXOL+MB56V9cDZWx7WWS3p0cf5u+PB6sV5MQ/Jgt6t9mD1Mn/8T7LAcqXr9Tz0rKPsW8+tmbCcR9lfyHO2E7Zzq+eq3qnMTLxcsQxizjIzOffUyFzRQ+5F4Vo58/rfErmUe1G4Vs48D2+nGe4/Onz/smdjFjI6fUfVAOwbl+F/AajT8HQ=
</data>
</layer>
<layer name="Objects" width="25" height="20">

View File

@@ -15,7 +15,10 @@ public final class ConversationCollection {
public static final String REPLY_NEXT = "N";
private final HashMap<String, Phrase> phrases = new HashMap<String, Phrase>();
public boolean hasPhrase(String id) {
return phrases.containsKey(id);
}
public Phrase getPhrase(String id) {
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
if (!phrases.containsKey(id)) {

View File

@@ -16,8 +16,9 @@ public final class ConversationLoader {
}
public Phrase loadPhrase(String phraseID, ConversationCollection conversationCollection, Resources r) {
Phrase phrase = conversationCollection.getPhrase(phraseID);
if (phrase != null) return phrase;
if (conversationCollection.hasPhrase(phraseID)) {
return conversationCollection.getPhrase(phraseID);
}
ConversationListParser conversationListParser = new ConversationListParser();
int resourceID = resourceIDsPerPhraseID.get(phraseID);

View File

@@ -15,6 +15,7 @@ public final class ItemTypeCollection {
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
if (!itemTypes.containsKey(id)) {
L.log("WARNING: Cannot find ItemType for id \"" + id + "\".");
return null;
}
}
return itemTypes.get(id);

View File

@@ -245,6 +245,7 @@ public final class ResourceLoader {
loader.prepareTileset(R.drawable.items_tometik2, "items_tometik2", new Size(10, 10), defaultTileSize);
loader.prepareTileset(R.drawable.items_tometik3, "items_tometik3", new Size(8, 6), defaultTileSize);
loader.prepareTileset(R.drawable.items_necklaces_1, "items_necklaces_1", new Size(10, 3), defaultTileSize);
loader.prepareTileset(R.drawable.items_weapons_2, "items_weapons_2", new Size(7, 1), defaultTileSize);
loader.prepareTileset(R.drawable.items_weapons_3, "items_weapons_3", new Size(13, 5), defaultTileSize);
loader.prepareTileset(R.drawable.items_armours_2, "items_armours_2", src_sz7x1, defaultTileSize);
loader.prepareTileset(R.drawable.items_armours_3, "items_armours_3", new Size(10, 4), defaultTileSize);

View File

@@ -33,7 +33,7 @@ public final class ItemTypeParser extends JsonCollectionParserFor<ItemType> {
final ItemTraits_OnUse hitEffect = itemTraitsParser.parseItemTraits_OnUse(o.optJSONObject(JsonFieldNames.ItemType.hitEffect));
final ItemTraits_OnUse killEffect = itemTraitsParser.parseItemTraits_OnUse(o.optJSONObject(JsonFieldNames.ItemType.killEffect));
final int baseMarketCost = o.getInt(JsonFieldNames.ItemType.baseMarketCost);
final int baseMarketCost = o.optInt(JsonFieldNames.ItemType.baseMarketCost);
final boolean hasManualPrice = o.optInt(JsonFieldNames.ItemType.hasManualPrice, 0) > 0;
final ItemType itemType = new ItemType(
id

View File

@@ -39,7 +39,10 @@ public final class ResourceParserUtils {
public static ConstRange parseConstRange(JSONObject o) throws JSONException {
if (o == null) return null;
return new ConstRange(o.getInt(JsonFieldNames.Range.max), o.getInt(JsonFieldNames.Range.min));
return new ConstRange(
o.getInt(JsonFieldNames.Range.max),
o.optInt(JsonFieldNames.Range.min)
);
}
public static final ConstRange always = one;

View File

@@ -62,7 +62,7 @@ public final class TileManager {
public final TileCache tileCache = new TileCache();
public final TileCollection preloadedTiles = new TileCollection(87);
public final TileCollection preloadedTiles = new TileCollection(94);
public TileCollection currentMapTiles;
public TileCollection adjacentMapTiles;
private final HashSet<Integer> preloadedTileIDs = new HashSet<Integer>();
@@ -188,6 +188,7 @@ public final class TileManager {
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
if (maxTileID > preloadedTiles.maxTileID) {
L.log("ERROR: TileManager.preloadedTiles needs to be initialized with at least " + maxTileID + " slots. Application will crash now.");
throw new IndexOutOfBoundsException("ERROR: TileManager.preloadedTiles needs to be initialized with at least " + maxTileID + " slots. Application will crash now.");
}
}
for(int i = TileManager.CHAR_HERO; i <= maxTileID; ++i) {