diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-01-09 12:14:13 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-01-09 12:14:13 +0100 |
commit | 54b192498d816e6aeb01c96101e7e6871ee77e5a (patch) | |
tree | 1094a1a455223c6c61d8aa3fb83a7d82eff16b30 /core/src/ch/asynk/rustanddust/engine | |
parent | ce0ff796ce1436d41127e170d42558ca1108d8cb (diff) | |
download | RustAndDust-54b192498d816e6aeb01c96101e7e6871ee77e5a.zip RustAndDust-54b192498d816e6aeb01c96101e7e6871ee77e5a.tar.gz |
while, for, if codding style
Diffstat (limited to 'core/src/ch/asynk/rustanddust/engine')
7 files changed, 21 insertions, 21 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/Board.java b/core/src/ch/asynk/rustanddust/engine/Board.java index 98d0149..d1eecc9 100644 --- a/core/src/ch/asynk/rustanddust/engine/Board.java +++ b/core/src/ch/asynk/rustanddust/engine/Board.java @@ -344,7 +344,7 @@ public abstract class Board implements Disposable, Animation Tile tile = neighbours[i]; if (tile != null) { Iterator<Pawn> pawns = tile.iterator(); - while(pawns.hasNext()) { + while (pawns.hasNext()) { Pawn p = pawns.next(); if (!pawn.isEnemy(p) && p.canMove()) assists.add(p); @@ -434,7 +434,7 @@ public abstract class Board implements Disposable, Animation public void enableOverlayOn(Tile tile, int i, boolean enable) { - if(tile.enableOverlay(i, enable)) + if (tile.enableOverlay(i, enable)) tilesToDraw.add(tile); else tilesToDraw.remove(tile); @@ -442,7 +442,7 @@ public abstract class Board implements Disposable, Animation public void enableOverlayOn(Tile tile, int i, Orientation o, boolean enable) { - if(tile.enableOverlay(i, enable, o.r())) + if (tile.enableOverlay(i, enable, o.r())) tilesToDraw.add(tile); else tilesToDraw.remove(tile); diff --git a/core/src/ch/asynk/rustanddust/engine/OrderList.java b/core/src/ch/asynk/rustanddust/engine/OrderList.java index 6fdd6e7..588e90f 100644 --- a/core/src/ch/asynk/rustanddust/engine/OrderList.java +++ b/core/src/ch/asynk/rustanddust/engine/OrderList.java @@ -12,7 +12,7 @@ public class OrderList extends LinkedList<Order> implements Json.Serializable public Order get(Pawn pawn, Order.OrderType type) { Iterator<Order> it = iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Order order = it.next(); if ((order.compareTo(pawn) == 0) && (order.isA(type))) return order; @@ -23,7 +23,7 @@ public class OrderList extends LinkedList<Order> implements Json.Serializable public void dispose(Pawn pawn) { Iterator<Order> it = iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Order order = it.next(); if (order.compareTo(pawn) == 0) { it.remove(); @@ -35,7 +35,7 @@ public class OrderList extends LinkedList<Order> implements Json.Serializable public void dispose(Pawn pawn, Order.OrderType type) { Iterator<Order> it = iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Order order = it.next(); if ((order.compareTo(pawn) == 0) && (order.isA(type))) { it.remove(); diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java index 6a2b1a2..127da12 100644 --- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java +++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java @@ -205,7 +205,7 @@ public class PathBuilder implements Disposable Tile moves[] = new Tile[6]; board.setAdjacentTiles(from, moves); - for(int i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) { Tile next = moves[i]; if ((next == null) || next.isOffMap()) continue; @@ -338,7 +338,7 @@ public class PathBuilder implements Disposable System.err.println(what + " " + paths.size() + " - " + from + " -> " + to); for (Path path : paths) { System.err.println(String.format(" - path (l:%d c:%d r:%b f:%d)", path.tiles.size(), path.cost, path.roadMarch, path.fitness)); - for(Tile tile : path.tiles) + for (Tile tile : path.tiles) System.err.println(" " + tile.toString()); } System.err.println(); diff --git a/core/src/ch/asynk/rustanddust/engine/SearchBoard.java b/core/src/ch/asynk/rustanddust/engine/SearchBoard.java index 19fa7a8..0fc4c9a 100644 --- a/core/src/ch/asynk/rustanddust/engine/SearchBoard.java +++ b/core/src/ch/asynk/rustanddust/engine/SearchBoard.java @@ -145,7 +145,7 @@ public class SearchBoard adjacentMoves(src, adjacents); - for(int i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) { Node dst = adjacents[i]; if (dst != null) { @@ -182,12 +182,12 @@ public class SearchBoard } for (Node n : roadMarch) n.remaining = roadMarchBonus; - while(roadMarch.size() != 0) { + while (roadMarch.size() != 0) { Node src = roadMarch.pop(); adjacentMoves(src, adjacents); - for(int i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) { Node dst = adjacents[i]; if (dst != null) { @@ -298,7 +298,7 @@ public class SearchBoard int rangeLeft = src.remaining - 1; - for(int i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) { Node dst = adjacents[i]; if ((dst == null) || (dst.search == searchCount)) continue; @@ -443,7 +443,7 @@ public class SearchBoard boolean diag = (dx == (3 * dy)); los.add(getNode(x, y)); - while((x != x1) || (y != y1)) { + while ((x != x1) || (y != y1)) { if (e > 0) { e -= (dy3 + dx3); y += ys; @@ -468,7 +468,7 @@ public class SearchBoard } los.add(getNode(x, y)); if (!losBlocked) losBlocked = board.getTile(x, y).blockLineOfSight(from, to); - if(losBlocked && clearVisibility) return fixLineOfSight(false, x1, y1); + if (losBlocked && clearVisibility) return fixLineOfSight(false, x1, y1); } return true; @@ -485,7 +485,7 @@ public class SearchBoard Tile t = null; los.add(getNode(x, y)); - while((x != x1) || (y != y1)) { + while ((x != x1) || (y != y1)) { boolean blocked = false; y += d; @@ -500,7 +500,7 @@ public class SearchBoard blocked = false; if (blocked) losBlocked = true; - if(losBlocked && clearVisibility) return false; + if (losBlocked && clearVisibility) return false; y += d; t = board.getTile(x, y); @@ -524,7 +524,7 @@ public class SearchBoard Tile t = null; los.add(getNode(x, y)); - while((x != x1) || (y != y1)) { + while ((x != x1) || (y != y1)) { boolean blocked = false; x += dx; @@ -541,7 +541,7 @@ public class SearchBoard blocked = false; if (blocked) losBlocked = true; - if(losBlocked && clearVisibility) return false; + if (losBlocked && clearVisibility) return false; x += dx; t = board.getTile(x, y); diff --git a/core/src/ch/asynk/rustanddust/engine/Tile.java b/core/src/ch/asynk/rustanddust/engine/Tile.java index f47f33f..e602944 100644 --- a/core/src/ch/asynk/rustanddust/engine/Tile.java +++ b/core/src/ch/asynk/rustanddust/engine/Tile.java @@ -124,7 +124,7 @@ public abstract class Tile implements Drawable, Disposable, Iterable<Pawn> { if (isEmpty()) return false; Iterator<Pawn> itr = iterator(); - while(itr.hasNext()) { + while (itr.hasNext()) { if (itr.next().isUnit()) return true; } diff --git a/core/src/ch/asynk/rustanddust/engine/gfx/animations/AnimationSequence.java b/core/src/ch/asynk/rustanddust/engine/gfx/animations/AnimationSequence.java index d440adc..d2feee8 100644 --- a/core/src/ch/asynk/rustanddust/engine/gfx/animations/AnimationSequence.java +++ b/core/src/ch/asynk/rustanddust/engine/gfx/animations/AnimationSequence.java @@ -51,7 +51,7 @@ public class AnimationSequence implements Animation, Pool.Poolable @Override public boolean animate(float delta) { - if(animations.isEmpty()) return true; + if (animations.isEmpty()) return true; Animation animation = animations.get(0); if (animation.animate(delta)) { diff --git a/core/src/ch/asynk/rustanddust/engine/gfx/animations/TankFireAnimation.java b/core/src/ch/asynk/rustanddust/engine/gfx/animations/TankFireAnimation.java index 8e000be..582bc1c 100644 --- a/core/src/ch/asynk/rustanddust/engine/gfx/animations/TankFireAnimation.java +++ b/core/src/ch/asynk/rustanddust/engine/gfx/animations/TankFireAnimation.java @@ -128,7 +128,7 @@ public class TankFireAnimation implements Disposable, Animation, Pool.Poolable this.head_back = !this.m.canAim(); this.aim_r += (Orientation.SOUTH.r() - this.m.getRotation()); while (aim_r > 180) aim_r -= 360; - while(aim_r < -180) aim_r += 360; + while (aim_r < -180) aim_r += 360; } @Override |