author | unc0rr |
Sat, 21 Nov 2015 00:42:11 +0300 | |
branch | qmlfrontend |
changeset 11424 | 8a5cc31483c6 |
parent 11423 | 091149424aa4 |
child 11425 | ef7f8ac96dfa |
--- a/hedgewars/uFLNet.pas Fri Nov 20 23:56:13 2015 +0300 +++ b/hedgewars/uFLNet.pas Sat Nov 21 00:42:11 2015 +0300 @@ -41,7 +41,7 @@ 'N', 'E', 'D', #10, 'I', 'N', 'G', #10, 'K', 'I', 'C', 'K', 'E', 'D', #10, 'L', 'E', 'F', 'T', #10, 'O', 'B', 'B', 'Y', ':', 'J', 'O', 'I', 'N', 'E', 'D', #10, 'L', 'E', 'F', 'T', #10, 'N', 'I', 'C', 'K', #10, 'O', 'T', 'I', 'C', 'E', #10, - 'P', 'I', 'N', 'G', #10, 'R', 'O', 'T', 'O', #10, 'R', 'O', 'O', 'M', #10, 'S', + 'P', 'I', 'N', 'G', #10, 'R', 'O', 'T', 'O', #10, 'R', 'O', 'O', 'M', 'S', #10, #10, 'U', 'N', 'D', '_', 'F', 'I', 'N', 'I', 'S', 'H', 'E', 'D', #10, 'U', 'N', '_', 'G', 'A', 'M', 'E', #10, 'S', 'E', 'R', 'V', 'E', 'R', '_', 'A', 'U', 'T', 'H', #10, 'M', 'E', 'S', 'S', 'A', 'G', 'E', #10, 'V', 'A', 'R', 'S', #10, 'T', @@ -53,8 +53,8 @@ 0, 0, 0, 0, 0, -32, 5, 0, 0, 0, -31, 11, 0, 0, 0, 3, 0, -30, 0, 0, 0, -29, 7, 0, 0, 0, 0, 0, -28, 22, 4, 0, 0, -27, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, -26, 0, 0, 0, 0, -25, 11, 4, 0, 0, -24, 0, 0, 0, 0, 0, -23, 10, 4, 0, 0, -22, 0, 0, 0, 0, - -21, 28, 19, 5, 2, -20, 0, -19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -18, 0, 0, - 0, 0, 0, 0, 0, -17, 25, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, -16, 8, 0, 0, 0, 0, 0, 0, + -21, 28, 19, 5, 3, 1, -20, -19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -18, 0, 0, 0, + 0, 0, 0, 0, -17, 25, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, -16, 8, 0, 0, 0, 0, 0, 0, -15, 0, 0, 0, 0, -14, 20, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, -13, 0, 0, 0, 0, 0, -12, 8, 0, 0, 0, 0, 0, 0, -11, 0, -10); @@ -134,6 +134,7 @@ procedure handler__UNKNOWN_; begin writeln('[NET] Unknown cmd'); + handleTail() end; const handlers: array[0..30] of PHandler = (@handler__UNKNOWN_, @handler_L, @handler_MS, @handler_S, @@ -230,8 +231,7 @@ inc(state.l) else begin - handler__UNKNOWN_(); - handleTail() + handler__UNKNOWN_() end end until state.netState = netDisconnected;
--- a/hedgewars/uFLNetProtocol.pas Fri Nov 20 23:56:13 2015 +0300 +++ b/hedgewars/uFLNetProtocol.pas Sat Nov 21 00:42:11 2015 +0300 @@ -108,6 +108,8 @@ procedure handler_LOBBY_JOINED_s(var s: TCmdParamS); begin + if s.str1 = 'qmlfrontend' then sendNet('LIST'); + sendUI(mtAddLobbyClient, @s.str1[1], length(s.str1)); end; @@ -169,7 +171,7 @@ if roomLinesCount = raRoomInfoLength[roomAction] then begin - sendUI(raRoomAction[roomAction], @roomInfo[1], length(roomInfo)); + sendUI(raRoomAction[roomAction], @roomInfo[1], length(roomInfo) - 1); roomLinesCount:= 0; roomInfo:= '' end;
--- a/qmlFrontend/hwengine.cpp Fri Nov 20 23:56:13 2015 +0300 +++ b/qmlFrontend/hwengine.cpp Sat Nov 21 00:42:11 2015 +0300 @@ -208,6 +208,7 @@ break; } case MSG_REMOVEROOM: { + emit roomRemoved(QString::fromUtf8(msg)); break; } }
--- a/qmlFrontend/hwengine.h Fri Nov 20 23:56:13 2015 +0300 +++ b/qmlFrontend/hwengine.h Sat Nov 21 00:42:11 2015 +0300 @@ -64,6 +64,7 @@ , const QString & script , const QString & scheme , const QString & weapons); + void roomRemoved(const QString & name); public slots:
--- a/qmlFrontend/qml/qmlFrontend/LobbyPage.qml Fri Nov 20 23:56:13 2015 +0300 +++ b/qmlFrontend/qml/qmlFrontend/LobbyPage.qml Sat Nov 21 00:42:11 2015 +0300 @@ -65,6 +65,12 @@ , "scheme": scheme , "weapons": weapons }) + onRoomRemoved: { + var i = roomsListModel.count - 1; + while ((i >= 0) && (roomsListModel.get(i).name !== name)) --i + + if(i >= 0) roomsListModel.remove(i, 1) + } } }
--- a/tools/protocolParser.hs Fri Nov 20 23:56:13 2015 +0300 +++ b/tools/protocolParser.hs Sat Nov 21 00:42:11 2015 +0300 @@ -120,10 +120,14 @@ emptyNamed = partition (\(_, (PTCommand n _:_)) -> null n) assocs assocs = groupByFirstChar cmds subtree = map buildsub assocs + buildsub :: (Char, [ParseTree]) -> ParseTree buildsub (c, cmds) = let st = bpt cmds in if null $ drop 1 st then maybeMerge c st else PTPrefix [c] st maybeMerge c cmd@[PTCommand {}] = PTPrefix [c] cmd maybeMerge c cmd@[PTPrefix s ss] = PTPrefix (c:s) ss - cmdLeaf ([(c, (hwc:assocs1))], assocs2) = (PTPrefix [c] [hwc]) : (bpt assocs1 ++ map buildsub assocs2) + maybeMerge c [] = PTPrefix [c] [] + cmdLeaf ([(c, hwc:assocs1)], assocs2) + | null assocs1 = PTPrefix [c] [hwc] : map buildsub assocs2 + | otherwise = [buildsub (c, assocs1)] ++ [PTPrefix [] [hwc]] ++ map buildsub assocs2 dumpTree = vcat . map dt where