patch and files from mantis #1630, Thanks Melanie

0.6.0-stable
MW 2008-06-29 11:48:58 +00:00
parent 68bec3f69f
commit f3f31744ab
10 changed files with 600 additions and 2 deletions

View File

@ -151,6 +151,15 @@ namespace OpenSim.Data.MSSQL
}
}
public void StoreRegionSettings(RegionSettings rs)
{
}
public RegionSettings LoadRegionSettings(LLUUID regionUUID)
{
return null;
}
/// <summary>
///
/// </summary>

View File

@ -54,6 +54,7 @@ namespace OpenSim.Data.MySQL
private const string m_landSelect = "select * from land";
private const string m_landAccessListSelect = "select * from landaccesslist";
private const string m_regionBanListSelect = "select * from regionban";
private const string m_regionSettingsSelect = "select * from regionsettings";
/// <summary>
@ -70,6 +71,7 @@ namespace OpenSim.Data.MySQL
private MySqlDataAdapter m_landDataAdapter;
private MySqlDataAdapter m_landAccessListDataAdapter;
private MySqlDataAdapter m_regionBanListDataAdapter;
private MySqlDataAdapter m_regionSettingsDataAdapter;
private DataTable m_primTable;
private DataTable m_shapeTable;
@ -78,6 +80,7 @@ namespace OpenSim.Data.MySQL
private DataTable m_landTable;
private DataTable m_landAccessListTable;
private DataTable m_regionBanListTable;
private DataTable m_regionSettingsTable;
/// <value>Temporary attribute while this is experimental</value>
private bool persistPrimInventories;
@ -134,6 +137,8 @@ namespace OpenSim.Data.MySQL
MySqlCommand regionBanListSelectCmd = new MySqlCommand(m_regionBanListSelect, m_connection);
m_regionBanListDataAdapter = new MySqlDataAdapter(regionBanListSelectCmd);
MySqlCommand regionSettingsSelectCmd = new MySqlCommand(m_regionSettingsSelect, m_connection);
m_regionSettingsDataAdapter = new MySqlDataAdapter(regionSettingsSelectCmd);
lock (m_dataSet)
{
@ -175,6 +180,11 @@ namespace OpenSim.Data.MySQL
m_dataSet.Tables.Add(m_regionBanListTable);
SetupRegionBanCommands(m_regionBanListDataAdapter, m_connection);
m_regionBanListDataAdapter.Fill(m_regionBanListTable);
m_regionSettingsTable = createRegionSettingsTable();
m_dataSet.Tables.Add(m_regionSettingsTable);
SetupRegionSettingsCommands(m_regionSettingsDataAdapter, m_connection);
m_regionSettingsDataAdapter.Fill(m_regionSettingsTable);
}
}
/// <summary>
@ -640,6 +650,41 @@ namespace OpenSim.Data.MySQL
}
}
public RegionSettings LoadRegionSettings(LLUUID regionUUID)
{
lock(m_dataSet)
{
DataTable regionsettings = m_regionSettingsTable;
string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
DataRow[] rawsettings = regionsettings.Select(searchExp);
if(rawsettings.Length == 0)
return null;
DataRow row = rawsettings[0];
return buildRegionSettings(row);
}
}
public void StoreRegionSettings(RegionSettings rs)
{
lock (m_dataSet)
{
DataTable regionsettings = m_dataSet.Tables["regionsettings"];
DataRow settingsRow = regionsettings.Rows.Find(rs.RegionUUID.ToString());
if (settingsRow == null)
{
settingsRow = regionsettings.NewRow();
fillRegionSettingsRow(settingsRow, rs);
regionsettings.Rows.Add(settingsRow);
}
else
{
fillRegionSettingsRow(settingsRow, rs);
}
}
}
/// <summary>
/// Load (fetch?) a region banlist
/// </summary>
@ -838,6 +883,49 @@ namespace OpenSim.Data.MySQL
return terrain;
}
/// <summary>
/// Create the "regionsettings" table
/// </summary>
/// <returns></returns>
private static DataTable createRegionSettingsTable()
{
DataTable regionsettings = new DataTable("regionsettings");
createCol(regionsettings, "regionUUID", typeof(String));
createCol(regionsettings, "block_terraform", typeof (Int32));
createCol(regionsettings, "block_fly", typeof (Int32));
createCol(regionsettings, "allow_damage", typeof (Int32));
createCol(regionsettings, "restrict_pushing", typeof (Int32));
createCol(regionsettings, "allow_land_resell", typeof (Int32));
createCol(regionsettings, "allow_land_join_divide", typeof (Int32));
createCol(regionsettings, "block_show_in_search", typeof (Int32));
createCol(regionsettings, "agent_limit", typeof (Int32));
createCol(regionsettings, "object_bonus", typeof (Double));
createCol(regionsettings, "maturity", typeof (Int32));
createCol(regionsettings, "disable_scripts", typeof (Int32));
createCol(regionsettings, "disable_collisions", typeof (Int32));
createCol(regionsettings, "disable_physics", typeof (Int32));
createCol(regionsettings, "terrain_texture_1", typeof(String));
createCol(regionsettings, "terrain_texture_2", typeof(String));
createCol(regionsettings, "terrain_texture_3", typeof(String));
createCol(regionsettings, "terrain_texture_4", typeof(String));
createCol(regionsettings, "elevation_1_nw", typeof (Double));
createCol(regionsettings, "elevation_2_nw", typeof (Double));
createCol(regionsettings, "elevation_1_ne", typeof (Double));
createCol(regionsettings, "elevation_2_ne", typeof (Double));
createCol(regionsettings, "elevation_1_se", typeof (Double));
createCol(regionsettings, "elevation_2_se", typeof (Double));
createCol(regionsettings, "elevation_1_sw", typeof (Double));
createCol(regionsettings, "elevation_2_sw", typeof (Double));
createCol(regionsettings, "water_height", typeof (Double));
createCol(regionsettings, "terrain_raise_limit", typeof (Double));
createCol(regionsettings, "terrain_lower_limit", typeof (Double));
createCol(regionsettings, "use_estate_sun", typeof (Int32));
createCol(regionsettings, "fixed_sun", typeof (Int32));
createCol(regionsettings, "sun_position", typeof (Double));
createCol(regionsettings, "covenant", typeof(String));
return regionsettings;
}
/// <summary>
/// Create the "regionban" table
/// </summary>
@ -1205,6 +1293,47 @@ namespace OpenSim.Data.MySQL
return taskItem;
}
private static RegionSettings buildRegionSettings(DataRow row)
{
RegionSettings newSettings = new RegionSettings();
newSettings.RegionUUID = new LLUUID((string) row["regionUUID"]);
newSettings.BlockTerraform = Convert.ToBoolean(row["block_terraform"]);
newSettings.AllowDamage = Convert.ToBoolean(row["allow_damage"]);
newSettings.BlockFly = Convert.ToBoolean(row["block_fly"]);
newSettings.RestrictPushing = Convert.ToBoolean(row["restrict_pushing"]);
newSettings.AllowLandResell = Convert.ToBoolean(row["allow_land_resell"]);
newSettings.AllowLandJoinDivide = Convert.ToBoolean(row["allow_land_join_divide"]);
newSettings.BlockShowInSearch = Convert.ToBoolean(row["block_show_in_search"]);
newSettings.AgentLimit = Convert.ToInt32(row["agent_limit"]);
newSettings.ObjectBonus = Convert.ToDouble(row["object_bonus"]);
newSettings.Maturity = Convert.ToInt32(row["maturity"]);
newSettings.DisableScripts = Convert.ToBoolean(row["disable_scripts"]);
newSettings.DisableCollisions = Convert.ToBoolean(row["disable_collisions"]);
newSettings.DisablePhysics = Convert.ToBoolean(row["disable_physics"]);
newSettings.TerrainTexture1 = new LLUUID((String) row["terrain_texture_1"]);
newSettings.TerrainTexture2 = new LLUUID((String) row["terrain_texture_2"]);
newSettings.TerrainTexture3 = new LLUUID((String) row["terrain_texture_3"]);
newSettings.TerrainTexture4 = new LLUUID((String) row["terrain_texture_4"]);
newSettings.Elevation1NW = Convert.ToDouble(row["elevation_1_nw"]);
newSettings.Elevation2NW = Convert.ToDouble(row["elevation_2_nw"]);
newSettings.Elevation1NE = Convert.ToDouble(row["elevation_1_ne"]);
newSettings.Elevation2NE = Convert.ToDouble(row["elevation_2_ne"]);
newSettings.Elevation1SE = Convert.ToDouble(row["elevation_1_se"]);
newSettings.Elevation2SE = Convert.ToDouble(row["elevation_2_se"]);
newSettings.Elevation1SW = Convert.ToDouble(row["elevation_1_sw"]);
newSettings.Elevation2SW = Convert.ToDouble(row["elevation_2_sw"]);
newSettings.WaterHeight = Convert.ToDouble(row["water_height"]);
newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
newSettings.Covenant = new LLUUID((String) row["covenant"]);
return newSettings;
}
/// <summary>
///
/// </summary>
@ -1422,6 +1551,46 @@ namespace OpenSim.Data.MySQL
row["flags"] = taskItem.Flags;
}
/// <summary>
///
/// </summary>
private static void fillRegionSettingsRow(DataRow row, RegionSettings settings)
{
row["regionUUID"] = settings.RegionUUID.ToString();
row["block_terraform"] = settings.BlockTerraform;
row["block_fly"] = settings.BlockFly;
row["allow_damage"] = settings.AllowDamage;
row["restrict_pushing"] = settings.RestrictPushing;
row["allow_land_resell"] = settings.AllowLandResell;
row["allow_land_join_divide"] = settings.AllowLandJoinDivide;
row["block_show_in_search"] = settings.BlockShowInSearch;
row["agent_limit"] = settings.AgentLimit;
row["object_bonus"] = settings.ObjectBonus;
row["maturity"] = settings.Maturity;
row["disable_scripts"] = settings.DisableScripts;
row["disable_collisions"] = settings.DisableCollisions;
row["disable_physics"] = settings.DisablePhysics;
row["terrain_texture_1"] = settings.TerrainTexture1.ToString();
row["terrain_texture_2"] = settings.TerrainTexture2.ToString();
row["terrain_texture_3"] = settings.TerrainTexture3.ToString();
row["terrain_texture_4"] = settings.TerrainTexture4.ToString();
row["elevation_1_nw"] = settings.Elevation1NW;
row["elevation_2_nw"] = settings.Elevation2NW;
row["elevation_1_ne"] = settings.Elevation1NE;
row["elevation_2_ne"] = settings.Elevation2NE;
row["elevation_1_se"] = settings.Elevation1SE;
row["elevation_2_se"] = settings.Elevation2SE;
row["elevation_1_sw"] = settings.Elevation1SW;
row["elevation_2_sw"] = settings.Elevation2SW;
row["water_height"] = settings.WaterHeight;
row["terrain_raise_limit"] = settings.TerrainRaiseLimit;
row["terrain_lower_limit"] = settings.TerrainLowerLimit;
row["use_estate_sun"] = settings.UseEstateSun;
row["fixed_sun"] = settings.FixedSun;
row["sun_position"] = settings.SunPosition;
row["covenant"] = settings.Covenant.ToString();
}
/// <summary>
///
/// </summary>
@ -1865,6 +2034,20 @@ namespace OpenSim.Data.MySQL
da.DeleteCommand = delete;
}
private void SetupRegionSettingsCommands(MySqlDataAdapter da, MySqlConnection conn)
{
da.InsertCommand = createInsertCommand("regionsettings", m_regionSettingsTable);
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("regionsettings", "regionUUID = ?regionUUID", m_regionSettingsTable);
da.UpdateCommand.Connection = conn;
MySqlCommand delete = new MySqlCommand("delete from regionsettings where regionUUID = ?regionUUID");
delete.Parameters.Add(createMySqlParameter("regionUUID", typeof(String)));
delete.Connection = conn;
da.DeleteCommand = delete;
}
/// <summary>
///
/// </summary>

View File

@ -0,0 +1,40 @@
BEGIN;
create table regionsettings (
regionUUID char(36) not null,
block_terraform integer not null,
block_fly integer not null,
allow_damage integer not null,
restrict_pushing integer not null,
allow_land_resell integer not null,
allow_land_join_divide integer not null,
block_show_in_search integer not null,
agent_limit integer not null,
object_bonus float not null,
maturity integer not null,
disable_scripts integer not null,
disable_collisions integer not null,
disable_physics integer not null,
terrain_texture_1 char(36) not null,
terrain_texture_2 char(36) not null,
terrain_texture_3 char(36) not null,
terrain_texture_4 char(36) not null,
elevation_1_nw float not null,
elevation_2_nw float not null,
elevation_1_ne float not null,
elevation_2_ne float not null,
elevation_1_se float not null,
elevation_2_se float not null,
elevation_1_sw float not null,
elevation_2_sw float not null,
water_height float not null,
terrain_raise_limit float not null,
terrain_lower_limit float not null,
use_estate_sun integer not null,
fixed_sun integer not null,
sun_position float not null,
covenant char(36),
primary key(regionUUID)
);
COMMIT;

View File

@ -43,6 +43,15 @@ namespace OpenSim.Data.Null
return;
}
public void StoreRegionSettings(RegionSettings rs)
{
}
public RegionSettings LoadRegionSettings(LLUUID regionUUID)
{
return null;
}
public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
{
}

View File

@ -0,0 +1,38 @@
BEGIN;
create table regionsettings (
regionUUID char(36) not null,
block_terraform integer not null,
block_fly integer not null,
allow_damage integer not null,
restrict_pushing integer not null,
allow_land_resell integer not null,
allow_land_join_divide integer not null,
block_show_in_search integer not null,
agent_limit integer not null,
object_bonus float not null,
maturity integer not null,
disable_scripts integer not null,
disable_collisions integer not null,
disable_physics integer not null,
terrain_texture_1 char(36) not null,
terrain_texture_2 char(36) not null,
terrain_texture_3 char(36) not null,
terrain_texture_4 char(36) not null,
elevation_1_nw float not null,
elevation_2_nw float not null,
elevation_1_ne float not null,
elevation_2_ne float not null,
elevation_1_se float not null,
elevation_2_se float not null,
elevation_1_sw float not null,
elevation_2_sw float not null,
water_height float not null,
terrain_raise_limit float not null,
terrain_lower_limit float not null,
use_estate_sun integer not null,
fixed_sun integer not null,
sun_position float not null,
covenant char(36));
COMMIT;

View File

@ -214,6 +214,15 @@ namespace OpenSim.Data.SQLite
}
}
public void StoreRegionSettings(RegionSettings rs)
{
}
public RegionSettings LoadRegionSettings(LLUUID regionUUID)
{
return null;
}
/// <summary>
/// Adds an object into region storage
/// </summary>

View File

@ -134,7 +134,7 @@ namespace OpenSim.Framework.Communications
public bool TryGetInventoryService(string host, out IInventoryServices inventoryService)
{
if ((host == string.Empty) | (host == "default"))
if ((host == string.Empty) || (host == "default"))
{
host = m_defaultInventoryHost;
}

View File

@ -0,0 +1,300 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using libsecondlife;
using log4net;
namespace OpenSim.Framework
{
public class RegionSettings
{
private LLUUID m_RegionUUID;
public LLUUID RegionUUID
{
get { return m_RegionUUID; }
set { m_RegionUUID = value; }
}
private bool m_BlockTerraform;
public bool BlockTerraform
{
get { return m_BlockTerraform; }
set { m_BlockTerraform = value; }
}
private bool m_BlockFly;
public bool BlockFly
{
get { return m_BlockFly; }
set { m_BlockFly = value; }
}
private bool m_AllowDamage;
public bool AllowDamage
{
get { return m_AllowDamage; }
set { m_AllowDamage = value; }
}
private bool m_RestrictPushing;
public bool RestrictPushing
{
get { return m_RestrictPushing; }
set { m_RestrictPushing = value; }
}
private bool m_AllowLandResell;
public bool AllowLandResell
{
get { return m_AllowLandResell; }
set { m_AllowLandResell = value; }
}
private bool m_AllowLandJoinDivide;
public bool AllowLandJoinDivide
{
get { return m_AllowLandJoinDivide; }
set { m_AllowLandJoinDivide = value; }
}
private bool m_BlockShowInSearch;
public bool BlockShowInSearch
{
get { return m_BlockShowInSearch; }
set { m_BlockShowInSearch = value; }
}
private int m_AgentLimit;
public int AgentLimit
{
get { return m_AgentLimit; }
set { m_AgentLimit = value; }
}
private double m_ObjectBonus;
public double ObjectBonus
{
get { return m_ObjectBonus; }
set { m_ObjectBonus = value; }
}
private int m_Maturity;
public int Maturity
{
get { return m_Maturity; }
set { m_Maturity = value; }
}
private bool m_DisableScripts;
public bool DisableScripts
{
get { return m_DisableScripts; }
set { m_DisableScripts = value; }
}
private bool m_DisableCollisions;
public bool DisableCollisions
{
get { return m_DisableCollisions; }
set { m_DisableCollisions = value; }
}
private bool m_DisablePhysics;
public bool DisablePhysics
{
get { return m_DisablePhysics; }
set { m_DisablePhysics = value; }
}
private LLUUID m_TerrainTexture1;
public LLUUID TerrainTexture1
{
get { return m_TerrainTexture1; }
set { m_TerrainTexture1 = value; }
}
private LLUUID m_TerrainTexture2;
public LLUUID TerrainTexture2
{
get { return m_TerrainTexture2; }
set { m_TerrainTexture2 = value; }
}
private LLUUID m_TerrainTexture3;
public LLUUID TerrainTexture3
{
get { return m_TerrainTexture3; }
set { m_TerrainTexture3 = value; }
}
private LLUUID m_TerrainTexture4;
public LLUUID TerrainTexture4
{
get { return m_TerrainTexture4; }
set { m_TerrainTexture4 = value; }
}
private double m_Elevation1NW;
public double Elevation1NW
{
get { return m_Elevation1NW; }
set { m_Elevation1NW = value; }
}
private double m_Elevation2NW;
public double Elevation2NW
{
get { return m_Elevation2NW; }
set { m_Elevation2NW = value; }
}
private double m_Elevation1NE;
public double Elevation1NE
{
get { return m_Elevation1NE; }
set { m_Elevation1NE = value; }
}
private double m_Elevation2NE;
public double Elevation2NE
{
get { return m_Elevation2NE; }
set { m_Elevation2NE = value; }
}
private double m_Elevation1SE;
public double Elevation1SE
{
get { return m_Elevation1SE; }
set { m_Elevation1SE = value; }
}
private double m_Elevation2SE;
public double Elevation2SE
{
get { return m_Elevation2SE; }
set { m_Elevation2SE = value; }
}
private double m_Elevation1SW;
public double Elevation1SW
{
get { return m_Elevation1SW; }
set { m_Elevation1SW = value; }
}
private double m_Elevation2SW;
public double Elevation2SW
{
get { return m_Elevation2SW; }
set { m_Elevation2SW = value; }
}
private double m_WaterHeight;
public double WaterHeight
{
get { return m_WaterHeight; }
set { m_WaterHeight = value; }
}
private double m_TerrainRaiseLimit;
public double TerrainRaiseLimit
{
get { return m_TerrainRaiseLimit; }
set { m_TerrainRaiseLimit = value; }
}
private double m_TerrainLowerLimit;
public double TerrainLowerLimit
{
get { return m_TerrainLowerLimit; }
set { m_TerrainLowerLimit = value; }
}
private bool m_UseEstateSun;
public bool UseEstateSun
{
get { return m_UseEstateSun; }
set { m_UseEstateSun = value; }
}
private bool m_FixedSun;
public bool FixedSun
{
get { return m_FixedSun; }
set { m_FixedSun = value; }
}
private double m_SunPosition;
public double SunPosition
{
get { return m_SunPosition; }
set { m_SunPosition = value; }
}
private LLUUID m_Covenant;
public LLUUID Covenant
{
get { return m_Covenant; }
set { m_Covenant = value; }
}
}
}

View File

@ -76,7 +76,8 @@ namespace OpenSim.Region.Environment.Interfaces
void AddToRegionBanlist(RegionBanListItem item);
void RemoveFromRegionBanlist(RegionBanListItem item);
void StoreRegionSettings(RegionSettings rs);
RegionSettings LoadRegionSettings(LLUUID regionUUID);
void Shutdown();
}

View File

@ -124,6 +124,15 @@ namespace OpenSim.DataStore.MSSQL
}
}
public void StoreRegionSettings(RegionSettings rs)
{
}
public RegionSettings LoadRegionSettings(LLUUID regionUUID)
{
return null;
}
public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
{
lock (ds)