From 9d554158abb827431d69f923de66fa58809d2aee Mon Sep 17 00:00:00 2001 From: aleandro Date: Fri, 19 Jun 2026 22:14:29 +0200 Subject: [PATCH] Removed useless comments --- .../polimi/ingsw/gc14/GameEventProcessor.java | 5 --- .../TribeCards/Events/CavePaintings.java | 4 +-- .../Cards/TribeCards/Events/Sustenance.java | 2 +- .../polimi/ingsw/gc14/Model/DecksCreator.java | 4 +-- .../java/it/polimi/ingsw/gc14/Model/Game.java | 1 - .../gc14/Model/GamePackage/CurrentState.java | 8 ----- .../it/polimi/ingsw/gc14/Model/Player.java | 8 ----- .../java/it/polimi/ingsw/gc14/Model/Slot.java | 5 --- .../Network/TCP/Server/HeartbeatHandler.java | 4 +-- .../it/polimi/ingsw/gc14/ServerLauncher.java | 4 --- .../gc14/View/GUI/FireParticleSystem.java | 7 ++-- .../View/GUI/LeaderboardFXMLController.java | 9 +++--- .../gc14/View/GUI/LoginFXMLController.java | 1 - .../gc14/View/GUI/MainFXMLController.java | 2 -- .../ingsw/gc14/View/TUI/AsciiTable.java | 32 +++++++++---------- .../it/polimi/ingsw/gc14/View/TUI/TUI.java | 5 --- 16 files changed, 29 insertions(+), 72 deletions(-) diff --git a/src/main/java/it/polimi/ingsw/gc14/GameEventProcessor.java b/src/main/java/it/polimi/ingsw/gc14/GameEventProcessor.java index 08ae45c..99573e5 100644 --- a/src/main/java/it/polimi/ingsw/gc14/GameEventProcessor.java +++ b/src/main/java/it/polimi/ingsw/gc14/GameEventProcessor.java @@ -76,7 +76,6 @@ public class GameEventProcessor { this.saveManager = saveManager; } - // ── Public entry point ──────────────────────────────────────────────────── /** * Blocks until one event is available in the queue, then routes it to the @@ -97,7 +96,6 @@ public class GameEventProcessor { } } - // ── State guards ────────────────────────────────────────────────────────── /** * Returns {@code true} when there is an ongoing game that has not yet ended. @@ -116,7 +114,6 @@ public class GameEventProcessor { return disconnectionTimer != null; } - // ── Inactive game path ──────────────────────────────────────────────────── /** * Handles events that arrive when no active game exists (not yet started, @@ -136,7 +133,6 @@ public class GameEventProcessor { } } - // ── Suspended game path ─────────────────────────────────────────────────── /** * Routes events while the game is suspended waiting for a reconnection. @@ -180,7 +176,6 @@ public class GameEventProcessor { broadcaster.notifyAll(event); } - // ── Active game path ────────────────────────────────────────────────────── /** * Applies the event to the game controller, saves the updated state, diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java index b2af817..53ca34d 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/CavePaintings.java @@ -23,12 +23,12 @@ public class CavePaintings extends EventCard { /** * The amount of Prestige removed if the player has fewer Artist cards than {@code nLower}. */ - private final int nPrestigeRem; // NPrestigeLower + private final int nPrestigeRem; /** * The Prestige multiplier applied if the player has at least {@code nLower} Artist cards. */ - private final int nPrestigeMul; // NPrestigeUpper + private final int nPrestigeMul; /** * Creates a CavePaintings event card with the specified era and effect parameters. diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Sustenance.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Sustenance.java index d45f7f7..a738330 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Sustenance.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/Sustenance.java @@ -92,7 +92,7 @@ public class Sustenance extends EventCard { } else{ foodDebt -= player.getFoodValue(); - player.removeFood(player.getFoodValue()); // player.getFoodValue() == 0 + player.removeFood(player.getFoodValue()); player.removePrestige(foodDebt * prestigeDebt); } } diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/DecksCreator.java b/src/main/java/it/polimi/ingsw/gc14/Model/DecksCreator.java index 91642bf..3f9c56d 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/DecksCreator.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/DecksCreator.java @@ -212,7 +212,7 @@ public class DecksCreator { int era; boolean armed; boolean isEvent; - List params; // Object to support mixed boolean and numeric parameters from JSON + List params; } /** @@ -225,6 +225,6 @@ public class DecksCreator { int era; int price; int prestigeValue; - List params; // Object to support mixed boolean and numeric parameters from JSON + List params; } } \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Game.java b/src/main/java/it/polimi/ingsw/gc14/Model/Game.java index a9848a6..ea44aca 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Game.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Game.java @@ -444,7 +444,6 @@ public class Game implements Serializable { currentState.gameStageUpdate(GameStages.TOTEM_CHOICE); } - //region Controller Methods /** * Attempts to assign the slot at the specified index to the specified player. diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/GamePackage/CurrentState.java b/src/main/java/it/polimi/ingsw/gc14/Model/GamePackage/CurrentState.java index 4ec3017..a15ffb7 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/GamePackage/CurrentState.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/GamePackage/CurrentState.java @@ -16,7 +16,6 @@ import java.util.List; * remaining upper and lower cards, and the current game stage. */ public class CurrentState implements Serializable { - // region Getters /** * The current player associated with the game state. @@ -116,9 +115,7 @@ public class CurrentState implements Serializable { return gameStage; } - // endregion getters - // region Setters /** * Increments the current era by 1. @@ -156,9 +153,7 @@ public class CurrentState implements Serializable { public void gameStageUpdate(GameStages stage){ this.gameStage = stage; } - // endregion setters - // region Constructors /** * Creates a new CurrentState object with default initial values. @@ -174,9 +169,7 @@ public class CurrentState implements Serializable { this.nLower = 0; this.gameStage = GameStages.WAITING; } - // endregion constructors - // region Functions /** * Updates the current player, slot, and available draws. @@ -224,5 +217,4 @@ public class CurrentState implements Serializable { table.addRow(values); return table.build(); } - // endregion functions } diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Player.java b/src/main/java/it/polimi/ingsw/gc14/Model/Player.java index 909b55b..8c6d4b7 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Player.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Player.java @@ -28,7 +28,6 @@ public class Player implements Serializable { */ private Totems totem; - // region Getters /** * Unique string identifier for players; must not be {@code null} and must not * exceed {@link #MAX_USERNAME_LENGTH} otherwise an {@link IllegalArgumentException} will be thrown @@ -130,9 +129,7 @@ public class Player implements Serializable { return prestigeValue; } - // endregion getters - // region Setters /** * Adds {@code value} amount of Food to the Player. @@ -187,9 +184,7 @@ public class Player implements Serializable { this.prestigeValue -= value; } - // endregion setters - // region Constructors /** * Constructor for the class {@code Player}. Each Player is uniquely identified by the {@link #userName}. @@ -220,9 +215,7 @@ public class Player implements Serializable { this.prestigeValue = 0; this.totem = null; } - // endregion constructors - // region Functions /** * Checks equality between this {@code Player} and another object. @@ -355,5 +348,4 @@ public class Player implements Serializable { return table.build(); } - // endregion functions } \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Slot.java b/src/main/java/it/polimi/ingsw/gc14/Model/Slot.java index 3219bc1..2c941f7 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Slot.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Slot.java @@ -7,7 +7,6 @@ import java.io.Serializable; * The slot configuration depends on the specified slot identifier. */ public class Slot implements Serializable { - // Getters /** * The identifier of this slot. @@ -78,9 +77,7 @@ public class Slot implements Serializable { public int getFood(){ return food; } - // End getters - // Constructors /** * Creates a slot with the specified identifier. @@ -176,7 +173,6 @@ public class Slot implements Serializable { return s.toString(); } - // Functions /** * Checks equality between this {@code Slot} and another object. @@ -202,5 +198,4 @@ public class Slot implements Serializable { return Character.hashCode(slotId); } - // End functions } diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/TCP/Server/HeartbeatHandler.java b/src/main/java/it/polimi/ingsw/gc14/Network/TCP/Server/HeartbeatHandler.java index fbb2447..8ddd1eb 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/TCP/Server/HeartbeatHandler.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/TCP/Server/HeartbeatHandler.java @@ -84,10 +84,10 @@ public class HeartbeatHandler implements Runnable { startWatchdog(); try { while (running) { - int b = in.read(); // blocks until a byte arrives + int b = in.read(); if (b == -1) { disconnect(); - break; // stream closed + break; } if (b == PING) { lastReceivedTime = System.currentTimeMillis(); diff --git a/src/main/java/it/polimi/ingsw/gc14/ServerLauncher.java b/src/main/java/it/polimi/ingsw/gc14/ServerLauncher.java index c6dce58..c0c9dd1 100644 --- a/src/main/java/it/polimi/ingsw/gc14/ServerLauncher.java +++ b/src/main/java/it/polimi/ingsw/gc14/ServerLauncher.java @@ -54,7 +54,6 @@ public class ServerLauncher { actionQueue, gameController, playerList, broadcaster, saveManager); } - // ── Entry point ─────────────────────────────────────────────────────────── /** * Initializes all server components, wires them together, restores a saved @@ -119,7 +118,6 @@ public class ServerLauncher { new Thread(() -> tcpServer.start()).start(); } - // ── Game loop ───────────────────────────────────────────────────────────── /** * Runs the event-processing loop until the thread is interrupted. @@ -137,7 +135,6 @@ public class ServerLauncher { } } - // ── Crash recovery ──────────────────────────────────────────────────────── /** * Attempts to restore a previously saved game. @@ -180,7 +177,6 @@ public class ServerLauncher { System.out.println("Game restored from save (" + game.getNPlayers() + " players)."); } - // ── Network interface selection ─────────────────────────────────────────── /** * Lists active non-loopback IPv4 network interfaces and prompts the operator diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/FireParticleSystem.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/FireParticleSystem.java index 4d65a07..6459600 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/FireParticleSystem.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/FireParticleSystem.java @@ -150,7 +150,6 @@ public class FireParticleSystem { return new Particle(x, y, w, h, corner, rnd); } - // ── Particle ────────────────────────────────────────────────────────────── /** * A single fire particle with position, velocity, wobble, and JavaFX visual nodes. @@ -210,17 +209,17 @@ public class FireParticleSystem { double angle = baseAngle + (rnd.nextDouble() - 0.5) * (Math.PI / 3.5); double speed; - if (type == 0) { // ember + if (type == 0) { speed = 0.5 + rnd.nextDouble() * 0.7; size = rnd.nextDouble() * 3 + 2; glow = new Circle(size * 2.2); core = new Circle(size / 2); - } else if (type == 1) { // spark + } else if (type == 1) { speed = 1.5 + rnd.nextDouble() * 2.0; size = rnd.nextDouble() * 1.5 + 0.5; glow = null; core = new Circle(size / 2); - } else { // dust + } else { speed = 0.2 + rnd.nextDouble() * 0.35; size = rnd.nextDouble() * 8 + 5; glow = null; diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/LeaderboardFXMLController.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/LeaderboardFXMLController.java index 421b5f2..5ef1005 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/LeaderboardFXMLController.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/LeaderboardFXMLController.java @@ -38,7 +38,6 @@ public class LeaderboardFXMLController { @FXML private StackPane rootPane; @FXML private VBox mainVBox; @FXML private VBox rankingList; - // title label removed; outcome text is added dynamically in render() /** Client controller for fetching game state and sending actions. */ private ClientController controller; /** Auto-hiding popup that shows detailed player card information. */ @@ -164,9 +163,9 @@ public class LeaderboardFXMLController { Label posLabel = new Label(position + "°"); posLabel.setMinWidth(55); String medalColor = switch (position) { - case 1 -> "#FFD700"; // oro - case 2 -> "#C0C0C0"; // argento - case 3 -> "#CD7F32"; // bronzo + case 1 -> "#FFD700"; + case 2 -> "#C0C0C0"; + case 3 -> "#CD7F32"; default -> "#EEEEEE"; }; posLabel.setStyle("-fx-font-size: 28px; -fx-font-weight: bold; -fx-text-fill: " + medalColor + ";"); @@ -325,7 +324,7 @@ public class LeaderboardFXMLController { scrollPane.setStyle("-fx-background: transparent; -fx-background-color: transparent;"); Window window = rootPane.getScene().getWindow(); - scrollPane.setMaxHeight(window.getHeight() * 0.8); // cap scroll area to 80% of window height + scrollPane.setMaxHeight(window.getHeight() * 0.8); popupContent.getChildren().add(scrollPane); popup.show(window, 0, 0); popup.getScene().setFill(Color.TRANSPARENT); diff --git a/src/main/java/it/polimi/ingsw/gc14/View/GUI/LoginFXMLController.java b/src/main/java/it/polimi/ingsw/gc14/View/GUI/LoginFXMLController.java index 392a602..3706893 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/GUI/LoginFXMLController.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/GUI/LoginFXMLController.java @@ -96,7 +96,6 @@ public class LoginFXMLController { tt.setToX(isRMI ? 0 : 110); tt.play(); - // pseudoClassStateChanged preserves layout properties unlike direct style mutation labelRMI.pseudoClassStateChanged(activeProtocolPseudo, isRMI); labelTCP.pseudoClassStateChanged(activeProtocolPseudo, !isRMI); } 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 07bc801..7b2ee14 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 @@ -428,7 +428,6 @@ public class MainFXMLController { infoText.setText("Round: "+ controller.getMiniModel().currentState.getRound() + " • " + controller.getMiniModel().currentState.getGameStage().toString()); if (controller.getMiniModel().currentState.getCurrentPlayer() == null) return; String current = controller.getMiniModel().currentState.getCurrentPlayer().getUserName(); - // ordine: building, artists, gatherers, inventors, builders, shamans, hunters String[] fields = {"building", "artists", "gatherers", "inventors", "builders", "shamans", "hunters"}; for (Player p : controller.getMiniModel().players.values()) { @@ -677,7 +676,6 @@ public class MainFXMLController { totem.setLayoutX(nv.doubleValue() * 0.364); }); - // initialize immediately if already laid out if (card.getHeight() > 0) totem.setLayoutY(card.getHeight() *(yRatio-0.196)); if (card.getWidth() > 0) totem.setLayoutX(card.getWidth() * 0.364); 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 eb5fe21..d73f8f8 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 @@ -149,7 +149,6 @@ public class AsciiTable { return sb.toString(); } - // ── Wide-character width ────────────────────────────────────────────────── /** * Returns the number of terminal columns required to display {@code s}. @@ -176,33 +175,32 @@ public class AsciiTable { */ private static boolean isWide(int cp) { if (cp < 0x1100) return false; - if (cp <= 0x115F) return true; // Hangul Jamo + if (cp <= 0x115F) return true; if (cp < 0x2E80) { - // Specific wide symbols below 0x2E80 - return cp == 0x2B50 // ⭐ STAR - || cp == 0x2B55; // ⭕ HEAVY LARGE CIRCLE + return cp == 0x2B50 + || cp == 0x2B55; } - if (cp <= 0x303E) return true; // CJK Radicals, Kangxi, CJK Symbols + if (cp <= 0x303E) return true; if (cp < 0x3041) return false; - if (cp <= 0xA4CF) return true; // Hiragana, Katakana, Bopomofo, CJK Unified + if (cp <= 0xA4CF) return true; if (cp < 0xA960) return false; - if (cp <= 0xA97F) return true; // Hangul Jamo Extended-A + if (cp <= 0xA97F) return true; if (cp < 0xAC00) return false; - if (cp <= 0xD7AF) return true; // Hangul Syllables + if (cp <= 0xD7AF) return true; if (cp < 0xF900) return false; - if (cp <= 0xFAFF) return true; // CJK Compatibility Ideographs + if (cp <= 0xFAFF) return true; if (cp < 0xFE10) return false; - if (cp <= 0xFE1F) return true; // Vertical Forms + if (cp <= 0xFE1F) return true; if (cp < 0xFE30) return false; - if (cp <= 0xFE6F) return true; // CJK Compatibility Forms + if (cp <= 0xFE6F) return true; if (cp < 0xFF00) return false; - if (cp <= 0xFF60) return true; // Fullwidth Latin, punctuation + if (cp <= 0xFF60) return true; if (cp < 0xFFE0) return false; - if (cp <= 0xFFE6) return true; // Fullwidth Signs + if (cp <= 0xFFE6) return true; if (cp < 0x1F004) return false; - if (cp <= 0x1FAFF) return true; // Emoji (mahjong, playing cards, flags, - // misc symbols, transport, 🍖 U+1F357, ...) + if (cp <= 0x1FAFF) return true; + if (cp < 0x20000) return false; - return cp <= 0x3FFFD; // CJK Extension B through G + return cp <= 0x3FFFD; } } diff --git a/src/main/java/it/polimi/ingsw/gc14/View/TUI/TUI.java b/src/main/java/it/polimi/ingsw/gc14/View/TUI/TUI.java index f8db7cf..b881330 100644 --- a/src/main/java/it/polimi/ingsw/gc14/View/TUI/TUI.java +++ b/src/main/java/it/polimi/ingsw/gc14/View/TUI/TUI.java @@ -46,7 +46,6 @@ public class TUI implements IView { this.username = ""; } - // ── Setters ─────────────────────────────────────────────────────────────── /** * Sets the username of the local player. @@ -79,7 +78,6 @@ public class TUI implements IView { this.terminal = lineReader.getTerminal(); } - // ── Public render entry points ──────────────────────────────────────────── /** * Default render: dispatches to the right view based on game stage. @@ -130,7 +128,6 @@ public class TUI implements IView { printLine("\033[31m" + text + "\033[0m"); } - // ── Content builders (return strings, do not print) ─────────────────────── /** * Builds the main view: board + menu side by side, followed by all players' @@ -211,7 +208,6 @@ public class TUI implements IView { return table.build(); } - // ── Core display primitive ──────────────────────────────────────────────── /** * Clears the terminal and displays {@code content}, horizontally centered. @@ -278,7 +274,6 @@ public class TUI implements IView { return AsciiTable.displayWidth(line); } - // ── Board / players stamp helpers ───────────────────────────────────────── /** * Returns the board state as a multi-line string: turn order, upper cards,