hedgewars/uUtils.pas
branchios-develop
changeset 13418 ba39a1d396c0
parent 13317 092adcf707c5
child 13826 94d0d1ab7a0e
equal deleted inserted replaced
13416:6e8b807bda4b 13418:ba39a1d396c0
   214 procedure SplitBySpace(var a,b: shortstring);
   214 procedure SplitBySpace(var a,b: shortstring);
   215 begin
   215 begin
   216 SplitByChar(a,b,' ');
   216 SplitByChar(a,b,' ');
   217 end;
   217 end;
   218 
   218 
   219 // should this include "strtolower()" for the split string?
       
   220 procedure SplitByChar(var a, b: shortstring; c : char);
   219 procedure SplitByChar(var a, b: shortstring; c : char);
   221 var i, t: LongInt;
   220 var i: LongInt;
   222 begin
   221 begin
   223 i:= Pos(c, a);
   222 i:= Pos(c, a);
   224 if i > 0 then
   223 if i > 0 then
   225     begin
   224     begin
   226     for t:= 1 to Pred(i) do
       
   227         if (a[t] >= 'A')and(a[t] <= 'Z') then
       
   228             Inc(a[t], 32);
       
   229     b:= copy(a, i + 1, Length(a) - i);
   225     b:= copy(a, i + 1, Length(a) - i);
   230     a[0]:= char(Pred(i))
   226     a[0]:= char(Pred(i))
   231     {$IFDEF PAS2C}
   227     {$IFDEF PAS2C}
   232        a[i] := 0;
   228        a[i] := 0;
   233     {$ENDIF}
   229     {$ENDIF}
   753 end;
   749 end;
   754 
   750 
   755 procedure freeModule;
   751 procedure freeModule;
   756 begin
   752 begin
   757 {$IFDEF DEBUGFILE}
   753 {$IFDEF DEBUGFILE}
       
   754 if logFile <> nil then
       
   755     begin
   758     pfsWriteLn(logFile, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft));
   756     pfsWriteLn(logFile, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft));
   759     pfsFlush(logFile);
   757     pfsFlush(logFile);
   760     pfsClose(logFile);
   758     pfsClose(logFile);
       
   759     end
       
   760 else
       
   761     WriteLn(stdout, 'halt at ' + inttostr(GameTicks) + ' ticks. TurnTimeLeft = ' + inttostr(TurnTimeLeft));
   761 {$IFDEF USE_VIDEO_RECORDING}
   762 {$IFDEF USE_VIDEO_RECORDING}
   762     DoneCriticalSection(logMutex);
   763     DoneCriticalSection(logMutex);
   763 {$ENDIF}
   764 {$ENDIF}
   764 {$ENDIF}
   765 {$ENDIF}
   765 end;
   766 end;