diff options
Diffstat (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs')
-rw-r--r-- | OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index eb633b3..9d52a8f 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | |||
@@ -89,89 +89,7 @@ namespace OpenSim.Region.RegionCombinerModule | |||
89 | public void RegionLoaded(Scene scene) | 89 | public void RegionLoaded(Scene scene) |
90 | { | 90 | { |
91 | if (enabledYN) | 91 | if (enabledYN) |
92 | { | ||
93 | RegionLoadedDoWork(scene); | 92 | RegionLoadedDoWork(scene); |
94 | |||
95 | scene.EventManager.OnNewPresence += NewPresence; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | private void NewPresence(ScenePresence presence) | ||
100 | { | ||
101 | if (presence.IsChildAgent) | ||
102 | { | ||
103 | byte[] throttleData; | ||
104 | |||
105 | try | ||
106 | { | ||
107 | throttleData = presence.ControllingClient.GetThrottlesPacked(1); | ||
108 | } | ||
109 | catch (NotImplementedException) | ||
110 | { | ||
111 | return; | ||
112 | } | ||
113 | |||
114 | if (throttleData == null) | ||
115 | return; | ||
116 | |||
117 | if (throttleData.Length == 0) | ||
118 | return; | ||
119 | |||
120 | if (throttleData.Length != 28) | ||
121 | return; | ||
122 | |||
123 | byte[] adjData; | ||
124 | int pos = 0; | ||
125 | |||
126 | if (!BitConverter.IsLittleEndian) | ||
127 | { | ||
128 | byte[] newData = new byte[7 * 4]; | ||
129 | Buffer.BlockCopy(throttleData, 0, newData, 0, 7 * 4); | ||
130 | |||
131 | for (int i = 0; i < 7; i++) | ||
132 | Array.Reverse(newData, i * 4, 4); | ||
133 | |||
134 | adjData = newData; | ||
135 | } | ||
136 | else | ||
137 | { | ||
138 | adjData = throttleData; | ||
139 | } | ||
140 | |||
141 | // 0.125f converts from bits to bytes | ||
142 | int resend = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
143 | int land = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
144 | int wind = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
145 | int cloud = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
146 | int task = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
147 | int texture = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); pos += 4; | ||
148 | int asset = (int)(BitConverter.ToSingle(adjData, pos) * 0.125f); | ||
149 | // State is a subcategory of task that we allocate a percentage to | ||
150 | |||
151 | |||
152 | //int total = resend + land + wind + cloud + task + texture + asset; | ||
153 | |||
154 | byte[] data = new byte[7 * 4]; | ||
155 | int ii = 0; | ||
156 | |||
157 | Buffer.BlockCopy(Utils.FloatToBytes(resend), 0, data, ii, 4); ii += 4; | ||
158 | Buffer.BlockCopy(Utils.FloatToBytes(land * 50), 0, data, ii, 4); ii += 4; | ||
159 | Buffer.BlockCopy(Utils.FloatToBytes(wind), 0, data, ii, 4); ii += 4; | ||
160 | Buffer.BlockCopy(Utils.FloatToBytes(cloud), 0, data, ii, 4); ii += 4; | ||
161 | Buffer.BlockCopy(Utils.FloatToBytes(task), 0, data, ii, 4); ii += 4; | ||
162 | Buffer.BlockCopy(Utils.FloatToBytes(texture), 0, data, ii, 4); ii += 4; | ||
163 | Buffer.BlockCopy(Utils.FloatToBytes(asset), 0, data, ii, 4); | ||
164 | |||
165 | try | ||
166 | { | ||
167 | presence.ControllingClient.SetChildAgentThrottle(data); | ||
168 | } | ||
169 | catch (NotImplementedException) | ||
170 | { | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | } | ||
175 | } | 93 | } |
176 | 94 | ||
177 | private void RegionLoadedDoWork(Scene scene) | 95 | private void RegionLoadedDoWork(Scene scene) |