hedgewars/uIO.pas
changeset 10343 fe9853dea6c4
parent 10307 e13d3147f15b
child 10349 a51de45dcc42
equal deleted inserted replaced
10342:16122539d2ea 10343:fe9853dea6c4
   219 end;
   219 end;
   220 
   220 
   221 function isSyncedCommand(c: char): boolean;
   221 function isSyncedCommand(c: char): boolean;
   222 begin
   222 begin
   223     case c of
   223     case c of
   224         '+', '#', 'L', 'l', 'R', 'r', 'U', 'u', 'D', 'd', 'Z', 'z', 'A', 'a', 'S', 'j', 'J', ',', 'c', 'N', 'p', 'P', 'w', 't', '1', '2', '3', '4', '5': isSyncedCommand:= true;
   224     '+', '#', 'L', 'l', 'R', 'r', 'U'
       
   225     , 'u', 'D', 'd', 'Z', 'z', 'A', 'a'
       
   226     , 'S', 'j', 'J', ',', 'c', 'N', 'p'
       
   227     , 'P', 'w', 't', '1', '2', '3', '4'
       
   228     , '5', 'f', 'g': isSyncedCommand:= true;
   225     else
   229     else
   226         isSyncedCommand:= ((byte(c) >= 128) and (byte(c) <= 128 + cMaxSlotIndex))
   230         isSyncedCommand:= ((byte(c) >= 128) and (byte(c) <= 128 + cMaxSlotIndex))
   227     end
   231     end
   228 end;
   232 end;
   229 
   233 
   322     and ((GameTicks = hiTicks shl 16 + headcmd^.loTime)
   326     and ((GameTicks = hiTicks shl 16 + headcmd^.loTime)
   323         or (headcmd^.cmd = 's') // for these commands time is not specified
   327         or (headcmd^.cmd = 's') // for these commands time is not specified
   324         or (headcmd^.cmd = 'h') // seems the hedgewars protocol does not allow remote synced commands
   328         or (headcmd^.cmd = 'h') // seems the hedgewars protocol does not allow remote synced commands
   325         or (headcmd^.cmd = '#') // must be synced for saves to work
   329         or (headcmd^.cmd = '#') // must be synced for saves to work
   326         or (headcmd^.cmd = 'b')
   330         or (headcmd^.cmd = 'b')
   327         or (headcmd^.cmd = 'F')) do
   331         or (headcmd^.cmd = 'F')
       
   332         or (headcmd^.cmd = 'G')) do
   328     begin
   333     begin
   329     case headcmd^.cmd of
   334     case headcmd^.cmd of
   330         '+': ; // do nothing - it is just an empty packet
   335         '+': ; // do nothing - it is just an empty packet
   331         '#': begin
   336         '#': begin
   332             AddFileLog('hiTicks increment by remote message');
   337             AddFileLog('hiTicks increment by remote message');
   360         'b': begin
   365         'b': begin
   361             s:= copy(headcmd^.str, 2, Pred(headcmd^.len));
   366             s:= copy(headcmd^.str, 2, Pred(headcmd^.len));
   362             ParseCommand('chatmsg ' + #4 + s, true);
   367             ParseCommand('chatmsg ' + #4 + s, true);
   363             WriteLnToConsole(s)
   368             WriteLnToConsole(s)
   364              end;
   369              end;
   365 // TODO: deprecate 'F'
   370         'F': ParseCommand('teamgone u' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true);
   366         'F': ParseCommand('teamgone ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true);
   371         'G': ParseCommand('teamback u' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true);
       
   372         'f': ParseCommand('teamgone s' + copy(headcmd^.str, 2, headcmd^.len - 3), true);
       
   373         'g': ParseCommand('teamback s' + copy(headcmd^.str, 2, headcmd^.len - 3), true);
   367         'N': begin
   374         'N': begin
   368             tmpflag:= false;
   375             tmpflag:= false;
   369             lastTurnChecksum:= SDLNet_Read32(@headcmd^.str[2]);
   376             lastTurnChecksum:= SDLNet_Read32(@headcmd^.str[2]);
   370             AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime))
   377             AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime))
   371              end;
   378              end;