From 166dc5151bc435d945bd4b93237fe266b21448d7 Mon Sep 17 00:00:00 2001 From: Jonas Date: Thu, 17 Mar 2022 14:56:29 +0100 Subject: [PATCH] small adjustments & comments to passenger & subclasses --- .../unibas/dmi/dbis/cs108/Klassenstruktur/GhostNPC.java | 2 +- .../dmi/dbis/cs108/Klassenstruktur/GhostPlayer.java | 6 +++++- .../unibas/dmi/dbis/cs108/Klassenstruktur/Passenger.java | 9 +++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/GhostNPC.java b/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/GhostNPC.java index 6f5ee69..7d80968 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/GhostNPC.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/GhostNPC.java @@ -13,7 +13,7 @@ public class GhostNPC extends Ghost{ this.position = position; this.sock = null; isGhost = true; - isPlayerCharacter = false; + isPlayer = false; kickedOff = false; if (name == null) { this.name = "Robot Nr. " + position; diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/GhostPlayer.java b/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/GhostPlayer.java index a2a7216..3ee1b9c 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/GhostPlayer.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/GhostPlayer.java @@ -16,10 +16,14 @@ public class GhostPlayer extends Ghost{ this.sock = sock; this.isOG = isOG; isGhost = true; - isPlayerCharacter = true; + isPlayer = true; kickedOff = false; if (name == null) { this.name = "Human Nr. " + position; } else this.name = name; } + + public void send(String msg) { + //todo: pass message along to client. + } } diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/Passenger.java b/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/Passenger.java index f0171ba..e53eccf 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/Passenger.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/Klassenstruktur/Passenger.java @@ -6,9 +6,10 @@ public class Passenger { protected int position; //the player's Cabin number (1 to 6) protected String name; //the player's Name protected Boolean isGhost; //boolean regarding if the player is a ghost. Could probably be removed since ghost is a subclass but I'm keeping it in. - protected Boolean isPlayerCharacter; //same here + protected Boolean isPlayer; //same here protected Boolean kickedOff; //true if the player has been voted off. protected Socket sock; //the socket for the client associated with this Passenger, for NPCs, this can be null. + //todo: maybe this should be a thread or some class instead of a socket? depends on client-server structure... /** @@ -16,7 +17,7 @@ public class Passenger { * @param msg the message that is sent to this player. **/ public void send(String msg) { - //todo: send protocol message to the respective client + //todo: send protocol message to the respective client OR process messages for NPCS } /** @@ -51,7 +52,7 @@ public class Passenger { return kickedOff; } - public Boolean getPlayerCharacter() { - return isPlayerCharacter; + public Boolean getIsPlayer() { + return isPlayer; } }