1
0
forked from 0ad/0ad

Replace an incorrect math.max() by math.min() in tileclass

Summary:  Patch by smiley fixing 8585040f27

Test Plan:
Check that is the correct fix.
Measure how badly it affected performance.

Reviewers: O14 Maps, elexis, Stan

Reviewed By: O14 Maps, elexis
Subscribers: smiley

Trac Tickets: #4992

Differential Revision: https://code.wildfiregames.com/D2010
This was SVN commit r22635.
This commit is contained in:
FeXoR 2019-08-09 10:47:20 +00:00
parent 8bc31ee0d2
commit d192c160de

View File

@ -126,7 +126,7 @@ TileClass.prototype.countInRadius = function(position, radius, returnMembers)
let dy = iy - position.y;
let xMin = Math.max(Math.floor(position.x - radius), 0);
let xMax = Math.max(Math.ceil(position.x + radius), this.size - 1);
let xMax = Math.min(Math.ceil(position.x + radius), this.size - 1);
for (let ix = xMin; ix <= xMax; ++ix)
{