- Allow 8 teams in game on 0.9.16-dev
authorunc0rr
Fri, 16 Sep 2011 19:55:11 +0400
changeset 5931 184057074257
parent 5930 89f5f5d3fdec
child 5933 97c240202986
- Allow 8 teams in game on 0.9.16-dev - Move protocol version check from FOLLOW to JOIN_ROOM
gameServer/HWProtoInRoomState.hs
gameServer/HWProtoLobbyState.hs
--- a/gameServer/HWProtoInRoomState.hs	Fri Sep 16 10:29:09 2011 -0400
+++ b/gameServer/HWProtoInRoomState.hs	Fri Sep 16 19:55:11 2011 +0400
@@ -52,7 +52,7 @@
         clChan <- thisClientChans
         othChans <- roomOthersChans
         return $
-            if not . null . drop 5 $ teams rm then
+            if not . null . drop (maxTeams rm - 1) $ teams rm then
                 [Warning "too many teams"]
             else if canAddNumber rm <= 0 then
                 [Warning "too many hedgehogs"]
@@ -78,6 +78,10 @@
         hhsList [_] = error "Hedgehogs list with odd elements number"
         hhsList (n:h:hhs) = HedgehogInfo n h : hhsList hhs
         newTeamHHNum r = min 4 (canAddNumber r)
+        maxTeams r 
+            | roomProto r < 38 = 6
+            | otherwise = 8
+                
 
 handleCmd_inRoom ["REMOVE_TEAM", tName] = do
         (ci, _) <- ask
--- a/gameServer/HWProtoLobbyState.hs	Fri Sep 16 10:29:09 2011 -0400
+++ b/gameServer/HWProtoLobbyState.hs	Fri Sep 16 19:55:11 2011 +0400
@@ -75,11 +75,12 @@
     let maybeRI = find (\ri -> roomName == name (irnc `room` ri)) ris
     let jRI = fromJust maybeRI
     let jRoom = irnc `room` jRI
+    let sameProto = clientProto cl == roomProto jRoom
     let jRoomClients = map (client irnc) $ roomClients irnc jRI
     let nicks = map nick jRoomClients
     let chans = map sendChan (cl : jRoomClients)
     return $
-        if isNothing maybeRI then 
+        if isNothing maybeRI || not sameProto then 
             [Warning "No such rooms"]
             else if isRestrictedJoins jRoom then
             [Warning "Joining restricted"]
@@ -135,7 +136,7 @@
     cl <- thisClient
     let ri = clientRoom rnc $ fromJust ci
     let clRoom = room rnc ri
-    if isNothing ci || ri == lobbyId || clientProto cl /= roomProto clRoom then
+    if isNothing ci || ri == lobbyId then
         return []
         else
         handleCmd_lobby ["JOIN_ROOM", name clRoom]