Fix "FOLLOW" command handler and place it into proper file
authorunc0rr
Sat, 06 Mar 2010 18:23:25 +0000
changeset 2961 3e057dfa601f
parent 2960 b467a681c5e0
child 2962 38237a443f74
Fix "FOLLOW" command handler and place it into proper file
gameServer/HWProtoCore.hs
gameServer/HWProtoLobbyState.hs
--- a/gameServer/HWProtoCore.hs	Sat Mar 06 18:21:05 2010 +0000
+++ b/gameServer/HWProtoCore.hs	Sat Mar 06 18:23:25 2010 +0000
@@ -63,20 +63,6 @@
             else ""
 
 
-handleCmd_loggedin clID clients rooms ["FOLLOW", asknick] =
-    if inLobby || noSuchClient then
-        []
-    else
-        handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomname]
-    where
-        maybeClient = find (\cl -> asknick == nick cl) clients
-        noSuchClient = isNothing maybeClient
-        client = fromJust maybeClient
-        room = rooms IntMap.! roomID client
-        roomname = (name room)
-        inLobby = roomname == ""
-
-
 handleCmd_loggedin clID clients rooms cmd =
     if roomID client == 0 then
         handleCmd_lobby clID clients rooms cmd
--- a/gameServer/HWProtoLobbyState.hs	Sat Mar 06 18:21:05 2010 +0000
+++ b/gameServer/HWProtoLobbyState.hs	Sat Mar 06 18:23:25 2010 +0000
@@ -117,6 +117,19 @@
 
 handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomName] =
     handleCmd_lobby clID clients rooms ["JOIN_ROOM", roomName, ""]
+    
+
+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 --