From 3494581c0eb9fa56f9e01028fec335c8892df86b Mon Sep 17 00:00:00 2001 From: aleandro Date: Fri, 12 Jun 2026 19:10:38 +0200 Subject: [PATCH] Fix: bug fixes and all version are up to date --- src/main/java/it/polimi/ingsw/gc14/ClientLauncherTUI.java | 6 +++++- .../it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java | 1 + .../it/polimi/ingsw/gc14/View/GUI/TotemFXMLController.java | 5 +++-- src/main/java/it/polimi/ingsw/gc14/View/TUI/AsciiTable.java | 4 ++-- src/main/resources/GUIScene/login.fxml | 2 +- src/main/resources/GUIScene/standing.fxml | 4 ++-- src/main/resources/GUIScene/totem.fxml | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/java/it/polimi/ingsw/gc14/ClientLauncherTUI.java b/src/main/java/it/polimi/ingsw/gc14/ClientLauncherTUI.java index 7fa23ac..cf3cfb6 100644 --- a/src/main/java/it/polimi/ingsw/gc14/ClientLauncherTUI.java +++ b/src/main/java/it/polimi/ingsw/gc14/ClientLauncherTUI.java @@ -79,12 +79,16 @@ public class ClientLauncherTUI { " immediately take 1 \uD83C\uDF56 for each Hunter in your tribe (with or without the icon).\n" + " During Hunt Event, take \uD83C\uDF56 and gain PP based on your Hunter count (see 'details events')."; + public static void main(String[] args) throws InterruptedException { + new ClientLauncherTUI().start(); + } + /** * Starts the TUI client. Creates a JLine terminal, loops through login → game → rematch. * * @throws InterruptedException if the thread is interrupted while waiting. */ - public void main() throws InterruptedException { + private void start() throws InterruptedException { try { System.setOut(new PrintStream(System.out, true, StandardCharsets.UTF_8)); System.setErr(new PrintStream(System.err, true, StandardCharsets.UTF_8)); diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java index 2501e77..892e57e 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/MainFXMLController.java @@ -388,6 +388,7 @@ public class MainFXMLController { /** Updates food/prestige labels, current-player highlight, card-icon opacity, and plays error shake if needed. */ private void updateSidePanel() { infoText.setText("Round: "+Integer.toString(controller.miniModel.currentState.getRound()) + " • " + controller.miniModel.currentState.getGameStage().toString()); + if (controller.miniModel.currentState.getCurrentPlayer() == null) return; String current = controller.miniModel.currentState.getCurrentPlayer().getUserName(); // ordine: building, artists, gatherers, inventors, builders, shamans, hunters String[] fields = {"building", "artists", "gatherers", "inventors", "builders", "shamans", "hunters"}; diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/TotemFXMLController.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/TotemFXMLController.java index e7b7e34..e310084 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/TotemFXMLController.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/TotemFXMLController.java @@ -63,7 +63,8 @@ public class TotemFXMLController { selectedIndex = -1; selectedFrame = null; - String chooser = controller.miniModel.currentState.getCurrentPlayer().getUserName(); // adatta al tuo campo + if (controller.miniModel.currentState.getCurrentPlayer() == null) return; + String chooser = controller.miniModel.currentState.getCurrentPlayer().getUserName(); boolean myTurn = chooser.equals(controller.myUsername); updateBanner(chooser, myTurn); @@ -207,7 +208,7 @@ public class TotemFXMLController { /** Returns the CSS style string for the totem name label, brightening it when {@code selected}. */ private String nameStyle(boolean selected) { return "-fx-font-family: 'Cinzel'; -fx-font-size: 10; -fx-letter-spacing: 2;" + - "-fx-text-fill: " + (selected ? "#ffffff" : "ffffff") + ";"; + "-fx-text-fill: " + (selected ? "#ffffff" : "#ffffff") + ";"; } /** Returns the totem name with only the first letter capitalised. */ diff --git a/src/main/java/it/polimi/ingsw/gc14/View/TUI/AsciiTable.java b/src/main/java/it/polimi/ingsw/gc14/View/TUI/AsciiTable.java index 8ce84b9..6f419a3 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/TUI/AsciiTable.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/TUI/AsciiTable.java @@ -48,8 +48,8 @@ public class AsciiTable { public String build() { var sb = new StringBuilder(); int maxWidth = rows.stream() - .mapToInt(x -> x.stream().mapToInt(y -> displayWidth(y)).max().getAsInt()) - .max().getAsInt() + 1; + .mapToInt(x -> x.stream().mapToInt(AsciiTable::displayWidth).max().orElse(0)) + .max().orElse(0) + 1; sb.append(hline(s.tl(), s.mt(), s.tr(), maxWidth)).append('\n'); for (int i = 0; i < rows.size(); i++) { diff --git a/src/main/resources/GUIScene/login.fxml b/src/main/resources/GUIScene/login.fxml index 8e0d78f..0af42d9 100644 --- a/src/main/resources/GUIScene/login.fxml +++ b/src/main/resources/GUIScene/login.fxml @@ -3,7 +3,7 @@ - - diff --git a/src/main/resources/GUIScene/totem.fxml b/src/main/resources/GUIScene/totem.fxml index 7460227..27b13f3 100644 --- a/src/main/resources/GUIScene/totem.fxml +++ b/src/main/resources/GUIScene/totem.fxml @@ -6,7 +6,7 @@ -