diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLRegionData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index fab0318..3dc049b 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -161,6 +161,7 @@ namespace OpenSim.Data.MySQL | |||
161 | 161 | ||
162 | public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) | 162 | public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID) |
163 | { | 163 | { |
164 | /* fix size regions | ||
164 | string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY"; | 165 | string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY"; |
165 | if (scopeID != UUID.Zero) | 166 | if (scopeID != UUID.Zero) |
166 | command += " and ScopeID = ?scopeID"; | 167 | command += " and ScopeID = ?scopeID"; |
@@ -175,6 +176,38 @@ namespace OpenSim.Data.MySQL | |||
175 | 176 | ||
176 | return RunCommand(cmd); | 177 | return RunCommand(cmd); |
177 | } | 178 | } |
179 | */ | ||
180 | string command = "select * from `" + m_Realm + "` where locX between ?startX and ?endX and locY between ?startY and ?endY"; | ||
181 | if (scopeID != UUID.Zero) | ||
182 | command += " and ScopeID = ?scopeID"; | ||
183 | |||
184 | int qstartX = startX - (int)Constants.MaximumRegionSize; | ||
185 | int qstartY = startY - (int)Constants.MaximumRegionSize; | ||
186 | |||
187 | List<RegionData> dbret; | ||
188 | using (MySqlCommand cmd = new MySqlCommand(command)) | ||
189 | { | ||
190 | cmd.Parameters.AddWithValue("?startX", qstartX.ToString()); | ||
191 | cmd.Parameters.AddWithValue("?startY", qstartY.ToString()); | ||
192 | cmd.Parameters.AddWithValue("?endX", endX.ToString()); | ||
193 | cmd.Parameters.AddWithValue("?endY", endY.ToString()); | ||
194 | cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString()); | ||
195 | |||
196 | dbret = RunCommand(cmd); | ||
197 | } | ||
198 | |||
199 | List<RegionData> ret = new List<RegionData>(); | ||
200 | |||
201 | if (dbret.Count == 0) | ||
202 | return ret; | ||
203 | |||
204 | foreach (RegionData r in dbret) | ||
205 | { | ||
206 | if (r.posX + r.sizeX > startX && r.posX <= endX | ||
207 | && r.posY + r.sizeX > startY && r.posY <= endY) | ||
208 | ret.Add(r); | ||
209 | } | ||
210 | return ret; | ||
178 | } | 211 | } |
179 | 212 | ||
180 | public List<RegionData> RunCommand(MySqlCommand cmd) | 213 | public List<RegionData> RunCommand(MySqlCommand cmd) |