Skip to content

Commit

Permalink
minor style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sesu8642 committed Apr 8, 2024
1 parent 39c41a9 commit 3a96acc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public EditorController(EventBus eventBus) {
public void generateEmptyGameState() {
gameState = new GameState();
ArrayList<Player> players = new ArrayList<>();
players.add(new Player(GameController.colorBank[0], Type.LOCAL_PLAYER));
for (int i = 1; i < GameController.colorBank.length; i++) {
players.add(new Player(GameController.colorBank[i], Type.LOCAL_BOT));
players.add(new Player(GameController.COLOR_BANK[0], Type.LOCAL_PLAYER));
for (int i = 1; i < GameController.COLOR_BANK.length; i++) {
players.add(new Player(GameController.COLOR_BANK[i], Type.LOCAL_BOT));
}
GameStateHelper.initializeMap(gameState, players, 0, 0, 0F, null);
eventBus.post(new GameStateChangeEvent(gameState));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.badlogic.gdx.graphics.Color;

import de.sesu8642.feudaltactics.lib.ingame.GameController;
import de.sesu8642.feudaltactics.lib.ingame.botai.Intelligence;

/** Value object: preferences for a new game. */
Expand Down Expand Up @@ -94,9 +95,8 @@ public float getDensityFloat() {

/** User colors that can be generated. */
public enum UserColors {
BLUE(new Color(0.2F, 0.45F, 0.8F, 1)), ORANGE(new Color(0.75F, 0.5F, 0F, 1)),
GREEN(new Color(0F, 1F, 0F, 1)), YELLOW(new Color(1F, 1F, 0F, 1)),
PINK(new Color(1F, 0.67F, 0.67F, 1)), WHITE(new Color(1F, 1F, 1F, 1));
BLUE(GameController.BLUE), ORANGE(GameController.ORANGE), GREEN(GameController.GREEN),
YELLOW(GameController.YELLOW), PINK(GameController.PINK), WHITE(GameController.WHITE);

private Color kingdomColor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ public class GameController {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());

/** All colors available to bots and user in the game. */
public static final Color blue = new Color(0.2F, 0.45F, 0.8F, 1);
public static final Color orange = new Color(0.75F, 0.5F, 0F, 1);
public static final Color pink = new Color(1F, 0.67F, 0.67F, 1);
public static final Color yellow = new Color(1F, 1F, 0F, 1);
public static final Color white = new Color(1F, 1F, 1F, 1);
public static final Color green = new Color(0F, 1F, 0F, 1);

public static final Color[] colorBank = { blue, orange, pink, yellow, white, green };
public Color[] playerColors = new Color[colorBank.length];
public static final Color BLUE = new Color(0.2F, 0.45F, 0.8F, 1);
public static final Color ORANGE = new Color(0.75F, 0.5F, 0F, 1);
public static final Color PINK = new Color(1F, 0.67F, 0.67F, 1);
public static final Color YELLOW = new Color(1F, 1F, 0F, 1);
public static final Color WHITE = new Color(1F, 1F, 1F, 1);
public static final Color GREEN = new Color(0F, 1F, 0F, 1);
public static final Color[] COLOR_BANK = { BLUE, ORANGE, PINK, YELLOW, WHITE, GREEN };

private final EventBus eventBus;
private final ExecutorService botTurnExecutor;
Expand Down Expand Up @@ -111,8 +109,7 @@ public void generateGameState(Intelligence botIntelligence, MapParameters mapPar
int remainingHumanPlayers = mapParams.getHumanPlayerNo();
int remainingBotPlayers = mapParams.getBotPlayerNo();

Color userColor = mapParams.getUserColor();
playerColors = setPlayerColors(colorBank, userColor);
Color[] playerColors = determinePlayerColors(mapParams.getUserColor());

for (Color color : playerColors) {
if (remainingHumanPlayers > 0) {
Expand All @@ -130,17 +127,16 @@ public void generateGameState(Intelligence botIntelligence, MapParameters mapPar
}

/**
* Set the color order depending on the user color choice
* Set the color order depending on the user color choice.
*
* @param colorBankColors Array of all six possible colors.
* @param userColor The color the user has chosen for their kingdom.
* @param userColor The color the user has chosen for their kingdom.
* @return Array with the user color in the zero index.
*/
public Color[] setPlayerColors(Color[] colorBankColors, Color userColor) {
Color[] colors = new Color[colorBankColors.length];
Queue<Color> colorQueue = new Queue<Color>();
private Color[] determinePlayerColors(Color userColor) {
Color[] colors = new Color[COLOR_BANK.length];
Queue<Color> colorQueue = new Queue<>();

for (Color color : colorBankColors) {
for (Color color : COLOR_BANK) {
if (color.equals(userColor)) {
colorQueue.addFirst(color);
} else {
Expand Down

0 comments on commit 3a96acc

Please sign in to comment.