Optimize TestFreeRow
This commit has not fully tested yet. If you experience problems, please submit an issue.
This commit is contained in:
parent
136e61556a
commit
71776baccc
@ -355,10 +355,12 @@ def TestFreeRows(rows, c, row, width, height, bottomReserved, lifetime):
|
|||||||
rowmax = height-bottomReserved-c[7]
|
rowmax = height-bottomReserved-c[7]
|
||||||
if c[4] in (1, 2):
|
if c[4] in (1, 2):
|
||||||
while row < rowmax and res < c[7]:
|
while row < rowmax and res < c[7]:
|
||||||
if rows[c[4]][row] and rows[c[4]][row][0]+lifetime > c[0]:
|
targetRow = rows[c[4]][row]
|
||||||
|
if targetRow and targetRow[0]+lifetime > c[0]:
|
||||||
break
|
break
|
||||||
row += 1
|
while rows[c[4]][row] == targetRow:
|
||||||
res += 1
|
row += 1
|
||||||
|
res += 1
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
thresholdTime = c[0]-lifetime*(1-width/(c[8]+width))
|
thresholdTime = c[0]-lifetime*(1-width/(c[8]+width))
|
||||||
@ -371,8 +373,9 @@ def TestFreeRows(rows, c, row, width, height, bottomReserved, lifetime):
|
|||||||
break
|
break
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
pass
|
pass
|
||||||
row += 1
|
while rows[c[4]][row] == targetRow:
|
||||||
res += 1
|
row += 1
|
||||||
|
res += 1
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user