add actor map constructor

This commit is contained in:
Thibault Duplessis 2014-05-10 23:26:37 +02:00
parent 886b9df439
commit f16c4fe911
2 changed files with 10 additions and 3 deletions

View file

@ -40,3 +40,11 @@ trait ActorMap[A <: Actor] extends Actor {
}
}
}
object ActorMap {
def apply[A <: Actor](make: String => A) = new ActorMap[A] {
def mkActor(id: String) = make(id)
def receive = actorMapReceive
}
}

View file

@ -47,8 +47,8 @@ final class Env(
lazy val history = () => new History(ttl = MessageTtl)
val roundMap = system.actorOf(Props(new lila.hub.ActorMap[Round] {
def mkActor(id: String) = new Round(
val roundMap = system.actorOf(Props(lila.hub.ActorMap { id =>
new Round(
gameId = id,
messenger = messenger,
takebacker = takebacker,
@ -58,7 +58,6 @@ final class Env(
drawer = drawer,
socketHub = socketHub,
moretimeDuration = Moretime)
def receive = actorMapReceive
}), name = ActorMapName)
private val socketHub = {