DEADSOFTWARE

Fix codestyle
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / GameWorld.java
index e921b98138ceaabcab6db3d9dff559e4aa9113a0..c5e7d46ecd99eb7b33f9b07eb0c762d6fdda914b 100644 (file)
@@ -1,6 +1,5 @@
 package ru.deadsoftware.cavedroid.game;
 
-import org.jetbrains.annotations.NotNull;
 import ru.deadsoftware.cavedroid.game.objects.Block;
 import ru.deadsoftware.cavedroid.game.objects.Drop;
 
@@ -9,9 +8,10 @@ import static ru.deadsoftware.cavedroid.GameScreen.GP;
 @SuppressWarnings("WeakerAccess")
 public class GameWorld {
 
-    private int WIDTH, HEIGHT;
-    private int[][] foreMap;
-    private int[][] backMap;
+    private final int WIDTH;
+    private final int HEIGHT;
+    private final int[][] foreMap;
+    private final int[][] backMap;
 
     GameWorld(int width, int height) {
         WIDTH = width;
@@ -22,7 +22,7 @@ public class GameWorld {
         WorldGen.clear();
     }
 
-    GameWorld(@NotNull int[][] foreMap, @NotNull int[][] backMap) {
+    GameWorld(int[][] foreMap, int[][] backMap) {
         this.foreMap = foreMap.clone();
         this.backMap = backMap.clone();
         WIDTH = foreMap.length;
@@ -55,7 +55,9 @@ public class GameWorld {
 
     private int transformX(int x) {
         x = x % getWidth();
-        if (x < 0) x = getWidth() - Math.abs(x);
+        if (x < 0) {
+            x = getWidth() - Math.abs(x);
+        }
         return x;
     }
 
@@ -72,8 +74,11 @@ public class GameWorld {
     private void setMap(int x, int y, int layer, int value) {
         try {
             x = transformX(x);
-            if (layer == 0) foreMap[x][y] = value;
-            else backMap[x][y] = value;
+            if (layer == 0) {
+                foreMap[x][y] = value;
+            } else {
+                backMap[x][y] = value;
+            }
         } catch (ArrayIndexOutOfBoundsException ignored) {
         }
     }
@@ -152,16 +157,18 @@ public class GameWorld {
     }
 
     public void destroyForeMap(int x, int y) {
-        if (GameItems.getBlock(getForeMap(x, y)).hasDrop())
+        if (GameItems.getBlock(getForeMap(x, y)).hasDrop()) {
             GP.drops.add(new Drop(transformX(x) * 16 + 4, y * 16 + 4,
                     GameItems.getItemId(GameItems.getBlock(getForeMap(x, y)).getDrop())));
+        }
         placeToForeground(x, y, 0);
     }
 
     public void destroyBackMap(int x, int y) {
-        if (GameItems.getBlock(getBackMap(x, y)).hasDrop())
+        if (GameItems.getBlock(getBackMap(x, y)).hasDrop()) {
             GP.drops.add(new Drop(transformX(x) * 16 + 4, y * 16 + 4,
                     GameItems.getItemId(GameItems.getBlock(getBackMap(x, y)).getDrop())));
+        }
         placeToBackground(x, y, 0);
     }