gameServer/HWProtoInRoomState.hs
changeset 3564 7c583c88327b
parent 3561 7f8e07e4a4e3
child 3566 772a46ef8288
--- a/gameServer/HWProtoInRoomState.hs	Sat Jun 26 16:56:02 2010 +0400
+++ b/gameServer/HWProtoInRoomState.hs	Sat Jun 26 16:57:43 2010 +0400
@@ -79,26 +79,27 @@
 handleCmd_inRoom ["REMOVE_TEAM", name] = do
         (ci, rnc) <- ask
         let r = room rnc $ clientRoom rnc ci
-		clNick <- clientNick
-		
-		let maybeTeam = findTeam r
-		let team = fromJust maybeTeam
-		
-		return $
-			if isNothing $ findTeam r then
-				[Warning "REMOVE_TEAM: no such team"]
-			else if clNick /= teamowner team then
-				[ProtocolError "Not team owner!"]
-			else
-				[RemoveTeam name,
-				ModifyClient 
-					(\c -> c{
-						teamsInGame = teamsInGame c - 1, 
-						clientClan = if teamsInGame client == 1 then undefined else anotherTeamClan ci r
-						})
-				]
+        clNick <- clientNick
+
+        let maybeTeam = findTeam r
+        let team = fromJust maybeTeam
+
+        return $
+            if isNothing $ findTeam r then
+                [Warning "REMOVE_TEAM: no such team"]
+            else if clNick /= teamowner team then
+                [ProtocolError "Not team owner!"]
+            else
+                [RemoveTeam name,
+                ModifyClient
+                    (\c -> c{
+                        teamsInGame = teamsInGame c - 1,
+                        clientClan = if teamsInGame c == 1 then undefined else anotherTeamClan ci r
+                        })
+                ]
     where
         anotherTeamClan ci = teamcolor . fromJust . find (\t -> teamownerId t == ci) . teams
+        findTeam = find (\t -> name == teamname t) . teams
 
 {-