diff options
author | mingchen | 2007-06-06 18:15:12 +0000 |
---|---|---|
committer | mingchen | 2007-06-06 18:15:12 +0000 |
commit | 73a36680bd5dacd4f2630c50115ef4c1f10dc387 (patch) | |
tree | a628ee922e8cac2e4836b025d986cb5806dd820d /OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs | |
parent | Changes: (diff) | |
download | opensim-SC-73a36680bd5dacd4f2630c50115ef4c1f10dc387.zip opensim-SC-73a36680bd5dacd4f2630c50115ef4c1f10dc387.tar.gz opensim-SC-73a36680bd5dacd4f2630c50115ef4c1f10dc387.tar.bz2 opensim-SC-73a36680bd5dacd4f2630c50115ef4c1f10dc387.tar.xz |
*Added new commands ('backup','show parcels','reset parcels')
*Added parcel join support
*Made parcel saving and loading much more efficient
*Fixed bug that would not allow joining of parcel locally in the viewer (gives an error before sending to server)
*Known Issue: Restoring parcels from storage is not working correctly. For now, do a 'reset parcels' to regenerate a standard parcel
Diffstat (limited to 'OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs')
-rw-r--r-- | OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs | 88 |
1 files changed, 61 insertions, 27 deletions
diff --git a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs index 2fb3c90..d7b9f38 100644 --- a/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs +++ b/OpenSim/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs | |||
@@ -71,7 +71,7 @@ namespace OpenSim.Storage.LocalStorageDb4o | |||
71 | 71 | ||
72 | public void StorePrim(PrimData prim) | 72 | public void StorePrim(PrimData prim) |
73 | { | 73 | { |
74 | IObjectSet result = db.Query(new UUIDQuery(prim.FullID)); | 74 | IObjectSet result = db.Query(new UUIDPrimQuery(prim.FullID)); |
75 | if(result.Count>0) | 75 | if(result.Count>0) |
76 | { | 76 | { |
77 | //prim already in storage | 77 | //prim already in storage |
@@ -112,7 +112,7 @@ namespace OpenSim.Storage.LocalStorageDb4o | |||
112 | 112 | ||
113 | public void RemovePrim(LLUUID primID) | 113 | public void RemovePrim(LLUUID primID) |
114 | { | 114 | { |
115 | IObjectSet result = db.Query(new UUIDQuery(primID)); | 115 | IObjectSet result = db.Query(new UUIDPrimQuery(primID)); |
116 | if(result.Count>0) | 116 | if(result.Count>0) |
117 | { | 117 | { |
118 | PrimData found = (PrimData) result.Next(); | 118 | PrimData found = (PrimData) result.Next(); |
@@ -133,7 +133,6 @@ namespace OpenSim.Storage.LocalStorageDb4o | |||
133 | public float[] LoadWorld() | 133 | public float[] LoadWorld() |
134 | { | 134 | { |
135 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Loading world...."); | 135 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Loading world...."); |
136 | //World blank = new World(); | ||
137 | float[] heightmap = null; | 136 | float[] heightmap = null; |
138 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB"); | 137 | OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB"); |
139 | IObjectSet world_result = db.Get(typeof(MapStorage)); | 138 | IObjectSet world_result = db.Get(typeof(MapStorage)); |
@@ -144,21 +143,6 @@ namespace OpenSim.Storage.LocalStorageDb4o | |||
144 | //blank.LandMap = map.Map; | 143 | //blank.LandMap = map.Map; |
145 | heightmap = map.Map; | 144 | heightmap = map.Map; |
146 | } | 145 | } |
147 | else | ||
148 | { | ||
149 | /* | ||
150 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - No heightmap found, generating new one"); | ||
151 | HeightmapGenHills hills = new HeightmapGenHills(); | ||
152 | // blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); | ||
153 | // heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); | ||
154 | heightmap = new float[256, 256]; | ||
155 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Saving heightmap to local database"); | ||
156 | MapStorage map = new MapStorage(); | ||
157 | map.Map = heightmap; //blank.LandMap; | ||
158 | db.Set(map); | ||
159 | db.Commit(); | ||
160 | */ | ||
161 | } | ||
162 | return heightmap; | 146 | return heightmap; |
163 | } | 147 | } |
164 | 148 | ||
@@ -177,27 +161,77 @@ namespace OpenSim.Storage.LocalStorageDb4o | |||
177 | db.Commit(); | 161 | db.Commit(); |
178 | } | 162 | } |
179 | 163 | ||
180 | public void SaveParcels(ParcelData[] parcel_data) | 164 | public void SaveParcel(ParcelData parcel) |
181 | { | 165 | { |
182 | MainConsole.Instance.Notice("Parcel Backup: Saving Parcels..."); | 166 | IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID)); |
183 | IObjectSet result = db.Get(typeof(ParcelData)); | 167 | if (result.Count > 0) |
184 | foreach (ParcelData parcel in result) | 168 | { |
169 | //Old Parcel | ||
170 | ParcelData updateParcel = (ParcelData)result.Next(); | ||
171 | updateParcel.AABBMax = parcel.AABBMax; | ||
172 | updateParcel.AABBMin = parcel.AABBMin; | ||
173 | updateParcel.area = parcel.area; | ||
174 | updateParcel.auctionID = parcel.auctionID; | ||
175 | updateParcel.authBuyerID = parcel.authBuyerID; | ||
176 | updateParcel.category = parcel.category; | ||
177 | updateParcel.claimDate = parcel.claimDate; | ||
178 | updateParcel.claimPrice = parcel.claimPrice; | ||
179 | updateParcel.groupID = parcel.groupID; | ||
180 | updateParcel.groupPrims = parcel.groupPrims; | ||
181 | updateParcel.isGroupOwned = parcel.isGroupOwned; | ||
182 | updateParcel.localID = parcel.localID; | ||
183 | updateParcel.ownerID = parcel.ownerID; | ||
184 | updateParcel.parcelBitmapByteArray = (byte[])parcel.parcelBitmapByteArray.Clone(); | ||
185 | updateParcel.parcelDesc = parcel.parcelDesc; | ||
186 | updateParcel.parcelFlags = parcel.parcelFlags; | ||
187 | updateParcel.parcelName = parcel.parcelName; | ||
188 | updateParcel.parcelStatus = parcel.parcelStatus; | ||
189 | updateParcel.salePrice = parcel.salePrice; | ||
190 | |||
191 | db.Set(updateParcel); | ||
192 | } | ||
193 | else | ||
185 | { | 194 | { |
186 | db.Delete(parcel); | 195 | db.Set(parcel); |
187 | } | 196 | } |
188 | MainConsole.Instance.Notice("Parcel Backup: Removing old entries complete. Adding new entries."); | 197 | db.Commit(); |
198 | } | ||
199 | |||
200 | public void SaveParcels(ParcelData[] parcel_data) | ||
201 | { | ||
202 | MainConsole.Instance.Notice("Parcel Backup: Saving Parcels..."); | ||
189 | int i; | 203 | int i; |
190 | for (i = 0; i < parcel_data.GetLength(0); i++) | 204 | for (i = 0; i < parcel_data.GetLength(0); i++) |
191 | { | 205 | { |
192 | 206 | ||
193 | MainConsole.Instance.Notice("Adding : " + i + " - SAMPLE: " + parcel_data[i].parcelBitmapByteArray[0]); | 207 | SaveParcel(parcel_data[i]); |
194 | db.Set(parcel_data[i]); | ||
195 | 208 | ||
196 | } | 209 | } |
197 | db.Commit(); | ||
198 | MainConsole.Instance.Notice("Parcel Backup: Parcel Save Complete"); | 210 | MainConsole.Instance.Notice("Parcel Backup: Parcel Save Complete"); |
199 | } | 211 | } |
200 | 212 | ||
213 | public void RemoveParcel(ParcelData parcel) | ||
214 | { | ||
215 | IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID)); | ||
216 | if (result.Count > 0) | ||
217 | { | ||
218 | db.Delete(result[0]); | ||
219 | } | ||
220 | db.Commit(); | ||
221 | } | ||
222 | public void RemoveAllParcels() | ||
223 | { | ||
224 | MainConsole.Instance.Notice("Parcel Backup: Removing all parcels..."); | ||
225 | IObjectSet result = db.Get(typeof(ParcelData)); | ||
226 | if (result.Count > 0) | ||
227 | { | ||
228 | foreach (ParcelData parcelData in result) | ||
229 | { | ||
230 | RemoveParcel(parcelData); | ||
231 | } | ||
232 | } | ||
233 | } | ||
234 | |||
201 | public void LoadParcels(ILocalStorageParcelReceiver recv) | 235 | public void LoadParcels(ILocalStorageParcelReceiver recv) |
202 | { | 236 | { |
203 | MainConsole.Instance.Notice("Parcel Backup: Loading Parcels..."); | 237 | MainConsole.Instance.Notice("Parcel Backup: Loading Parcels..."); |