gameServer/HWProtoLobbyState.hs
branchserver_refactor
changeset 4616 cc3485866b93
parent 4597 31e042ab870c
child 4618 0f56fa511f65
--- a/gameServer/HWProtoLobbyState.hs	Sun Jan 30 20:32:23 2011 +0300
+++ b/gameServer/HWProtoLobbyState.hs	Sun Jan 30 20:36:32 2011 +0300
@@ -119,19 +119,18 @@
 handleCmd_lobby ["JOIN_ROOM", roomName] =
     handleCmd_lobby ["JOIN_ROOM", roomName, ""]
 
+
+handleCmd_lobby ["FOLLOW", asknick] = do
+    (_, rnc) <- ask
+    ci <- clientByNick asknick
+    let ri = clientRoom rnc $ fromJust ci
+    let clRoom = room rnc ri
+    if isNothing ci || ri == lobbyId then
+        return []
+        else
+        handleCmd_lobby ["JOIN_ROOM", name clRoom]
+
 {-
-handleCmd_lobby clID clients rooms ["FOLLOW", asknick] =
-    if noSuchClient || roomID followClient == 0 then
-        []
-    else
-        handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomName]
-    where
-        maybeClient = Foldable.find (\cl -> asknick == nick cl) clients
-        noSuchClient = isNothing maybeClient
-        followClient = fromJust maybeClient
-        roomName = name $ rooms IntMap.! roomID followClient
-
-
     ---------------------------
     -- Administrator's stuff --