From 0edffae7e42c0705303e015036fa85687508ecf0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 30 Aug 2015 19:17:35 +0100 Subject: more on tps and crossings --- OpenSim/Framework/Util.cs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index d807e2a..5f4ab06 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -675,17 +675,26 @@ namespace OpenSim.Framework /// Old region y-coord /// New region y-coord /// - public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy) + public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy, + int oldsizex, int oldsizey, int newsizex, int newsizey) { - int dd = (int)((drawdist + Constants.RegionSize - 1) / Constants.RegionSize); + // we still need to make sure we see new region 1stNeighbors - int startX = (int)oldx - dd; - int startY = (int)oldy - dd; + oldx *= Constants.RegionSize; + newx *= Constants.RegionSize; + if (oldx + oldsizex + drawdist < newx) + return true; + if (newx + newsizex + drawdist < oldx) + return true; - int endX = (int)oldx + dd; - int endY = (int)oldy + dd; + oldy *= Constants.RegionSize; + newy *= Constants.RegionSize; + if (oldy + oldsizey + drawdist < newy) + return true; + if (newy + newsizey + drawdist< oldy) + return true; - return (newx < startX || endX < newx || newy < startY || endY < newy); + return false; } public static string FieldToString(byte[] bytes) -- cgit v1.1