author | unC0Rr |
Tue, 03 Sep 2024 13:56:35 +0200 | |
branch | transitional_engine |
changeset 16029 | 9cbd18220eb7 |
parent 15983 | 2c92499daa67 |
permissions | -rw-r--r-- |
10460
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
1 |
{- |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
10460
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
4 |
* |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
8 |
* |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
12 |
* GNU General Public License for more details. |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
13 |
* |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
17 |
\-} |
8dcea9087d75
Added copyrights to gameServer directory
Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
parents:
10212
diff
changeset
|
18 |
|
8479
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
19 |
{-# LANGUAGE OverloadedStrings #-} |
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
20 |
module HWProtoChecker where |
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
21 |
|
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
22 |
import Data.Maybe |
15983 | 23 |
import Control.Monad |
8479
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
24 |
import Control.Monad.Reader |
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
25 |
-------------------------------------- |
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
26 |
import CoreTypes |
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
27 |
import HandlerUtils |
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
28 |
|
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
29 |
|
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
30 |
handleCmd_checker :: CmdHandler |
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
31 |
|
9433 | 32 |
handleCmd_checker ["READY"] = return [ModifyClient $ \c -> c{isReady = True}, CheckRecord] |
8479
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
33 |
|
8507 | 34 |
handleCmd_checker ["CHECKED", "FAIL", msg] = do |
35 |
isChecking <- liftM (isJust . checkInfo) thisClient |
|
36 |
if not isChecking then |
|
37 |
return [] |
|
38 |
else |
|
9444 | 39 |
return [CheckFailed msg, ModifyClient $ \c -> c{checkInfo = Nothing}] |
8507 | 40 |
|
41 |
||
42 |
handleCmd_checker ("CHECKED" : "OK" : info) = do |
|
43 |
isChecking <- liftM (isJust . checkInfo) thisClient |
|
44 |
if not isChecking then |
|
45 |
return [] |
|
46 |
else |
|
9444 | 47 |
return [CheckSuccess info, ModifyClient $ \c -> c{checkInfo = Nothing}] |
8507 | 48 |
|
8479
8d71109b04d2
Some work on loading replay and interaction with checker
unc0rr
parents:
diff
changeset
|
49 |
handleCmd_checker _ = return [ProtocolError "Unknown command"] |