hedgewars/uIO.pas
branchqmlfrontend
changeset 11843 01f88c3b7b66
parent 11634 0af93f018701
child 12855 1b2b84315d27
equal deleted inserted replaced
11842:93e6c401cc3d 11843:01f88c3b7b66
   254     end
   254     end
   255 end;
   255 end;
   256 
   256 
   257 procedure flushBuffer();
   257 procedure flushBuffer();
   258 begin
   258 begin
       
   259     ipcToFrontendRaw(@sendBuffer.buf, sendBuffer.count);
   259     flushDelayTicks:= 0;
   260     flushDelayTicks:= 0;
       
   261     sendBuffer.count:= 0;
   260 end;
   262 end;
   261 
   263 
   262 procedure SendIPC(s: shortstring);
   264 procedure SendIPC(s: shortstring);
   263 begin
   265 begin
   264     if s[0] > #251 then
   266     if s[0] > #251 then
   267     SDLNet_Write16(GameTicks, @s[Succ(byte(s[0]))]);
   269     SDLNet_Write16(GameTicks, @s[Succ(byte(s[0]))]);
   268 
   270 
   269     AddFileLog('[IPC out] '+ sanitizeCharForLog(s[1]));
   271     AddFileLog('[IPC out] '+ sanitizeCharForLog(s[1]));
   270     inc(s[0], 2);
   272     inc(s[0], 2);
   271 
   273 
   272     ipcToFrontend(s)
   274     if isSyncedCommand(s[1]) then
       
   275         begin
       
   276         if sendBuffer.count + byte(s[0]) >= cSendBufferSize then
       
   277             flushBuffer();
       
   278 
       
   279         Move(s, sendBuffer.buf[sendBuffer.count], byte(s[0]) + 1);
       
   280         inc(sendBuffer.count, byte(s[0]) + 1);
       
   281 
       
   282         if (s[1] = 'N') or (s[1] = '#') then
       
   283             flushBuffer();
       
   284         end
       
   285     else
       
   286         ipcToFrontendRaw(@s, Succ(byte(s[0])))
       
   287 
   273 end;
   288 end;
   274 
   289 
   275 procedure SendIPCRaw(p: pointer; len: Longword);
   290 procedure SendIPCRaw(p: pointer; len: Longword);
   276 begin
   291 begin
   277     ipcToFrontendRaw(p, len)
   292     ipcToFrontendRaw(p, len)