hedgewars/uIO.pas
changeset 11537 bf86c6cb9341
parent 11512 bd9a2f1b0080
child 11544 c22d292e7266
equal deleted inserted replaced
11536:d1cf1ff6cabb 11537:bf86c6cb9341
   100 end;
   100 end;
   101 
   101 
   102 procedure RemoveCmd;
   102 procedure RemoveCmd;
   103 var tmp: PCmd;
   103 var tmp: PCmd;
   104 begin
   104 begin
   105 TryDo(headcmd <> nil, 'Engine bug: headcmd = nil', true);
       
   106 tmp:= headcmd;
   105 tmp:= headcmd;
   107 headcmd:= headcmd^.Next;
   106 headcmd:= headcmd^.Next;
   108 if headcmd = nil then
   107 if headcmd = nil then
   109     lastcmd:= nil;
   108     lastcmd:= nil;
   110 dispose(tmp)
   109 dispose(tmp)
   222 // set RDNLY on file open
   221 // set RDNLY on file open
   223 filemode:= 0;
   222 filemode:= 0;
   224 {$I-}
   223 {$I-}
   225 assign(f, fileName);
   224 assign(f, fileName);
   226 reset(f, 1);
   225 reset(f, 1);
   227 tryDo(IOResult = 0, 'Error opening file ' + fileName, true);
   226 if checkFails(IOResult = 0, 'Error opening file ' + fileName, true) then
       
   227     exit;
   228 
   228 
   229 i:= 0; // avoid compiler hints
   229 i:= 0; // avoid compiler hints
   230 s[0]:= #0;
   230 s[0]:= #0;
   231 repeat
   231 repeat
   232     BlockRead(f, s[1], 255 - Length(ss), i);
   232     BlockRead(f, s[1], 255 - Length(ss), i);
   433         end;
   433         end;
   434     RemoveCmd
   434     RemoveCmd
   435     end;
   435     end;
   436 
   436 
   437 if (headcmd <> nil) and tmpflag and (not CurrentTeam^.hasGone) then
   437 if (headcmd <> nil) and tmpflag and (not CurrentTeam^.hasGone) then
   438     TryDo(GameTicks < LongWord(hiTicks shl 16) + headcmd^.loTime,
   438     checkFails(GameTicks < LongWord(hiTicks shl 16) + headcmd^.loTime,
   439             'oops, queue error. in buffer: ' + headcmd^.cmd +
   439             'oops, queue error. in buffer: ' + headcmd^.cmd +
   440             ' (' + IntToStr(GameTicks) + ' > ' +
   440             ' (' + IntToStr(GameTicks) + ' > ' +
   441             IntToStr(hiTicks shl 16 + headcmd^.loTime) + ')',
   441             IntToStr(hiTicks shl 16 + headcmd^.loTime) + ')',
   442             true);
   442             true);
   443 
   443