Skip to content

Commit

Permalink
fix codacy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazingTwist committed Jan 28, 2024
1 parent 32f8674 commit f97ef53
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
17 changes: 9 additions & 8 deletions src/main/java/jchess/gamemode/hex2p/Hex2PlayerGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,21 @@ protected int getDirectionFromOwnerId(int ownerId) {
protected void generateBoard() {
for (int y = 0; y < numTilesVertical; y++) {
Entity[] tileRow = tiles[y];
int x_start, x_end;
final int x0;
final int x1;

if (y < 5) { // top part
x_start = 5 - y;
x_end = x_start + 2 * (y + 1);
x0 = 5 - y;
x1 = x0 + 2 * (y + 1);
} else if (y < 16) { // middle part
x_start = (y % 2 == 0) ? 1 : 0;
x_end = numTilesHorizontal;
x0 = (y % 2 == 0) ? 1 : 0;
x1 = numTilesHorizontal;
} else { // bottom part
x_start = y - 15;
x_end = x_start + (6 - x_start) * 2;
x0 = y - 15;
x1 = x0 + (6 - x0) * 2;
}

for (int x = x_start; x < x_end; x += 2) {
for (int x = x0; x < x1; x += 2) {
tileRow[x] = entityManager.createEntity();
tileRow[x].tile = new TileComponent(new Point(x, y), y % 3);
}
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/jchess/gamemode/hex2p/Hex2pPieces.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import dx.schema.types.PieceType;
import jchess.common.components.PieceIdentifier;
import jchess.common.moveset.special.*;
import jchess.common.moveset.special.EnPassant;
import jchess.common.moveset.special.PawnPromotion;
import jchess.common.moveset.special.RangedAttack;
import jchess.common.moveset.special.ShapeShifting;
import jchess.ecs.Entity;
import jchess.el.CompiledTileExpression;
import jchess.el.v2.ExpressionCompiler;
Expand All @@ -12,7 +15,9 @@
import java.util.function.Predicate;
import java.util.stream.Stream;

import static jchess.el.v2.TileExpression.*;
import static jchess.el.v2.TileExpression.neighbor;
import static jchess.el.v2.TileExpression.regex;
import static jchess.el.v2.TileExpression.rotations;

public enum Hex2pPieces implements PieceStore.IPieceDefinitionProvider {
Rook(PieceType.ROOK, new PieceStore.PieceDefinition(
Expand Down

0 comments on commit f97ef53

Please sign in to comment.