From 5cd8d1be90387f82fd2a7f4b9348a61e94d13572 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 9 Aug 2016 17:15:54 -0400 Subject: [PATCH] v0.4.1a: increased the number of situations where exceptions are reported --- .../shatteredpixeldungeon/Badges.java | 4 +++- .../shatteredpixeldungeon/Bones.java | 4 +++- .../shatteredpixeldungeon/Dungeon.java | 3 ++- .../shatteredpixeldungeon/GamesInProgress.java | 1 + .../shatteredpixeldungeon/Preferences.java | 3 +++ .../shatteredpixeldungeon/Rankings.java | 3 ++- .../actors/blobs/WaterOfTransmutation.java | 14 ++------------ .../shatteredpixeldungeon/actors/buffs/Buff.java | 2 ++ .../actors/mobs/Bestiary.java | 3 +++ .../shatteredpixeldungeon/actors/mobs/Mob.java | 2 ++ .../actors/mobs/npcs/Ghost.java | 2 ++ .../shatteredpixeldungeon/items/Amulet.java | 2 ++ .../shatteredpixeldungeon/items/Generator.java | 6 ++++++ .../shatteredpixeldungeon/items/Heap.java | 2 ++ .../shatteredpixeldungeon/items/Item.java | 3 +++ .../shatteredpixeldungeon/items/armor/Armor.java | 3 +++ .../items/armor/curses/Multiplicity.java | 2 ++ .../items/food/Blandfruit.java | 2 ++ .../items/wands/CursedWand.java | 6 ++---- .../shatteredpixeldungeon/items/weapon/Weapon.java | 3 +++ .../items/weapon/enchantments/Unstable.java | 2 ++ .../shatteredpixeldungeon/levels/Room.java | 1 + .../levels/painters/MagicWellPainter.java | 4 +++- .../levels/painters/TrapsPainter.java | 3 ++- .../mechanics/Ballistica.java | 2 ++ .../shatteredpixeldungeon/messages/Messages.java | 4 +++- .../shatteredpixeldungeon/plants/Plant.java | 2 ++ .../shatteredpixeldungeon/scenes/GameScene.java | 2 +- .../shatteredpixeldungeon/ui/AttackIndicator.java | 2 ++ .../shatteredpixeldungeon/ui/CustomTileVisual.java | 2 +- .../shatteredpixeldungeon/windows/WndCatalogs.java | 3 ++- .../shatteredpixeldungeon/windows/WndGame.java | 2 +- 32 files changed, 72 insertions(+), 27 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Badges.java b/src/com/shatteredpixel/shatteredpixeldungeon/Badges.java index 8b6bd3cc0..ccac8398b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Badges.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Badges.java @@ -196,6 +196,7 @@ public class Badges { try { badges.add( Badge.valueOf( names[i] ) ); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); } } @@ -230,6 +231,7 @@ public class Badges { global = restore( bundle ); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); global = new HashSet(); } } @@ -247,7 +249,7 @@ public class Badges { output.close(); saveNeeded = false; } catch (IOException e) { - + ShatteredPixelDungeon.reportException(e); } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java b/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java index e646979b6..7608e6651 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Bones.java @@ -67,7 +67,7 @@ public class Bones { Bundle.write( bundle, output ); output.close(); } catch (IOException e) { - + ShatteredPixelDungeon.reportException(e); } } @@ -139,6 +139,7 @@ public class Bones { return get(); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } @@ -162,6 +163,7 @@ public class Bones { return artifact; } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return new Gold(item.price()); } } else { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index da0fdab64..5d1eac3d6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -311,6 +311,7 @@ public class Dungeon { try { saveAll(); } catch (IOException e) { + ShatteredPixelDungeon.reportException(e); /*This only catches IO errors. Yes, this means things can go wrong, and they can go wrong catastrophically. But when they do the user will get a nice 'report this issue' dialogue, and I can fix the bug.*/ } @@ -472,8 +473,8 @@ public class Dungeon { output.close(); } catch (IOException e) { - GamesInProgress.setUnknown( hero.heroClass ); + ShatteredPixelDungeon.reportException(e); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java b/src/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java index edd892fdd..8763bec69 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java @@ -45,6 +45,7 @@ public class GamesInProgress { Dungeon.preview( info, bundle ); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); info = null; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java b/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java index 21b17fe63..deaa64fc2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Preferences.java @@ -60,6 +60,7 @@ enum Preferences { try { return get().getInt( key, defValue ); } catch (ClassCastException e) { + ShatteredPixelDungeon.reportException(e); return defValue; } } @@ -68,6 +69,7 @@ enum Preferences { try { return get().getBoolean(key, defValue); } catch (ClassCastException e) { + ShatteredPixelDungeon.reportException(e); return defValue; } } @@ -76,6 +78,7 @@ enum Preferences { try { return get().getString( key, defValue ); } catch (ClassCastException e) { + ShatteredPixelDungeon.reportException(e); return defValue; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java b/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java index a9a4888c2..6ae1cfa0a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/Rankings.java @@ -208,6 +208,7 @@ public enum Rankings { Bundle.write( bundle, output ); output.close(); } catch (IOException e) { + ShatteredPixelDungeon.reportException(e); } } @@ -244,7 +245,7 @@ public enum Rankings { } } catch (IOException e) { - + ShatteredPixelDungeon.reportException(e); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java index 52a91e60b..bd913e29b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/WaterOfTransmutation.java @@ -20,9 +20,9 @@ */ package com.shatteredpixel.shatteredpixeldungeon.actors.blobs; -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Journal; import com.shatteredpixel.shatteredpixeldungeon.Journal.Feature; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; @@ -38,19 +38,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInf import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.BattleAxe; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Dagger; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Glaive; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Knuckles; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Longsword; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Mace; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Quarterstaff; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Spear; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Sword; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WarHammer; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.watabou.utils.Random; @@ -120,6 +109,7 @@ public class WaterOfTransmutation extends WellWater { try { n = (Weapon)c.classes[Random.chances(c.probs)].newInstance(); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } while (!(n instanceof MeleeWeapon) || n.getClass() == w.getClass()); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java index a6318da69..21bdaa0bb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Buff.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; @@ -99,6 +100,7 @@ public class Buff extends Actor { buff.attachTo( target ); return buff; } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java index 74d914f31..d70dfc90e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bestiary.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.watabou.utils.Random; public class Bestiary { @@ -30,6 +31,7 @@ public class Bestiary { try { return cl.newInstance(); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } @@ -55,6 +57,7 @@ public class Bestiary { try { return cl.newInstance(); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 462b89f95..088df1439 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Challenges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; @@ -143,6 +144,7 @@ public abstract class Mob extends Char { try { sprite = spriteClass.newInstance(); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); } return sprite; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java index 72921f43a..786ec92a5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java @@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Journal; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; @@ -297,6 +298,7 @@ public class Ghost extends NPC { weapon = (Weapon) Generator.wepTiers[wepTier - 1].classes[Random.chances(Generator.wepTiers[wepTier - 1].probs)].newInstance(); } while (!(weapon instanceof MeleeWeapon)); } catch (Exception e){ + ShatteredPixelDungeon.reportException(e); weapon = new NewShortsword(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java index 7cbc0a593..172e16500 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Amulet.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -91,6 +92,7 @@ public class Amulet extends Item { AmuletScene.noText = !showText; Game.switchScene( AmuletScene.class ); } catch (IOException e) { + ShatteredPixelDungeon.reportException(e); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java index 6c9c59a53..d875978cc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Ghost; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor; @@ -405,6 +406,7 @@ public class Generator { } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } @@ -417,6 +419,7 @@ public class Generator { } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } @@ -435,6 +438,7 @@ public class Generator { a.random(); return a; } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } @@ -461,6 +465,7 @@ public class Generator { w.random(); return w; } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } @@ -488,6 +493,7 @@ public class Generator { return artifact; } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index c324385a0..52e3ee990 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; @@ -418,6 +419,7 @@ public class Heap implements Bundlable { try { potion = itemClass.newInstance(); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index 49d207706..913ab262d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Combo; @@ -236,6 +237,7 @@ public class Item implements Bundlable { detached.onDetach( ); return detached; } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } @@ -404,6 +406,7 @@ public class Item implements Bundlable { return item; } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index b5ad3f713..965094a2b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.armor; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -490,6 +491,7 @@ public class Armor extends EquipableItem { try { return ((Class)glyphs[ Random.chances( chances ) ]).newInstance(); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } @@ -499,6 +501,7 @@ public class Armor extends EquipableItem { try { return ((Class)Random.oneOf(curses)).newInstance(); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Multiplicity.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Multiplicity.java index 85bde39c1..fd3c35f4b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Multiplicity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/curses/Multiplicity.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.armor.curses; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; @@ -72,6 +73,7 @@ public class Multiplicity extends Armor.Glyph { m.restoreFromBundle(store); m.HP = m.HT; } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); m = null; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java index a364e3931..3e24fecb8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/food/Blandfruit.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.food; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.EarthImbue; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FireImbue; @@ -125,6 +126,7 @@ public class Blandfruit extends Food { try { return imbuePotion((Potion)seed.alchemyClass.newInstance()); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java index 65388d71f..11ad72e5b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.wands; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; @@ -45,12 +46,8 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShadowParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Bomb; -import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Item; -import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; -import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc; -import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; @@ -419,6 +416,7 @@ public class CursedWand { ); } } catch(IOException e){ + ShatteredPixelDungeon.reportException(e); //oookay maybe don't kill the game if the save failed. GLog.i(Messages.get(CursedWand.class, "nothing")); wand.wandUsed(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 7de8770d6..4cd14c9c5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon; import com.shatteredpixel.shatteredpixeldungeon.Badges; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; @@ -319,6 +320,7 @@ abstract public class Weapon extends KindOfWeapon { try { return ((Class)enchants[ Random.chances( chances ) ]).newInstance(); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } @@ -328,6 +330,7 @@ abstract public class Weapon extends KindOfWeapon { try { return ((Class)Random.oneOf(curses)).newInstance(); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Unstable.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Unstable.java index c065171b7..acd8304ce 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Unstable.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Unstable.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; @@ -47,6 +48,7 @@ public class Unstable extends Weapon.Enchantment { try { return Random.oneOf(randomEnchants).newInstance().proc( weapon, attacker, defender, damage ); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return damage; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java index 908507797..f85ae0980 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Room.java @@ -109,6 +109,7 @@ public class Room extends Rect implements Graph.Node, Bundlable { try { paint = painter.getMethod( "paint", Level.class, Room.class ); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); paint = null; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MagicWellPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MagicWellPainter.java index 707292e8f..2e629bd10 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MagicWellPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MagicWellPainter.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.painters; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WaterOfAwareness; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WaterOfHealth; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WaterOfTransmutation; @@ -59,7 +60,8 @@ public class MagicWellPainter extends Painter { try { water = waterClass.newInstance(); } catch (Exception e) { - water = null; + ShatteredPixelDungeon.reportException(e); + return; } } water.seed( c.x + Level.WIDTH * c.y, 1 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java index 8ed4c82f5..54b14d37c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/TrapsPainter.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.painters; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; @@ -99,7 +100,7 @@ public class TrapsPainter extends Painter { try { level.setTrap(((Trap) trapClass.newInstance()).reveal(), cell); } catch (Exception e) { - e.printStackTrace(); + ShatteredPixelDungeon.reportException(e); } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/mechanics/Ballistica.java b/src/com/shatteredpixel/shatteredpixeldungeon/mechanics/Ballistica.java index 65f136baa..0dbde3b20 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/mechanics/Ballistica.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/mechanics/Ballistica.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.mechanics; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; @@ -135,6 +136,7 @@ public class Ballistica { end = Math.min( end, path.size()-1); return path.subList(start, end+1); } catch (Exception e){ + ShatteredPixelDungeon.reportException(e); return new ArrayList<>(); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java b/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java index 7db69e9cf..02579023a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/messages/Messages.java @@ -89,7 +89,9 @@ public class Messages { if (android.os.Build.VERSION.SDK_INT == 8) { try { value = new String(value.getBytes("ISO-8859-1"), "UTF-8"); - } catch (Exception e) {} + } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); + } } strings.put(key, value); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java index f3855fb8d..5d7b51d36 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.plants; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin; @@ -173,6 +174,7 @@ public abstract class Plant implements Bundlable { plant.pos = pos; return plant; } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); return null; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 23cf1fcb1..49fb5a44c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -396,7 +396,7 @@ public class GameScene extends PixelScene { Dungeon.saveAll(); Badges.saveGlobal(); } catch (IOException e) { - // + ShatteredPixelDungeon.reportException(e); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java index d6785ff99..dcbda54ac 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java @@ -21,6 +21,7 @@ package com.shatteredpixel.shatteredpixeldungeon.ui; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; @@ -144,6 +145,7 @@ public class AttackIndicator extends Tag { PixelScene.align(sprite); } catch (Exception e) { + ShatteredPixelDungeon.reportException(e); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/CustomTileVisual.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/CustomTileVisual.java index 582bb6f95..848ae0fe2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/CustomTileVisual.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/CustomTileVisual.java @@ -86,7 +86,7 @@ public abstract class CustomTileVisual extends Image implements Bundlable { result.add(vis); } } - } catch (InstantiationException | IllegalAccessException e) { + } catch (Exception e) { throw new RuntimeException("Something went wrong while making a bunch of tile visuals for a room!", e); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogs.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogs.java index 5ec30ff17..a3cb9b483 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogs.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogs.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; +import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; @@ -170,7 +171,7 @@ public class WndCatalogs extends WndTabbed { label.hardlight( 0xCCCCCC ); } } catch (Exception e) { - // Do nothing + ShatteredPixelDungeon.reportException(e); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java index 85f485be6..a9e500eba 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndGame.java @@ -98,7 +98,7 @@ public class WndGame extends Window { try { Dungeon.saveAll(); } catch (IOException e) { - // Do nothing + ShatteredPixelDungeon.reportException(e); } Game.switchScene(TitleScene.class); }