From dc6ce2444385730a3ea1ba1104f2e2caa15a907a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Apr 2011 20:31:52 +0100 Subject: switch llGetParcelPrimCount() to use new prim counts module --- .../Shared/Api/Implementation/LSL_Api.cs | 85 ++++++++++------------ 1 file changed, 39 insertions(+), 46 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 43b0da3..5f8ca91 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9835,63 +9835,56 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) { m_host.AddScriptLPS(1); + + ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); + + //LandData land = World.GetLandData((float)pos.x, (float)pos.y); - LandData land = World.GetLandData((float)pos.x, (float)pos.y); + if (lo == null) + return 0; + + IPrimCounts pc = lo.PrimCounts; - if (land == null) + if (sim_wide != 0) { - return 0; + if (category == 0) + { + return pc.Simulator; + } + else + { + // counts not implemented yet + return 0; + } } - else { - if (sim_wide != 0) + if (category == 0)//Total Prims { - if (category == 0) - { - return land.SimwidePrims; - } - - else - { - //public int simwideArea = 0; - return 0; - } + return pc.Total; } - - else + else if (category == 1)//Owner Prims { - if (category == 0)//Total Prims - { - return 0;//land. - } - - else if (category == 1)//Owner Prims - { - return land.OwnerPrims; - } - - else if (category == 2)//Group Prims - { - return land.GroupPrims; - } - - else if (category == 3)//Other Prims - { - return land.OtherPrims; - } - - else if (category == 4)//Selected - { - return land.SelectedPrims; - } - - else if (category == 5)//Temp - { - return 0;//land. - } + return pc.Owner; + } + else if (category == 2)//Group Prims + { + return pc.Group; + } + else if (category == 3)//Other Prims + { + return pc.Others; + } + else if (category == 4)//Selected + { + return pc.Selected; + } + else if (category == 5)//Temp + { + return 0; // counts not implemented yet } } + return 0; } -- cgit v1.1