From 54b192498d816e6aeb01c96101e7e6871ee77e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 9 Jan 2016 12:14:13 +0100 Subject: while, for, if codding style --- core/src/ch/asynk/rustanddust/engine/Board.java | 6 +++--- core/src/ch/asynk/rustanddust/engine/OrderList.java | 6 +++--- .../src/ch/asynk/rustanddust/engine/PathBuilder.java | 4 ++-- .../src/ch/asynk/rustanddust/engine/SearchBoard.java | 20 ++++++++++---------- core/src/ch/asynk/rustanddust/engine/Tile.java | 2 +- .../engine/gfx/animations/AnimationSequence.java | 2 +- .../engine/gfx/animations/TankFireAnimation.java | 2 +- core/src/ch/asynk/rustanddust/game/Config.java | 2 +- .../asynk/rustanddust/game/states/StateEngage.java | 2 +- .../ch/asynk/rustanddust/game/states/StateMove.java | 2 +- core/src/ch/asynk/rustanddust/menu/PlayMenu.java | 2 +- 11 files changed, 25 insertions(+), 25 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 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 implements Json.Serializable public Order get(Pawn pawn, Order.OrderType type) { Iterator 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 implements Json.Serializable public void dispose(Pawn pawn) { Iterator 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 implements Json.Serializable public void dispose(Pawn pawn, Order.OrderType type) { Iterator 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 { if (isEmpty()) return false; Iterator 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 diff --git a/core/src/ch/asynk/rustanddust/game/Config.java b/core/src/ch/asynk/rustanddust/game/Config.java index fc2d1e9..6e7001b 100644 --- a/core/src/ch/asynk/rustanddust/game/Config.java +++ b/core/src/ch/asynk/rustanddust/game/Config.java @@ -44,7 +44,7 @@ public class Config { if (this == SOLO) return PVE; - if(this == PVE) + if (this == PVE) return PVP; return SOLO; } diff --git a/core/src/ch/asynk/rustanddust/game/states/StateEngage.java b/core/src/ch/asynk/rustanddust/game/states/StateEngage.java index 99a24d5..37fed6c 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateEngage.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateEngage.java @@ -87,7 +87,7 @@ public class StateEngage extends StateCommon } else if ((activeUnit != null) && map.unitsAssistContains(unit)) { map.toggleAssist(unit); - // if(map.toggleAssist(unit)) + // if (map.toggleAssist(unit)) // ctrl.hud.notify(unit + " will fire"); // else // ctrl.hud.notify(unit + " wont fire"); diff --git a/core/src/ch/asynk/rustanddust/game/states/StateMove.java b/core/src/ch/asynk/rustanddust/game/states/StateMove.java index 3a2bc76..3072396 100644 --- a/core/src/ch/asynk/rustanddust/game/states/StateMove.java +++ b/core/src/ch/asynk/rustanddust/game/states/StateMove.java @@ -106,7 +106,7 @@ public class StateMove extends StateCommon Unit unit = hex.getUnit(); if (map.unitsMoveableContains(unit)) { - if(unit != activeUnit) + if (unit != activeUnit) changeUnit(unit); } else if ((s == 0) && map.movesContains(hex)) { collectPaths(hex); diff --git a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java index 866a647..f2c4b97 100644 --- a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java @@ -59,7 +59,7 @@ public class PlayMenu extends Patch battleValue.write(game.config.battle.getName()); float w = 0; - for(int i = game.config.gameMode.i; ;) { + for (int i = game.config.gameMode.i; ;) { gameModeValue.write(game.config.gameMode.s); if (w < gameModeValue.getWidth()) w = gameModeValue.getWidth(); -- cgit v1.1-2-g2b99