DEADSOFTWARE

Fix codestyle
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / GameFluidsThread.java
index 8f4a891930bc570ce868899a99e965da9329d492..d069a4058b171a259f57ab6e8a0de86266424c5b 100644 (file)
@@ -1,11 +1,13 @@
 package ru.deadsoftware.cavedroid.game;
 
+import com.badlogic.gdx.utils.TimeUtils;
+
 import java.util.Arrays;
 
 import static ru.deadsoftware.cavedroid.GameScreen.GP;
 import static ru.deadsoftware.cavedroid.game.GameItems.*;
 
-public class GameFluidsThread extends Thread {
+class GameFluidsThread extends Thread {
 
     private static final int FLUID_UPDATE_INTERVAL_MS = 100;
     private static final int FLUID_STATES = 5;
@@ -32,7 +34,9 @@ public class GameFluidsThread extends Thread {
 
     private int getNextBlockStateId(int id) {
         int nextState = getNextBlockState(id);
-        if (nextState == -1) return 0;
+        if (nextState == -1) {
+            return 0;
+        }
         if (isWater(id)) {
             return WATER_IDS[nextState];
         }
@@ -98,8 +102,12 @@ public class GameFluidsThread extends Thread {
     }
 
     private void updateFluids(int x, int y) {
-        if (!isFluid(id(x, y))) return;
-        if (drainFluid(x, y)) return;
+        if (!isFluid(id(x, y))) {
+            return;
+        }
+        if (drainFluid(x, y)) {
+            return;
+        }
         flowFluid(x, y);
     }
 
@@ -114,8 +122,8 @@ public class GameFluidsThread extends Thread {
     }
 
     private boolean timeToUpdate() {
-        if (System.currentTimeMillis() - fluidLastUpdateTimestamp >= FLUID_UPDATE_INTERVAL_MS) {
-            fluidLastUpdateTimestamp = System.currentTimeMillis();
+        if (TimeUtils.timeSinceMillis(fluidLastUpdateTimestamp) >= FLUID_UPDATE_INTERVAL_MS) {
+            fluidLastUpdateTimestamp = TimeUtils.millis();
             return true;
         }
         return false;