Defs: Fix the off-by-one error when printing line numbers.

git-svn-id: https://svn.eduke32.com/eduke32@5906 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-10-23 19:47:23 +00:00
parent d4640b1806
commit 94f615cc52

View file

@ -194,7 +194,7 @@ int32_t scriptfile_getlinum(const scriptfile *sf, const char *ptr)
for (stp=1; stp+stp<sf->linenum; stp+=stp) { } //stp = highest power of 2 less than sf->linenum
for (i=0; stp; stp>>=1)
if ((i+stp < sf->linenum) && (sf->lineoffs[i+stp] < ind)) i += stp;
if ((i+stp-1 < sf->linenum) && (sf->lineoffs[i+stp-1] < ind)) i += stp;
return i+1; //i = index to highest lineoffs which is less than ind; convert to 1-based line numbers
}