@@ -36,7 +36,7 @@ void startNewGame(ByteBuffer liveData, PerformanceMetrics performanceMetrics) {
3636 }
3737 this .performanceMetrics = performanceMetrics ;
3838 botGame = new Game ();
39- botGame .clientData ().setBuffer (liveData );
39+ botGame .botClientData ().setBuffer (liveData );
4040 liveClientData .setBuffer (liveData );
4141 this .liveData = liveData ;
4242 botThread = null ;
@@ -76,7 +76,7 @@ void onFrame() {
7676 if (configuration .getAsync ()) {
7777 configuration .log ("Main: onFrame asynchronous start" );
7878 long startNanos = System .nanoTime ();
79- long endNanos = startNanos + configuration .getMaxFrameDurationMs () * 1000000 ;
79+ long endNanos = startNanos + ( long ) configuration .getMaxFrameDurationMs () * 1000000 ;
8080 if (botThread == null ) {
8181 configuration .log ("Main: Starting bot thread" );
8282 botThread = createBotThread ();
@@ -94,7 +94,7 @@ void onFrame() {
9494 try {
9595 if (frameBuffer .empty ()) {
9696 configuration .log ("Main: Putting bot on live data" );
97- botGame .clientData ().setBuffer (liveData );
97+ botGame .botClientData ().setBuffer (liveData );
9898 setUnsafeReadReady (true );
9999 } else {
100100 setUnsafeReadReady (false );
@@ -125,7 +125,7 @@ void onFrame() {
125125 // so there's no guarantee of safety here.
126126 if (configuration .getAsyncUnsafe () && frameBuffer .size () == 1 ) {
127127 configuration .log ("Main: Weaning bot off live data" );
128- botGame .clientData ().setBuffer (frameBuffer .peek ());
128+ botGame .botClientData ().setBuffer (frameBuffer .peek ());
129129 }
130130
131131 // Make bot exceptions fall through to the main thread.
@@ -209,7 +209,7 @@ private Thread createBotThread() {
209209 // TODO: Maybe we should point it at live data from here?
210210 } else {
211211 configuration .log ("Bot: Peeking next frame from buffer" );
212- botGame .clientData ().setBuffer (frameBuffer .peek ());
212+ botGame .botClientData ().setBuffer (frameBuffer .peek ());
213213 }
214214
215215 configuration .log ("Bot: Handling events on frame #" + botGame .getFrameCount ());
@@ -235,22 +235,22 @@ private Thread createBotThread() {
235235 }
236236
237237 private void handleEvents () {
238- ClientData .GameData gameData = botGame .clientData ().gameData ();
238+ ClientData .GameData botGameData = botGame .botClientData ().gameData ();
239239
240240 // Populate gameOver before invoking event handlers (in case the bot throws)
241- for (int i = 0 ; i < gameData .getEventCount (); i ++) {
242- gameOver = gameOver || gameData .getEvents (i ).getType () == EventType .MatchEnd ;
241+ for (int i = 0 ; i < botGameData .getEventCount (); i ++) {
242+ gameOver = gameOver || botGameData .getEvents (i ).getType () == EventType .MatchEnd ;
243243 }
244244
245245 if (configuration .getAsync ()) {
246246 performanceMetrics .getFramesBehind ().record (Math .max (1 , frameBuffer .framesBuffered ()) - 1 );
247247 }
248248
249249 performanceMetrics .getBotResponse ().timeIf (
250- ! gameOver && (gameData .getFrameCount () > 0 || ! configuration .getUnlimitedFrameZero ()),
250+ ! gameOver && (botGameData .getFrameCount () > 0 || ! configuration .getUnlimitedFrameZero ()),
251251 () -> {
252- for (int i = 0 ; i < gameData .getEventCount (); i ++) {
253- EventHandler .operation (eventListener , botGame , gameData .getEvents (i ));
252+ for (int i = 0 ; i < botGameData .getEventCount (); i ++) {
253+ EventHandler .operation (eventListener , botGame , botGameData .getEvents (i ));
254254 }
255255 });
256256 }
0 commit comments