diff options
author | MW | 2007-03-08 13:21:24 +0000 |
---|---|---|
committer | MW | 2007-03-08 13:21:24 +0000 |
commit | f60bc970eb925cd245cc77b1ae700b28d4589163 (patch) | |
tree | d279883582f00232bad87bf17e5727ff263027a4 /src/world/Primitive.cs | |
parent | Brought OGS.sql back into trunk (diff) | |
download | opensim-SC_OLD-f60bc970eb925cd245cc77b1ae700b28d4589163.zip opensim-SC_OLD-f60bc970eb925cd245cc77b1ae700b28d4589163.tar.gz opensim-SC_OLD-f60bc970eb925cd245cc77b1ae700b28d4589163.tar.bz2 opensim-SC_OLD-f60bc970eb925cd245cc77b1ae700b28d4589163.tar.xz |
Another attemp to fix the Session Logout bug
World map data is now saved in database and recovered on startup.
Primitives are now backed up to a local database and reloaded on startup.
Diffstat (limited to '')
-rw-r--r-- | src/world/Primitive.cs | 110 |
1 files changed, 83 insertions, 27 deletions
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs index 1fb7142..6029f76 100644 --- a/src/world/Primitive.cs +++ b/src/world/Primitive.cs | |||
@@ -4,6 +4,7 @@ using System.Text; | |||
4 | using OpenSim.types; | 4 | using OpenSim.types; |
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using libsecondlife.Packets; | 6 | using libsecondlife.Packets; |
7 | using GridInterfaces; | ||
7 | 8 | ||
8 | namespace OpenSim.world | 9 | namespace OpenSim.world |
9 | { | 10 | { |
@@ -15,7 +16,7 @@ namespace OpenSim.world | |||
15 | protected bool newPrimFlag; | 16 | protected bool newPrimFlag; |
16 | protected bool updateFlag; | 17 | protected bool updateFlag; |
17 | protected ObjectUpdatePacket OurPacket; | 18 | protected ObjectUpdatePacket OurPacket; |
18 | 19 | ||
19 | public bool UpdateFlag | 20 | public bool UpdateFlag |
20 | { | 21 | { |
21 | get | 22 | get |
@@ -69,6 +70,14 @@ namespace OpenSim.world | |||
69 | } | 70 | } |
70 | this.updateFlag = false; | 71 | this.updateFlag = false; |
71 | } | 72 | } |
73 | |||
74 | } | ||
75 | |||
76 | public void UpdateClient(OpenSimClient RemoteClient) | ||
77 | { | ||
78 | byte[] pb = this.position.GetBytes(); | ||
79 | Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length); | ||
80 | RemoteClient.OutPacket(OurPacket); | ||
72 | } | 81 | } |
73 | 82 | ||
74 | public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID) | 83 | public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID) |
@@ -118,8 +127,7 @@ namespace OpenSim.world | |||
118 | //finish off copying rest of shape data | 127 | //finish off copying rest of shape data |
119 | 128 | ||
120 | objupdate.ObjectData[0].ID = (uint)(localID); | 129 | objupdate.ObjectData[0].ID = (uint)(localID); |
121 | objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efefda" + (localID- 702000).ToString("000")); | 130 | objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID- 702000).ToString("00000")); |
122 | |||
123 | objupdate.ObjectData[0].ObjectData = new byte[60]; | 131 | objupdate.ObjectData[0].ObjectData = new byte[60]; |
124 | objupdate.ObjectData[0].ObjectData[46] = 128; | 132 | objupdate.ObjectData[0].ObjectData[46] = 128; |
125 | objupdate.ObjectData[0].ObjectData[47] = 63; | 133 | objupdate.ObjectData[0].ObjectData[47] = 63; |
@@ -135,6 +143,67 @@ namespace OpenSim.world | |||
135 | this.OurPacket = objupdate; | 143 | this.OurPacket = objupdate; |
136 | } | 144 | } |
137 | 145 | ||
146 | public void CreateFromStorage(PrimStorage store) | ||
147 | { | ||
148 | //need to clean this up as it shares a lot of code with CreateFromPacket() | ||
149 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
150 | objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
151 | objupdate.RegionData.TimeDilation = 64096; | ||
152 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
153 | |||
154 | this.primData = store.Data; | ||
155 | objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock(); | ||
156 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
157 | objupdate.ObjectData[0].ExtraParams = new byte[1]; | ||
158 | objupdate.ObjectData[0].MediaURL = new byte[0]; | ||
159 | objupdate.ObjectData[0].NameValue = new byte[0]; | ||
160 | objupdate.ObjectData[0].PSBlock = new byte[0]; | ||
161 | objupdate.ObjectData[0].Text = new byte[0]; | ||
162 | objupdate.ObjectData[0].TextColor = new byte[4]; | ||
163 | objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0); | ||
164 | objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0); | ||
165 | objupdate.ObjectData[0].Material = 3; | ||
166 | objupdate.ObjectData[0].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456; | ||
167 | objupdate.ObjectData[0].TextureAnim = new byte[0]; | ||
168 | objupdate.ObjectData[0].Sound = LLUUID.Zero; | ||
169 | LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
170 | objupdate.ObjectData[0].TextureEntry = ntex.ToBytes(); | ||
171 | objupdate.ObjectData[0].State = 0; | ||
172 | objupdate.ObjectData[0].Data = new byte[0]; | ||
173 | objupdate.ObjectData[0].OwnerID = this.primData.OwnerID; | ||
174 | objupdate.ObjectData[0].PCode = this.primData.PCode; | ||
175 | objupdate.ObjectData[0].PathBegin = this.primData.PathBegin; | ||
176 | objupdate.ObjectData[0].PathEnd = this.primData.PathEnd; | ||
177 | objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX; | ||
178 | objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY; | ||
179 | objupdate.ObjectData[0].PathShearX = this.primData.PathShearX; | ||
180 | objupdate.ObjectData[0].PathShearY = this.primData.PathShearY; | ||
181 | objupdate.ObjectData[0].PathSkew = this.primData.PathSkew; | ||
182 | objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin; | ||
183 | objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd; | ||
184 | objupdate.ObjectData[0].Scale = this.primData.Scale; | ||
185 | objupdate.ObjectData[0].PathCurve = this.primData.PathCurve; | ||
186 | objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve; | ||
187 | objupdate.ObjectData[0].ParentID = 0; | ||
188 | objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow; | ||
189 | //finish off copying rest of shape data | ||
190 | |||
191 | objupdate.ObjectData[0].ID = (uint)store.LocalID; | ||
192 | objupdate.ObjectData[0].FullID = store.FullID; | ||
193 | |||
194 | objupdate.ObjectData[0].ObjectData = new byte[60]; | ||
195 | objupdate.ObjectData[0].ObjectData[46] = 128; | ||
196 | objupdate.ObjectData[0].ObjectData[47] = 63; | ||
197 | LLVector3 pos1= store.Position; | ||
198 | //update position | ||
199 | byte[] pb = pos1.GetBytes(); | ||
200 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length); | ||
201 | |||
202 | this.uuid = objupdate.ObjectData[0].FullID; | ||
203 | this.localid = objupdate.ObjectData[0].ID; | ||
204 | this.position = pos1; | ||
205 | this.OurPacket = objupdate; | ||
206 | } | ||
138 | public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() | 207 | public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock() |
139 | { | 208 | { |
140 | uint ID = this.localid; | 209 | uint ID = this.localid; |
@@ -200,30 +269,17 @@ namespace OpenSim.world | |||
200 | dat.Data=bytes; | 269 | dat.Data=bytes; |
201 | return dat; | 270 | return dat; |
202 | } | 271 | } |
272 | |||
273 | public override void BackUp() | ||
274 | { | ||
275 | PrimStorage pStore = new PrimStorage(); | ||
276 | pStore.Data = this.primData; | ||
277 | pStore.FullID = this.uuid; | ||
278 | pStore.LocalID = this.localid; | ||
279 | pStore.Position = this.position; | ||
280 | pStore.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z , this.rotation.w); | ||
281 | OpenSim_Main.local_world.localStorage.StorePrim(pStore); | ||
282 | } | ||
203 | } | 283 | } |
204 | 284 | ||
205 | public class PrimData | ||
206 | { | ||
207 | public LLUUID OwnerID; | ||
208 | public byte PCode; | ||
209 | public byte PathBegin; | ||
210 | public byte PathEnd; | ||
211 | public byte PathScaleX; | ||
212 | public byte PathScaleY; | ||
213 | public byte PathShearX; | ||
214 | public byte PathShearY; | ||
215 | public sbyte PathSkew; | ||
216 | public byte ProfileBegin; | ||
217 | public byte ProfileEnd; | ||
218 | public LLVector3 Scale; | ||
219 | public byte PathCurve; | ||
220 | public byte ProfileCurve; | ||
221 | public uint ParentID=0; | ||
222 | public byte ProfileHollow; | ||
223 | |||
224 | public PrimData() | ||
225 | { | ||
226 | |||
227 | } | ||
228 | } | ||
229 | } | 285 | } |