# HG changeset patch # User sheepluva # Date 1418846504 -3600 # Node ID 97f45f1374be9806225f9b46bafe4cc108f736ae # Parent c3b73dc33294dd354d03e49e6a4906cfbbdb99e4 change speechfix implementation (no "continue" anymore diff -r c3b73dc33294 -r 97f45f1374be hedgewars/uRenderUtils.pas --- a/hedgewars/uRenderUtils.pas Wed Dec 17 19:23:57 2014 +0100 +++ b/hedgewars/uRenderUtils.pas Wed Dec 17 21:01:44 2014 +0100 @@ -306,7 +306,7 @@ function GetNextSpeechLine(s: ansistring; ldelim: char; var startFrom: LongInt; out substr: ansistring): boolean; var p, l, m, r: Integer; - newl : boolean; + newl, skip: boolean; c : char; begin m:= Length(s); @@ -325,19 +325,26 @@ for p:= max(1, startFrom) to m do begin + inc(r); + // read char from source string c:= s[p]; // strip empty lines, spaces and newlines on beginnings of line - if (newl or (p = m)) and ((c = ' ') or (c = ldelim)) then - continue; + skip:= ((newl or (p = m)) and ((c = ' ') or (c = ldelim))); - newl:= (c = ldelim); - if newl then - break; + if (not skip) then + begin + newl:= (c = ldelim); + // stop if we went past the end of the line + if newl then + break; - inc(l); - substr[l]:= c; + // copy current char to output substring + inc(l); + substr[l]:= c; + end; + end; inc(startFrom, r);