diff options
author | Diva Canto | 2014-05-31 11:40:54 -0700 |
---|---|---|
committer | Diva Canto | 2014-05-31 11:40:54 -0700 |
commit | eaf595c008998047eaa754696f8b1bec70faa65c (patch) | |
tree | fa7bce4befb6c0fb9f99870b61282e90a92d47f8 /OpenSim | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-eaf595c008998047eaa754696f8b1bec70faa65c.zip opensim-SC_OLD-eaf595c008998047eaa754696f8b1bec70faa65c.tar.gz opensim-SC_OLD-eaf595c008998047eaa754696f8b1bec70faa65c.tar.bz2 opensim-SC_OLD-eaf595c008998047eaa754696f8b1bec70faa65c.tar.xz |
Fix a bug where estate not found would result in a dummy estate record with erroneous information.
Also, added conversion of EstateSettings from/to key-value pairs in preparation for robust net work connectors.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLEstateData.cs | 11 | ||||
-rw-r--r-- | OpenSim/Framework/EstateSettings.cs | 19 |
2 files changed, 28 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index 3dd46cb..69c89d4 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs | |||
@@ -145,7 +145,11 @@ namespace OpenSim.Data.MySQL | |||
145 | cmd.CommandText = sql; | 145 | cmd.CommandText = sql; |
146 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); | 146 | cmd.Parameters.AddWithValue("?RegionID", regionID.ToString()); |
147 | 147 | ||
148 | return DoLoad(cmd, regionID, create); | 148 | EstateSettings e = DoLoad(cmd, regionID, create); |
149 | if (!create && e.EstateID == 0) // Not found | ||
150 | return null; | ||
151 | |||
152 | return e; | ||
149 | } | 153 | } |
150 | } | 154 | } |
151 | 155 | ||
@@ -427,7 +431,10 @@ namespace OpenSim.Data.MySQL | |||
427 | cmd.CommandText = sql; | 431 | cmd.CommandText = sql; |
428 | cmd.Parameters.AddWithValue("?EstateID", estateID); | 432 | cmd.Parameters.AddWithValue("?EstateID", estateID); |
429 | 433 | ||
430 | return DoLoad(cmd, UUID.Zero, false); | 434 | EstateSettings e = DoLoad(cmd, UUID.Zero, false); |
435 | if (e.EstateID != estateID) | ||
436 | return null; | ||
437 | return e; | ||
431 | } | 438 | } |
432 | } | 439 | } |
433 | 440 | ||
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index a02993d..dd3e195 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | 33 | ||
33 | namespace OpenSim.Framework | 34 | namespace OpenSim.Framework |
@@ -411,5 +412,23 @@ namespace OpenSim.Framework | |||
411 | { | 412 | { |
412 | return l_EstateGroups.Contains(groupID); | 413 | return l_EstateGroups.Contains(groupID); |
413 | } | 414 | } |
415 | |||
416 | public Dictionary<string, object> ToMap() | ||
417 | { | ||
418 | Dictionary<string, object> map = new Dictionary<string, object>(); | ||
419 | PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); | ||
420 | foreach (PropertyInfo p in properties) | ||
421 | map[p.Name] = p.GetValue(this, null); | ||
422 | |||
423 | return map; | ||
424 | } | ||
425 | |||
426 | public EstateSettings(Dictionary<string, object> map) | ||
427 | { | ||
428 | PropertyInfo[] properties = this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); | ||
429 | foreach (PropertyInfo p in properties) | ||
430 | p.SetValue(this, map[p.Name], null); | ||
431 | |||
432 | } | ||
414 | } | 433 | } |
415 | } | 434 | } |