equal
deleted
inserted
replaced
|
1 {- |
|
2 * Hedgewars, a free turn based strategy game |
|
3 * Copyright (c) 2004-2014 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation; version 2 of the License |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
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 |
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
17 \-} |
|
18 |
1 {-# LANGUAGE OverloadedStrings #-} |
19 {-# LANGUAGE OverloadedStrings #-} |
2 module HWProtoInRoomState where |
20 module HWProtoInRoomState where |
3 |
21 |
4 import qualified Data.Map as Map |
22 import qualified Data.Map as Map |
5 import Data.List as L |
23 import Data.List as L |
265 -- compatibility with clients with protocol < 38 |
283 -- compatibility with clients with protocol < 38 |
266 handleCmd_inRoom ["ROUNDFINISHED"] = |
284 handleCmd_inRoom ["ROUNDFINISHED"] = |
267 handleCmd_inRoom ["ROUNDFINISHED", "1"] |
285 handleCmd_inRoom ["ROUNDFINISHED", "1"] |
268 |
286 |
269 handleCmd_inRoom ["TOGGLE_RESTRICT_JOINS"] = roomAdminOnly $ |
287 handleCmd_inRoom ["TOGGLE_RESTRICT_JOINS"] = roomAdminOnly $ |
270 return [ModifyRoom (\r -> r{isRestrictedJoins = not $ isRestrictedJoins r})] |
288 return [ModifyRoom (\r -> r{isRestrictedJoins = not $ isRestrictedJoins r}), SendUpdateOnThisRoom] |
271 |
289 |
272 |
290 |
273 handleCmd_inRoom ["TOGGLE_RESTRICT_TEAMS"] = roomAdminOnly $ |
291 handleCmd_inRoom ["TOGGLE_RESTRICT_TEAMS"] = roomAdminOnly $ |
274 return [ModifyRoom (\r -> r{isRestrictedTeams = not $ isRestrictedTeams r})] |
292 return [ModifyRoom (\r -> r{isRestrictedTeams = not $ isRestrictedTeams r})] |
275 |
293 |
276 |
294 |
277 handleCmd_inRoom ["TOGGLE_REGISTERED_ONLY"] = roomAdminOnly $ |
295 handleCmd_inRoom ["TOGGLE_REGISTERED_ONLY"] = roomAdminOnly $ |
278 return [ModifyRoom (\r -> r{isRegisteredOnly = not $ isRegisteredOnly r})] |
296 return [ModifyRoom (\r -> r{isRegisteredOnly = not $ isRegisteredOnly r}), SendUpdateOnThisRoom] |
279 |
297 |
280 |
298 |
281 handleCmd_inRoom ["ROOM_NAME", newName] = roomAdminOnly $ do |
299 handleCmd_inRoom ["ROOM_NAME", newName] = roomAdminOnly $ do |
282 cl <- thisClient |
300 cl <- thisClient |
283 rs <- allRoomInfos |
301 rs <- allRoomInfos |