ucsb-cs56-projects / cs56-games-roguelike

-
5 stars 13 forks source link

ArrayIndexOutOfBounds occurring randomly #16

Closed rick-lee closed 8 years ago

rick-lee commented 10 years ago

If you play the game, you'll have a chance to get this after moving the player:

[ricklee@mcl-1 cs56-games-roguelike]$ ant run
Buildfile: /cs/student/ricklee/cs56/cs56-games-roguelike/build.xml

compile:
    [javac] Compiling 1 source file to /cs/student/ricklee/cs56/cs56-games-roguelike/build

run:
     [java] Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
     [java]     at edu.ucsb.cs56.projects.games.roguelike.LogicEngine.attack(LogicEngine.java:174)
     [java]     at edu.ucsb.cs56.projects.games.roguelike.RogueController.moveMonster(RogueController.java:117)
     [java]     at edu.ucsb.cs56.projects.games.roguelike.RogueController.keyPressed(RogueController.java:302)
     [java]     at java.awt.Component.processKeyEvent(Component.java:6463)
     [java]     at java.awt.Component.processEvent(Component.java:6282)
     [java]     at java.awt.Container.processEvent(Container.java:2229)
     [java]     at java.awt.Window.processEvent(Window.java:2022)
     [java]     at java.awt.Component.dispatchEventImpl(Component.java:4861)
     [java]     at java.awt.Container.dispatchEventImpl(Container.java:2287)
     [java]     at java.awt.Window.dispatchEventImpl(Window.java:2719)
     [java]     at java.awt.Component.dispatchEvent(Component.java:4687)
     [java]     at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895)
     [java]     at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762)
     [java]     at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027)
     [java]     at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:899)
     [java]     at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:727)
     [java]     at java.awt.Component.dispatchEventImpl(Component.java:4731)
     [java]     at java.awt.Container.dispatchEventImpl(Container.java:2287)
     [java]     at java.awt.Window.dispatchEventImpl(Window.java:2719)
     [java]     at java.awt.Component.dispatchEvent(Component.java:4687)
     [java]     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
     [java]     at java.awt.EventQueue.access$200(EventQueue.java:103)
     [java]     at java.awt.EventQueue$3.run(EventQueue.java:694)
     [java]     at java.awt.EventQueue$3.run(EventQueue.java:692)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     [java]     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
     [java]     at java.awt.EventQueue$4.run(EventQueue.java:708)
     [java]     at java.awt.EventQueue$4.run(EventQueue.java:706)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     [java]     at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
     [java]     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
     [java]     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
     [java]     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
     [java]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
     [java]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
     [java]     at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
     [java] Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
     [java]     at edu.ucsb.cs56.projects.games.roguelike.RoguePanel.moveMonster(RoguePanel.java:654)
     [java]     at edu.ucsb.cs56.projects.games.roguelike.RogueController.moveMonster(RogueController.java:124)
     [java]     at edu.ucsb.cs56.projects.games.roguelike.RogueController.keyPressed(RogueController.java:302)
     [java]     at java.awt.Component.processKeyEvent(Component.java:6463)
     [java]     at java.awt.Component.processEvent(Component.java:6282)
     [java]     at java.awt.Container.processEvent(Container.java:2229)
     [java]     at java.awt.Window.processEvent(Window.java:2022)
     [java]     at java.awt.Component.dispatchEventImpl(Component.java:4861)
     [java]     at java.awt.Container.dispatchEventImpl(Container.java:2287)
     [java]     at java.awt.Window.dispatchEventImpl(Window.java:2719)
     [java]     at java.awt.Component.dispatchEvent(Component.java:4687)
     [java]     at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895)
     [java]     at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762)
     [java]     at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027)
     [java]     at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:899)
     [java]     at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:727)
     [java]     at java.awt.Component.dispatchEventImpl(Component.java:4731)
     [java]     at java.awt.Container.dispatchEventImpl(Container.java:2287)
     [java]     at java.awt.Window.dispatchEventImpl(Window.java:2719)
     [java]     at java.awt.Component.dispatchEvent(Component.java:4687)
     [java]     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
     [java]     at java.awt.EventQueue.access$200(EventQueue.java:103)
     [java]     at java.awt.EventQueue$3.run(EventQueue.java:694)
     [java]     at java.awt.EventQueue$3.run(EventQueue.java:692)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     [java]     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
     [java]     at java.awt.EventQueue$4.run(EventQueue.java:708)
     [java]     at java.awt.EventQueue$4.run(EventQueue.java:706)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     [java]     at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
     [java]     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
     [java]     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
     [java]     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
     [java]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
     [java]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
     [java]     at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

This is probably because the game tries to put two object in the same space.

~estimated 100

andrewberls commented 10 years ago

Moderator approved!

MadRubicant commented 8 years ago

F16 CLOSED: Appears to be a duplicate of #30