gameServer/CoreTypes.hs
changeset 11320 556eafd1443a
parent 11265 35e359585dea
child 11464 a9957113404a
equal deleted inserted replaced
11319:3c4ec0742967 11320:556eafd1443a
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    17  \-}
    17  \-}
    18 
    18 
    19 {-# LANGUAGE CPP, OverloadedStrings, DeriveDataTypeable #-}
    19 {-# LANGUAGE CPP, OverloadedStrings, DeriveDataTypeable, GeneralizedNewtypeDeriving #-}
    20 module CoreTypes where
    20 module CoreTypes where
    21 
    21 
    22 import Control.Concurrent
    22 import Control.Concurrent
    23 import Data.Word
    23 import Data.Word
    24 import qualified Data.Map as Map
    24 import qualified Data.Map as Map
   118 data CheckInfo =
   118 data CheckInfo =
   119     CheckInfo
   119     CheckInfo
   120     {
   120     {
   121         recordFileName :: String,
   121         recordFileName :: String,
   122         recordTeams :: [TeamInfo],
   122         recordTeams :: [TeamInfo],
   123         recordScript :: B.ByteString
   123         details :: Maybe GameDetails
   124     }
   124     }
   125 
   125 
   126 data ClientInfo =
   126 data ClientInfo =
   127     ClientInfo
   127     ClientInfo
   128     {
   128     {
   344 
   344 
   345 data DBQuery =
   345 data DBQuery =
   346     CheckAccount ClientIndex Int B.ByteString B.ByteString
   346     CheckAccount ClientIndex Int B.ByteString B.ByteString
   347     | ClearCache
   347     | ClearCache
   348     | SendStats Int Int
   348     | SendStats Int Int
   349     | StoreAchievements Word16 B.ByteString [(B.ByteString, B.ByteString)] B.ByteString [B.ByteString]
   349     | StoreAchievements Word16 B.ByteString [(B.ByteString, B.ByteString)] GameDetails [B.ByteString]
   350     | GetReplayName ClientIndex Int B.ByteString
   350     | GetReplayName ClientIndex Int B.ByteString
   351     deriving (Show, Read)
   351     deriving (Show, Read)
       
   352 
       
   353 data GameDetails =
       
   354     GameDetails {
       
   355         gameScript :: B.ByteString
       
   356         , infRope
       
   357         , isVamp
       
   358         , infAttacks :: Bool
       
   359     } deriving (Show, Read)
       
   360 
       
   361 instance NFData GameDetails where
       
   362     rnf (GameDetails a b c d) = a `deepseq` b `deepseq` c `deepseq` d `deepseq` ()
   352 
   363 
   353 data CoreMessage =
   364 data CoreMessage =
   354     Accept ClientInfo
   365     Accept ClientInfo
   355     | ClientMessage (ClientIndex, [B.ByteString])
   366     | ClientMessage (ClientIndex, [B.ByteString])
   356     | ClientAccountInfo ClientIndex Int AccountInfo
   367     | ClientAccountInfo ClientIndex Int AccountInfo