gameServer/HWProtoInRoomState.hs
changeset 5098 cb9cf41a208c
parent 5030 42746c5d4a80
child 5143 649d87819682
--- a/gameServer/HWProtoInRoomState.hs	Sun Apr 03 19:27:48 2011 +0400
+++ b/gameServer/HWProtoInRoomState.hs	Sun Apr 03 20:07:05 2011 +0400
@@ -242,6 +242,20 @@
             [ModifyRoom (\r -> r{isRestrictedTeams = not $ isRestrictedTeams r})]
 
 
+handleCmd_inRoom ["ROOM_NAME", newName] = do
+    cl <- thisClient
+    rs <- allRoomInfos
+    
+    return $
+        if not $ isMaster cl then
+            [ProtocolError "Not room master"]
+        else
+        if isJust $ find (\r -> newName == name r) rs then
+            [Warning "Room with such name already exists"]
+        else
+            [ModifyRoom (\r -> r{name = newName})]
+
+
 handleCmd_inRoom ["KICK", kickNick] = do
     (thisClientId, rnc) <- ask
     maybeClientId <- clientByNick kickNick