Closed Gankra closed 11 years ago
To clarify the view bug, it's null pointering on the value of currentView in the switch statement of updateView. I suggest that in your handleChange method, you check to see if the currentView has been initialized, and if not, assume that this is the game signaling the start of the Game to you.
Stack trace:
java.lang.NullPointerException
at com.steamedpears.comp3004.SevenWonders.updateView(SevenWonders.java:86)
at com.steamedpears.comp3004.SevenWonders.access$000(SevenWonders.java:14)
at com.steamedpears.comp3004.SevenWonders$1.stateChanged(SevenWonders.java:65)
at com.steamedpears.comp3004.models.Changeable.announceChange(Changeable.java:23)
at com.steamedpears.comp3004.routing.Router.stateChanged(Router.java:100)
at com.steamedpears.comp3004.models.Changeable.announceChange(Changeable.java:23)
at com.steamedpears.comp3004.models.SevenWondersGame.takeTurnsInternal(SevenWondersGame.java:111)
at com.steamedpears.comp3004.models.SevenWondersGame.run(SevenWondersGame.java:167)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
Cool.
Client connects and handshakes with Host Host registers client they successfully send data back and forth
GUI seems to vomit from not being properly initialized for the client though, so I can't fully test out all of the client's stuff.
Regardless, a bunch of functionality has been moved out of HostRouter into more useful places. SevenWondersGame now handles most serialize/deserialize stuff. Also, all messages are now sent as valid JSON to leverage JsonParser-JsonReader functionality.