Skip to content

Commit

Permalink
Revert "Revert "fixed global state of GameController.java variables""
Browse files Browse the repository at this point in the history
This reverts commit d1bf327.
  • Loading branch information
AnthonyClayton12 committed Apr 6, 2024
1 parent 290d051 commit 32c9136
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
48 changes: 48 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Java",
"type": "java",
"request": "launch",
"stopOnEntry": true,
"jdkPath": "${env:JAVA_HOME}/bin",
"cwd": "${fileDirname}",
"startupClass": "${fileBasenameNoExtension}",
"classpath": [
".",
"${fileDirname}"
]
},
{
"name": "Java Console App",
"type": "java",
"request": "launch",
"stopOnEntry": true,
"jdkPath": "${env:JAVA_HOME}/bin",
"cwd": "${fileDirname}",
"startupClass": "${fileBasenameNoExtension}",
"classpath": [
".",
"${fileDirname}"
],
"externalConsole": true
},
{
"type": "java",
"name": "Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "DesktopLauncher",
"request": "launch",
"mainClass": "de.sesu8642.feudaltactics.desktop.DesktopLauncher",
"projectName": "Feudal Tactics-desktop"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public class GameController {
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 Color[] colorBank = { orange, blue, pink, yellow, white, green };
public static Color[] PLAYER_COLORS = new Color[colorBank.length];

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

Color userColor = mapParams.getUserColor();
playerColors = setColors(colorBank, userColor);
PLAYER_COLORS = setColors(colorBank, userColor);

for (Color color : playerColors) {
if (remainingHumanPlayers > 0) {
Expand All @@ -136,7 +136,7 @@ public void generateGameState(Intelligence botIntelligence, MapParameters mapPar
* @param userColor The color the user has chosen for their kingdom.
* @return Array with the user color in the zero index.
*/
public static Color[] setColors(Color[] colorBankColors, Color userColor) {
public Color[] setPlayerColors(Color[] colorBankColors, Color userColor) {
Color[] colors = new Color[colorBankColors.length];
Queue<Color> colorQueue = new Queue<Color>();

Expand Down

0 comments on commit 32c9136

Please sign in to comment.