Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOutOfBounds occurring randomly #16

Closed
rick-lee opened this issue Feb 28, 2014 · 2 comments
Closed

ArrayIndexOutOfBounds occurring randomly #16

rick-lee opened this issue Feb 28, 2014 · 2 comments

Comments

@rick-lee
Copy link
Contributor

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
Copy link
Contributor

Moderator approved!

@MadRubicant
Copy link
Contributor

F16 CLOSED: Appears to be a duplicate of #30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants