Throw away stupid Data.Seq
authorunc0rr
Thu, 10 Jan 2013 22:54:55 +0400
changeset 8369 31033e521653
parent 8368 6feae8073965
child 8370 0c79946e96f8
Throw away stupid Data.Seq
gameServer/Actions.hs
gameServer/CoreTypes.hs
gameServer/HWProtoInRoomState.hs
gameServer/HWProtoLobbyState.hs
--- a/gameServer/Actions.hs	Wed Jan 09 10:16:10 2013 +0400
+++ b/gameServer/Actions.hs	Thu Jan 10 22:54:55 2013 +0400
@@ -4,7 +4,6 @@
 
 import Control.Concurrent
 import qualified Data.Set as Set
-import qualified Data.Sequence as Seq
 import qualified Data.List as L
 import qualified Control.Exception as Exception
 import System.Log.Logger
@@ -374,7 +373,7 @@
         ModifyRoom (\r -> r{
                 gameInfo = liftM (\g -> g{
                     teamsInGameNumber = teamsInGameNumber g - 1
-                    , roundMsgs = roundMsgs g Seq.|> rmTeamMsg
+                    , roundMsgs = rmTeamMsg : roundMsgs g
                 }) $ gameInfo r
             })
         ]
--- a/gameServer/CoreTypes.hs	Wed Jan 09 10:16:10 2013 +0400
+++ b/gameServer/CoreTypes.hs	Thu Jan 10 22:54:55 2013 +0400
@@ -4,7 +4,6 @@
 import Control.Concurrent
 import Data.Word
 import qualified Data.Map as Map
-import Data.Sequence(Seq, empty)
 import Data.Time
 import Network
 import Data.Function
@@ -68,7 +67,7 @@
 data GameInfo =
     GameInfo
     {
-        roundMsgs :: Seq B.ByteString,
+        roundMsgs :: [B.ByteString],
         leftTeams :: [B.ByteString],
         teamsAtStart :: [TeamInfo],
         teamsInGameNumber :: Int,
@@ -85,7 +84,7 @@
                 -> GameInfo
 newGameInfo =
     GameInfo
-        Data.Sequence.empty
+        []
         []
 
 data RoomInfo =
--- a/gameServer/HWProtoInRoomState.hs	Wed Jan 09 10:16:10 2013 +0400
+++ b/gameServer/HWProtoInRoomState.hs	Thu Jan 10 22:54:55 2013 +0400
@@ -2,13 +2,11 @@
 module HWProtoInRoomState where
 
 import qualified Data.Map as Map
-import Data.Sequence((|>))
 import Data.List as L
 import Data.Maybe
 import qualified Data.ByteString.Char8 as B
 import Control.Monad
 import Control.Monad.Reader
-import Control.DeepSeq
 --------------------------------------
 import CoreTypes
 import Actions
@@ -214,7 +212,8 @@
     chans <- roomOthersChans
 
     if teamsInGame cl > 0 && (isJust $ gameInfo rm) && isLegal then
-        return $ AnswerClients chans ["EM", msg] : [ModifyRoom (\r -> r{gameInfo = liftM (\g -> g{roundMsgs = roundMsgs g |> msg}) $ gameInfo r}) | not isKeepAlive]
+        return $ AnswerClients chans ["EM", msg]
+            : [ModifyRoom (\r -> r{gameInfo = liftM (\g -> g{roundMsgs = msg : roundMsgs g}) $ gameInfo r}) | not isKeepAlive]
         else
         return []
     where
--- a/gameServer/HWProtoLobbyState.hs	Wed Jan 09 10:16:10 2013 +0400
+++ b/gameServer/HWProtoLobbyState.hs	Thu Jan 10 22:54:55 2013 +0400
@@ -2,11 +2,9 @@
 module HWProtoLobbyState where
 
 import qualified Data.Map as Map
-import qualified Data.Foldable as Foldable
 import Data.Maybe
 import Data.List
 import Control.Monad.Reader
-import qualified Data.ByteString.Char8 as B
 --------------------------------------
 import CoreTypes
 import Actions
@@ -128,7 +126,7 @@
                     [AnswerClients [sendChan cl]  ["RUN_GAME"]
                     , AnswerClients chans ["CLIENT_FLAGS", "+g", nick cl]
                     , ModifyClient (\c -> c{isInGame = True})
-                    , AnswerClients [sendChan cl] $ "EM" : toEngineMsg "e$spectate 1" : Foldable.toList (roundMsgs . fromJust . gameInfo $ jRoom)]
+                    , AnswerClients [sendChan cl] $ "EM" : toEngineMsg "e$spectate 1" : (reverse . roundMsgs . fromJust . gameInfo $ jRoom)]
 
 
 handleCmd_lobby ["JOIN_ROOM", roomName] =