# HG changeset patch # User unc0rr # Date 1359104346 -14400 # Node ID 74c2c95ab07b8da245d4b80e61318630bd857237 # Parent 5a5c34a75e1ab81d3a09535d870d68ca103a81aa Fix finding player's another clan diff -r 5a5c34a75e1a -r 74c2c95ab07b gameServer/CoreTypes.hs --- a/gameServer/CoreTypes.hs Wed Jan 23 16:35:26 2013 -0500 +++ b/gameServer/CoreTypes.hs Fri Jan 25 12:59:06 2013 +0400 @@ -38,7 +38,7 @@ isAdministrator :: Bool, isChecker :: Bool, isKickedFromServer :: Bool, - clientClan :: Maybe B.ByteString, + clientClan :: !Maybe B.ByteString, teamsInGame :: Word } @@ -66,6 +66,9 @@ } deriving (Show, Read) +instance Eq TeamInfo where + (==) = (==) `on` teamname + data GameInfo = GameInfo { diff -r 5a5c34a75e1a -r 74c2c95ab07b gameServer/HWProtoInRoomState.hs --- a/gameServer/HWProtoInRoomState.hs Wed Jan 23 16:35:26 2013 -0500 +++ b/gameServer/HWProtoInRoomState.hs Fri Jan 25 12:59:06 2013 +0400 @@ -97,7 +97,6 @@ handleCmd_inRoom ["REMOVE_TEAM", tName] = do (ci, _) <- ask r <- thisRoom - clNick <- clientNick let maybeTeam = findTeam r let team = fromJust maybeTeam @@ -105,7 +104,7 @@ return $ if isNothing $ maybeTeam then [Warning $ loc "REMOVE_TEAM: no such team"] - else if clNick /= teamowner team then + else if ci /= teamownerId team then [ProtocolError $ loc "Not team owner!"] else [RemoveTeam tName, @@ -116,7 +115,7 @@ }) ] where - anotherTeamClan ci = teamcolor . fromJust . find (\t -> teamownerId t == ci) . teams + anotherTeamClan ci = teamcolor . fromJust . find (\t -> (teamownerId t == ci) && (t /= team)) . teams findTeam = find (\t -> tName == teamname t) . teams