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
					
				
					 1 changed files with 8 additions and 5 deletions
				
			
		|  | @ -355,10 +355,12 @@ def TestFreeRows(rows, c, row, width, height, bottomReserved, lifetime): | |||
|     rowmax = height-bottomReserved-c[7] | ||||
|     if c[4] in (1, 2): | ||||
|         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 | ||||
|             row += 1 | ||||
|             res += 1 | ||||
|             while rows[c[4]][row] == targetRow: | ||||
|                 row += 1 | ||||
|                 res += 1 | ||||
|     else: | ||||
|         try: | ||||
|             thresholdTime = c[0]-lifetime*(1-width/(c[8]+width)) | ||||
|  | @ -371,8 +373,9 @@ def TestFreeRows(rows, c, row, width, height, bottomReserved, lifetime): | |||
|                     break | ||||
|             except ZeroDivisionError: | ||||
|                 pass | ||||
|             row += 1 | ||||
|             res += 1 | ||||
|             while rows[c[4]][row] == targetRow: | ||||
|                 row += 1 | ||||
|                 res += 1 | ||||
|     return res | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Star Brilliant
						Star Brilliant