diff options
author | MW | 2007-04-02 10:46:59 +0000 |
---|---|---|
committer | MW | 2007-04-02 10:46:59 +0000 |
commit | 1ea4ba3a18cf0ccdc512a1cc800e44bc5cf16210 (patch) | |
tree | 4022048c8ad28d31a2dd9c87f27bab213a731468 /OpenSim.Storage | |
parent | Finished putting user server config into Db4o (diff) | |
download | opensim-SC_OLD-1ea4ba3a18cf0ccdc512a1cc800e44bc5cf16210.zip opensim-SC_OLD-1ea4ba3a18cf0ccdc512a1cc800e44bc5cf16210.tar.gz opensim-SC_OLD-1ea4ba3a18cf0ccdc512a1cc800e44bc5cf16210.tar.bz2 opensim-SC_OLD-1ea4ba3a18cf0ccdc512a1cc800e44bc5cf16210.tar.xz |
Moved database storage of the world map to the Db4LocalStorage so its in the same database as in world prims are stored.
Diffstat (limited to 'OpenSim.Storage')
3 files changed, 175 insertions, 111 deletions
diff --git a/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs b/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs index 93ed9cc..cdab9ba 100644 --- a/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs +++ b/OpenSim.Storage/LocalStorageDb4o/Db4LocalStorage.cs | |||
@@ -31,6 +31,7 @@ using Db4objects.Db4o.Query; | |||
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim.Framework.Interfaces; | 32 | using OpenSim.Framework.Interfaces; |
33 | using OpenSim.Framework.Assets; | 33 | using OpenSim.Framework.Assets; |
34 | using OpenSim.Framework.Terrain; | ||
34 | 35 | ||
35 | namespace OpenSim.Storage.LocalStorageDb4o | 36 | namespace OpenSim.Storage.LocalStorageDb4o |
36 | { | 37 | { |
@@ -116,7 +117,51 @@ namespace OpenSim.Storage.LocalStorageDb4o | |||
116 | receiver.PrimFromStorage(prim); | 117 | receiver.PrimFromStorage(prim); |
117 | } | 118 | } |
118 | } | 119 | } |
119 | 120 | ||
121 | public float[] LoadWorld() | ||
122 | { | ||
123 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Loading world...."); | ||
124 | //World blank = new World(); | ||
125 | float[] heightmap = null; | ||
126 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Looking for a heightmap in local DB"); | ||
127 | IObjectSet world_result = db.Get(typeof(MapStorage)); | ||
128 | if (world_result.Count > 0) | ||
129 | { | ||
130 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Found a heightmap in local database, loading"); | ||
131 | MapStorage map = (MapStorage)world_result.Next(); | ||
132 | //blank.LandMap = map.Map; | ||
133 | heightmap = map.Map; | ||
134 | } | ||
135 | else | ||
136 | { | ||
137 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - No heightmap found, generating new one"); | ||
138 | HeightmapGenHills hills = new HeightmapGenHills(); | ||
139 | // blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); | ||
140 | heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); | ||
141 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Saving heightmap to local database"); | ||
142 | MapStorage map = new MapStorage(); | ||
143 | map.Map = heightmap; //blank.LandMap; | ||
144 | db.Set(map); | ||
145 | db.Commit(); | ||
146 | } | ||
147 | return heightmap; | ||
148 | } | ||
149 | |||
150 | public void SaveMap(float[] heightmap) | ||
151 | { | ||
152 | IObjectSet world_result = db.Get(typeof(MapStorage)); | ||
153 | if (world_result.Count > 0) | ||
154 | { | ||
155 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine("SaveWorld() - updating saved copy of heightmap in local database"); | ||
156 | MapStorage map = (MapStorage)world_result.Next(); | ||
157 | db.Delete(map); | ||
158 | } | ||
159 | MapStorage map1 = new MapStorage(); | ||
160 | map1.Map = heightmap; //OpenSim_Main.local_world.LandMap; | ||
161 | db.Set(map1); | ||
162 | db.Commit(); | ||
163 | } | ||
164 | |||
120 | public void ShutDown() | 165 | public void ShutDown() |
121 | { | 166 | { |
122 | db.Commit(); | 167 | db.Commit(); |
diff --git a/OpenSim.Storage/LocalStorageDb4o/MapStorage.cs b/OpenSim.Storage/LocalStorageDb4o/MapStorage.cs new file mode 100644 index 0000000..db590ff --- /dev/null +++ b/OpenSim.Storage/LocalStorageDb4o/MapStorage.cs | |||
@@ -0,0 +1,16 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Storage.LocalStorageDb4o | ||
6 | { | ||
7 | public class MapStorage | ||
8 | { | ||
9 | public float[] Map; | ||
10 | |||
11 | public MapStorage() | ||
12 | { | ||
13 | |||
14 | } | ||
15 | } | ||
16 | } \ No newline at end of file | ||
diff --git a/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj index b366e35..6504b77 100644 --- a/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj +++ b/OpenSim.Storage/LocalStorageDb4o/OpenSim.Storage.LocalStorageDb4o.csproj | |||
@@ -1,110 +1,113 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
2 | <PropertyGroup> | 2 | <PropertyGroup> |
3 | <ProjectType>Local</ProjectType> | 3 | <ProjectType>Local</ProjectType> |
4 | <ProductVersion>8.0.50727</ProductVersion> | 4 | <ProductVersion>8.0.50727</ProductVersion> |
5 | <SchemaVersion>2.0</SchemaVersion> | 5 | <SchemaVersion>2.0</SchemaVersion> |
6 | <ProjectGuid>{4D4E187D-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{E1B79ECF-0000-0000-0000-000000000000}</ProjectGuid> |
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
9 | <ApplicationIcon></ApplicationIcon> | 9 | <ApplicationIcon></ApplicationIcon> |
10 | <AssemblyKeyContainerName> | 10 | <AssemblyKeyContainerName> |
11 | </AssemblyKeyContainerName> | 11 | </AssemblyKeyContainerName> |
12 | <AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName> | 12 | <AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName> |
13 | <DefaultClientScript>JScript</DefaultClientScript> | 13 | <DefaultClientScript>JScript</DefaultClientScript> |
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | 14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> |
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 16 | <DelaySign>false</DelaySign> |
17 | <OutputType>Library</OutputType> | 17 | <OutputType>Library</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 18 | <AppDesignerFolder></AppDesignerFolder> |
19 | <RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace> | 19 | <RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace> |
20 | <StartupObject></StartupObject> | 20 | <StartupObject></StartupObject> |
21 | <FileUpgradeFlags> | 21 | <FileUpgradeFlags> |
22 | </FileUpgradeFlags> | 22 | </FileUpgradeFlags> |
23 | </PropertyGroup> | 23 | </PropertyGroup> |
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | 24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
26 | <BaseAddress>285212672</BaseAddress> | 26 | <BaseAddress>285212672</BaseAddress> |
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | 27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
28 | <ConfigurationOverrideFile> | 28 | <ConfigurationOverrideFile> |
29 | </ConfigurationOverrideFile> | 29 | </ConfigurationOverrideFile> |
30 | <DefineConstants>TRACE</DefineConstants> | 30 | <DefineConstants>TRACE;DEBUG</DefineConstants> |
31 | <DocumentationFile></DocumentationFile> | 31 | <DocumentationFile></DocumentationFile> |
32 | <DebugSymbols>False</DebugSymbols> | 32 | <DebugSymbols>True</DebugSymbols> |
33 | <FileAlignment>4096</FileAlignment> | 33 | <FileAlignment>4096</FileAlignment> |
34 | <Optimize>True</Optimize> | 34 | <Optimize>False</Optimize> |
35 | <OutputPath>../../bin/</OutputPath> | 35 | <OutputPath>..\..\bin\</OutputPath> |
36 | <RegisterForComInterop>False</RegisterForComInterop> | 36 | <RegisterForComInterop>False</RegisterForComInterop> |
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
39 | <WarningLevel>4</WarningLevel> | 39 | <WarningLevel>4</WarningLevel> |
40 | <NoWarn></NoWarn> | 40 | <NoWarn></NoWarn> |
41 | </PropertyGroup> | 41 | </PropertyGroup> |
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | 42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | 43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
44 | <BaseAddress>285212672</BaseAddress> | 44 | <BaseAddress>285212672</BaseAddress> |
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | 45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
46 | <ConfigurationOverrideFile> | 46 | <ConfigurationOverrideFile> |
47 | </ConfigurationOverrideFile> | 47 | </ConfigurationOverrideFile> |
48 | <DefineConstants>TRACE;DEBUG</DefineConstants> | 48 | <DefineConstants>TRACE</DefineConstants> |
49 | <DocumentationFile></DocumentationFile> | 49 | <DocumentationFile></DocumentationFile> |
50 | <DebugSymbols>True</DebugSymbols> | 50 | <DebugSymbols>False</DebugSymbols> |
51 | <FileAlignment>4096</FileAlignment> | 51 | <FileAlignment>4096</FileAlignment> |
52 | <Optimize>False</Optimize> | 52 | <Optimize>True</Optimize> |
53 | <OutputPath>../../bin/</OutputPath> | 53 | <OutputPath>..\..\bin\</OutputPath> |
54 | <RegisterForComInterop>False</RegisterForComInterop> | 54 | <RegisterForComInterop>False</RegisterForComInterop> |
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | 55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> |
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | 56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> |
57 | <WarningLevel>4</WarningLevel> | 57 | <WarningLevel>4</WarningLevel> |
58 | <NoWarn></NoWarn> | 58 | <NoWarn></NoWarn> |
59 | </PropertyGroup> | 59 | </PropertyGroup> |
60 | <ItemGroup> | 60 | <ItemGroup> |
61 | <Reference Include="System" > | 61 | <Reference Include="System" > |
62 | <HintPath>System.dll</HintPath> | 62 | <HintPath>System.dll</HintPath> |
63 | <Private>False</Private> | 63 | <Private>False</Private> |
64 | </Reference> | 64 | </Reference> |
65 | <Reference Include="System.Xml" > | 65 | <Reference Include="System.Xml" > |
66 | <HintPath>System.Xml.dll</HintPath> | 66 | <HintPath>System.Xml.dll</HintPath> |
67 | <Private>False</Private> | 67 | <Private>False</Private> |
68 | </Reference> | 68 | </Reference> |
69 | <Reference Include="Db4objects.Db4o.dll" > | 69 | <Reference Include="Db4objects.Db4o.dll" > |
70 | <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> | 70 | <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> |
71 | <Private>False</Private> | 71 | <Private>False</Private> |
72 | </Reference> | 72 | </Reference> |
73 | <Reference Include="libsecondlife.dll" > | 73 | <Reference Include="libsecondlife.dll" > |
74 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | 74 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> |
75 | <Private>False</Private> | 75 | <Private>False</Private> |
76 | </Reference> | 76 | </Reference> |
77 | </ItemGroup> | 77 | </ItemGroup> |
78 | <ItemGroup> | 78 | <ItemGroup> |
79 | <ProjectReference Include="../../OpenSim.Framework/OpenSim.Framework.csproj"> | 79 | <ProjectReference Include="..\..\OpenSim.Framework\OpenSim.Framework.csproj"> |
80 | <Name>OpenSim.Framework</Name> | 80 | <Name>OpenSim.Framework</Name> |
81 | <Project>{7404933D-0000-0000-0000-000000000000}</Project> | 81 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> |
82 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 82 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
83 | <Private>False</Private> | 83 | <Private>False</Private> |
84 | </ProjectReference> | 84 | </ProjectReference> |
85 | <ProjectReference Include="../../OpenSim.Framework.Console/OpenSim.Framework.Console.csproj"> | 85 | <ProjectReference Include="..\..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> |
86 | <Name>OpenSim.Framework.Console</Name> | 86 | <Name>OpenSim.Framework.Console</Name> |
87 | <Project>{16759386-0000-0000-0000-000000000000}</Project> | 87 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> |
88 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 88 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
89 | <Private>False</Private> | 89 | <Private>False</Private> |
90 | </ProjectReference> | 90 | </ProjectReference> |
91 | </ItemGroup> | 91 | </ItemGroup> |
92 | <ItemGroup> | 92 | <ItemGroup> |
93 | <Compile Include="AssemblyInfo.cs"> | 93 | <Compile Include="AssemblyInfo.cs"> |
94 | <SubType>Code</SubType> | 94 | <SubType>Code</SubType> |
95 | </Compile> | 95 | </Compile> |
96 | <Compile Include="Db4LocalStorage.cs"> | 96 | <Compile Include="Db4LocalStorage.cs"> |
97 | <SubType>Code</SubType> | 97 | <SubType>Code</SubType> |
98 | </Compile> | 98 | </Compile> |
99 | <Compile Include="UUIDQuery.cs"> | 99 | <Compile Include="MapStorage.cs"> |
100 | <SubType>Code</SubType> | 100 | <SubType>Code</SubType> |
101 | </Compile> | 101 | </Compile> |
102 | </ItemGroup> | 102 | <Compile Include="UUIDQuery.cs"> |
103 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | 103 | <SubType>Code</SubType> |
104 | <PropertyGroup> | 104 | </Compile> |
105 | <PreBuildEvent> | 105 | </ItemGroup> |
106 | </PreBuildEvent> | 106 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> |
107 | <PostBuildEvent> | 107 | <PropertyGroup> |
108 | </PostBuildEvent> | 108 | <PreBuildEvent> |
109 | </PropertyGroup> | 109 | </PreBuildEvent> |
110 | </Project> | 110 | <PostBuildEvent> |
111 | </PostBuildEvent> | ||
112 | </PropertyGroup> | ||
113 | </Project> | ||