aboutsummaryrefslogtreecommitdiff
path: root/src/scalevalapokalypsi/Model/Adventure.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/scalevalapokalypsi/Model/Adventure.scala')
-rw-r--r--src/scalevalapokalypsi/Model/Adventure.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/scalevalapokalypsi/Model/Adventure.scala b/src/scalevalapokalypsi/Model/Adventure.scala
index 9d07ba6..0fbf6cd 100644
--- a/src/scalevalapokalypsi/Model/Adventure.scala
+++ b/src/scalevalapokalypsi/Model/Adventure.scala
@@ -36,14 +36,14 @@ class Adventure(val playerNames: Vector[String]):
"Et vielä voi tehdä sillä mitään, koska et edes osaa laula."
))
- val players: Map[String, Player] = Map()
- playerNames.foreach(this.addPlayer(_))
-
val entities: Map[String, Entity] = Map()
private val gruu = Entity("Gruu", northForest)
northForest.addEntity(gruu)
this.entities += gruu.name -> gruu
+ val players: Map[String, Player] = Map()
+ playerNames.foreach(this.addPlayer(_))
+
/** Adds a player entity with the specified name to the game.
*
* @param name the name of the player entity to add
@@ -52,9 +52,10 @@ class Adventure(val playerNames: Vector[String]):
def addPlayer(name: String): Player =
val newPlayer = Player(name, middle)
middle.addEntity(newPlayer)
+ this.entities += name -> newPlayer
players += name -> newPlayer
newPlayer
-
+
/** Gets the player entity with the specified name.
*
* @param name name of the player to find