diff options
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 96292ff..3f676f9 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -471,10 +471,17 @@ namespace OpenSim.Framework | |||
471 | /// <param name="oldy">Old region y-coord</param> | 471 | /// <param name="oldy">Old region y-coord</param> |
472 | /// <param name="newy">New region y-coord</param> | 472 | /// <param name="newy">New region y-coord</param> |
473 | /// <returns></returns> | 473 | /// <returns></returns> |
474 | public static bool IsOutsideView(uint oldx, uint newx, uint oldy, uint newy) | 474 | public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy) |
475 | { | 475 | { |
476 | // Eventually this will be a function of the draw distance / camera position too. | 476 | int dd = (int)((drawdist + Constants.RegionSize - 1) / Constants.RegionSize); |
477 | return (((int)Math.Abs((int)(oldx - newx)) > 1) || ((int)Math.Abs((int)(oldy - newy)) > 1)); | 477 | |
478 | int startX = (int)oldx - dd; | ||
479 | int startY = (int)oldy - dd; | ||
480 | |||
481 | int endX = (int)oldx + dd; | ||
482 | int endY = (int)oldy + dd; | ||
483 | |||
484 | return (newx < startX || endX < newx || newy < startY || endY < newy); | ||
478 | } | 485 | } |
479 | 486 | ||
480 | public static string FieldToString(byte[] bytes) | 487 | public static string FieldToString(byte[] bytes) |
@@ -1346,6 +1353,11 @@ namespace OpenSim.Framework | |||
1346 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; | 1353 | return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri; |
1347 | } | 1354 | } |
1348 | 1355 | ||
1356 | public static byte[] StringToBytes256(string str, params object[] args) | ||
1357 | { | ||
1358 | return StringToBytes256(string.Format(str, args)); | ||
1359 | } | ||
1360 | |||
1349 | public static byte[] StringToBytes256(string str) | 1361 | public static byte[] StringToBytes256(string str) |
1350 | { | 1362 | { |
1351 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1363 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |
@@ -1364,6 +1376,11 @@ namespace OpenSim.Framework | |||
1364 | return data; | 1376 | return data; |
1365 | } | 1377 | } |
1366 | 1378 | ||
1379 | public static byte[] StringToBytes1024(string str, params object[] args) | ||
1380 | { | ||
1381 | return StringToBytes1024(string.Format(str, args)); | ||
1382 | } | ||
1383 | |||
1367 | public static byte[] StringToBytes1024(string str) | 1384 | public static byte[] StringToBytes1024(string str) |
1368 | { | 1385 | { |
1369 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } | 1386 | if (String.IsNullOrEmpty(str)) { return Utils.EmptyBytes; } |