GameServer: Turn some messages into warnings
authorWuzzy <Wuzzy2@mail.ru>
Sat, 03 Nov 2018 15:17:46 +0100
changeset 14122 d6915d15b6de
parent 14121 83bd383e6d11
child 14123 589a752c01ca
GameServer: Turn some messages into warnings
gameServer/HWProtoInRoomState.hs
gameServer/Votes.hs
--- a/gameServer/HWProtoInRoomState.hs	Sat Nov 03 16:20:31 2018 +0300
+++ b/gameServer/HWProtoInRoomState.hs	Sat Nov 03 15:17:46 2018 +0100
@@ -411,7 +411,7 @@
     if not $ isMaster cl then
         return [Warning $ loc "You're not the room master!"]
     else if m < 2 || m > cMaxTeams then
-        return [AnswerClients [sendChan cl] ["CHAT", nickServer, loc "/maxteams: specify number from 2 to 8"]]
+        return [Warning $ loc "/maxteams: specify number from 2 to 8"]
     else
         return [ModifyRoom (\r -> r{teamsNumberLimit = m})]
 
@@ -457,12 +457,12 @@
     cl <- thisClient
     rm <- thisRoom
     return
-        [AnswerClients [sendChan cl] ["CHAT", nickServer,
+        [Warning $
         if isJust $ masterID rm then
             loc "/callvote kick: This is only allowed in rooms without a room master."
         else
             loc "/callvote kick: You need to specify a nickname."
-        ]]
+        ]
 
 handleCmd_inRoom ["CALLVOTE", "KICK", nickname] = do
     (thisClientId, rnc) <- ask
@@ -473,12 +473,12 @@
     let sameRoom = clientRoom rnc thisClientId == clientRoom rnc kickId
 
     if isJust $ masterID rm then
-        return [AnswerClients [sendChan cl] ["CHAT", nickServer, loc "/callvote kick: This is only allowed in rooms without a room master."]]
+        return [Warning $ loc "/callvote kick: This is only allowed in rooms without a room master."]
         else
         if isJust maybeClientId && sameRoom then
             startVote $ VoteKick nickname
             else
-            return [AnswerClients [sendChan cl] ["CHAT", nickServer, loc "/callvote kick: No such user!"]]
+            return [Warning $ loc "/callvote kick: No such user!"]
 
 
 handleCmd_inRoom ["CALLVOTE", "MAP"] = do
@@ -501,7 +501,7 @@
     if Map.member roomSave $ roomSaves rm then
         startVote $ VoteMap roomSave
         else
-        return [AnswerClients [sendChan cl] ["CHAT", nickServer, loc "/callvote map: No such map!"]]
+        return [Warning $ loc "/callvote map: No such map!"]
 
 
 handleCmd_inRoom ["CALLVOTE", "PAUSE"] = do
@@ -511,7 +511,7 @@
     if isJust $ gameInfo rm then
         startVote VotePause
         else 
-        return [AnswerClients [sendChan cl] ["CHAT", nickServer, loc "/callvote pause: No game in progress!"]]
+        return [Warning $ loc "/callvote pause: No game in progress!"]
 
 handleCmd_inRoom ["CALLVOTE", "PAUSE", _] = handleCmd_inRoom ["CALLVOTE", "PAUSE"]
 
@@ -522,7 +522,7 @@
 
 handleCmd_inRoom ["CALLVOTE", "HEDGEHOGS"] = do
     cl <- thisClient
-    return [AnswerClients [sendChan cl] ["CHAT", nickServer, loc "/callvote hedgehogs: Specify number from 1 to 8."]]
+    return [Warning $ loc "/callvote hedgehogs: Specify number from 1 to 8."]
 
 
 handleCmd_inRoom ["CALLVOTE", "HEDGEHOGS", hhs] = do
@@ -532,7 +532,7 @@
     if h > 0 && h <= cHogsPerTeam then
         startVote $ VoteHedgehogsPerTeam h
         else
-        return [AnswerClients [sendChan cl] ["CHAT", nickServer, loc "/callvote hedgehogs: Specify number from 1 to 8."]]
+        return [Warning $ loc "/callvote hedgehogs: Specify number from 1 to 8."]
 
 handleCmd_inRoom ["CALLVOTE", _] = handleCmd_inRoom ["CALLVOTE"]
 handleCmd_inRoom ["CALLVOTE", _, _] = handleCmd_inRoom ["CALLVOTE"]
@@ -543,12 +543,12 @@
     if isJust b then
         voted (p == ["FORCE"]) (fromJust b)
     else
-        return [AnswerClients [sendChan cl] ["CHAT", nickServer,
+        return [Warning $
             if (p == ["FORCE"]) then
                 loc "/force: Please use 'yes' or 'no'."
             else
                 loc "/vote: Please use 'yes' or 'no'."
-        ]]
+        ]
 
 
 handleCmd_inRoom ["SAVE", stateName, location] = serverAdminOnly $ do
--- a/gameServer/Votes.hs	Sat Nov 03 16:20:31 2018 +0300
+++ b/gameServer/Votes.hs	Sat Nov 03 15:17:46 2018 +0100
@@ -43,12 +43,12 @@
 
     case voting rm of
         Nothing -> 
-            return [AnswerClients [sendChan cl] ["CHAT", nickServer, loc "There's no voting going on."]]
+            return [Warning $ loc "There's no voting going on."]
         Just voting ->
             if (not forced) && (uid `L.notElem` entitledToVote voting) then
                 return []
             else if (not forced) && (uid `L.elem` map fst (votes voting)) then
-                return [AnswerClients [sendChan cl] ["CHAT", nickServer, loc "You already have voted."]]
+                return [Warning $ loc "You already have voted."]
             else if forced && (not $ isAdministrator cl) then
                 return []
             else