change math on GetParcelMaxPrimCount and GetSimulatorMaxPrimCount to reduce round errors, limit both to region max prims. consider ObjectBonus on last one also. Change a variable name in PrimLimitsModule to make it more clear

httptests
UbitUmarov 2016-10-11 01:14:53 +01:00
parent 76a2d90dad
commit 7494d7726a
2 changed files with 20 additions and 9 deletions

View File

@ -341,10 +341,16 @@ namespace OpenSim.Region.CoreModules.World.Land
else else
{ {
// Normal Calculations // Normal Calculations
int parcelMax = (int)( (long)LandData.Area int parcelMax = (int)(
* (long)m_scene.RegionInfo.ObjectCapacity (double)LandData.Area
* (long)m_scene.RegionInfo.RegionSettings.ObjectBonus * (double)m_scene.RegionInfo.ObjectCapacity
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); * (double)m_scene.RegionInfo.RegionSettings.ObjectBonus
/ (double)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)
+ 0.5 );
if(parcelMax > m_scene.RegionInfo.ObjectCapacity)
parcelMax = m_scene.RegionInfo.ObjectCapacity;
//m_log.DebugFormat("Area: {0}, Capacity {1}, Bonus {2}, Parcel {3}", LandData.Area, m_scene.RegionInfo.ObjectCapacity, m_scene.RegionInfo.RegionSettings.ObjectBonus, parcelMax); //m_log.DebugFormat("Area: {0}, Capacity {1}, Bonus {2}, Parcel {3}", LandData.Area, m_scene.RegionInfo.ObjectCapacity, m_scene.RegionInfo.RegionSettings.ObjectBonus, parcelMax);
return parcelMax; return parcelMax;
} }
@ -359,9 +365,14 @@ namespace OpenSim.Region.CoreModules.World.Land
else else
{ {
//Normal Calculations //Normal Calculations
int simMax = (int)( (long)LandData.SimwideArea int simMax = (int)( (double)LandData.SimwideArea
* (long)m_scene.RegionInfo.ObjectCapacity * (double)m_scene.RegionInfo.ObjectCapacity
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); * (double)m_scene.RegionInfo.RegionSettings.ObjectBonus
/ (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)
+0.5 );
if(simMax > m_scene.RegionInfo.ObjectCapacity)
simMax = m_scene.RegionInfo.ObjectCapacity;
//m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}, SimWidePrims {3}", //m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}, SimWidePrims {3}",
// LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax, LandData.SimwidePrims); // LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax, LandData.SimwidePrims);
return simMax; return simMax;

View File

@ -186,8 +186,8 @@ namespace OpenSim.Region.OptionalModules
{ {
string response = null; string response = null;
int simulatorCapacity = lo.GetSimulatorMaxPrimCount(); int OwnedParcelsCapacity = lo.GetSimulatorMaxPrimCount();
if ((objectCount + lo.PrimCounts.Total) > simulatorCapacity) if ((objectCount + lo.PrimCounts.Total) > OwnedParcelsCapacity)
{ {
response = "Unable to rez object because the parcel is too full"; response = "Unable to rez object because the parcel is too full";
} }