mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 10:15:33 +08:00
merge
This commit is contained in:
@@ -88,6 +88,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||
|
||||
bool IsForcefulBansAllowed();
|
||||
void UpdateLandObject(int localID, LandData data);
|
||||
void SendParcelsOverlay(IClientAPI client);
|
||||
void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient);
|
||||
void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel);
|
||||
void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel);
|
||||
|
||||
@@ -64,25 +64,25 @@ namespace OpenSim.Framework
|
||||
|
||||
private void XWfloat(string name, float f)
|
||||
{
|
||||
writer.WriteElementString(name, f.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString(name, f.ToString(Culture.FormatProvider));
|
||||
}
|
||||
|
||||
private void XWVector(string name, Vector3 vec)
|
||||
{
|
||||
writer.WriteStartElement(name);
|
||||
writer.WriteElementString("X", vec.X.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString("Y", vec.Y.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString("Z", vec.Z.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString("X", vec.X.ToString(Culture.FormatProvider));
|
||||
writer.WriteElementString("Y", vec.Y.ToString(Culture.FormatProvider));
|
||||
writer.WriteElementString("Z", vec.Z.ToString(Culture.FormatProvider));
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
private void XWVector4(string name, Vector4 quat)
|
||||
{
|
||||
writer.WriteStartElement(name);
|
||||
writer.WriteElementString("X", quat.X.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString("Y", quat.Y.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString("Z", quat.Z.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString("W", quat.W.ToString(Utils.EnUsCulture));
|
||||
writer.WriteElementString("X", quat.X.ToString(Culture.FormatProvider));
|
||||
writer.WriteElementString("Y", quat.Y.ToString(Culture.FormatProvider));
|
||||
writer.WriteElementString("Z", quat.Z.ToString(Culture.FormatProvider));
|
||||
writer.WriteElementString("W", quat.W.ToString(Culture.FormatProvider));
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,27 @@ namespace OpenSim.Framework
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryOrderedDequeue(out EntityUpdate value, out Int32 timeinqueue)
|
||||
{
|
||||
// If there is anything in imediate queues, return it first no
|
||||
// matter what else. Breaks fairness. But very useful.
|
||||
for (int iq = 0; iq < NumberOfQueues; iq++)
|
||||
{
|
||||
if (m_heaps[iq].Count > 0)
|
||||
{
|
||||
MinHeapItem item = m_heaps[iq].RemoveMin();
|
||||
m_lookupTable.Remove(item.Value.Entity.LocalId);
|
||||
timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
|
||||
value = item.Value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
timeinqueue = 0;
|
||||
value = default(EntityUpdate);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reapply the prioritization function to each of the updates currently
|
||||
/// stored in the priority queues.
|
||||
|
||||
@@ -156,12 +156,14 @@ namespace OpenSim.Framework
|
||||
public static readonly int MAX_THREADPOOL_LEVEL = 3;
|
||||
|
||||
public static double TimeStampClockPeriodMS;
|
||||
public static double TimeStampClockPeriod;
|
||||
|
||||
static Util()
|
||||
{
|
||||
LogThreadPool = 0;
|
||||
LogOverloads = true;
|
||||
TimeStampClockPeriodMS = 1000.0D / (double)Stopwatch.Frequency;
|
||||
TimeStampClockPeriod = 1.0D/ (double)Stopwatch.Frequency;
|
||||
TimeStampClockPeriodMS = 1e3 * TimeStampClockPeriod;
|
||||
m_log.InfoFormat("[UTIL] TimeStamp clock with period of {0}ms", Math.Round(TimeStampClockPeriodMS,6,MidpointRounding.AwayFromZero));
|
||||
}
|
||||
|
||||
@@ -2221,9 +2223,9 @@ namespace OpenSim.Framework
|
||||
// might have gotten an oversized array even after the string trim
|
||||
byte[] data = UTF8.GetBytes(str);
|
||||
|
||||
if (data.Length > 256)
|
||||
if (data.Length > 255) //play safe
|
||||
{
|
||||
int cut = 255;
|
||||
int cut = 254;
|
||||
if((data[cut] & 0x80 ) != 0 )
|
||||
{
|
||||
while(cut > 0 && (data[cut] & 0xc0) != 0xc0)
|
||||
@@ -2325,7 +2327,7 @@ namespace OpenSim.Framework
|
||||
|
||||
if (data.Length > MaxLength)
|
||||
{
|
||||
int cut = MaxLength -1 ;
|
||||
int cut = MaxLength - 1 ;
|
||||
if((data[cut] & 0x80 ) != 0 )
|
||||
{
|
||||
while(cut > 0 && (data[cut] & 0xc0) != 0xc0)
|
||||
@@ -2967,9 +2969,9 @@ namespace OpenSim.Framework
|
||||
/// <returns></returns>
|
||||
public static Int32 EnvironmentTickCount()
|
||||
{
|
||||
double now = GetTimeStampMS();
|
||||
return (int)now;
|
||||
return Environment.TickCount & EnvironmentTickCountMask;
|
||||
}
|
||||
|
||||
const Int32 EnvironmentTickCountMask = 0x3fffffff;
|
||||
|
||||
/// <summary>
|
||||
@@ -2994,8 +2996,7 @@ namespace OpenSim.Framework
|
||||
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
|
||||
public static Int32 EnvironmentTickCountSubtract(Int32 prevValue)
|
||||
{
|
||||
double now = GetTimeStampMS();
|
||||
return EnvironmentTickCountSubtract((int)now, prevValue);
|
||||
return EnvironmentTickCountSubtract(EnvironmentTickCount(), prevValue);
|
||||
}
|
||||
|
||||
// Returns value of Tick Count A - TickCount B accounting for wrapping of TickCount
|
||||
@@ -3017,6 +3018,11 @@ namespace OpenSim.Framework
|
||||
|
||||
// returns a timestamp in ms as double
|
||||
// using the time resolution avaiable to StopWatch
|
||||
public static double GetTimeStamp()
|
||||
{
|
||||
return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriod;
|
||||
}
|
||||
|
||||
public static double GetTimeStampMS()
|
||||
{
|
||||
return (double)Stopwatch.GetTimestamp() * TimeStampClockPeriodMS;
|
||||
|
||||
Reference in New Issue
Block a user