diff -r 6adf27e85cae -r 93e6c401cc3d hedgewars/uFLNet.pas --- a/hedgewars/uFLNet.pas Fri Jul 15 22:39:07 2016 +0300 +++ b/hedgewars/uFLNet.pas Tue Aug 02 23:08:17 2016 +0300 @@ -1,5 +1,6 @@ unit uFLNet; interface +uses SDLh; procedure connectOfficialServer; @@ -7,11 +8,12 @@ procedure freeModule; procedure sendNet(s: shortstring); procedure sendNetLn(s: shortstring); +procedure passToNet(data: PByteArray; len: Longword); var isConnected: boolean = false; implementation -uses SDLh, uFLIPC, uFLTypes, uFLUICallback, uFLNetTypes, uFLUtils; +uses uFLIPC, uFLUICallback, uFLNetTypes, uFLUtils, uFLTypes; const endCmd: shortstring = #10 + #10; @@ -378,7 +380,7 @@ procedure netSendCallback(p: pointer; msg: PChar; len: Longword); begin - // W A R N I N G: totally thread-unsafe due to use of sock variable + // FIXME W A R N I N G: totally thread-unsafe due to use of sock variable SDLNet_TCP_Send(sock, msg, len); end; @@ -397,6 +399,24 @@ SDL_DetachThread(netReaderThread) end; + +procedure passToNet(data: PByteArray; len: Longword); +var i: Longword; +begin + i:= 0; + + while(i < len) do + begin + if data^[i + 1] = ord('s') then + begin + sendUI(mtRoomChatLine, @(data^[i + 2]), data^[i]); + //sendChatLine() + end; + + inc(i, data^[i] + 1); + end; +end; + procedure initModule; begin sock:= nil;