aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorlbsa712007-12-27 21:41:48 +0000
committerlbsa712007-12-27 21:41:48 +0000
commitefd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch)
treebf5b897e1e3c13211e3e2fc61d30508b94c928c0
parent* removed always true if (diff)
downloadopensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs23
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs78
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs10
-rw-r--r--OpenSim/Framework/AgentCircuitManager.cs2
-rw-r--r--OpenSim/Framework/AgentInventory.cs2
-rw-r--r--OpenSim/Framework/AssetBase.cs2
-rw-r--r--OpenSim/Framework/AssetLandmark.cs2
-rw-r--r--OpenSim/Framework/AssetStorage.cs2
-rw-r--r--OpenSim/Framework/AuthenticateResponse.cs2
-rw-r--r--OpenSim/Framework/AvatarWearable.cs2
-rw-r--r--OpenSim/Framework/BlockingQueue.cs4
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs8
-rw-r--r--OpenSim/Framework/ClientManager.cs21
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs49
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServer.cs6
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs10
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs2
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetTransactions.cs6
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs2
-rw-r--r--OpenSim/Framework/Communications/Cache/GridAssetClient.cs15
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs4
-rw-r--r--OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs37
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs8
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs37
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs82
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSD.cs42
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDArray.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs15
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs8
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs14
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs12
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDTest.cs2
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDType.cs2
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs7
-rw-r--r--OpenSim/Framework/Communications/IGridServices.cs4
-rw-r--r--OpenSim/Framework/Communications/IInterRegionCommunications.cs6
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs2
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs5
-rw-r--r--OpenSim/Framework/Communications/LoginResponse.cs6
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs25
-rw-r--r--OpenSim/Framework/Communications/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Communications/RestClient/RestClient.cs16
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs32
-rw-r--r--OpenSim/Framework/Configuration/XML/XmlConfiguration.cs2
-rw-r--r--OpenSim/Framework/ConfigurationMember.cs135
-rw-r--r--OpenSim/Framework/ConfigurationOption.cs1
-rw-r--r--OpenSim/Framework/Console/AssemblyInfo.cs2
-rw-r--r--OpenSim/Framework/Console/ConsoleCallbacksBase.cs2
-rw-r--r--OpenSim/Framework/Console/LogBase.cs6
-rw-r--r--OpenSim/Framework/Console/MainLog.cs2
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oGridData.cs5
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oManager.cs2
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oUserData.cs10
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs59
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs46
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs163
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs13
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLManager.cs261
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs142
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLAssetData.cs14
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLDataStore.cs404
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs49
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs4
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLLogData.cs2
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLManager.cs2
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs53
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs2
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteBase.cs2
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteGridData.cs5
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs6
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteManager.cs2
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteUserData.cs44
-rw-r--r--OpenSim/Framework/Data/GridData.cs7
-rw-r--r--OpenSim/Framework/Data/ILogData.cs2
-rw-r--r--OpenSim/Framework/Data/IniConfig.cs2
-rw-r--r--OpenSim/Framework/Data/RegionProfileData.cs2
-rw-r--r--OpenSim/Framework/Data/ReservationData.cs2
-rw-r--r--OpenSim/Framework/EstateSettings.cs4
-rw-r--r--OpenSim/Framework/GridConfig.cs5
-rw-r--r--OpenSim/Framework/IAssetServer.cs2
-rw-r--r--OpenSim/Framework/IClientAPI.cs56
-rw-r--r--OpenSim/Framework/IGenericConfig.cs2
-rw-r--r--OpenSim/Framework/IRegionCommsListener.cs5
-rw-r--r--OpenSim/Framework/IRegionLoader.cs7
-rw-r--r--OpenSim/Framework/IScene.cs7
-rw-r--r--OpenSim/Framework/IUserData.cs8
-rw-r--r--OpenSim/Framework/IUserService.cs4
-rw-r--r--OpenSim/Framework/InventoryItemBase.cs2
-rw-r--r--OpenSim/Framework/LandData.cs7
-rw-r--r--OpenSim/Framework/Login.cs2
-rw-r--r--OpenSim/Framework/NeighbourInfo.cs2
-rw-r--r--OpenSim/Framework/NetworkServersInfo.cs8
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs32
-rw-r--r--OpenSim/Framework/RegionCommsListener.cs13
-rw-r--r--OpenSim/Framework/RegionInfo.cs205
-rw-r--r--OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs8
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs37
-rw-r--r--OpenSim/Framework/Remoting.cs2
-rw-r--r--OpenSim/Framework/SerializableRegionInfo.cs79
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs66
-rw-r--r--OpenSim/Framework/Servers/CheckSumServer.cs2
-rw-r--r--OpenSim/Framework/Servers/RestMethod.cs2
-rw-r--r--OpenSim/Framework/Servers/RestObjectPoster.cs8
-rw-r--r--OpenSim/Framework/Servers/RestObjectPosterResponse.cs14
-rw-r--r--OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs14
-rw-r--r--OpenSim/Framework/Servers/XmlRpcMethod.cs2
-rw-r--r--OpenSim/Framework/UserConfig.cs11
-rw-r--r--OpenSim/Framework/UserProfileData.cs15
-rw-r--r--OpenSim/Framework/Util.cs17
-rw-r--r--OpenSim/Framework/sLLVector3.cs7
-rw-r--r--OpenSim/Grid/AssetServer/Main.cs2
-rw-r--r--OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Grid/AssetServer/RestService.cs4
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs17
-rw-r--r--OpenSim/Grid/GridServer/Main.cs4
-rw-r--r--OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Grid/InventoryServer/GridInventoryService.cs45
-rw-r--r--OpenSim/Grid/InventoryServer/InventoryManager.cs43
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs34
-rw-r--r--OpenSim/Grid/ScriptServer/Application.cs2
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs2
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs2
-rw-r--r--OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs2
-rw-r--r--OpenSim/Grid/UserServer/Main.cs21
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs65
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs32
-rw-r--r--OpenSim/Region/Application/Application.cs2
-rw-r--r--OpenSim/Region/Application/IApplicationPlugin.cs11
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs85
-rw-r--r--OpenSim/Region/Application/VersionInfo.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs378
-rw-r--r--OpenSim/Region/ClientStack/PacketQueue.cs198
-rw-r--r--OpenSim/Region/ClientStack/PacketServer.cs13
-rw-r--r--OpenSim/Region/ClientStack/PacketThrottle.cs43
-rw-r--r--OpenSim/Region/ClientStack/QueItem.cs18
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs9
-rw-r--r--OpenSim/Region/ClientStack/UDPServer.cs87
-rw-r--r--OpenSim/Region/Communications/Local/CommunicationsLocal.cs2
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs40
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs10
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs14
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs3
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs219
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs32
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs24
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1UserServices.cs29
-rw-r--r--OpenSim/Region/Environment/EstateManager.cs24
-rw-r--r--OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs1
-rw-r--r--OpenSim/Region/Environment/Interfaces/IHttpRequests.cs2
-rw-r--r--OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs7
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs61
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs95
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs17
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs10
-rw-r--r--OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs260
-rw-r--r--OpenSim/Region/Environment/Modules/SunModule.cs37
-rw-r--r--OpenSim/Region/Environment/Modules/TextureDownloadModule.cs42
-rw-r--r--OpenSim/Region/Environment/Modules/WorldCommModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/XMLRPCModule.cs9
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs31
-rw-r--r--OpenSim/Region/Environment/Scenes/AvatarAnimations.cs17
-rw-r--r--OpenSim/Region/Environment/Scenes/AvatarAppearance.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs123
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs189
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs19
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs400
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs11
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs72
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneEvents.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs93
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs414
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs132
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs25
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs69
-rw-r--r--OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs1
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs27
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyWorld.cs9
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs5
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/Script.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs2
-rw-r--r--OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs2
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs42
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs206
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs69
-rw-r--r--OpenSim/Region/Physics/Manager/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/IMesher.cs9
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs101
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs8
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs15
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsVector.cs15
-rw-r--r--OpenSim/Region/Physics/Manager/ZeroMesher.cs9
-rw-r--r--OpenSim/Region/Physics/Meshing/Extruder.cs21
-rw-r--r--OpenSim/Region/Physics/Meshing/HelperTypes.cs10
-rw-r--r--OpenSim/Region/Physics/Meshing/Mesh.cs42
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs74
-rw-r--r--OpenSim/Region/Physics/Meshing/SimpleHull.cs120
-rw-r--r--OpenSim/Region/Physics/Meshing/Simplex.cs49
-rw-r--r--OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs114
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs175
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs336
-rw-r--r--OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPlugin.cs84
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs124
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_Types.cs66
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs21
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs65
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs309
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs306
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs5
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs35
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs2
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs2
-rw-r--r--OpenSim/Tools/Export/OpenSimExport.cs36
277 files changed, 4704 insertions, 4427 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 3c27108..b897c60 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -26,21 +26,14 @@
26* 26*
27*/ 27*/
28 28
29using System; 29using Mono.Addins;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim;
33using OpenSim.Framework.Console;
34using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Framework.Console;
35using OpenSim.Framework.RegionLoader.Filesystem; 32using OpenSim.Framework.RegionLoader.Filesystem;
36using OpenSim.Framework.RegionLoader.Web; 33using OpenSim.Framework.RegionLoader.Web;
37using Mono.Addins;
38using Mono.Addins.Description;
39using Nini;
40using Nini.Config;
41 34
42[assembly:Addin] 35[assembly : Addin]
43[assembly:AddinDependency ("OpenSim", "0.4")] 36[assembly : AddinDependency("OpenSim", "0.4")]
44 37
45namespace OpenSim.ApplicationPlugins.LoadRegions 38namespace OpenSim.ApplicationPlugins.LoadRegions
46{ 39{
@@ -65,7 +58,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
65 58
66 regionLoader.SetIniConfigSource(openSim.ConfigSource); 59 regionLoader.SetIniConfigSource(openSim.ConfigSource);
67 RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); 60 RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
68 61
69 openSim.ModuleLoader.LoadDefaultSharedModules(); 62 openSim.ModuleLoader.LoadDefaultSharedModules();
70 63
71 for (int i = 0; i < regionsToLoad.Length; i++) 64 for (int i = 0; i < regionsToLoad.Length; i++)
@@ -77,6 +70,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
77 openSim.ModuleLoader.PostInitialise(); 70 openSim.ModuleLoader.PostInitialise();
78 openSim.ModuleLoader.ClearCache(); 71 openSim.ModuleLoader.ClearCache();
79 } 72 }
73
80 public void LoadRegionFromConfig(OpenSimMain openSim, ulong regionhandle) 74 public void LoadRegionFromConfig(OpenSimMain openSim, ulong regionhandle)
81 { 75 {
82 MainLog.Instance.Notice("LOADREGIONS", "Load Regions addin being initialised"); 76 MainLog.Instance.Notice("LOADREGIONS", "Load Regions addin being initialised");
@@ -103,11 +97,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
103 openSim.CreateRegion(regionsToLoad[i]); 97 openSim.CreateRegion(regionsToLoad[i]);
104 } 98 }
105 } 99 }
106
107 } 100 }
101
108 public void Close() 102 public void Close()
109 { 103 {
110
111 } 104 }
112 } 105 }
113} \ No newline at end of file 106} \ No newline at end of file
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
index 0b5f4bd..ffb3e48 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
@@ -1,26 +1,28 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
4 3
5// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
7// associated with an assembly. 6// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Addin")] 7
9[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Addin")]
10[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
11[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
12[assembly: AssemblyProduct("OpenSim.Addin")] 11[assembly : AssemblyCompany("")]
13[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Addin")]
14[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
15[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
16 16
17// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
21 22
22// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("45b979d9-d8d4-42fd-9780-fe9ac7e86cb4")] 24
25[assembly : Guid("45b979d9-d8d4-42fd-9780-fe9ac7e86cb4")]
24 26
25// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
26// 28//
@@ -32,5 +34,6 @@ using System.Runtime.InteropServices;
32// You can specify all the values or you can default the Build and Revision Numbers 34// You can specify all the values or you can default the Build and Revision Numbers
33// by using the '*' as shown below: 35// by using the '*' as shown below:
34// [assembly: AssemblyVersion("1.0.*")] 36// [assembly: AssemblyVersion("1.0.*")]
35[assembly: AssemblyVersion("1.0.0.0")] 37
36[assembly: AssemblyFileVersion("1.0.0.0")] 38[assembly : AssemblyVersion("1.0.0.0")]
39[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 9ae1a7b..b57d3e6 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -27,24 +27,19 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Net;
33using OpenSim;
34using OpenSim.Framework.Console;
35using OpenSim.Framework;
36using OpenSim.Framework.Servers;
37using Mono.Addins;
38using Mono.Addins.Description;
39using Nini;
40using Nini.Config;
41using Nwc.XmlRpc;
42using System.Collections; 30using System.Collections;
31using System.Net;
43using System.Timers; 32using System.Timers;
44using libsecondlife; 33using libsecondlife;
34using Mono.Addins;
35using Nwc.XmlRpc;
36using OpenSim.Framework;
37using OpenSim.Framework.Console;
38using OpenSim.Framework.Servers;
39using OpenSim.Region.Environment.Scenes;
45 40
46[assembly: Addin] 41[assembly : Addin]
47[assembly: AddinDependency("OpenSim", "0.4")] 42[assembly : AddinDependency("OpenSim", "0.4")]
48 43
49namespace OpenSim.ApplicationPlugins.LoadRegions 44namespace OpenSim.ApplicationPlugins.LoadRegions
50{ 45{
@@ -54,6 +49,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
54 private OpenSimMain m_app; 49 private OpenSimMain m_app;
55 private BaseHttpServer m_httpd; 50 private BaseHttpServer m_httpd;
56 private string requiredPassword = ""; 51 private string requiredPassword = "";
52
57 public void Initialise(OpenSimMain openSim) 53 public void Initialise(OpenSimMain openSim)
58 { 54 {
59 try 55 try
@@ -81,12 +77,13 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
81 public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request) 77 public XmlRpcResponse XmlRpcRestartMethod(XmlRpcRequest request)
82 { 78 {
83 XmlRpcResponse response = new XmlRpcResponse(); 79 XmlRpcResponse response = new XmlRpcResponse();
84 Hashtable requestData = (Hashtable)request.Params[0]; 80 Hashtable requestData = (Hashtable) request.Params[0];
85 81
86 LLUUID regionID = new LLUUID((string)requestData["regionID"]); 82 LLUUID regionID = new LLUUID((string) requestData["regionID"]);
87 83
88 Hashtable responseData = new Hashtable(); 84 Hashtable responseData = new Hashtable();
89 if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) 85 if (requiredPassword != "" &&
86 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
90 { 87 {
91 responseData["accepted"] = "false"; 88 responseData["accepted"] = "false";
92 response.Value = responseData; 89 response.Value = responseData;
@@ -96,7 +93,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
96 responseData["accepted"] = "true"; 93 responseData["accepted"] = "true";
97 response.Value = responseData; 94 response.Value = responseData;
98 95
99 OpenSim.Region.Environment.Scenes.Scene RebootedScene; 96 Scene RebootedScene;
100 97
101 if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene)) 98 if (m_app.SceneManager.TryGetScene(regionID, out RebootedScene))
102 { 99 {
@@ -115,18 +112,18 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
115 public XmlRpcResponse XmlRpcAlertMethod(XmlRpcRequest request) 112 public XmlRpcResponse XmlRpcAlertMethod(XmlRpcRequest request)
116 { 113 {
117 XmlRpcResponse response = new XmlRpcResponse(); 114 XmlRpcResponse response = new XmlRpcResponse();
118 Hashtable requestData = (Hashtable)request.Params[0]; 115 Hashtable requestData = (Hashtable) request.Params[0];
119 116
120 Hashtable responseData = new Hashtable(); 117 Hashtable responseData = new Hashtable();
121 if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) 118 if (requiredPassword != "" &&
119 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
122 { 120 {
123 responseData["accepted"] = "false"; 121 responseData["accepted"] = "false";
124 response.Value = responseData; 122 response.Value = responseData;
125 } 123 }
126 else 124 else
127 { 125 {
128 126 string message = (string) requestData["message"];
129 string message = (string)requestData["message"];
130 MainLog.Instance.Verbose("RADMIN", "Broadcasting: " + message); 127 MainLog.Instance.Verbose("RADMIN", "Broadcasting: " + message);
131 128
132 responseData["accepted"] = "true"; 129 responseData["accepted"] = "true";
@@ -142,23 +139,24 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
142 { 139 {
143 MainLog.Instance.Verbose("RADMIN", "Received Shutdown Administrator Request"); 140 MainLog.Instance.Verbose("RADMIN", "Received Shutdown Administrator Request");
144 XmlRpcResponse response = new XmlRpcResponse(); 141 XmlRpcResponse response = new XmlRpcResponse();
145 Hashtable requestData = (Hashtable)request.Params[0]; 142 Hashtable requestData = (Hashtable) request.Params[0];
146 Hashtable responseData = new Hashtable(); 143 Hashtable responseData = new Hashtable();
147 if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) 144 if (requiredPassword != "" &&
145 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
148 { 146 {
149 responseData["accepted"] = "false"; 147 responseData["accepted"] = "false";
150 response.Value = responseData; 148 response.Value = responseData;
151 } 149 }
152 else 150 else
153 { 151 {
154 if ((string)requestData["shutdown"] == "delayed") 152 if ((string) requestData["shutdown"] == "delayed")
155 { 153 {
156 int timeout = (Int32)requestData["milliseconds"]; 154 int timeout = (Int32) requestData["milliseconds"];
157 155
158 responseData["accepted"] = "true"; 156 responseData["accepted"] = "true";
159 response.Value = responseData; 157 response.Value = responseData;
160 158
161 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int)(timeout / 1000)).ToString() + 159 m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() +
162 " second(s). Please save what you are doing and log out."); 160 " second(s). Please save what you are doing and log out.");
163 161
164 // Perform shutdown 162 // Perform shutdown
@@ -197,9 +195,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
197 { 195 {
198 MainLog.Instance.Verbose("RADMIN", "Received Create Region Administrator Request"); 196 MainLog.Instance.Verbose("RADMIN", "Received Create Region Administrator Request");
199 XmlRpcResponse response = new XmlRpcResponse(); 197 XmlRpcResponse response = new XmlRpcResponse();
200 Hashtable requestData = (Hashtable)request.Params[0]; 198 Hashtable requestData = (Hashtable) request.Params[0];
201 Hashtable responseData = new Hashtable(); 199 Hashtable responseData = new Hashtable();
202 if (requiredPassword != "" && (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) 200 if (requiredPassword != "" &&
201 (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
203 { 202 {
204 responseData["created"] = "false"; 203 responseData["created"] = "false";
205 response.Value = responseData; 204 response.Value = responseData;
@@ -210,22 +209,22 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
210 209
211 try 210 try
212 { 211 {
213 newRegionData.RegionID = (string)requestData["region_id"]; 212 newRegionData.RegionID = (string) requestData["region_id"];
214 newRegionData.RegionName = (string)requestData["region_name"]; 213 newRegionData.RegionName = (string) requestData["region_name"];
215 newRegionData.RegionLocX = Convert.ToUInt32((Int32)requestData["region_x"]); 214 newRegionData.RegionLocX = Convert.ToUInt32((Int32) requestData["region_x"]);
216 newRegionData.RegionLocY = Convert.ToUInt32((Int32)requestData["region_y"]); 215 newRegionData.RegionLocY = Convert.ToUInt32((Int32) requestData["region_y"]);
217 216
218 // Security risk 217 // Security risk
219 newRegionData.DataStore = (string)requestData["datastore"]; 218 newRegionData.DataStore = (string) requestData["datastore"];
220 219
221 newRegionData.InternalEndPoint = new IPEndPoint( 220 newRegionData.InternalEndPoint = new IPEndPoint(
222 IPAddress.Parse((string)requestData["listen_ip"]), 0); 221 IPAddress.Parse((string) requestData["listen_ip"]), 0);
223 222
224 newRegionData.InternalEndPoint.Port = (Int32)requestData["listen_port"]; 223 newRegionData.InternalEndPoint.Port = (Int32) requestData["listen_port"];
225 newRegionData.ExternalHostName = (string)requestData["external_address"]; 224 newRegionData.ExternalHostName = (string) requestData["external_address"];
226 225
227 newRegionData.MasterAvatarFirstName = (string)requestData["region_master_first"]; 226 newRegionData.MasterAvatarFirstName = (string) requestData["region_master_first"];
228 newRegionData.MasterAvatarLastName = (string)requestData["region_master_last"]; 227 newRegionData.MasterAvatarLastName = (string) requestData["region_master_last"];
229 228
230 m_app.CreateRegion(newRegionData); 229 m_app.CreateRegion(newRegionData);
231 230
@@ -245,7 +244,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
245 244
246 public void Close() 245 public void Close()
247 { 246 {
248
249 } 247 }
250 } 248 }
251} \ No newline at end of file 249} \ No newline at end of file
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 0617a76..65a072f 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -35,12 +35,13 @@ namespace OpenSim.Framework
35 public AgentCircuitData() 35 public AgentCircuitData()
36 { 36 {
37 } 37 }
38
38 public AgentCircuitData(sAgentCircuitData cAgent) 39 public AgentCircuitData(sAgentCircuitData cAgent)
39 { 40 {
40 AgentID = new LLUUID(cAgent.AgentID); 41 AgentID = new LLUUID(cAgent.AgentID);
41 SessionID = new LLUUID(cAgent.SessionID); 42 SessionID = new LLUUID(cAgent.SessionID);
42 SecureSessionID = new LLUUID(cAgent.SecureSessionID); 43 SecureSessionID = new LLUUID(cAgent.SecureSessionID);
43 startpos = new LLVector3(cAgent.startposx,cAgent.startposy,cAgent.startposz); 44 startpos = new LLVector3(cAgent.startposx, cAgent.startposy, cAgent.startposz);
44 firstname = cAgent.firstname; 45 firstname = cAgent.firstname;
45 lastname = cAgent.lastname; 46 lastname = cAgent.lastname;
46 circuitcode = cAgent.circuitcode; 47 circuitcode = cAgent.circuitcode;
@@ -69,6 +70,7 @@ namespace OpenSim.Framework
69 public sAgentCircuitData() 70 public sAgentCircuitData()
70 { 71 {
71 } 72 }
73
72 public sAgentCircuitData(AgentCircuitData cAgent) 74 public sAgentCircuitData(AgentCircuitData cAgent)
73 { 75 {
74 AgentID = cAgent.AgentID.UUID; 76 AgentID = cAgent.AgentID.UUID;
@@ -85,6 +87,7 @@ namespace OpenSim.Framework
85 BaseFolder = cAgent.BaseFolder.UUID; 87 BaseFolder = cAgent.BaseFolder.UUID;
86 CapsPath = cAgent.CapsPath; 88 CapsPath = cAgent.CapsPath;
87 } 89 }
90
88 public Guid AgentID; 91 public Guid AgentID;
89 public Guid SessionID; 92 public Guid SessionID;
90 public Guid SecureSessionID; 93 public Guid SecureSessionID;
@@ -98,8 +101,5 @@ namespace OpenSim.Framework
98 public Guid InventoryFolder; 101 public Guid InventoryFolder;
99 public Guid BaseFolder; 102 public Guid BaseFolder;
100 public string CapsPath = ""; 103 public string CapsPath = "";
101
102
103
104 } 104 }
105} 105} \ No newline at end of file
diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs
index 2803a4a..938dce8 100644
--- a/OpenSim/Framework/AgentCircuitManager.cs
+++ b/OpenSim/Framework/AgentCircuitManager.cs
@@ -124,4 +124,4 @@ namespace OpenSim.Framework
124 return false; 124 return false;
125 } 125 }
126 } 126 }
127} 127} \ No newline at end of file
diff --git a/OpenSim/Framework/AgentInventory.cs b/OpenSim/Framework/AgentInventory.cs
index 541bc27..84a782b 100644
--- a/OpenSim/Framework/AgentInventory.cs
+++ b/OpenSim/Framework/AgentInventory.cs
@@ -255,4 +255,4 @@ namespace OpenSim.Framework
255 return result; 255 return result;
256 } 256 }
257 } 257 }
258} 258} \ No newline at end of file
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index 5775f06..2bef61b 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -52,4 +52,4 @@ namespace OpenSim.Framework
52 Name = name; 52 Name = name;
53 } 53 }
54 } 54 }
55} 55} \ No newline at end of file
diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs
index d83b43b..050b80f 100644
--- a/OpenSim/Framework/AssetLandmark.cs
+++ b/OpenSim/Framework/AssetLandmark.cs
@@ -56,4 +56,4 @@ namespace OpenSim.Framework
56 LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position); 56 LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position);
57 } 57 }
58 } 58 }
59} 59} \ No newline at end of file
diff --git a/OpenSim/Framework/AssetStorage.cs b/OpenSim/Framework/AssetStorage.cs
index 9e0cf10..7d6cdf0 100644
--- a/OpenSim/Framework/AssetStorage.cs
+++ b/OpenSim/Framework/AssetStorage.cs
@@ -45,4 +45,4 @@ namespace OpenSim.Framework
45 public string Name; 45 public string Name;
46 public LLUUID UUID; 46 public LLUUID UUID;
47 } 47 }
48} 48} \ No newline at end of file
diff --git a/OpenSim/Framework/AuthenticateResponse.cs b/OpenSim/Framework/AuthenticateResponse.cs
index 7d4cd11..90c9acd 100644
--- a/OpenSim/Framework/AuthenticateResponse.cs
+++ b/OpenSim/Framework/AuthenticateResponse.cs
@@ -36,4 +36,4 @@ namespace OpenSim.Framework
36 { 36 {
37 } 37 }
38 } 38 }
39} 39} \ No newline at end of file
diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs
index d0c68de..c7083f3 100644
--- a/OpenSim/Framework/AvatarWearable.cs
+++ b/OpenSim/Framework/AvatarWearable.cs
@@ -68,4 +68,4 @@ namespace OpenSim.Framework
68 } 68 }
69 } 69 }
70 } 70 }
71} 71} \ No newline at end of file
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs
index a3cae63..ae2a189 100644
--- a/OpenSim/Framework/BlockingQueue.cs
+++ b/OpenSim/Framework/BlockingQueue.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Framework
34 { 34 {
35 private Queue<T> _queue = new Queue<T>(); 35 private Queue<T> _queue = new Queue<T>();
36 private object _queueSync = new object(); 36 private object _queueSync = new object();
37 37
38 public void Enqueue(T value) 38 public void Enqueue(T value)
39 { 39 {
40 lock (_queueSync) 40 lock (_queueSync)
@@ -55,4 +55,4 @@ namespace OpenSim.Framework
55 } 55 }
56 } 56 }
57 } 57 }
58} 58} \ No newline at end of file
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index fb9a48f..32ce4ab 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace OpenSim.Framework 31namespace OpenSim.Framework
34{ 32{
@@ -37,8 +35,8 @@ namespace OpenSim.Framework
37 { 35 {
38 public ChildAgentDataUpdate() 36 public ChildAgentDataUpdate()
39 { 37 {
40
41 } 38 }
39
42 public sLLVector3 Position; 40 public sLLVector3 Position;
43 public ulong regionHandle; 41 public ulong regionHandle;
44 public float drawdistance; 42 public float drawdistance;
@@ -47,6 +45,6 @@ namespace OpenSim.Framework
47 public float AVHeight; 45 public float AVHeight;
48 public Guid AgentID; 46 public Guid AgentID;
49 public float godlevel; 47 public float godlevel;
50 public byte[] throttles; 48 public byte[] throttles;
51 } 49 }
52} 50} \ No newline at end of file
diff --git a/OpenSim/Framework/ClientManager.cs b/OpenSim/Framework/ClientManager.cs
index e32c9eb..da60ed7 100644
--- a/OpenSim/Framework/ClientManager.cs
+++ b/OpenSim/Framework/ClientManager.cs
@@ -26,9 +26,11 @@
26* 26*
27*/ 27*/
28 28
29using System;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using libsecondlife; 31using libsecondlife;
31using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework.Console;
32 34
33namespace OpenSim.Framework 35namespace OpenSim.Framework
34{ 36{
@@ -40,7 +42,6 @@ namespace OpenSim.Framework
40 42
41 public void ForEachClient(ForEachClientDelegate whatToDo) 43 public void ForEachClient(ForEachClientDelegate whatToDo)
42 { 44 {
43
44 // Wasteful, I know 45 // Wasteful, I know
45 IClientAPI[] LocalClients = new IClientAPI[0]; 46 IClientAPI[] LocalClients = new IClientAPI[0];
46 lock (m_clients) 47 lock (m_clients)
@@ -55,9 +56,11 @@ namespace OpenSim.Framework
55 { 56 {
56 whatToDo(LocalClients[i]); 57 whatToDo(LocalClients[i]);
57 } 58 }
58 catch (System.Exception e) 59 catch (Exception e)
59 { 60 {
60 OpenSim.Framework.Console.MainLog.Instance.Warn("CLIENT", "Unable to do ForEachClient for one of the clients" + "\n Reason: " + e.ToString()); 61 MainLog.Instance.Warn("CLIENT",
62 "Unable to do ForEachClient for one of the clients" + "\n Reason: " +
63 e.ToString());
61 } 64 }
62 } 65 }
63 } 66 }
@@ -107,20 +110,19 @@ namespace OpenSim.Framework
107 IClientAPI client; 110 IClientAPI client;
108 try 111 try
109 { 112 {
110
111 if (m_clients.TryGetValue(circuits[i], out client)) 113 if (m_clients.TryGetValue(circuits[i], out client))
112 { 114 {
113 Remove(client.CircuitCode); 115 Remove(client.CircuitCode);
114 client.Close(false); 116 client.Close(false);
115 } 117 }
116 } 118 }
117 catch (System.Exception e) 119 catch (Exception e)
118 { 120 {
119 OpenSim.Framework.Console.MainLog.Instance.Error("CLIENT", "Unable to shutdown circuit for: " + agentId.ToString() + "\n Reason: " + e.ToString()); 121 MainLog.Instance.Error("CLIENT",
122 "Unable to shutdown circuit for: " + agentId.ToString() + "\n Reason: " +
123 e.ToString());
120 } 124 }
121 } 125 }
122
123
124 } 126 }
125 127
126 private uint[] GetAllCircuits(LLUUID agentId) 128 private uint[] GetAllCircuits(LLUUID agentId)
@@ -135,7 +137,7 @@ namespace OpenSim.Framework
135 } 137 }
136 138
137 139
138 for (int i = 0; i < LocalClients.Length; i++ ) 140 for (int i = 0; i < LocalClients.Length; i++)
139 { 141 {
140 if (LocalClients[i].AgentId == agentId) 142 if (LocalClients[i].AgentId == agentId)
141 { 143 {
@@ -168,7 +170,6 @@ namespace OpenSim.Framework
168 packet.AgentData.SessionID = LocalClients[i].SessionId; 170 packet.AgentData.SessionID = LocalClients[i].SessionId;
169 LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task); 171 LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task);
170 } 172 }
171
172 } 173 }
173 } 174 }
174 175
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 4765548..664625e 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -28,7 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO;
32using System.Threading; 31using System.Threading;
33using libsecondlife; 32using libsecondlife;
34using libsecondlife.Packets; 33using libsecondlife.Packets;
@@ -92,7 +91,7 @@ namespace OpenSim.Framework.Communications.Cache
92 Thread.Sleep(500); 91 Thread.Sleep(500);
93 } 92 }
94 catch (Exception e) 93 catch (Exception e)
95 { 94 {
96 m_log.Error("ASSETCACHE", e.ToString()); 95 m_log.Error("ASSETCACHE", e.ToString());
97 } 96 }
98 } 97 }
@@ -177,30 +176,29 @@ namespace OpenSim.Framework.Communications.Cache
177 // packets from the client. 176 // packets from the client.
178 int pollPeriod = 200; 177 int pollPeriod = 200;
179 int maxPolls = 15; 178 int maxPolls = 15;
180 179
181 AssetBase asset = GetCachedAsset(assetID); 180 AssetBase asset = GetCachedAsset(assetID);
182 if (asset != null) 181 if (asset != null)
183 { 182 {
184 return asset; 183 return asset;
185 } 184 }
186 185
187 m_assetServer.RequestAsset(assetID, isTexture); 186 m_assetServer.RequestAsset(assetID, isTexture);
188 187
189 do 188 do
190 { 189 {
191 Thread.Sleep(pollPeriod); 190 Thread.Sleep(pollPeriod);
192 191
193 asset = GetCachedAsset(assetID); 192 asset = GetCachedAsset(assetID);
194 if (asset != null) 193 if (asset != null)
195 { 194 {
196 return asset; 195 return asset;
197 } 196 }
198 } 197 } while (--maxPolls > 0);
199 while (--maxPolls > 0); 198
200
201 MainLog.Instance.Warn( 199 MainLog.Instance.Warn(
202 "ASSETCACHE", "Asset {0} was not received before the retrieval timeout was reached"); 200 "ASSETCACHE", "Asset {0} was not received before the retrieval timeout was reached");
203 201
204 return null; 202 return null;
205 } 203 }
206 204
@@ -368,12 +366,13 @@ namespace OpenSim.Framework.Communications.Cache
368 { 366 {
369 // over max number of bytes so split up file 367 // over max number of bytes so split up file
370 long restData = data.LongLength - m_maxPacketSize; 368 long restData = data.LongLength - m_maxPacketSize;
371 int restPackets = (int) ((restData + m_maxPacketSize - 1) / m_maxPacketSize); 369 int restPackets = (int) ((restData + m_maxPacketSize - 1)/m_maxPacketSize);
372 numPackets += restPackets; 370 numPackets += restPackets;
373 } 371 }
374 372
375 return numPackets; 373 return numPackets;
376 } 374 }
375
377 #region Assets 376 #region Assets
378 377
379 /// <summary> 378 /// <summary>
@@ -448,7 +447,7 @@ namespace OpenSim.Framework.Communications.Cache
448 AssetRequest req; 447 AssetRequest req;
449 for (int i = 0; i < num; i++) 448 for (int i = 0; i < num; i++)
450 { 449 {
451 req = (AssetRequest)AssetRequests[i]; 450 req = (AssetRequest) AssetRequests[i];
452 //Console.WriteLine("sending asset " + req.RequestAssetID); 451 //Console.WriteLine("sending asset " + req.RequestAssetID);
453 TransferInfoPacket Transfer = new TransferInfoPacket(); 452 TransferInfoPacket Transfer = new TransferInfoPacket();
454 Transfer.TransferInfo.ChannelType = 2; 453 Transfer.TransferInfo.ChannelType = 2;
@@ -458,7 +457,7 @@ namespace OpenSim.Framework.Communications.Cache
458 { 457 {
459 Transfer.TransferInfo.Params = new byte[20]; 458 Transfer.TransferInfo.Params = new byte[20];
460 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); 459 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
461 int assType = (int)req.AssetInf.Type; 460 int assType = (int) req.AssetInf.Type;
462 Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); 461 Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
463 } 462 }
464 else if (req.AssetRequestSource == 3) 463 else if (req.AssetRequestSource == 3)
@@ -468,7 +467,7 @@ namespace OpenSim.Framework.Communications.Cache
468 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); 467 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
469 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16); 468 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16);
470 } 469 }
471 Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; 470 Transfer.TransferInfo.Size = (int) req.AssetInf.Data.Length;
472 Transfer.TransferInfo.TransferID = req.TransferRequestID; 471 Transfer.TransferInfo.TransferID = req.TransferRequestID;
473 req.RequestUser.OutPacket(Transfer, ThrottleOutPacketType.Asset); 472 req.RequestUser.OutPacket(Transfer, ThrottleOutPacketType.Asset);
474 473
@@ -488,20 +487,20 @@ namespace OpenSim.Framework.Communications.Cache
488 // libsecondlife hardcodes 1500 as the maximum data chunk size 487 // libsecondlife hardcodes 1500 as the maximum data chunk size
489 int maxChunkSize = 1500; 488 int maxChunkSize = 1500;
490 int packetNumber = 0; 489 int packetNumber = 0;
491 490
492 while (processedLength < req.AssetInf.Data.Length) 491 while (processedLength < req.AssetInf.Data.Length)
493 { 492 {
494 TransferPacketPacket TransferPacket = new TransferPacketPacket(); 493 TransferPacketPacket TransferPacket = new TransferPacketPacket();
495 TransferPacket.TransferData.Packet = packetNumber; 494 TransferPacket.TransferData.Packet = packetNumber;
496 TransferPacket.TransferData.ChannelType = 2; 495 TransferPacket.TransferData.ChannelType = 2;
497 TransferPacket.TransferData.TransferID = req.TransferRequestID; 496 TransferPacket.TransferData.TransferID = req.TransferRequestID;
498 497
499 int chunkSize = Math.Min(req.AssetInf.Data.Length - processedLength, maxChunkSize); 498 int chunkSize = Math.Min(req.AssetInf.Data.Length - processedLength, maxChunkSize);
500 byte[] chunk = new byte[chunkSize]; 499 byte[] chunk = new byte[chunkSize];
501 Array.Copy(req.AssetInf.Data, processedLength, chunk, 0, chunk.Length); 500 Array.Copy(req.AssetInf.Data, processedLength, chunk, 0, chunk.Length);
502 501
503 TransferPacket.TransferData.Data = chunk; 502 TransferPacket.TransferData.Data = chunk;
504 503
505 // 0 indicates more packets to come, 1 indicates last packet 504 // 0 indicates more packets to come, 1 indicates last packet
506 if (req.AssetInf.Data.Length - processedLength > maxChunkSize) 505 if (req.AssetInf.Data.Length - processedLength > maxChunkSize)
507 { 506 {
@@ -510,10 +509,10 @@ namespace OpenSim.Framework.Communications.Cache
510 else 509 else
511 { 510 {
512 TransferPacket.TransferData.Status = 1; 511 TransferPacket.TransferData.Status = 1;
513 } 512 }
514 513
515 req.RequestUser.OutPacket(TransferPacket, ThrottleOutPacketType.Asset); 514 req.RequestUser.OutPacket(TransferPacket, ThrottleOutPacketType.Asset);
516 515
517 processedLength += chunkSize; 516 processedLength += chunkSize;
518 packetNumber++; 517 packetNumber++;
519 } 518 }
@@ -609,4 +608,4 @@ namespace OpenSim.Framework.Communications.Cache
609 } 608 }
610 } 609 }
611 } 610 }
612} 611} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs
index ae6494f..692ee1e 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Framework.Communications.Cache
80 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); 80 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
81 if (result.Count > 0) 81 if (result.Count > 0)
82 { 82 {
83 foundAsset = (AssetStorage)result.Next(); 83 foundAsset = (AssetStorage) result.Next();
84 found = true; 84 found = true;
85 } 85 }
86 86
@@ -93,7 +93,7 @@ namespace OpenSim.Framework.Communications.Cache
93 asset.Name = foundAsset.Name; 93 asset.Name = foundAsset.Name;
94 idata = foundAsset.Data; 94 idata = foundAsset.Data;
95 asset.Data = idata; 95 asset.Data = idata;
96 96
97 return asset; 97 return asset;
98 } 98 }
99 else 99 else
@@ -141,4 +141,4 @@ namespace OpenSim.Framework.Communications.Cache
141 return (asset.UUID == _findID); 141 return (asset.UUID == _findID);
142 } 142 }
143 } 143 }
144} 144} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
index 43d3dd9..1b2c836 100644
--- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Framework.Communications.Cache
69 { 69 {
70 MainLog.Instance.Verbose( 70 MainLog.Instance.Verbose(
71 "ASSET", "Asset {0} received from asset server", req.AssetID); 71 "ASSET", "Asset {0} received from asset server", req.AssetID);
72 72
73 _receiver.AssetReceived(asset, req.IsTexture); 73 _receiver.AssetReceived(asset, req.IsTexture);
74 } 74 }
75 else 75 else
@@ -112,9 +112,9 @@ namespace OpenSim.Framework.Communications.Cache
112 112
113 ProcessRequest(req); 113 ProcessRequest(req);
114 } 114 }
115 catch(Exception e) 115 catch (Exception e)
116 { 116 {
117 MainLog.Instance.Error("ASSETSERVER", e.Message ); 117 MainLog.Instance.Error("ASSETSERVER", e.Message);
118 } 118 }
119 } 119 }
120 } 120 }
@@ -149,7 +149,7 @@ namespace OpenSim.Framework.Communications.Cache
149 req.AssetID = assetID; 149 req.AssetID = assetID;
150 req.IsTexture = isTexture; 150 req.IsTexture = isTexture;
151 _assetRequests.Enqueue(req); 151 _assetRequests.Enqueue(req);
152 152
153 MainLog.Instance.Verbose("ASSET", "Added {0} to request queue", assetID); 153 MainLog.Instance.Verbose("ASSET", "Added {0} to request queue", assetID);
154 } 154 }
155 155
@@ -253,4 +253,4 @@ namespace OpenSim.Framework.Communications.Cache
253 assets.ForEach(action); 253 assets.ForEach(action);
254 } 254 }
255 } 255 }
256} 256} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs
index 7de84fa..c9c9541 100644
--- a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs
@@ -106,4 +106,4 @@ namespace OpenSim.Framework.Communications.Cache
106 } 106 }
107 } 107 }
108 } 108 }
109} 109} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs
index 57c1fa6..8aa567c 100644
--- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs
@@ -182,7 +182,7 @@ namespace OpenSim.Framework.Communications.Cache
182 Asset.Description = "empty"; 182 Asset.Description = "empty";
183 Asset.Local = storeLocal; 183 Asset.Local = storeLocal;
184 Asset.Temporary = tempFile; 184 Asset.Temporary = tempFile;
185 185
186 TransactionID = transaction; 186 TransactionID = transaction;
187 m_storeLocal = storeLocal; 187 m_storeLocal = storeLocal;
188 if (Asset.Data.Length > 2) 188 if (Asset.Data.Length > 2)
@@ -312,6 +312,7 @@ namespace OpenSim.Framework.Communications.Cache
312 } 312 }
313 313
314 #region Nested Classes currently not in use (waiting for them to be enabled) 314 #region Nested Classes currently not in use (waiting for them to be enabled)
315
315 public class AssetCapsUploader 316 public class AssetCapsUploader
316 { 317 {
317 // Fields 318 // Fields
@@ -424,6 +425,7 @@ namespace OpenSim.Framework.Communications.Cache
424 return text; 425 return text;
425 } 426 }
426 } 427 }
428
427 #endregion 429 #endregion
428 } 430 }
429} 431} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index a547c8a..1cf95b7 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -130,4 +130,4 @@ namespace OpenSim.Framework.Communications.Cache
130 return result; 130 return result;
131 } 131 }
132 } 132 }
133} 133} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
index 9c460c7..cf54fa4 100644
--- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs
@@ -27,10 +27,8 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.IO; 30using System.IO;
32using System.Xml.Serialization; 31using System.Xml.Serialization;
33using libsecondlife;
34using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
35using OpenSim.Framework.Servers; 33using OpenSim.Framework.Servers;
36 34
@@ -65,9 +63,9 @@ namespace OpenSim.Framework.Communications.Cache
65 63
66 if (s.Length > 0) 64 if (s.Length > 0)
67 { 65 {
68 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 66 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
69 67
70 return (AssetBase)xs.Deserialize(s); 68 return (AssetBase) xs.Deserialize(s);
71 } 69 }
72 } 70 }
73 catch (Exception e) 71 catch (Exception e)
@@ -76,12 +74,11 @@ namespace OpenSim.Framework.Communications.Cache
76 MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", req.AssetID.ToString()); 74 MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", req.AssetID.ToString());
77 MainLog.Instance.Error("ASSETCACHE", e.StackTrace); 75 MainLog.Instance.Error("ASSETCACHE", e.StackTrace);
78 } 76 }
79 77
80 return null; 78 return null;
81 } 79 }
82 80
83 81
84
85 public override void UpdateAsset(AssetBase asset) 82 public override void UpdateAsset(AssetBase asset)
86 { 83 {
87 throw new Exception("The method or operation is not implemented."); 84 throw new Exception("The method or operation is not implemented.");
@@ -119,8 +116,6 @@ namespace OpenSim.Framework.Communications.Cache
119 throw new Exception("The method or operation is not implemented."); 116 throw new Exception("The method or operation is not implemented.");
120 } 117 }
121 118
122
123
124 #endregion 119 #endregion
125 } 120 }
126} 121} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
index 1d2c920..a1e79b2 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Framework.Communications.Cache
65 InventoryFolderImpl subFold = new InventoryFolderImpl(); 65 InventoryFolderImpl subFold = new InventoryFolderImpl();
66 subFold.name = folderName; 66 subFold.name = folderName;
67 subFold.folderID = folderID; 67 subFold.folderID = folderID;
68 subFold.type = (short)type; 68 subFold.type = (short) type;
69 subFold.parentID = this.folderID; 69 subFold.parentID = this.folderID;
70 subFold.agentID = agentID; 70 subFold.agentID = agentID;
71 SubFolders.Add(subFold.folderID, subFold); 71 SubFolders.Add(subFold.folderID, subFold);
@@ -153,4 +153,4 @@ namespace OpenSim.Framework.Communications.Cache
153 return folderList; 153 return folderList;
154 } 154 }
155 } 155 }
156} 156} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
index 4c8eddf..fd93b19 100644
--- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Framework.Communications.Cache
49 folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); 49 folderID = new LLUUID("00000112-000f-0000-0000-000100bba000");
50 name = "OpenSim Library"; 50 name = "OpenSim Library";
51 parentID = LLUUID.Zero; 51 parentID = LLUUID.Zero;
52 type = (short)-1; 52 type = (short) -1;
53 version = (ushort)1; 53 version = (ushort) 1;
54 54
55 InventoryFolderImpl folderInfo = new InventoryFolderImpl(); 55 InventoryFolderImpl folderInfo = new InventoryFolderImpl();
56 folderInfo.agentID = libOwner; 56 folderInfo.agentID = libOwner;
@@ -81,28 +81,41 @@ namespace OpenSim.Framework.Communications.Cache
81 81
82 private void CreateLibraryItems() 82 private void CreateLibraryItems()
83 { 83 {
84 InventoryItemBase item = CreateItem(new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"), new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"), "Default Shape", "Default Shape", (int)AssetType.Bodypart, (int)InventoryType.Wearable, folderID); 84 InventoryItemBase item =
85 CreateItem(new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"),
86 new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"), "Default Shape", "Default Shape",
87 (int) AssetType.Bodypart, (int) InventoryType.Wearable, folderID);
85 item.inventoryCurrentPermissions = 0; 88 item.inventoryCurrentPermissions = 0;
86 item.inventoryNextPermissions = 0; 89 item.inventoryNextPermissions = 0;
87 Items.Add(item.inventoryID, item); 90 Items.Add(item.inventoryID, item);
88 91
89 item = CreateItem(new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"), new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"), "Default Skin", "Default Skin", (int)AssetType.Bodypart, (int)InventoryType.Wearable, folderID); 92 item =
93 CreateItem(new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"),
94 new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"), "Default Skin", "Default Skin",
95 (int) AssetType.Bodypart, (int) InventoryType.Wearable, folderID);
90 item.inventoryCurrentPermissions = 0; 96 item.inventoryCurrentPermissions = 0;
91 item.inventoryNextPermissions = 0; 97 item.inventoryNextPermissions = 0;
92 Items.Add(item.inventoryID, item); 98 Items.Add(item.inventoryID, item);
93 99
94 item = CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"), new LLUUID("00000000-38f9-1111-024e-222222111110"), "Default Shirt", "Default Shirt", (int)AssetType.Clothing, (int)InventoryType.Wearable, folderID); 100 item =
101 CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"),
102 new LLUUID("00000000-38f9-1111-024e-222222111110"), "Default Shirt", "Default Shirt",
103 (int) AssetType.Clothing, (int) InventoryType.Wearable, folderID);
95 item.inventoryCurrentPermissions = 0; 104 item.inventoryCurrentPermissions = 0;
96 item.inventoryNextPermissions = 0; 105 item.inventoryNextPermissions = 0;
97 Items.Add(item.inventoryID, item); 106 Items.Add(item.inventoryID, item);
98 107
99 item = CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"), new LLUUID("00000000-38f9-1111-024e-222222111120"), "Default Pants", "Default Pants", (int)AssetType.Clothing, (int)InventoryType.Wearable, folderID); 108 item =
109 CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"),
110 new LLUUID("00000000-38f9-1111-024e-222222111120"), "Default Pants", "Default Pants",
111 (int) AssetType.Clothing, (int) InventoryType.Wearable, folderID);
100 item.inventoryCurrentPermissions = 0; 112 item.inventoryCurrentPermissions = 0;
101 item.inventoryNextPermissions = 0; 113 item.inventoryNextPermissions = 0;
102 Items.Add(item.inventoryID, item); 114 Items.Add(item.inventoryID, item);
103 } 115 }
104 116
105 public InventoryItemBase CreateItem(LLUUID inventoryID, LLUUID assetID, string name, string description, int assetType, int invType, LLUUID parentFolderID) 117 public InventoryItemBase CreateItem(LLUUID inventoryID, LLUUID assetID, string name, string description,
118 int assetType, int invType, LLUUID parentFolderID)
106 { 119 {
107 InventoryItemBase item = new InventoryItemBase(); 120 InventoryItemBase item = new InventoryItemBase();
108 item.avatarID = libOwner; 121 item.avatarID = libOwner;
@@ -135,10 +148,10 @@ namespace OpenSim.Framework.Communications.Cache
135 item.inventoryName = source.Configs[i].GetString("name", ""); 148 item.inventoryName = source.Configs[i].GetString("name", "");
136 item.assetType = source.Configs[i].GetInt("assetType", 0); 149 item.assetType = source.Configs[i].GetInt("assetType", 0);
137 item.invType = source.Configs[i].GetInt("inventoryType", 0); 150 item.invType = source.Configs[i].GetInt("inventoryType", 0);
138 item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); 151 item.inventoryCurrentPermissions = (uint) source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF);
139 item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); 152 item.inventoryNextPermissions = (uint) source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF);
140 item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); 153 item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF);
141 item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); 154 item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF);
142 if (item.assetType == 0) 155 if (item.assetType == 0)
143 { 156 {
144 item.parentFolderID = m_textureFolder.folderID; 157 item.parentFolderID = m_textureFolder.folderID;
@@ -152,4 +165,4 @@ namespace OpenSim.Framework.Communications.Cache
152 } 165 }
153 } 166 }
154 } 167 }
155} 168} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
index 7fcff10..e4c278f 100644
--- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
+++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Communications.Cache
57 if (typeInterface != null) 57 if (typeInterface != null)
58 { 58 {
59 IAssetProvider plug = 59 IAssetProvider plug =
60 (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 60 (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
61 m_assetProviderPlugin = plug; 61 m_assetProviderPlugin = plug;
62 m_assetProviderPlugin.Initialise(); 62 m_assetProviderPlugin.Initialise();
63 63
@@ -84,8 +84,8 @@ namespace OpenSim.Framework.Communications.Cache
84 { 84 {
85 asset = m_assetProviderPlugin.FetchAsset(req.AssetID); 85 asset = m_assetProviderPlugin.FetchAsset(req.AssetID);
86 } 86 }
87 87
88 return asset; 88 return asset;
89 } 89 }
90 90
91 protected override void StoreAsset(AssetBase asset) 91 protected override void StoreAsset(AssetBase asset)
@@ -98,4 +98,4 @@ namespace OpenSim.Framework.Communications.Cache
98 m_assetProviderPlugin.CommitAssets(); 98 m_assetProviderPlugin.CommitAssets();
99 } 99 }
100 } 100 }
101} 101} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 47f970e..14670fd 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -130,7 +130,8 @@ namespace OpenSim.Framework.Communications.Cache
130 } 130 }
131 } 131 }
132 132
133 public void HandleUpdateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID) 133 public void HandleUpdateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort type, string name,
134 LLUUID parentID)
134 { 135 {
135 CachedUserInfo userProfile; 136 CachedUserInfo userProfile;
136 137
@@ -143,7 +144,7 @@ namespace OpenSim.Framework.Communications.Cache
143 baseFolder.folderID = folderID; 144 baseFolder.folderID = folderID;
144 baseFolder.name = name; 145 baseFolder.name = name;
145 baseFolder.parentID = parentID; 146 baseFolder.parentID = parentID;
146 baseFolder.type = (short)type; 147 baseFolder.type = (short) type;
147 baseFolder.version = userProfile.RootFolder.version; 148 baseFolder.version = userProfile.RootFolder.version;
148 m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder); 149 m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder);
149 } 150 }
@@ -180,12 +181,12 @@ namespace OpenSim.Framework.Communications.Cache
180 bool fetchFolders, bool fetchItems, int sortOrder) 181 bool fetchFolders, bool fetchItems, int sortOrder)
181 { 182 {
182 // XXX We're not handling sortOrder yet! 183 // XXX We're not handling sortOrder yet!
183 184
184 InventoryFolderImpl fold = null; 185 InventoryFolderImpl fold = null;
185 if (folderID == libraryRoot.folderID) 186 if (folderID == libraryRoot.folderID)
186 { 187 {
187 remoteClient.SendInventoryFolderDetails( 188 remoteClient.SendInventoryFolderDetails(
188 libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems(), 189 libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems(),
189 libraryRoot.RequestListOfFolders(), fetchFolders, fetchItems); 190 libraryRoot.RequestListOfFolders(), fetchFolders, fetchItems);
190 191
191 return; 192 return;
@@ -194,7 +195,7 @@ namespace OpenSim.Framework.Communications.Cache
194 if ((fold = libraryRoot.HasSubFolder(folderID)) != null) 195 if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
195 { 196 {
196 remoteClient.SendInventoryFolderDetails( 197 remoteClient.SendInventoryFolderDetails(
197 libraryRoot.agentID, folderID, fold.RequestListOfItems(), 198 libraryRoot.agentID, folderID, fold.RequestListOfItems(),
198 fold.RequestListOfFolders(), fetchFolders, fetchItems); 199 fold.RequestListOfFolders(), fetchFolders, fetchItems);
199 200
200 return; 201 return;
@@ -209,9 +210,9 @@ namespace OpenSim.Framework.Communications.Cache
209 { 210 {
210 remoteClient.SendInventoryFolderDetails( 211 remoteClient.SendInventoryFolderDetails(
211 remoteClient.AgentId, folderID, userProfile.RootFolder.RequestListOfItems(), 212 remoteClient.AgentId, folderID, userProfile.RootFolder.RequestListOfItems(),
212 userProfile.RootFolder.RequestListOfFolders(), 213 userProfile.RootFolder.RequestListOfFolders(),
213 fetchFolders, fetchItems); 214 fetchFolders, fetchItems);
214 215
215 return; 216 return;
216 } 217 }
217 else 218 else
@@ -219,9 +220,9 @@ namespace OpenSim.Framework.Communications.Cache
219 if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null) 220 if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null)
220 { 221 {
221 remoteClient.SendInventoryFolderDetails( 222 remoteClient.SendInventoryFolderDetails(
222 remoteClient.AgentId, folderID, fold.RequestListOfItems(), 223 remoteClient.AgentId, folderID, fold.RequestListOfItems(),
223 fold.RequestListOfFolders(), fetchFolders, fetchItems); 224 fold.RequestListOfFolders(), fetchFolders, fetchItems);
224 225
225 return; 226 return;
226 } 227 }
227 } 228 }
@@ -230,20 +231,20 @@ namespace OpenSim.Framework.Communications.Cache
230 { 231 {
231 MainLog.Instance.Error( 232 MainLog.Instance.Error(
232 "INVENTORYCACHE", "Could not find root folder for user {0}", remoteClient.Name); 233 "INVENTORYCACHE", "Could not find root folder for user {0}", remoteClient.Name);
233 234
234 return; 235 return;
235 } 236 }
236 } 237 }
237 else 238 else
238 { 239 {
239 MainLog.Instance.Error( 240 MainLog.Instance.Error(
240 "INVENTORYCACHE", 241 "INVENTORYCACHE",
241 "Could not find user profile for {0} for folder {1}", 242 "Could not find user profile for {0} for folder {1}",
242 remoteClient.Name, folderID); 243 remoteClient.Name, folderID);
243 244
244 return; 245 return;
245 } 246 }
246 247
247 // If we've reached this point then we couldn't find the folder, even though the client thinks 248 // If we've reached this point then we couldn't find the folder, even though the client thinks
248 // it exists 249 // it exists
249 MainLog.Instance.Error( 250 MainLog.Instance.Error(
@@ -262,8 +263,8 @@ namespace OpenSim.Framework.Communications.Cache
262 InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID); 263 InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID);
263 if (subFolder != null) 264 if (subFolder != null)
264 { 265 {
265 List<InventoryItemBase> items=subFolder.RequestListOfItems(); 266 List<InventoryItemBase> items = subFolder.RequestListOfItems();
266 foreach(InventoryItemBase item in items) 267 foreach (InventoryItemBase item in items)
267 { 268 {
268 userProfile.DeleteItem(remoteClient.AgentId, item); 269 userProfile.DeleteItem(remoteClient.AgentId, item);
269 } 270 }
@@ -300,4 +301,4 @@ namespace OpenSim.Framework.Communications.Cache
300 m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); 301 m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
301 } 302 }
302 } 303 }
303} 304} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index e00f49d..4b42046 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -38,33 +38,33 @@ using OpenSim.Framework.Servers;
38namespace OpenSim.Region.Capabilities 38namespace OpenSim.Region.Capabilities
39{ 39{
40 public delegate void UpLoadedAsset( 40 public delegate void UpLoadedAsset(
41 string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, 41 string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder,
42 byte[] data, string inventoryType, string assetType); 42 byte[] data, string inventoryType, string assetType);
43 43
44 public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); 44 public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data);
45 45
46 public delegate void UpdateTaskScript(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data); 46 public delegate void UpdateTaskScript(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data);
47 47
48 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); 48 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item);
49 49
50 public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); 50 public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data);
51 51
52 public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, 52 public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID,
53 bool isScriptRunning, byte[] data); 53 bool isScriptRunning, byte[] data);
54 54
55 public class Caps 55 public class Caps
56 { 56 {
57 private string m_httpListenerHostName; 57 private string m_httpListenerHostName;
58 private uint m_httpListenPort; 58 private uint m_httpListenPort;
59 59
60 private string m_capsObjectPath = "00001-"; 60 private string m_capsObjectPath = "00001-";
61 private string m_requestPath = "0000/"; 61 private string m_requestPath = "0000/";
62 private string m_mapLayerPath = "0001/"; 62 private string m_mapLayerPath = "0001/";
63 private string m_newInventory = "0002/"; 63 private string m_newInventory = "0002/";
64 //private string m_requestTexture = "0003/"; 64 //private string m_requestTexture = "0003/";
65 private string m_notecardUpdatePath = "0004/"; 65 private string m_notecardUpdatePath = "0004/";
66 private string m_notecardTaskUpdatePath = "0005/"; 66 private string m_notecardTaskUpdatePath = "0005/";
67 67
68 //private string eventQueue = "0100/"; 68 //private string eventQueue = "0100/";
69 private BaseHttpServer m_httpListener; 69 private BaseHttpServer m_httpListener;
70 private LLUUID m_agentID; 70 private LLUUID m_agentID;
@@ -78,7 +78,7 @@ namespace OpenSim.Region.Capabilities
78 public NewInventoryItem AddNewInventoryItem = null; 78 public NewInventoryItem AddNewInventoryItem = null;
79 public ItemUpdatedCallback ItemUpdatedCall = null; 79 public ItemUpdatedCallback ItemUpdatedCall = null;
80 public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; 80 public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
81 81
82 public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, 82 public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
83 LLUUID agent, bool dumpAssetsToFile) 83 LLUUID agent, bool dumpAssetsToFile)
84 { 84 {
@@ -138,7 +138,7 @@ namespace OpenSim.Region.Capabilities
138 /// <returns></returns> 138 /// <returns></returns>
139 public string CapsRequest(string request, string path, string param) 139 public string CapsRequest(string request, string path, string param)
140 { 140 {
141 //Console.WriteLine("caps request " + request); 141 //Console.WriteLine("caps request " + request);
142 string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities()); 142 string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities());
143 return result; 143 return result;
144 } 144 }
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Capabilities
153 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + 153 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" +
154 m_capsObjectPath; 154 m_capsObjectPath;
155 caps.MapLayer = capsBaseUrl + m_mapLayerPath; 155 caps.MapLayer = capsBaseUrl + m_mapLayerPath;
156 // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; 156 // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture;
157 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; 157 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
158 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; 158 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath;
159 caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; 159 caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath;
@@ -262,7 +262,7 @@ namespace OpenSim.Region.Capabilities
262 } 262 }
263 263
264 #endregion 264 #endregion
265 265
266 /// <summary> 266 /// <summary>
267 /// Callback for a client request for an upload url for a script task 267 /// Callback for a client request for an upload url for a script task
268 /// inventory update 268 /// inventory update
@@ -272,28 +272,28 @@ namespace OpenSim.Region.Capabilities
272 /// <param name="param"></param> 272 /// <param name="param"></param>
273 /// <returns></returns> 273 /// <returns></returns>
274 public string ScriptTaskInventory(string request, string path, string param) 274 public string ScriptTaskInventory(string request, string path, string param)
275 { 275 {
276 try 276 try
277 { 277 {
278// MainLog.Instance.Debug("CAPS", "request: {0}, path: {1}, param: {2}", request, path, param); 278// MainLog.Instance.Debug("CAPS", "request: {0}, path: {1}, param: {2}", request, path, param);
279 279
280 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); 280 Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request));
281 LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate(); 281 LLSDTaskScriptUpdate llsdUpdateRequest = new LLSDTaskScriptUpdate();
282 LLSDHelpers.DeserialiseLLSDMap(hash, llsdUpdateRequest); 282 LLSDHelpers.DeserialiseLLSDMap(hash, llsdUpdateRequest);
283 283
284 string capsBase = "/CAPS/" + m_capsObjectPath; 284 string capsBase = "/CAPS/" + m_capsObjectPath;
285 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 285 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
286 286
287 TaskInventoryScriptUpdater uploader = 287 TaskInventoryScriptUpdater uploader =
288 new TaskInventoryScriptUpdater( 288 new TaskInventoryScriptUpdater(
289 llsdUpdateRequest.item_id, 289 llsdUpdateRequest.item_id,
290 llsdUpdateRequest.task_id, 290 llsdUpdateRequest.task_id,
291 llsdUpdateRequest.is_script_running, 291 llsdUpdateRequest.is_script_running,
292 capsBase + uploaderPath, 292 capsBase + uploaderPath,
293 m_httpListener, 293 m_httpListener,
294 m_dumpAssetsToFile); 294 m_dumpAssetsToFile);
295 uploader.OnUpLoad += TaskScriptUpdated; 295 uploader.OnUpLoad += TaskScriptUpdated;
296 296
297 m_httpListener.AddStreamHandler( 297 m_httpListener.AddStreamHandler(
298 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 298 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
299 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + 299 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
@@ -302,13 +302,13 @@ namespace OpenSim.Region.Capabilities
302 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 302 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
303 uploadResponse.uploader = uploaderURL; 303 uploadResponse.uploader = uploaderURL;
304 uploadResponse.state = "upload"; 304 uploadResponse.state = "upload";
305 305
306// MainLog.Instance.Verbose( 306// MainLog.Instance.Verbose(
307// "CAPS", 307// "CAPS",
308// "ScriptTaskInventory response: {0}", 308// "ScriptTaskInventory response: {0}",
309// LLSDHelpers.SerialiseLLSDReply(uploadResponse)); 309// LLSDHelpers.SerialiseLLSDReply(uploadResponse));
310 310
311 return LLSDHelpers.SerialiseLLSDReply(uploadResponse); 311 return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
312 } 312 }
313 catch (Exception e) 313 catch (Exception e)
314 { 314 {
@@ -329,7 +329,7 @@ namespace OpenSim.Region.Capabilities
329 public string NoteCardAgentInventory(string request, string path, string param) 329 public string NoteCardAgentInventory(string request, string path, string param)
330 { 330 {
331 //libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request)); 331 //libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request));
332 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); 332 Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request));
333 LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); 333 LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
334 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); 334 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
335 335
@@ -353,7 +353,7 @@ namespace OpenSim.Region.Capabilities
353// "CAPS", 353// "CAPS",
354// "NoteCardAgentInventory response: {0}", 354// "NoteCardAgentInventory response: {0}",
355// LLSDHelpers.SerialiseLLSDReply(uploadResponse)); 355// LLSDHelpers.SerialiseLLSDReply(uploadResponse));
356 356
357 return LLSDHelpers.SerialiseLLSDReply(uploadResponse); 357 return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
358 } 358 }
359 359
@@ -453,7 +453,7 @@ namespace OpenSim.Region.Capabilities
453 { 453 {
454 return ItemUpdatedCall(m_agentID, itemID, data); 454 return ItemUpdatedCall(m_agentID, itemID, data);
455 } 455 }
456 456
457 return LLUUID.Zero; 457 return LLUUID.Zero;
458 } 458 }
459 459
@@ -613,7 +613,7 @@ namespace OpenSim.Region.Capabilities
613 fs.Close(); 613 fs.Close();
614 } 614 }
615 } 615 }
616 616
617 /// <summary> 617 /// <summary>
618 /// This class is a callback invoked when a client sends asset data to 618 /// This class is a callback invoked when a client sends asset data to
619 /// a task inventory script update url 619 /// a task inventory script update url
@@ -629,17 +629,17 @@ namespace OpenSim.Region.Capabilities
629 private BaseHttpServer httpListener; 629 private BaseHttpServer httpListener;
630 private bool m_dumpAssetToFile; 630 private bool m_dumpAssetToFile;
631 631
632 public TaskInventoryScriptUpdater(LLUUID inventoryItemID, LLUUID primID, int isScriptRunning, 632 public TaskInventoryScriptUpdater(LLUUID inventoryItemID, LLUUID primID, int isScriptRunning,
633 string path, BaseHttpServer httpServer, bool dumpAssetToFile) 633 string path, BaseHttpServer httpServer, bool dumpAssetToFile)
634 { 634 {
635 m_dumpAssetToFile = dumpAssetToFile; 635 m_dumpAssetToFile = dumpAssetToFile;
636 636
637 this.inventoryItemID = inventoryItemID; 637 this.inventoryItemID = inventoryItemID;
638 this.primID = primID; 638 this.primID = primID;
639 639
640 // This comes in over the packet as an integer, but actually appears to be treated as a bool 640 // This comes in over the packet as an integer, but actually appears to be treated as a bool
641 this.isScriptRunning = (0 == isScriptRunning ? false : true); 641 this.isScriptRunning = (0 == isScriptRunning ? false : true);
642 642
643 uploaderPath = path; 643 uploaderPath = path;
644 httpListener = httpServer; 644 httpListener = httpServer;
645 } 645 }
@@ -659,7 +659,7 @@ namespace OpenSim.Region.Capabilities
659// "CAPS", 659// "CAPS",
660// "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", 660// "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}",
661// data, path, param); 661// data, path, param);
662 662
663 string res = ""; 663 string res = "";
664 LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete(); 664 LLSDTaskInventoryUploadComplete uploadComplete = new LLSDTaskInventoryUploadComplete();
665 665
@@ -668,7 +668,7 @@ namespace OpenSim.Region.Capabilities
668 OnUpLoad(inventoryItemID, primID, isScriptRunning, data); 668 OnUpLoad(inventoryItemID, primID, isScriptRunning, data);
669 } 669 }
670 670
671 uploadComplete.item_id = inventoryItemID; 671 uploadComplete.item_id = inventoryItemID;
672 uploadComplete.task_id = primID; 672 uploadComplete.task_id = primID;
673 uploadComplete.state = "complete"; 673 uploadComplete.state = "complete";
674 674
@@ -680,7 +680,7 @@ namespace OpenSim.Region.Capabilities
680 { 680 {
681 SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data); 681 SaveAssetToFile("updatedtaskscript" + Util.RandomClass.Next(1, 1000) + ".dat", data);
682 } 682 }
683 683
684// MainLog.Instance.Verbose("CAPS", "TaskInventoryScriptUpdater.uploaderCaps res: {0}", res); 684// MainLog.Instance.Verbose("CAPS", "TaskInventoryScriptUpdater.uploaderCaps res: {0}", res);
685 685
686 return res; 686 return res;
@@ -689,9 +689,9 @@ namespace OpenSim.Region.Capabilities
689 { 689 {
690 MainLog.Instance.Error("CAPS", e.ToString()); 690 MainLog.Instance.Error("CAPS", e.ToString());
691 } 691 }
692 692
693 // XXX Maybe this should be some meaningful error packet 693 // XXX Maybe this should be some meaningful error packet
694 return null; 694 return null;
695 } 695 }
696 696
697 private void SaveAssetToFile(string filename, byte[] data) 697 private void SaveAssetToFile(string filename, byte[] data)
@@ -702,6 +702,6 @@ namespace OpenSim.Region.Capabilities
702 bw.Close(); 702 bw.Close();
703 fs.Close(); 703 fs.Close();
704 } 704 }
705 } 705 }
706 } 706 }
707} 707} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSD.cs b/OpenSim/Framework/Communications/Capabilities/LLSD.cs
index 987d6e6..dab926c 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSD.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSD.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -28,12 +28,12 @@
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Globalization;
32using System.Xml;
33using System.IO; 32using System.IO;
34using libsecondlife;
35using System.Security.Cryptography; 33using System.Security.Cryptography;
36using System.Text; 34using System.Text;
35using System.Xml;
36using libsecondlife;
37 37
38namespace OpenSim.Region.Capabilities 38namespace OpenSim.Region.Capabilities
39{ 39{
@@ -47,7 +47,9 @@ namespace OpenSim.Region.Capabilities
47 /// </summary> 47 /// </summary>
48 public class LLSDParseException : Exception 48 public class LLSDParseException : Exception
49 { 49 {
50 public LLSDParseException(string message) : base(message) { } 50 public LLSDParseException(string message) : base(message)
51 {
52 }
51 } 53 }
52 54
53 /// <summary> 55 /// <summary>
@@ -55,7 +57,9 @@ namespace OpenSim.Region.Capabilities
55 /// </summary> 57 /// </summary>
56 public class LLSDSerializeException : Exception 58 public class LLSDSerializeException : Exception
57 { 59 {
58 public LLSDSerializeException(string message) : base(message) { } 60 public LLSDSerializeException(string message) : base(message)
61 {
62 }
59 } 63 }
60 64
61 /// <summary> 65 /// <summary>
@@ -129,7 +133,7 @@ namespace OpenSim.Region.Capabilities
129 if (obj is string) 133 if (obj is string)
130 { 134 {
131 writer.WriteStartElement(String.Empty, "string", String.Empty); 135 writer.WriteStartElement(String.Empty, "string", String.Empty);
132 writer.WriteString((string)obj); 136 writer.WriteString((string) obj);
133 writer.WriteEndElement(); 137 writer.WriteEndElement();
134 } 138 }
135 else if (obj is int) 139 else if (obj is int)
@@ -146,7 +150,7 @@ namespace OpenSim.Region.Capabilities
146 } 150 }
147 else if (obj is bool) 151 else if (obj is bool)
148 { 152 {
149 bool b = (bool)obj; 153 bool b = (bool) obj;
150 writer.WriteStartElement(String.Empty, "boolean", String.Empty); 154 writer.WriteStartElement(String.Empty, "boolean", String.Empty);
151 writer.WriteString(b ? "1" : "0"); 155 writer.WriteString(b ? "1" : "0");
152 writer.WriteEndElement(); 156 writer.WriteEndElement();
@@ -157,7 +161,7 @@ namespace OpenSim.Region.Capabilities
157 } 161 }
158 else if (obj is LLUUID) 162 else if (obj is LLUUID)
159 { 163 {
160 LLUUID u = (LLUUID)obj; 164 LLUUID u = (LLUUID) obj;
161 writer.WriteStartElement(String.Empty, "uuid", String.Empty); 165 writer.WriteStartElement(String.Empty, "uuid", String.Empty);
162 writer.WriteString(u.ToString()); 166 writer.WriteString(u.ToString());
163 writer.WriteEndElement(); 167 writer.WriteEndElement();
@@ -463,7 +467,7 @@ namespace OpenSim.Region.Capabilities
463 } 467 }
464 else if (obj is string) 468 else if (obj is string)
465 { 469 {
466 return GetSpaces(indent) + "- string \"" + (string)obj + "\"\n"; 470 return GetSpaces(indent) + "- string \"" + (string) obj + "\"\n";
467 } 471 }
468 else if (obj is int) 472 else if (obj is int)
469 { 473 {
@@ -475,13 +479,13 @@ namespace OpenSim.Region.Capabilities
475 } 479 }
476 else if (obj is LLUUID) 480 else if (obj is LLUUID)
477 { 481 {
478 return GetSpaces(indent) + "- uuid " + ((LLUUID)obj).ToString() + Environment.NewLine; 482 return GetSpaces(indent) + "- uuid " + ((LLUUID) obj).ToString() + Environment.NewLine;
479 } 483 }
480 else if (obj is Hashtable) 484 else if (obj is Hashtable)
481 { 485 {
482 StringBuilder ret = new StringBuilder(); 486 StringBuilder ret = new StringBuilder();
483 ret.Append(GetSpaces(indent) + "- map" + Environment.NewLine); 487 ret.Append(GetSpaces(indent) + "- map" + Environment.NewLine);
484 Hashtable map = (Hashtable)obj; 488 Hashtable map = (Hashtable) obj;
485 489
486 foreach (string key in map.Keys) 490 foreach (string key in map.Keys)
487 { 491 {
@@ -495,7 +499,7 @@ namespace OpenSim.Region.Capabilities
495 { 499 {
496 StringBuilder ret = new StringBuilder(); 500 StringBuilder ret = new StringBuilder();
497 ret.Append(GetSpaces(indent) + "- array\n"); 501 ret.Append(GetSpaces(indent) + "- array\n");
498 ArrayList list = (ArrayList)obj; 502 ArrayList list = (ArrayList) obj;
499 503
500 foreach (object item in list) 504 foreach (object item in list)
501 { 505 {
@@ -506,8 +510,8 @@ namespace OpenSim.Region.Capabilities
506 } 510 }
507 else if (obj is byte[]) 511 else if (obj is byte[])
508 { 512 {
509 return GetSpaces(indent) + "- binary\n" + Helpers.FieldToHexString((byte[])obj, GetSpaces(indent)) + 513 return GetSpaces(indent) + "- binary\n" + Helpers.FieldToHexString((byte[]) obj, GetSpaces(indent)) +
510 Environment.NewLine; 514 Environment.NewLine;
511 } 515 }
512 else 516 else
513 { 517 {
@@ -557,8 +561,8 @@ namespace OpenSim.Region.Capabilities
557 double value; 561 double value;
558 endPos = FindEnd(llsd, 1); 562 endPos = FindEnd(llsd, 1);
559 563
560 if (Double.TryParse(llsd.Substring(1, endPos - 1), System.Globalization.NumberStyles.Float, 564 if (Double.TryParse(llsd.Substring(1, endPos - 1), NumberStyles.Float,
561 Helpers.EnUsCulture.NumberFormat, out value)) 565 Helpers.EnUsCulture.NumberFormat, out value))
562 return value; 566 return value;
563 else 567 else
564 throw new LLSDParseException("Failed to parse double value type"); 568 throw new LLSDParseException("Failed to parse double value type");
@@ -652,7 +656,7 @@ namespace OpenSim.Region.Capabilities
652 656
653 private static int FindEnd(string llsd, int start) 657 private static int FindEnd(string llsd, int start)
654 { 658 {
655 int end = llsd.IndexOfAny(new char[] { ',', ']', '}' }); 659 int end = llsd.IndexOfAny(new char[] {',', ']', '}'});
656 if (end == -1) end = llsd.Length - 1; 660 if (end == -1) end = llsd.Length - 1;
657 return end; 661 return end;
658 } 662 }
@@ -673,4 +677,4 @@ namespace OpenSim.Region.Capabilities
673 } 677 }
674 } 678 }
675 } 679 }
676} 680} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs
index 2bc1643..d641b5c 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs
@@ -38,4 +38,4 @@ namespace OpenSim.Region.Capabilities
38 { 38 {
39 } 39 }
40 } 40 }
41} 41} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs
index 307e3e3..f838c85 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs
@@ -41,4 +41,4 @@ namespace OpenSim.Region.Capabilities
41 { 41 {
42 } 42 }
43 } 43 }
44} 44} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs
index eb76d64..3b8c077 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs
@@ -37,4 +37,4 @@ namespace OpenSim.Region.Capabilities
37 { 37 {
38 } 38 }
39 } 39 }
40} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
index dfb1683..7b09cb3 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Region.Capabilities
34 public string MapLayer = ""; 34 public string MapLayer = "";
35 public string NewFileAgentInventory = ""; 35 public string NewFileAgentInventory = "";
36 //public string EventQueueGet = ""; 36 //public string EventQueueGet = "";
37 // public string RequestTextureDownload = ""; 37 // public string RequestTextureDownload = "";
38 // public string ChatSessionRequest = ""; 38 // public string ChatSessionRequest = "";
39 public string UpdateNotecardAgentInventory = ""; 39 public string UpdateNotecardAgentInventory = "";
40 public string UpdateScriptAgentInventory = ""; 40 public string UpdateScriptAgentInventory = "";
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs
index 101d9c0..5e6e917 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs
@@ -34,4 +34,4 @@ namespace OpenSim.Region.Capabilities
34 { 34 {
35 } 35 }
36 } 36 }
37} 37} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
index 60aa60c..28f838d 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
@@ -30,7 +30,6 @@ using System.Collections;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Xml; 32using System.Xml;
33using libsecondlife;
34 33
35namespace OpenSim.Region.Capabilities 34namespace OpenSim.Region.Capabilities
36{ 35{
@@ -77,7 +76,7 @@ namespace OpenSim.Region.Capabilities
77 writer.WriteString(fields[i].Name); 76 writer.WriteString(fields[i].Name);
78 writer.WriteEndElement(); 77 writer.WriteEndElement();
79 LLSD.LLSDWriteOne(writer, fieldValue); 78 LLSD.LLSDWriteOne(writer, fieldValue);
80 // libsecondlife.StructuredData.LLSDParser.SerializeXmlElement( 79 // libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
81 // writer, libsecondlife.StructuredData.LLSD.FromObject(fieldValue)); 80 // writer, libsecondlife.StructuredData.LLSD.FromObject(fieldValue));
82 } 81 }
83 } 82 }
@@ -102,8 +101,8 @@ namespace OpenSim.Region.Capabilities
102 else 101 else
103 { 102 {
104 LLSD.LLSDWriteOne(writer, obj); 103 LLSD.LLSDWriteOne(writer, obj);
105 //libsecondlife.StructuredData.LLSDParser.SerializeXmlElement( 104 //libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
106 // writer, libsecondlife.StructuredData.LLSD.FromObject(obj)); 105 // writer, libsecondlife.StructuredData.LLSD.FromObject(obj));
107 } 106 }
108 } 107 }
109 108
@@ -122,12 +121,12 @@ namespace OpenSim.Region.Capabilities
122 FieldInfo field = myType.GetField((string) enumerator.Key); 121 FieldInfo field = myType.GetField((string) enumerator.Key);
123 if (field != null) 122 if (field != null)
124 { 123 {
125 // if (enumerator.Value is libsecondlife.StructuredData.LLSDMap) 124 // if (enumerator.Value is libsecondlife.StructuredData.LLSDMap)
126 if (enumerator.Value is Hashtable) 125 if (enumerator.Value is Hashtable)
127 { 126 {
128 object fieldValue = field.GetValue(obj); 127 object fieldValue = field.GetValue(obj);
129 DeserialiseLLSDMap((Hashtable)enumerator.Value, fieldValue); 128 DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue);
130 // DeserialiseLLSDMap((libsecondlife.StructuredData.LLSDMap) enumerator.Value, fieldValue); 129 // DeserialiseLLSDMap((libsecondlife.StructuredData.LLSDMap) enumerator.Value, fieldValue);
131 } 130 }
132 else if (enumerator.Value is ArrayList) 131 else if (enumerator.Value is ArrayList)
133 { 132 {
@@ -149,4 +148,4 @@ namespace OpenSim.Region.Capabilities
149 return obj; 148 return obj;
150 } 149 }
151 } 150 }
152} 151} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs
index 214b9c7..121b36a 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs
@@ -42,4 +42,4 @@ namespace OpenSim.Region.Capabilities
42 { 42 {
43 } 43 }
44 } 44 }
45} 45} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs
index 48130b1..93b0f83 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs
@@ -37,4 +37,4 @@ namespace OpenSim.Region.Capabilities
37 { 37 {
38 } 38 }
39 } 39 }
40} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
index 71cc358..4321d7b 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs
@@ -29,9 +29,7 @@
29using System.Collections; 29using System.Collections;
30using System.IO; 30using System.IO;
31using System.Text; 31using System.Text;
32using libsecondlife;
33using OpenSim.Framework.Servers; 32using OpenSim.Framework.Servers;
34using System.Xml;
35 33
36namespace OpenSim.Region.Capabilities 34namespace OpenSim.Region.Capabilities
37{ 35{
@@ -54,10 +52,10 @@ namespace OpenSim.Region.Capabilities
54 //string requestBody = streamReader.ReadToEnd(); 52 //string requestBody = streamReader.ReadToEnd();
55 //streamReader.Close(); 53 //streamReader.Close();
56 54
57 // libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap) 55 // libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)
58 // libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request)); 56 // libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
59 57
60 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(request); 58 Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
61 TRequest llsdRequest = new TRequest(); 59 TRequest llsdRequest = new TRequest();
62 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); 60 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
63 61
@@ -68,4 +66,4 @@ namespace OpenSim.Region.Capabilities
68 return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); 66 return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
69 } 67 }
70 } 68 }
71} 69} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs
index 3703efc..8d6550b 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDTaskInventoryUploadComplete.cs
@@ -25,10 +25,10 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29 29
30namespace OpenSim.Region.Capabilities 30namespace OpenSim.Region.Capabilities
31{ 31{
32 [LLSDMap] 32 [LLSDMap]
33 public class LLSDTaskInventoryUploadComplete 33 public class LLSDTaskInventoryUploadComplete
34 { 34 {
@@ -36,15 +36,15 @@ namespace OpenSim.Region.Capabilities
36 /// The task inventory item that was updated 36 /// The task inventory item that was updated
37 /// </summary> 37 /// </summary>
38 public LLUUID item_id; 38 public LLUUID item_id;
39 39
40 /// <summary> 40 /// <summary>
41 /// The task that was updated 41 /// The task that was updated
42 /// </summary> 42 /// </summary>
43 public LLUUID task_id; 43 public LLUUID task_id;
44 44
45 /// <summary> 45 /// <summary>
46 /// State of the upload. So far have only even seen this set to "complete" 46 /// State of the upload. So far have only even seen this set to "complete"
47 /// </summary> 47 /// </summary>
48 public string state; 48 public string state;
49 } 49 }
50} 50} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs
index 6dcf2b5..e9c77b8 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDTaskScriptUpdate.cs
@@ -26,10 +26,10 @@
26* 26*
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Region.Capabilities 31namespace OpenSim.Region.Capabilities
32{ 32{
33 [LLSDMap] 33 [LLSDMap]
34 public class LLSDTaskScriptUpdate 34 public class LLSDTaskScriptUpdate
35 { 35 {
@@ -37,15 +37,15 @@ namespace OpenSim.Region.Capabilities
37 /// The item containing the script to update 37 /// The item containing the script to update
38 /// </summary> 38 /// </summary>
39 public LLUUID item_id; 39 public LLUUID item_id;
40 40
41 /// <summary> 41 /// <summary>
42 /// The task containing the script 42 /// The task containing the script
43 /// </summary> 43 /// </summary>
44 public LLUUID task_id; 44 public LLUUID task_id;
45 45
46 /// <summary> 46 /// <summary>
47 /// Signals whether the script is currently active 47 /// Signals whether the script is currently active
48 /// </summary> 48 /// </summary>
49 public int is_script_running; 49 public int is_script_running;
50 } 50 }
51} 51} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs
index 70bfd2c..d10b0c0 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs
@@ -37,4 +37,4 @@ namespace OpenSim.Region.Capabilities
37 { 37 {
38 } 38 }
39 } 39 }
40} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs
index 7bbe16e..e851742 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs
@@ -52,4 +52,4 @@ namespace OpenSim.Region.Capabilities
52 { 52 {
53 } 53 }
54 } 54 }
55} 55} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 4614756..02c54e1 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic;
29using libsecondlife; 30using libsecondlife;
30using OpenSim.Framework.Communications.Cache; 31using OpenSim.Framework.Communications.Cache;
31using System.Collections.Generic;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33using OpenSim.Framework.Servers; 33using OpenSim.Framework.Servers;
34 34
@@ -173,12 +173,13 @@ namespace OpenSim.Framework.Communications
173 } 173 }
174 } 174 }
175 } 175 }
176
176 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query) 177 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
177 { 178 {
178 List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query); 179 List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
179 return pickerlist; 180 return pickerlist;
180 } 181 }
181 182
182 #endregion 183 #endregion
183 } 184 }
184} 185} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs
index d51f234..e2c2661 100644
--- a/OpenSim/Framework/Communications/IGridServices.cs
+++ b/OpenSim/Framework/Communications/IGridServices.cs
@@ -25,7 +25,6 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections;
29using System.Collections.Generic; 28using System.Collections.Generic;
30 29
31namespace OpenSim.Framework.Communications 30namespace OpenSim.Framework.Communications
@@ -39,6 +38,5 @@ namespace OpenSim.Framework.Communications
39 RegionInfo RequestNeighbourInfo(ulong regionHandle); 38 RegionInfo RequestNeighbourInfo(ulong regionHandle);
40 Dictionary<string, string> GetGridSettings(); 39 Dictionary<string, string> GetGridSettings();
41 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); 40 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY);
42
43 } 41 }
44} 42} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
index 3aa20a3..e2a96f6 100644
--- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs
+++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs
@@ -31,8 +31,7 @@ namespace OpenSim.Framework.Communications
31{ 31{
32 public interface IInterRegionCommunications 32 public interface IInterRegionCommunications
33 { 33 {
34 34 string rdebugRegionName { get; set; }
35 string rdebugRegionName{ get; set; }
36 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData); 35 bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
37 bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData); 36 bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData);
38 bool RegionUp(SearializableRegionInfo region, ulong regionhandle); 37 bool RegionUp(SearializableRegionInfo region, ulong regionhandle);
@@ -45,6 +44,5 @@ namespace OpenSim.Framework.Communications
45 bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID); 44 bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID);
46 45
47 void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID); 46 void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID);
48
49 } 47 }
50} 48} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index 9c493d4..f2e5cc5 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -52,4 +52,4 @@ namespace OpenSim.Framework.Communications
52 /// <returns></returns> 52 /// <returns></returns>
53 List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID); 53 List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID);
54 } 54 }
55} 55} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 534383a..098d08e 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -30,7 +30,6 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
35 34
36namespace OpenSim.Framework.Communications 35namespace OpenSim.Framework.Communications
@@ -65,7 +64,7 @@ namespace OpenSim.Framework.Communications
65 if (typeInterface != null) 64 if (typeInterface != null)
66 { 65 {
67 IInventoryData plug = 66 IInventoryData plug =
68 (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 67 (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
69 plug.Initialise(); 68 plug.Initialise();
70 m_plugins.Add(plug.getName(), plug); 69 m_plugins.Add(plug.getName(), plug);
71 MainLog.Instance.Verbose("AGENTINVENTORY", "Added IInventoryData Interface"); 70 MainLog.Instance.Verbose("AGENTINVENTORY", "Added IInventoryData Interface");
@@ -370,4 +369,4 @@ namespace OpenSim.Framework.Communications
370 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 369 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
371 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); 370 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
372 } 371 }
373} 372} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs
index ede3148..954aecb 100644
--- a/OpenSim/Framework/Communications/LoginResponse.cs
+++ b/OpenSim/Framework/Communications/LoginResponse.cs
@@ -525,9 +525,9 @@ namespace OpenSim.Framework.UserManagement
525 set { welcomeMessage = value; } 525 set { welcomeMessage = value; }
526 } 526 }
527 527
528 public BuddyList BuddList 528 public BuddyList BuddList
529 { 529 {
530 get{return m_buddyList;} 530 get { return m_buddyList; }
531 set { m_buddyList = value; } 531 set { m_buddyList = value; }
532 } 532 }
533 533
@@ -591,4 +591,4 @@ namespace OpenSim.Framework.UserManagement
591 } 591 }
592 } 592 }
593 } 593 }
594} 594} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 6d4cb68..a284910 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Framework.UserManagement
64 //CFK: CustomizeResponse contains sufficient strings to alleviate the need for this. 64 //CFK: CustomizeResponse contains sufficient strings to alleviate the need for this.
65 //CKF: MainLog.Instance.Verbose("LOGIN", "Attempting login now..."); 65 //CKF: MainLog.Instance.Verbose("LOGIN", "Attempting login now...");
66 XmlRpcResponse response = new XmlRpcResponse(); 66 XmlRpcResponse response = new XmlRpcResponse();
67 Hashtable requestData = (Hashtable)request.Params[0]; 67 Hashtable requestData = (Hashtable) request.Params[0];
68 68
69 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && 69 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") &&
70 requestData.Contains("passwd")); 70 requestData.Contains("passwd"));
@@ -75,17 +75,17 @@ namespace OpenSim.Framework.UserManagement
75 75
76 if (GoodXML) 76 if (GoodXML)
77 { 77 {
78 string firstname = (string)requestData["first"]; 78 string firstname = (string) requestData["first"];
79 string lastname = (string)requestData["last"]; 79 string lastname = (string) requestData["last"];
80 string passwd = (string)requestData["passwd"]; 80 string passwd = (string) requestData["passwd"];
81 81
82 userProfile = GetTheUser(firstname, lastname); 82 userProfile = GetTheUser(firstname, lastname);
83 if (userProfile == null) 83 if (userProfile == null)
84 { 84 {
85 MainLog.Instance.Verbose( 85 MainLog.Instance.Verbose(
86 "LOGIN", 86 "LOGIN",
87 "Could not find a profile for " + firstname + " " + lastname); 87 "Could not find a profile for " + firstname + " " + lastname);
88 88
89 return logResponse.CreateLoginFailedResponse(); 89 return logResponse.CreateLoginFailedResponse();
90 } 90 }
91 91
@@ -103,15 +103,14 @@ namespace OpenSim.Framework.UserManagement
103 else 103 else
104 { 104 {
105 // If we already have a session... 105 // If we already have a session...
106 106
107 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) 107 if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
108 { 108 {
109 userProfile.currentAgent = null; 109 userProfile.currentAgent = null;
110 m_userManager.CommitAgent(ref userProfile); 110 m_userManager.CommitAgent(ref userProfile);
111 111
112 // Reject the login 112 // Reject the login
113 return logResponse.CreateAlreadyLoggedInResponse(); 113 return logResponse.CreateAlreadyLoggedInResponse();
114
115 } 114 }
116 // Otherwise... 115 // Otherwise...
117 // Create a new agent session 116 // Create a new agent session
@@ -132,7 +131,7 @@ namespace OpenSim.Framework.UserManagement
132 userProfile.rootInventoryFolderID = inventData.RootFolderID; 131 userProfile.rootInventoryFolderID = inventData.RootFolderID;
133 132
134 // Circuit Code 133 // Circuit Code
135 uint circode = (uint)(Util.RandomClass.Next()); 134 uint circode = (uint) (Util.RandomClass.Next());
136 135
137 logResponse.Lastname = userProfile.surname; 136 logResponse.Lastname = userProfile.surname;
138 logResponse.Firstname = userProfile.username; 137 logResponse.Firstname = userProfile.username;
@@ -150,7 +149,7 @@ namespace OpenSim.Framework.UserManagement
150 logResponse.InventoryLibRoot = InventoryLibRoot; 149 logResponse.InventoryLibRoot = InventoryLibRoot;
151 150
152 logResponse.InventoryLibraryOwner = GetLibraryOwner(); 151 logResponse.InventoryLibraryOwner = GetLibraryOwner();
153 logResponse.CircuitCode = (Int32)circode; 152 logResponse.CircuitCode = (Int32) circode;
154 //logResponse.RegionX = 0; //overwritten 153 //logResponse.RegionX = 0; //overwritten
155 //logResponse.RegionY = 0; //overwritten 154 //logResponse.RegionY = 0; //overwritten
156 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten 155 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
@@ -277,7 +276,7 @@ namespace OpenSim.Framework.UserManagement
277 TempHash["type_default"] = -1; 276 TempHash["type_default"] = -1;
278 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; 277 TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001";
279 temp.Add(TempHash); 278 temp.Add(TempHash);
280 279
281 return temp; 280 return temp;
282 } 281 }
283 282
@@ -328,4 +327,4 @@ namespace OpenSim.Framework.UserManagement
328 } 327 }
329 } 328 }
330 } 329 }
331} 330} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
index fd8ce38..e9c7bf3 100644
--- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
+++ b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
@@ -62,4 +62,4 @@ using System.Runtime.InteropServices;
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("1.0.0.0")] 64[assembly : AssemblyVersion("1.0.0.0")]
65[assembly : AssemblyFileVersion("1.0.0.0")] 65[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/RestClient/RestClient.cs b/OpenSim/Framework/Communications/RestClient/RestClient.cs
index 5c77193..1aaf68e 100644
--- a/OpenSim/Framework/Communications/RestClient/RestClient.cs
+++ b/OpenSim/Framework/Communications/RestClient/RestClient.cs
@@ -238,7 +238,7 @@ namespace OpenSim.Framework.Communications
238 } 238 }
239 } 239 }
240 realuri = sb.ToString(); 240 realuri = sb.ToString();
241 MainLog.Instance.Verbose("REST", "RestURL: {0}", realuri); 241 MainLog.Instance.Verbose("REST", "RestURL: {0}", realuri);
242 return new Uri(sb.ToString()); 242 return new Uri(sb.ToString());
243 } 243 }
244 244
@@ -365,7 +365,7 @@ namespace OpenSim.Framework.Communications
365 } 365 }
366 366
367 public Stream Request(Stream src) 367 public Stream Request(Stream src)
368 { 368 {
369 _request = (HttpWebRequest) WebRequest.Create(buildUri()); 369 _request = (HttpWebRequest) WebRequest.Create(buildUri());
370 _request.KeepAlive = false; 370 _request.KeepAlive = false;
371 _request.ContentType = "application/xml"; 371 _request.ContentType = "application/xml";
@@ -374,16 +374,16 @@ namespace OpenSim.Framework.Communications
374 _asyncException = null; 374 _asyncException = null;
375 _request.ContentLength = src.Length; 375 _request.ContentLength = src.Length;
376 376
377 MainLog.Instance.Verbose("REST", "Request Length {0}", _request.ContentLength); 377 MainLog.Instance.Verbose("REST", "Request Length {0}", _request.ContentLength);
378 MainLog.Instance.Verbose("REST", "Sending Web Request {0}", buildUri()); 378 MainLog.Instance.Verbose("REST", "Sending Web Request {0}", buildUri());
379 src.Seek(0, SeekOrigin.Begin); 379 src.Seek(0, SeekOrigin.Begin);
380 MainLog.Instance.Verbose("REST", "Seek is ok"); 380 MainLog.Instance.Verbose("REST", "Seek is ok");
381 Stream dst = _request.GetRequestStream(); 381 Stream dst = _request.GetRequestStream();
382 MainLog.Instance.Verbose("REST", "GetRequestStream is ok"); 382 MainLog.Instance.Verbose("REST", "GetRequestStream is ok");
383 383
384 byte[] buf = new byte[1024]; 384 byte[] buf = new byte[1024];
385 int length = src.Read(buf, 0, 1024); 385 int length = src.Read(buf, 0, 1024);
386 MainLog.Instance.Verbose("REST", "First Read is ok"); 386 MainLog.Instance.Verbose("REST", "First Read is ok");
387 while (length > 0) 387 while (length > 0)
388 { 388 {
389 dst.Write(buf, 0, length); 389 dst.Write(buf, 0, length);
@@ -440,4 +440,4 @@ namespace OpenSim.Framework.Communications
440 440
441 #endregion Async Invocation 441 #endregion Async Invocation
442 } 442 }
443} 443} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index d946e00..f913d2c 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -27,7 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections;
31using System.Collections.Generic; 30using System.Collections.Generic;
32using System.Reflection; 31using System.Reflection;
33using System.Security.Cryptography; 32using System.Security.Cryptography;
@@ -93,13 +92,13 @@ namespace OpenSim.Framework.UserManagement
93 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 92 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
94 { 93 {
95 UserProfileData profile = plugin.Value.GetUserByUUID(uuid); 94 UserProfileData profile = plugin.Value.GetUserByUUID(uuid);
96 95
97 if (null != profile) 96 if (null != profile)
98 { 97 {
99 profile.currentAgent = getUserAgent(profile.UUID); 98 profile.currentAgent = getUserAgent(profile.UUID);
100 return profile; 99 return profile;
101 } 100 }
102 } 101 }
103 102
104 return null; 103 return null;
105 } 104 }
@@ -112,11 +111,11 @@ namespace OpenSim.Framework.UserManagement
112 try 111 try
113 { 112 {
114 pickerlist = plugin.Value.GeneratePickerResults(queryID, query); 113 pickerlist = plugin.Value.GeneratePickerResults(queryID, query);
115
116 } 114 }
117 catch (Exception) 115 catch (Exception)
118 { 116 {
119 MainLog.Instance.Verbose("USERSTORAGE", "Unable to generate AgentPickerData via " + plugin.Key + "(" + query + ")"); 117 MainLog.Instance.Verbose("USERSTORAGE",
118 "Unable to generate AgentPickerData via " + plugin.Key + "(" + query + ")");
120 return new List<AvatarPickerAvatar>(); 119 return new List<AvatarPickerAvatar>();
121 } 120 }
122 } 121 }
@@ -162,7 +161,8 @@ namespace OpenSim.Framework.UserManagement
162 } 161 }
163 catch (Exception e) 162 catch (Exception e)
164 { 163 {
165 MainLog.Instance.Verbose("USERSTORAGE", "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); 164 MainLog.Instance.Verbose("USERSTORAGE",
165 "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")");
166 } 166 }
167 } 167 }
168 168
@@ -188,7 +188,8 @@ namespace OpenSim.Framework.UserManagement
188 } 188 }
189 catch (Exception e) 189 catch (Exception e)
190 { 190 {
191 MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 191 MainLog.Instance.Verbose("USERSTORAGE",
192 "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
192 } 193 }
193 } 194 }
194 195
@@ -210,7 +211,8 @@ namespace OpenSim.Framework.UserManagement
210 } 211 }
211 catch (Exception e) 212 catch (Exception e)
212 { 213 {
213 MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 214 MainLog.Instance.Verbose("USERSTORAGE",
215 "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
214 } 216 }
215 } 217 }
216 218
@@ -222,7 +224,7 @@ namespace OpenSim.Framework.UserManagement
222 { 224 {
223 UserProfileData profile = GetUserProfile(agentID); 225 UserProfileData profile = GetUserProfile(agentID);
224 profile.currentAgent = null; 226 profile.currentAgent = null;
225 227
226 setUserProfile(profile); 228 setUserProfile(profile);
227 } 229 }
228 230
@@ -242,7 +244,8 @@ namespace OpenSim.Framework.UserManagement
242 } 244 }
243 catch (Exception e) 245 catch (Exception e)
244 { 246 {
245 MainLog.Instance.Verbose("USERSTORAGE", "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 247 MainLog.Instance.Verbose("USERSTORAGE",
248 "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
246 } 249 }
247 } 250 }
248 251
@@ -356,7 +359,8 @@ namespace OpenSim.Framework.UserManagement
356 } 359 }
357 catch (Exception e) 360 catch (Exception e)
358 { 361 {
359 MainLog.Instance.Verbose("USERSTORAGE", "Unable to add user via " + plugin.Key + "(" + e.ToString() + ")"); 362 MainLog.Instance.Verbose("USERSTORAGE",
363 "Unable to add user via " + plugin.Key + "(" + e.ToString() + ")");
360 } 364 }
361 } 365 }
362 366
@@ -365,6 +369,6 @@ namespace OpenSim.Framework.UserManagement
365 369
366 public abstract UserProfileData SetupMasterUser(string firstName, string lastName); 370 public abstract UserProfileData SetupMasterUser(string firstName, string lastName);
367 public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); 371 public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password);
368 public abstract UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid); 372 public abstract UserProfileData SetupMasterUser(LLUUID uuid);
369 } 373 }
370} 374} \ No newline at end of file
diff --git a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs
index b8e64f3..8bb31f8 100644
--- a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs
+++ b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs
@@ -136,4 +136,4 @@ namespace OpenSim.Framework.Configuration
136 doc = null; 136 doc = null;
137 } 137 }
138 } 138 }
139} 139} \ No newline at end of file
diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs
index 271c02c..a5ab613 100644
--- a/OpenSim/Framework/ConfigurationMember.cs
+++ b/OpenSim/Framework/ConfigurationMember.cs
@@ -27,24 +27,20 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Reflection;
31using System.Collections;
32using System.Collections.Generic; 30using System.Collections.Generic;
33using System.Text; 31using System.Globalization;
34using System.Net; 32using System.Net;
33using System.Reflection;
35using System.Xml; 34using System.Xml;
36
37using libsecondlife; 35using libsecondlife;
38
39using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
40using OpenSim.Framework;
41using System.Globalization;
42 37
43namespace OpenSim.Framework 38namespace OpenSim.Framework
44{ 39{
45 public class ConfigurationMember 40 public class ConfigurationMember
46 { 41 {
47 public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); 42 public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result);
43
48 public delegate void ConfigurationOptionsLoad(); 44 public delegate void ConfigurationOptionsLoad();
49 45
50 private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>(); 46 private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>();
@@ -55,29 +51,36 @@ namespace OpenSim.Framework
55 private ConfigurationOptionResult resultFunction; 51 private ConfigurationOptionResult resultFunction;
56 52
57 private IGenericConfig configurationPlugin = null; 53 private IGenericConfig configurationPlugin = null;
54
58 /// <summary> 55 /// <summary>
59 /// This is the default configuration DLL loaded 56 /// This is the default configuration DLL loaded
60 /// </summary> 57 /// </summary>
61 private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; 58 private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll";
62 public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) 59
60 public ConfigurationMember(string configuration_filename, string configuration_description,
61 ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function)
63 { 62 {
64 this.configurationFilename = configuration_filename; 63 configurationFilename = configuration_filename;
65 this.configurationDescription = configuration_description; 64 configurationDescription = configuration_description;
66 this.loadFunction = load_function; 65 loadFunction = load_function;
67 this.resultFunction = result_function; 66 resultFunction = result_function;
68 } 67 }
69 public ConfigurationMember(XmlNode configuration_xml, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) 68
69 public ConfigurationMember(XmlNode configuration_xml, string configuration_description,
70 ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function)
70 { 71 {
71 this.configurationFilename = ""; 72 configurationFilename = "";
72 this.configurationFromXMLNode = configuration_xml; 73 configurationFromXMLNode = configuration_xml;
73 this.configurationDescription = configuration_description; 74 configurationDescription = configuration_description;
74 this.loadFunction = load_function; 75 loadFunction = load_function;
75 this.resultFunction = result_function; 76 resultFunction = result_function;
76 } 77 }
78
77 public void setConfigurationFilename(string filename) 79 public void setConfigurationFilename(string filename)
78 { 80 {
79 configurationFilename = filename; 81 configurationFilename = filename;
80 } 82 }
83
81 public void setConfigurationDescription(string desc) 84 public void setConfigurationDescription(string desc)
82 { 85 {
83 configurationDescription = desc; 86 configurationDescription = desc;
@@ -92,9 +95,11 @@ namespace OpenSim.Framework
92 { 95 {
93 configurationPluginFilename = dll_filename; 96 configurationPluginFilename = dll_filename;
94 } 97 }
98
95 private void checkAndAddConfigOption(ConfigurationOption option) 99 private void checkAndAddConfigOption(ConfigurationOption option)
96 { 100 {
97 if ((option.configurationKey != "" && option.configurationQuestion != "") || (option.configurationKey != "" && option.configurationUseDefaultNoPrompt)) 101 if ((option.configurationKey != "" && option.configurationQuestion != "") ||
102 (option.configurationKey != "" && option.configurationUseDefaultNoPrompt))
98 { 103 {
99 if (!configurationOptions.Contains(option)) 104 if (!configurationOptions.Contains(option))
100 { 105 {
@@ -103,11 +108,16 @@ namespace OpenSim.Framework
103 } 108 }
104 else 109 else
105 { 110 {
106 MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + option.configurationKey + ")"); 111 MainLog.Instance.Notice(
112 "Required fields for adding a configuration option is invalid. Will not add this option (" +
113 option.configurationKey + ")");
107 } 114 }
108 } 115 }
109 116
110 public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt) 117 public void addConfigurationOption(string configuration_key,
118 ConfigurationOption.ConfigurationTypes configuration_type,
119 string configuration_question, string configuration_default,
120 bool use_default_no_prompt)
111 { 121 {
112 ConfigurationOption configOption = new ConfigurationOption(); 122 ConfigurationOption configOption = new ConfigurationOption();
113 configOption.configurationKey = configuration_key; 123 configOption.configurationKey = configuration_key;
@@ -119,7 +129,11 @@ namespace OpenSim.Framework
119 checkAndAddConfigOption(configOption); 129 checkAndAddConfigOption(configOption);
120 } 130 }
121 131
122 public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt, ConfigurationOption.ConfigurationOptionShouldBeAsked shouldIBeAskedDelegate) 132 public void addConfigurationOption(string configuration_key,
133 ConfigurationOption.ConfigurationTypes configuration_type,
134 string configuration_question, string configuration_default,
135 bool use_default_no_prompt,
136 ConfigurationOption.ConfigurationOptionShouldBeAsked shouldIBeAskedDelegate)
123 { 137 {
124 ConfigurationOption configOption = new ConfigurationOption(); 138 ConfigurationOption configOption = new ConfigurationOption();
125 configOption.configurationKey = configuration_key; 139 configOption.configurationKey = configuration_key;
@@ -133,26 +147,30 @@ namespace OpenSim.Framework
133 147
134 public void performConfigurationRetrieve() 148 public void performConfigurationRetrieve()
135 { 149 {
136 configurationPlugin = this.LoadConfigDll(configurationPluginFilename); 150 configurationPlugin = LoadConfigDll(configurationPluginFilename);
137 configurationOptions.Clear(); 151 configurationOptions.Clear();
138 if(loadFunction == null) 152 if (loadFunction == null)
139 { 153 {
140 MainLog.Instance.Error("Load Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); 154 MainLog.Instance.Error("Load Function for '" + configurationDescription +
155 "' is null. Refusing to run configuration.");
141 return; 156 return;
142 } 157 }
143 158
144 if(resultFunction == null) 159 if (resultFunction == null)
145 { 160 {
146 MainLog.Instance.Error("Result Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); 161 MainLog.Instance.Error("Result Function for '" + configurationDescription +
162 "' is null. Refusing to run configuration.");
147 return; 163 return;
148 } 164 }
149 165
150 MainLog.Instance.Verbose("CONFIG", "Calling Configuration Load Function..."); 166 MainLog.Instance.Verbose("CONFIG", "Calling Configuration Load Function...");
151 this.loadFunction(); 167 loadFunction();
152 168
153 if(configurationOptions.Count <= 0) 169 if (configurationOptions.Count <= 0)
154 { 170 {
155 MainLog.Instance.Error("CONFIG", "No configuration options were specified for '" + this.configurationOptions + "'. Refusing to continue configuration."); 171 MainLog.Instance.Error("CONFIG",
172 "No configuration options were specified for '" + configurationOptions +
173 "'. Refusing to continue configuration.");
156 return; 174 return;
157 } 175 }
158 176
@@ -179,7 +197,7 @@ namespace OpenSim.Framework
179 } 197 }
180 else 198 else
181 { 199 {
182 if (this.configurationFromXMLNode != null) 200 if (configurationFromXMLNode != null)
183 { 201 {
184 MainLog.Instance.Notice("Loading from XML Node, will not save to the file"); 202 MainLog.Instance.Notice("Loading from XML Node, will not save to the file");
185 configurationPlugin.LoadDataFromString(configurationFromXMLNode.OuterXml); 203 configurationPlugin.LoadDataFromString(configurationFromXMLNode.OuterXml);
@@ -219,15 +237,22 @@ namespace OpenSim.Framework
219 } 237 }
220 else 238 else
221 { 239 {
222 if ((configOption.shouldIBeAsked != null && configOption.shouldIBeAsked(configOption.configurationKey)) || configOption.shouldIBeAsked == null) 240 if ((configOption.shouldIBeAsked != null &&
241 configOption.shouldIBeAsked(configOption.configurationKey)) ||
242 configOption.shouldIBeAsked == null)
223 { 243 {
224 if (configurationDescription.Trim() != "") 244 if (configurationDescription.Trim() != "")
225 { 245 {
226 console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); 246 console_result =
247 MainLog.Instance.CmdPrompt(
248 configurationDescription + ": " + configOption.configurationQuestion,
249 configOption.configurationDefault);
227 } 250 }
228 else 251 else
229 { 252 {
230 console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); 253 console_result =
254 MainLog.Instance.CmdPrompt(configOption.configurationQuestion,
255 configOption.configurationDefault);
231 } 256 }
232 } 257 }
233 else 258 else
@@ -235,7 +260,7 @@ namespace OpenSim.Framework
235 //Dont Ask! Just use default 260 //Dont Ask! Just use default
236 console_result = configOption.configurationDefault; 261 console_result = configOption.configurationDefault;
237 } 262 }
238 } 263 }
239 } 264 }
240 else 265 else
241 { 266 {
@@ -366,7 +391,9 @@ namespace OpenSim.Framework
366 break; 391 break;
367 case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: 392 case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT:
368 float floatResult; 393 float floatResult;
369 if (float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out floatResult)) 394 if (
395 float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo,
396 out floatResult))
370 { 397 {
371 convertSuccess = true; 398 convertSuccess = true;
372 return_result = floatResult; 399 return_result = floatResult;
@@ -375,7 +402,9 @@ namespace OpenSim.Framework
375 break; 402 break;
376 case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: 403 case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE:
377 double doubleResult; 404 double doubleResult;
378 if (Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out doubleResult)) 405 if (
406 Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo,
407 out doubleResult))
379 { 408 {
380 convertSuccess = true; 409 convertSuccess = true;
381 return_result = doubleResult; 410 return_result = doubleResult;
@@ -391,9 +420,10 @@ namespace OpenSim.Framework
391 configurationPlugin.SetAttribute(configOption.configurationKey, console_result); 420 configurationPlugin.SetAttribute(configOption.configurationKey, console_result);
392 } 421 }
393 422
394 if (!this.resultFunction(configOption.configurationKey, return_result)) 423 if (!resultFunction(configOption.configurationKey, return_result))
395 { 424 {
396 Console.MainLog.Instance.Notice("The handler for the last configuration option denied that input, please try again."); 425 MainLog.Instance.Notice(
426 "The handler for the last configuration option denied that input, please try again.");
397 convertSuccess = false; 427 convertSuccess = false;
398 ignoreNextFromConfig = true; 428 ignoreNextFromConfig = true;
399 } 429 }
@@ -402,19 +432,27 @@ namespace OpenSim.Framework
402 { 432 {
403 if (configOption.configurationUseDefaultNoPrompt) 433 if (configOption.configurationUseDefaultNoPrompt)
404 { 434 {
405 MainLog.Instance.Error("CONFIG", string.Format("[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename)); 435 MainLog.Instance.Error("CONFIG",
436 string.Format(
437 "[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n",
438 configOption.configurationKey, console_result, errorMessage,
439 configurationFilename));
406 convertSuccess = true; 440 convertSuccess = true;
407 } 441 }
408 else 442 else
409 { 443 {
410 MainLog.Instance.Warn("CONFIG", string.Format("[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename)); 444 MainLog.Instance.Warn("CONFIG",
445 string.Format(
446 "[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n",
447 configOption.configurationKey, console_result, errorMessage,
448 configurationFilename));
411 ignoreNextFromConfig = true; 449 ignoreNextFromConfig = true;
412 } 450 }
413 } 451 }
414 } 452 }
415 } 453 }
416 454
417 if(useFile) 455 if (useFile)
418 { 456 {
419 configurationPlugin.Commit(); 457 configurationPlugin.Commit();
420 configurationPlugin.Close(); 458 configurationPlugin.Close();
@@ -436,7 +474,8 @@ namespace OpenSim.Framework
436 474
437 if (typeInterface != null) 475 if (typeInterface != null)
438 { 476 {
439 plug = (IGenericConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 477 plug =
478 (IGenericConfig) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
440 } 479 }
441 } 480 }
442 } 481 }
@@ -448,10 +487,10 @@ namespace OpenSim.Framework
448 487
449 public void forceSetConfigurationOption(string configuration_key, string configuration_value) 488 public void forceSetConfigurationOption(string configuration_key, string configuration_value)
450 { 489 {
451 this.configurationPlugin.LoadData(); 490 configurationPlugin.LoadData();
452 this.configurationPlugin.SetAttribute(configuration_key, configuration_value); 491 configurationPlugin.SetAttribute(configuration_key, configuration_value);
453 this.configurationPlugin.Commit(); 492 configurationPlugin.Commit();
454 this.configurationPlugin.Close(); 493 configurationPlugin.Close();
455 } 494 }
456 } 495 }
457} 496} \ No newline at end of file
diff --git a/OpenSim/Framework/ConfigurationOption.cs b/OpenSim/Framework/ConfigurationOption.cs
index b83be5e..7f9b5b5 100644
--- a/OpenSim/Framework/ConfigurationOption.cs
+++ b/OpenSim/Framework/ConfigurationOption.cs
@@ -30,7 +30,6 @@ namespace OpenSim.Framework
30{ 30{
31 public class ConfigurationOption 31 public class ConfigurationOption
32 { 32 {
33
34 public delegate bool ConfigurationOptionShouldBeAsked(string configuration_key); 33 public delegate bool ConfigurationOptionShouldBeAsked(string configuration_key);
35 34
36 public enum ConfigurationTypes 35 public enum ConfigurationTypes
diff --git a/OpenSim/Framework/Console/AssemblyInfo.cs b/OpenSim/Framework/Console/AssemblyInfo.cs
index bba4f95..73ecd18 100644
--- a/OpenSim/Framework/Console/AssemblyInfo.cs
+++ b/OpenSim/Framework/Console/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("1.0.*")] 58[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/OpenSim/Framework/Console/ConsoleCallbacksBase.cs b/OpenSim/Framework/Console/ConsoleCallbacksBase.cs
index 93540aa..606469d 100644
--- a/OpenSim/Framework/Console/ConsoleCallbacksBase.cs
+++ b/OpenSim/Framework/Console/ConsoleCallbacksBase.cs
@@ -32,4 +32,4 @@ namespace OpenSim.Framework.Console
32 void RunCmd(string cmd, string[] cmdparams); 32 void RunCmd(string cmd, string[] cmdparams);
33 void Show(string ShowWhat); 33 void Show(string ShowWhat);
34 } 34 }
35} 35} \ No newline at end of file
diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs
index dd0c5fa..e7b1945 100644
--- a/OpenSim/Framework/Console/LogBase.cs
+++ b/OpenSim/Framework/Console/LogBase.cs
@@ -248,12 +248,12 @@ namespace OpenSim.Framework.Console
248 // Some older systems dont support coloured text. 248 // Some older systems dont support coloured text.
249 System.Console.WriteLine(format, args); 249 System.Console.WriteLine(format, args);
250 } 250 }
251 catch (System.FormatException) 251 catch (FormatException)
252 { 252 {
253 // Some older systems dont support coloured text. 253 // Some older systems dont support coloured text.
254 System.Console.WriteLine(args); 254 System.Console.WriteLine(args);
255 } 255 }
256 256
257 return; 257 return;
258 } 258 }
259 } 259 }
@@ -479,4 +479,4 @@ namespace OpenSim.Framework.Console
479 } 479 }
480 } 480 }
481 } 481 }
482} 482} \ No newline at end of file
diff --git a/OpenSim/Framework/Console/MainLog.cs b/OpenSim/Framework/Console/MainLog.cs
index 16ba2c2..bea2a22 100644
--- a/OpenSim/Framework/Console/MainLog.cs
+++ b/OpenSim/Framework/Console/MainLog.cs
@@ -37,4 +37,4 @@ namespace OpenSim.Framework.Console
37 set { instance = value; } 37 set { instance = value; }
38 } 38 }
39 } 39 }
40} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
index 00999c2..2637166 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs
@@ -140,16 +140,17 @@ namespace OpenSim.Framework.Data.DB4o
140 { 140 {
141 manager = null; 141 manager = null;
142 } 142 }
143
143 /// <summary> 144 /// <summary>
144 /// // Returns a list of avatar and UUIDs that match the query 145 /// // Returns a list of avatar and UUIDs that match the query
145 /// </summary> 146 /// </summary>
146
147 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 147 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
148 { 148 {
149 //Do nothing yet 149 //Do nothing yet
150 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 150 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
151 return returnlist; 151 return returnlist;
152 } 152 }
153
153 /// <summary> 154 /// <summary>
154 /// Returns the providers name 155 /// Returns the providers name
155 /// </summary> 156 /// </summary>
@@ -173,4 +174,4 @@ namespace OpenSim.Framework.Data.DB4o
173 return null; 174 return null;
174 } 175 }
175 } 176 }
176} 177} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs
index cf1dfae..4b1b451 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs
@@ -167,4 +167,4 @@ namespace OpenSim.Framework.Data.DB4o
167 } 167 }
168 } 168 }
169 } 169 }
170} 170} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
index 383bfbe..e0973f1 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
@@ -26,8 +26,8 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO;
30using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
31using libsecondlife; 31using libsecondlife;
32 32
33namespace OpenSim.Framework.Data.DB4o 33namespace OpenSim.Framework.Data.DB4o
@@ -132,12 +132,14 @@ namespace OpenSim.Framework.Data.DB4o
132 return null; 132 return null;
133 } 133 }
134 } 134 }
135 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 135
136 public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
136 { 137 {
137 //Do nothing yet 138 //Do nothing yet
138 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); 139 List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>();
139 return returnlist; 140 return returnlist;
140 } 141 }
142
141 /// <summary> 143 /// <summary>
142 /// Creates a new user profile 144 /// Creates a new user profile
143 /// </summary> 145 /// </summary>
@@ -225,4 +227,4 @@ namespace OpenSim.Framework.Data.DB4o
225 return "0.1"; 227 return "0.1";
226 } 228 }
227 } 229 }
228} 230} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs
index cc0422c..08fbef0 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLAssetData.cs
@@ -27,18 +27,18 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Data;
31using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Data;
32using System.Data.SqlClient; 32using System.Data.SqlClient;
33
34using libsecondlife; 33using libsecondlife;
35using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
36 35
37namespace OpenSim.Framework.Data.MSSQL 36namespace OpenSim.Framework.Data.MSSQL
38{ 37{
39 class MSSQLAssetData : IAssetProvider 38 internal class MSSQLAssetData : IAssetProvider
40 { 39 {
41 MSSQLManager database; 40 private MSSQLManager database;
41
42 #region IAssetProvider Members 42 #region IAssetProvider Members
43 43
44 private void UpgradeAssetsTable(string tableName) 44 private void UpgradeAssetsTable(string tableName)
@@ -46,7 +46,7 @@ namespace OpenSim.Framework.Data.MSSQL
46 // null as the version, indicates that the table didn't exist 46 // null as the version, indicates that the table didn't exist
47 if (tableName == null) 47 if (tableName == null)
48 { 48 {
49 MainLog.Instance.Notice("ASSETS", "Creating new database tables"); 49 MainLog.Instance.Notice("ASSETS", "Creating new database tables");
50 database.ExecuteResourceSql("CreateAssetsTable.sql"); 50 database.ExecuteResourceSql("CreateAssetsTable.sql");
51 return; 51 return;
52 } 52 }
@@ -57,14 +57,12 @@ namespace OpenSim.Framework.Data.MSSQL
57 /// </summary> 57 /// </summary>
58 private void TestTables() 58 private void TestTables()
59 { 59 {
60
61 Dictionary<string, string> tableList = new Dictionary<string, string>(); 60 Dictionary<string, string> tableList = new Dictionary<string, string>();
62 61
63 tableList["assets"] = null; 62 tableList["assets"] = null;
64 database.GetTableVersion(tableList); 63 database.GetTableVersion(tableList);
65 64
66 UpgradeAssetsTable(tableList["assets"]); 65 UpgradeAssetsTable(tableList["assets"]);
67
68 } 66 }
69 67
70 public AssetBase FetchAsset(LLUUID assetID) 68 public AssetBase FetchAsset(LLUUID assetID)
@@ -80,30 +78,27 @@ namespace OpenSim.Framework.Data.MSSQL
80 asset = database.getAssetRow(reader); 78 asset = database.getAssetRow(reader);
81 reader.Close(); 79 reader.Close();
82 result.Dispose(); 80 result.Dispose();
83 81
84 return asset; 82 return asset;
85 } 83 }
86 84
87 public void CreateAsset(AssetBase asset) 85 public void CreateAsset(AssetBase asset)
88 { 86 {
89 87 if (ExistsAsset((LLUUID) asset.FullID))
90 if (ExistsAsset((LLUUID)asset.FullID))
91 { 88 {
92 return; 89 return;
93 } 90 }
94 91
95 92
96
97 SqlCommand cmd = 93 SqlCommand cmd =
98 new SqlCommand( 94 new SqlCommand(
99 "INSERT INTO assets ([id], [name], [description], [assetType], [invType], [local], [temporary], [data])"+ 95 "INSERT INTO assets ([id], [name], [description], [assetType], [invType], [local], [temporary], [data])" +
100 " VALUES "+ 96 " VALUES " +
101 "(@id, @name, @description, @assetType, @invType, @local, @temporary, @data)", 97 "(@id, @name, @description, @assetType, @invType, @local, @temporary, @data)",
102 database.getConnection()); 98 database.getConnection());
103 99
104 using (cmd) 100 using (cmd)
105 { 101 {
106
107 //SqlParameter p = cmd.Parameters.Add("id", SqlDbType.NVarChar); 102 //SqlParameter p = cmd.Parameters.Add("id", SqlDbType.NVarChar);
108 //p.Value = asset.FullID.ToString(); 103 //p.Value = asset.FullID.ToString();
109 cmd.Parameters.AddWithValue("id", asset.FullID.ToString()); 104 cmd.Parameters.AddWithValue("id", asset.FullID.ToString());
@@ -127,24 +122,23 @@ namespace OpenSim.Framework.Data.MSSQL
127 { 122 {
128 throw; 123 throw;
129 } 124 }
130 125
131 cmd.Dispose(); 126 cmd.Dispose();
132 } 127 }
133
134 } 128 }
135 129
136 130
137 public void UpdateAsset(AssetBase asset) 131 public void UpdateAsset(AssetBase asset)
138 { 132 {
139 SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " + 133 SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " +
140 "name = @name, " + 134 "name = @name, " +
141 "description = @description," + 135 "description = @description," +
142 "assetType = @assetType," + 136 "assetType = @assetType," +
143 "invType = @invType," + 137 "invType = @invType," +
144 "local = @local,"+ 138 "local = @local," +
145 "temporary = @temporary," + 139 "temporary = @temporary," +
146 "data = @data where " + 140 "data = @data where " +
147 "id = @keyId;", database.getConnection()); 141 "id = @keyId;", database.getConnection());
148 SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString()); 142 SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString());
149 SqlParameter param2 = new SqlParameter("@name", asset.Name); 143 SqlParameter param2 = new SqlParameter("@name", asset.Name);
150 SqlParameter param3 = new SqlParameter("@description", asset.Description); 144 SqlParameter param3 = new SqlParameter("@description", asset.Description);
@@ -172,12 +166,12 @@ namespace OpenSim.Framework.Data.MSSQL
172 { 166 {
173 MainLog.Instance.Error(e.ToString()); 167 MainLog.Instance.Error(e.ToString());
174 } 168 }
175
176 } 169 }
177 170
178 public bool ExistsAsset(LLUUID uuid) 171 public bool ExistsAsset(LLUUID uuid)
179 { 172 {
180 if (FetchAsset(uuid) != null) { 173 if (FetchAsset(uuid) != null)
174 {
181 return true; 175 return true;
182 } 176 }
183 return false; 177 return false;
@@ -194,11 +188,8 @@ namespace OpenSim.Framework.Data.MSSQL
194 188
195 #region IPlugin Members 189 #region IPlugin Members
196 190
197
198
199 public void Initialise() 191 public void Initialise()
200 { 192 {
201
202 IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini"); 193 IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
203 string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source"); 194 string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
204 string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog"); 195 string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog");
@@ -206,7 +197,9 @@ namespace OpenSim.Framework.Data.MSSQL
206 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 197 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
207 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 198 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
208 199
209 this.database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 200 database =
201 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
202 settingPassword);
210 203
211 TestTables(); 204 TestTables();
212 } 205 }
@@ -214,7 +207,7 @@ namespace OpenSim.Framework.Data.MSSQL
214 public string Version 207 public string Version
215 { 208 {
216// get { return database.getVersion(); } 209// get { return database.getVersion(); }
217 get { return database.getVersion(); } 210 get { return database.getVersion(); }
218 } 211 }
219 212
220 public string Name 213 public string Name
@@ -224,4 +217,4 @@ namespace OpenSim.Framework.Data.MSSQL
224 217
225 #endregion 218 #endregion
226 } 219 }
227} 220} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
index 72db568..7d228e6 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
@@ -57,8 +57,9 @@ namespace OpenSim.Framework.Data.MSSQL
57 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 57 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
58 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 58 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
59 59
60 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 60 database =
61 61 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
62 settingPassword);
62 } 63 }
63 64
64 /// <summary> 65 /// <summary>
@@ -120,14 +121,13 @@ namespace OpenSim.Framework.Data.MSSQL
120 result.Dispose(); 121 result.Dispose();
121 122
122 return row; 123 return row;
123
124 } 124 }
125 catch (Exception) 125 catch (Exception)
126 { 126 {
127 if (reader != null) { 127 if (reader != null)
128 {
128 reader.Close(); 129 reader.Close();
129 } 130 }
130
131 } 131 }
132 return null; 132 return null;
133 } 133 }
@@ -135,7 +135,6 @@ namespace OpenSim.Framework.Data.MSSQL
135 /// <summary> 135 /// <summary>
136 /// // Returns a list of avatar and UUIDs that match the query 136 /// // Returns a list of avatar and UUIDs that match the query
137 /// </summary> 137 /// </summary>
138
139 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 138 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
140 { 139 {
141 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 140 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
@@ -152,18 +151,19 @@ namespace OpenSim.Framework.Data.MSSQL
152 param["second"] = querysplit[1]; 151 param["second"] = querysplit[1];
153 152
154 IDbCommand result = 153 IDbCommand result =
155 database.Query("SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second", param); 154 database.Query(
155 "SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second",
156 param);
156 IDataReader reader = result.ExecuteReader(); 157 IDataReader reader = result.ExecuteReader();
157 158
158 159
159 while (reader.Read()) 160 while (reader.Read())
160 { 161 {
161 AvatarPickerAvatar user = new AvatarPickerAvatar(); 162 AvatarPickerAvatar user = new AvatarPickerAvatar();
162 user.AvatarID = new LLUUID((string)reader["UUID"]); 163 user.AvatarID = new LLUUID((string) reader["UUID"]);
163 user.firstName = (string)reader["username"]; 164 user.firstName = (string) reader["username"];
164 user.lastName = (string)reader["surname"]; 165 user.lastName = (string) reader["surname"];
165 returnlist.Add(user); 166 returnlist.Add(user);
166
167 } 167 }
168 reader.Close(); 168 reader.Close();
169 result.Dispose(); 169 result.Dispose();
@@ -175,13 +175,9 @@ namespace OpenSim.Framework.Data.MSSQL
175 MainLog.Instance.Error(e.ToString()); 175 MainLog.Instance.Error(e.ToString());
176 return returnlist; 176 return returnlist;
177 } 177 }
178
179
180
181 } 178 }
182 else if (querysplit.Length == 1) 179 else if (querysplit.Length == 1)
183 { 180 {
184
185 try 181 try
186 { 182 {
187 lock (database) 183 lock (database)
@@ -191,18 +187,19 @@ namespace OpenSim.Framework.Data.MSSQL
191 param["second"] = querysplit[1]; 187 param["second"] = querysplit[1];
192 188
193 IDbCommand result = 189 IDbCommand result =
194 database.Query("SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second", param); 190 database.Query(
191 "SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second",
192 param);
195 IDataReader reader = result.ExecuteReader(); 193 IDataReader reader = result.ExecuteReader();
196 194
197 195
198 while (reader.Read()) 196 while (reader.Read())
199 { 197 {
200 AvatarPickerAvatar user = new AvatarPickerAvatar(); 198 AvatarPickerAvatar user = new AvatarPickerAvatar();
201 user.AvatarID = new LLUUID((string)reader["UUID"]); 199 user.AvatarID = new LLUUID((string) reader["UUID"]);
202 user.firstName = (string)reader["username"]; 200 user.firstName = (string) reader["username"];
203 user.lastName = (string)reader["surname"]; 201 user.lastName = (string) reader["surname"];
204 returnlist.Add(user); 202 returnlist.Add(user);
205
206 } 203 }
207 reader.Close(); 204 reader.Close();
208 result.Dispose(); 205 result.Dispose();
@@ -225,8 +222,8 @@ namespace OpenSim.Framework.Data.MSSQL
225 /// <returns>The sim profile</returns> 222 /// <returns>The sim profile</returns>
226 public RegionProfileData GetProfileByLLUUID(LLUUID uuid) 223 public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
227 { 224 {
228 Dictionary<string, string> param = new Dictionary<string, string>(); 225 Dictionary<string, string> param = new Dictionary<string, string>();
229 param["uuid"] = uuid.ToString(); 226 param["uuid"] = uuid.ToString();
230 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); 227 IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param);
231 IDataReader reader = result.ExecuteReader(); 228 IDataReader reader = result.ExecuteReader();
232 229
@@ -244,7 +241,6 @@ namespace OpenSim.Framework.Data.MSSQL
244 /// <returns>A dataresponse enum indicating success</returns> 241 /// <returns>A dataresponse enum indicating success</returns>
245 public DataResponse AddProfile(RegionProfileData profile) 242 public DataResponse AddProfile(RegionProfileData profile)
246 { 243 {
247
248 try 244 try
249 { 245 {
250 if (GetProfileByLLUUID(profile.UUID) != null) 246 if (GetProfileByLLUUID(profile.UUID) != null)
@@ -310,4 +306,4 @@ namespace OpenSim.Framework.Data.MSSQL
310 return null; 306 return null;
311 } 307 }
312 } 308 }
313} 309} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
index a6b8819..4b2c7af 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
@@ -26,10 +26,9 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Data.SqlClient; 31using System.Data.SqlClient;
32using System.Collections.Generic;
33using libsecondlife; 32using libsecondlife;
34using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
35 34
@@ -57,7 +56,9 @@ namespace OpenSim.Framework.Data.MSSQL
57 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 56 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
58 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 57 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
59 58
60 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 59 database =
60 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
61 settingPassword);
61 TestTables(); 62 TestTables();
62 } 63 }
63 64
@@ -72,7 +73,6 @@ namespace OpenSim.Framework.Data.MSSQL
72 //database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql"); 73 //database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql");
73 return; 74 return;
74 } 75 }
75
76 } 76 }
77 77
78 private void UpgradeItemsTable(string tableName) 78 private void UpgradeItemsTable(string tableName)
@@ -88,17 +88,17 @@ namespace OpenSim.Framework.Data.MSSQL
88 88
89 private void TestTables() 89 private void TestTables()
90 { 90 {
91
92 Dictionary<string, string> tableList = new Dictionary<string, string>(); 91 Dictionary<string, string> tableList = new Dictionary<string, string>();
93 92
94 tableList["inventoryfolders"] = null; 93 tableList["inventoryfolders"] = null;
95 tableList["inventoryitems"] = null; 94 tableList["inventoryitems"] = null;
96 95
97 database.GetTableVersion(tableList); 96 database.GetTableVersion(tableList);
98 97
99 UpgradeFoldersTable(tableList["inventoryfolders"]); 98 UpgradeFoldersTable(tableList["inventoryfolders"]);
100 UpgradeItemsTable(tableList["inventoryitems"]); 99 UpgradeItemsTable(tableList["inventoryitems"]);
101 } 100 }
101
102 #endregion 102 #endregion
103 103
104 /// <summary> 104 /// <summary>
@@ -124,7 +124,7 @@ namespace OpenSim.Framework.Data.MSSQL
124 /// <returns>A string containing the DB provider</returns> 124 /// <returns>A string containing the DB provider</returns>
125 public string getVersion() 125 public string getVersion()
126 { 126 {
127 return database.getVersion(); 127 return database.getVersion();
128 } 128 }
129 129
130 /// <summary> 130 /// <summary>
@@ -143,15 +143,16 @@ namespace OpenSim.Framework.Data.MSSQL
143 Dictionary<string, string> param = new Dictionary<string, string>(); 143 Dictionary<string, string> param = new Dictionary<string, string>();
144 param["parentFolderID"] = folderID.ToString(); 144 param["parentFolderID"] = folderID.ToString();
145 145
146 IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID", param); 146 IDbCommand result =
147 database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = @parentFolderID", param);
147 IDataReader reader = result.ExecuteReader(); 148 IDataReader reader = result.ExecuteReader();
148 149
149 while(reader.Read()) 150 while (reader.Read())
150 items.Add(readInventoryItem(reader)); 151 items.Add(readInventoryItem(reader));
151 152
152 reader.Close(); 153 reader.Close();
153 result.Dispose(); 154 result.Dispose();
154 155
155 return items; 156 return items;
156 } 157 }
157 } 158 }
@@ -174,16 +175,17 @@ namespace OpenSim.Framework.Data.MSSQL
174 { 175 {
175 lock (database) 176 lock (database)
176 { 177 {
177
178 Dictionary<string, string> param = new Dictionary<string, string>(); 178 Dictionary<string, string> param = new Dictionary<string, string>();
179 param["uuid"] = user.ToString(); 179 param["uuid"] = user.ToString();
180 param["zero"] = LLUUID.Zero.ToString(); 180 param["zero"] = LLUUID.Zero.ToString();
181 181
182 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); 182 IDbCommand result =
183 database.Query(
184 "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param);
183 IDataReader reader = result.ExecuteReader(); 185 IDataReader reader = result.ExecuteReader();
184 186
185 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 187 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
186 while(reader.Read()) 188 while (reader.Read())
187 items.Add(readInventoryFolder(reader)); 189 items.Add(readInventoryFolder(reader));
188 190
189 191
@@ -212,24 +214,27 @@ namespace OpenSim.Framework.Data.MSSQL
212 param["uuid"] = user.ToString(); 214 param["uuid"] = user.ToString();
213 param["zero"] = LLUUID.Zero.ToString(); 215 param["zero"] = LLUUID.Zero.ToString();
214 216
215 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param); 217 IDbCommand result =
218 database.Query(
219 "SELECT * FROM inventoryfolders WHERE parentFolderID = @zero AND agentID = @uuid", param);
216 IDataReader reader = result.ExecuteReader(); 220 IDataReader reader = result.ExecuteReader();
217 221
218 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 222 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
219 while(reader.Read()) 223 while (reader.Read())
220 items.Add(readInventoryFolder(reader)); 224 items.Add(readInventoryFolder(reader));
221 225
222 InventoryFolderBase rootFolder = null; 226 InventoryFolderBase rootFolder = null;
223 227
224 // There should only ever be one root folder for a user. However, if there's more 228 // There should only ever be one root folder for a user. However, if there's more
225 // than one we'll simply use the first one rather than failing. It would be even 229 // than one we'll simply use the first one rather than failing. It would be even
226 // nicer to print some message to this effect, but this feels like it's too low a 230 // nicer to print some message to this effect, but this feels like it's too low a
227 // to put such a message out, and it's too minor right now to spare the time to 231 // to put such a message out, and it's too minor right now to spare the time to
228 // suitably refactor. 232 // suitably refactor.
229 if (items.Count > 0) { 233 if (items.Count > 0)
234 {
230 rootFolder = items[0]; 235 rootFolder = items[0];
231 } 236 }
232 237
233 reader.Close(); 238 reader.Close();
234 result.Dispose(); 239 result.Dispose();
235 240
@@ -259,12 +264,13 @@ namespace OpenSim.Framework.Data.MSSQL
259 param["parentFolderID"] = parentID.ToString(); 264 param["parentFolderID"] = parentID.ToString();
260 265
261 266
262 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentFolderID", param); 267 IDbCommand result =
268 database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = @parentFolderID", param);
263 IDataReader reader = result.ExecuteReader(); 269 IDataReader reader = result.ExecuteReader();
264 270
265 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 271 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
266 272
267 while(reader.Read()) 273 while (reader.Read())
268 items.Add(readInventoryFolder(reader)); 274 items.Add(readInventoryFolder(reader));
269 275
270 reader.Close(); 276 reader.Close();
@@ -292,17 +298,17 @@ namespace OpenSim.Framework.Data.MSSQL
292 { 298 {
293 InventoryItemBase item = new InventoryItemBase(); 299 InventoryItemBase item = new InventoryItemBase();
294 300
295 item.inventoryID = new LLUUID((string)reader["inventoryID"]); 301 item.inventoryID = new LLUUID((string) reader["inventoryID"]);
296 item.assetID = new LLUUID((string)reader["assetID"]); 302 item.assetID = new LLUUID((string) reader["assetID"]);
297 item.assetType = (int)reader["assetType"]; 303 item.assetType = (int) reader["assetType"];
298 item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); 304 item.parentFolderID = new LLUUID((string) reader["parentFolderID"]);
299 item.avatarID = new LLUUID((string)reader["avatarID"]); 305 item.avatarID = new LLUUID((string) reader["avatarID"]);
300 item.inventoryName = (string)reader["inventoryName"]; 306 item.inventoryName = (string) reader["inventoryName"];
301 item.inventoryDescription = (string)reader["inventoryDescription"]; 307 item.inventoryDescription = (string) reader["inventoryDescription"];
302 item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]); 308 item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]);
303 item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]); 309 item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]);
304 item.invType = (int)reader["invType"]; 310 item.invType = (int) reader["invType"];
305 item.creatorsID = new LLUUID((string)reader["creatorID"]); 311 item.creatorsID = new LLUUID((string) reader["creatorID"]);
306 item.inventoryBasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); 312 item.inventoryBasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
307 item.inventoryEveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); 313 item.inventoryEveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
308 return item; 314 return item;
@@ -322,7 +328,6 @@ namespace OpenSim.Framework.Data.MSSQL
322 /// <returns>An inventory item</returns> 328 /// <returns>An inventory item</returns>
323 public InventoryItemBase getInventoryItem(LLUUID itemID) 329 public InventoryItemBase getInventoryItem(LLUUID itemID)
324 { 330 {
325
326 try 331 try
327 { 332 {
328 lock (database) 333 lock (database)
@@ -330,11 +335,12 @@ namespace OpenSim.Framework.Data.MSSQL
330 Dictionary<string, string> param = new Dictionary<string, string>(); 335 Dictionary<string, string> param = new Dictionary<string, string>();
331 param["inventoryID"] = itemID.ToString(); 336 param["inventoryID"] = itemID.ToString();
332 337
333 IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID", param); 338 IDbCommand result =
339 database.Query("SELECT * FROM inventoryitems WHERE inventoryID = @inventoryID", param);
334 IDataReader reader = result.ExecuteReader(); 340 IDataReader reader = result.ExecuteReader();
335 341
336 InventoryItemBase item = null; 342 InventoryItemBase item = null;
337 if(reader.Read()) 343 if (reader.Read())
338 item = readInventoryItem(reader); 344 item = readInventoryItem(reader);
339 345
340 reader.Close(); 346 reader.Close();
@@ -361,12 +367,12 @@ namespace OpenSim.Framework.Data.MSSQL
361 try 367 try
362 { 368 {
363 InventoryFolderBase folder = new InventoryFolderBase(); 369 InventoryFolderBase folder = new InventoryFolderBase();
364 folder.agentID = new LLUUID((string)reader["agentID"]); 370 folder.agentID = new LLUUID((string) reader["agentID"]);
365 folder.parentID = new LLUUID((string)reader["parentFolderID"]); 371 folder.parentID = new LLUUID((string) reader["parentFolderID"]);
366 folder.folderID = new LLUUID((string)reader["folderID"]); 372 folder.folderID = new LLUUID((string) reader["folderID"]);
367 folder.name = (string)reader["folderName"]; 373 folder.name = (string) reader["folderName"];
368 folder.type = (short)reader["type"]; 374 folder.type = (short) reader["type"];
369 folder.version = (ushort)((int)reader["version"]); 375 folder.version = (ushort) ((int) reader["version"]);
370 return folder; 376 return folder;
371 } 377 }
372 catch (Exception e) 378 catch (Exception e)
@@ -389,7 +395,7 @@ namespace OpenSim.Framework.Data.MSSQL
389 { 395 {
390 lock (database) 396 lock (database)
391 { 397 {
392 Dictionary<string, string> param = new Dictionary<string,string>(); 398 Dictionary<string, string> param = new Dictionary<string, string>();
393 param["uuid"] = folderID.ToString(); 399 param["uuid"] = folderID.ToString();
394 400
395 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = @uuid", param); 401 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = @uuid", param);
@@ -418,8 +424,10 @@ namespace OpenSim.Framework.Data.MSSQL
418 public void addInventoryItem(InventoryItemBase item) 424 public void addInventoryItem(InventoryItemBase item)
419 { 425 {
420 string sql = "INSERT INTO inventoryitems"; 426 string sql = "INSERT INTO inventoryitems";
421 sql += "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]) VALUES "; 427 sql +=
422 sql += "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, @inventoryBasePermissions, @inventoryEveryOnePermissions);"; 428 "([inventoryID], [assetID], [assetType], [parentFolderID], [avatarID], [inventoryName], [inventoryDescription], [inventoryNextPermissions], [inventoryCurrentPermissions], [invType], [creatorID], [inventoryBasePermissions], [inventoryEveryOnePermissions]) VALUES ";
429 sql +=
430 "(@inventoryID, @assetID, @assetType, @parentFolderID, @avatarID, @inventoryName, @inventoryDescription, @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, @inventoryBasePermissions, @inventoryEveryOnePermissions);";
423 431
424 try 432 try
425 { 433 {
@@ -441,7 +449,6 @@ namespace OpenSim.Framework.Data.MSSQL
441 IDbCommand result = database.Query(sql, param); 449 IDbCommand result = database.Query(sql, param);
442 result.ExecuteNonQuery(); 450 result.ExecuteNonQuery();
443 result.Dispose(); 451 result.Dispose();
444
445 } 452 }
446 catch (SqlException e) 453 catch (SqlException e)
447 { 454 {
@@ -454,21 +461,21 @@ namespace OpenSim.Framework.Data.MSSQL
454 /// </summary> 461 /// </summary>
455 /// <param name="item">Inventory item to update</param> 462 /// <param name="item">Inventory item to update</param>
456 public void updateInventoryItem(InventoryItemBase item) 463 public void updateInventoryItem(InventoryItemBase item)
457 { 464 {
458 SqlCommand command = new SqlCommand("UPDATE inventoryitems set inventoryID = @inventoryID, " + 465 SqlCommand command = new SqlCommand("UPDATE inventoryitems set inventoryID = @inventoryID, " +
459 "assetID = @assetID, " + 466 "assetID = @assetID, " +
460 "assetType = @assetType" + 467 "assetType = @assetType" +
461 "parentFolderID = @parentFolderID" + 468 "parentFolderID = @parentFolderID" +
462 "avatarID = @avatarID" + 469 "avatarID = @avatarID" +
463 "inventoryName = @inventoryName"+ 470 "inventoryName = @inventoryName" +
464 "inventoryDescription = @inventoryDescription" + 471 "inventoryDescription = @inventoryDescription" +
465 "inventoryNextPermissions = @inventoryNextPermissions" + 472 "inventoryNextPermissions = @inventoryNextPermissions" +
466 "inventoryCurrentPermissions = @inventoryCurrentPermissions" + 473 "inventoryCurrentPermissions = @inventoryCurrentPermissions" +
467 "invType = @invType" + 474 "invType = @invType" +
468 "creatorID = @creatorID" + 475 "creatorID = @creatorID" +
469 "inventoryBasePermissions = @inventoryBasePermissions" + 476 "inventoryBasePermissions = @inventoryBasePermissions" +
470 "inventoryEveryOnePermissions = @inventoryEveryOnePermissions) where " + 477 "inventoryEveryOnePermissions = @inventoryEveryOnePermissions) where " +
471 "invenoryID = @keyInventoryID;", database.getConnection()); 478 "invenoryID = @keyInventoryID;", database.getConnection());
472 SqlParameter param1 = new SqlParameter("@inventoryID", item.inventoryID.ToString()); 479 SqlParameter param1 = new SqlParameter("@inventoryID", item.inventoryID.ToString());
473 SqlParameter param2 = new SqlParameter("@assetID", item.assetID); 480 SqlParameter param2 = new SqlParameter("@assetID", item.assetID);
474 SqlParameter param3 = new SqlParameter("@assetType", item.assetType); 481 SqlParameter param3 = new SqlParameter("@assetType", item.assetType);
@@ -481,7 +488,7 @@ namespace OpenSim.Framework.Data.MSSQL
481 SqlParameter param10 = new SqlParameter("@invType", item.invType); 488 SqlParameter param10 = new SqlParameter("@invType", item.invType);
482 SqlParameter param11 = new SqlParameter("@creatorID", item.creatorsID); 489 SqlParameter param11 = new SqlParameter("@creatorID", item.creatorsID);
483 SqlParameter param12 = new SqlParameter("@inventoryBasePermissions", item.inventoryBasePermissions); 490 SqlParameter param12 = new SqlParameter("@inventoryBasePermissions", item.inventoryBasePermissions);
484 SqlParameter param13 = new SqlParameter("@inventoryEveryOnePermissions", item.inventoryEveryOnePermissions); 491 SqlParameter param13 = new SqlParameter("@inventoryEveryOnePermissions", item.inventoryEveryOnePermissions);
485 SqlParameter param14 = new SqlParameter("@keyInventoryID", item.inventoryID.ToString()); 492 SqlParameter param14 = new SqlParameter("@keyInventoryID", item.inventoryID.ToString());
486 command.Parameters.Add(param1); 493 command.Parameters.Add(param1);
487 command.Parameters.Add(param2); 494 command.Parameters.Add(param2);
@@ -506,7 +513,6 @@ namespace OpenSim.Framework.Data.MSSQL
506 { 513 {
507 MainLog.Instance.Error(e.ToString()); 514 MainLog.Instance.Error(e.ToString());
508 } 515 }
509
510 } 516 }
511 517
512 /// <summary> 518 /// <summary>
@@ -523,8 +529,6 @@ namespace OpenSim.Framework.Data.MSSQL
523 IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE inventoryID=@uuid", param); 529 IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE inventoryID=@uuid", param);
524 cmd.ExecuteNonQuery(); 530 cmd.ExecuteNonQuery();
525 cmd.Dispose(); 531 cmd.Dispose();
526
527
528 } 532 }
529 catch (SqlException e) 533 catch (SqlException e)
530 { 534 {
@@ -539,7 +543,8 @@ namespace OpenSim.Framework.Data.MSSQL
539 /// <param name="folder">Folder to create</param> 543 /// <param name="folder">Folder to create</param>
540 public void addInventoryFolder(InventoryFolderBase folder) 544 public void addInventoryFolder(InventoryFolderBase folder)
541 { 545 {
542 string sql = "INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) VALUES "; 546 string sql =
547 "INSERT INTO inventoryfolders ([folderID], [agentID], [parentFolderID], [folderName], [type], [version]) VALUES ";
543 sql += "(@folderID, @agentID, @parentFolderID, @folderName, @type, @version);"; 548 sql += "(@folderID, @agentID, @parentFolderID, @folderName, @type, @version);";
544 549
545 550
@@ -550,9 +555,9 @@ namespace OpenSim.Framework.Data.MSSQL
550 param["folderName"] = folder.name; 555 param["folderName"] = folder.name;
551 param["type"] = Convert.ToString(folder.type); 556 param["type"] = Convert.ToString(folder.type);
552 param["version"] = Convert.ToString(folder.version); 557 param["version"] = Convert.ToString(folder.version);
553 558
554 try 559 try
555 { 560 {
556 IDbCommand result = database.Query(sql, param); 561 IDbCommand result = database.Query(sql, param);
557 result.ExecuteNonQuery(); 562 result.ExecuteNonQuery();
558 result.Dispose(); 563 result.Dispose();
@@ -567,16 +572,15 @@ namespace OpenSim.Framework.Data.MSSQL
567 /// Updates an inventory folder 572 /// Updates an inventory folder
568 /// </summary> 573 /// </summary>
569 /// <param name="folder">Folder to update</param> 574 /// <param name="folder">Folder to update</param>
570
571 public void updateInventoryFolder(InventoryFolderBase folder) 575 public void updateInventoryFolder(InventoryFolderBase folder)
572 { 576 {
573 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + 577 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " +
574 "agentID = @agentID, " + 578 "agentID = @agentID, " +
575 "parentFolderID = @parentFolderID," + 579 "parentFolderID = @parentFolderID," +
576 "folderName = @folderName," + 580 "folderName = @folderName," +
577 "type = @type," + 581 "type = @type," +
578 "version = @version where " + 582 "version = @version where " +
579 "folderID = @keyFolderID;", database.getConnection()); 583 "folderID = @keyFolderID;", database.getConnection());
580 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); 584 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString());
581 SqlParameter param2 = new SqlParameter("@agentID", folder.agentID.ToString()); 585 SqlParameter param2 = new SqlParameter("@agentID", folder.agentID.ToString());
582 SqlParameter param3 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); 586 SqlParameter param3 = new SqlParameter("@parentFolderID", folder.parentID.ToString());
@@ -600,20 +604,17 @@ namespace OpenSim.Framework.Data.MSSQL
600 { 604 {
601 MainLog.Instance.Error(e.ToString()); 605 MainLog.Instance.Error(e.ToString());
602 } 606 }
603
604
605 } 607 }
606 608
607 /// <summary> 609 /// <summary>
608 /// Updates an inventory folder 610 /// Updates an inventory folder
609 /// </summary> 611 /// </summary>
610 /// <param name="folder">Folder to update</param> 612 /// <param name="folder">Folder to update</param>
611
612 public void moveInventoryFolder(InventoryFolderBase folder) 613 public void moveInventoryFolder(InventoryFolderBase folder)
613 { 614 {
614 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " + 615 SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " +
615 "parentFolderID = @parentFolderID," + 616 "parentFolderID = @parentFolderID," +
616 "folderID = @keyFolderID;", database.getConnection()); 617 "folderID = @keyFolderID;", database.getConnection());
617 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString()); 618 SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToString());
618 SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToString()); 619 SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToString());
619 SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToString()); 620 SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToString());
@@ -629,8 +630,6 @@ namespace OpenSim.Framework.Data.MSSQL
629 { 630 {
630 MainLog.Instance.Error(e.ToString()); 631 MainLog.Instance.Error(e.ToString());
631 } 632 }
632
633
634 } 633 }
635 634
636 /// <summary> 635 /// <summary>
@@ -645,7 +644,7 @@ namespace OpenSim.Framework.Data.MSSQL
645 foreach (InventoryFolderBase f in subfolderList) 644 foreach (InventoryFolderBase f in subfolderList)
646 folders.Add(f); 645 folders.Add(f);
647 } 646 }
648 647
649 /// <summary> 648 /// <summary>
650 /// Returns all child folders in the hierarchy from the parent folder and down 649 /// Returns all child folders in the hierarchy from the parent folder and down
651 /// </summary> 650 /// </summary>
@@ -672,7 +671,6 @@ namespace OpenSim.Framework.Data.MSSQL
672 IDbCommand cmd = database.Query("DELETE FROM inventoryfolders WHERE folderID=@folderID", param); 671 IDbCommand cmd = database.Query("DELETE FROM inventoryfolders WHERE folderID=@folderID", param);
673 cmd.ExecuteNonQuery(); 672 cmd.ExecuteNonQuery();
674 cmd.Dispose(); 673 cmd.Dispose();
675
676 } 674 }
677 catch (SqlException e) 675 catch (SqlException e)
678 { 676 {
@@ -689,7 +687,8 @@ namespace OpenSim.Framework.Data.MSSQL
689 param["parentFolderID"] = folderID.ToString(); 687 param["parentFolderID"] = folderID.ToString();
690 688
691 689
692 IDbCommand cmd = database.Query("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", param); 690 IDbCommand cmd =
691 database.Query("DELETE FROM inventoryitems WHERE parentFolderID=@parentFolderID", param);
693 cmd.ExecuteNonQuery(); 692 cmd.ExecuteNonQuery();
694 cmd.Dispose(); 693 cmd.Dispose();
695 } 694 }
@@ -724,4 +723,4 @@ namespace OpenSim.Framework.Data.MSSQL
724 } 723 }
725 } 724 }
726 } 725 }
727} 726} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs
index a5b33ec..c3ec7c6 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLLogData.cs
@@ -25,14 +25,12 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29
30namespace OpenSim.Framework.Data.MSSQL 28namespace OpenSim.Framework.Data.MSSQL
31{ 29{
32 /// <summary> 30 /// <summary>
33 /// An interface to the log database for MySQL 31 /// An interface to the log database for MySQL
34 /// </summary> 32 /// </summary>
35 class MSSQLLogData : ILogData 33 internal class MSSQLLogData : ILogData
36 { 34 {
37 /// <summary> 35 /// <summary>
38 /// The database manager 36 /// The database manager
@@ -51,7 +49,9 @@ namespace OpenSim.Framework.Data.MSSQL
51 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 49 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
52 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 50 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
53 51
54 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 52 database =
53 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
54 settingPassword);
55 } 55 }
56 56
57 /// <summary> 57 /// <summary>
@@ -63,7 +63,8 @@ namespace OpenSim.Framework.Data.MSSQL
63 /// <param name="arguments">The arguments passed to the method</param> 63 /// <param name="arguments">The arguments passed to the method</param>
64 /// <param name="priority">How critical is this?</param> 64 /// <param name="priority">How critical is this?</param>
65 /// <param name="logMessage">The message to log</param> 65 /// <param name="logMessage">The message to log</param>
66 public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) 66 public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
67 string logMessage)
67 { 68 {
68 try 69 try
69 { 70 {
@@ -101,4 +102,4 @@ namespace OpenSim.Framework.Data.MSSQL
101 return "0.1"; 102 return "0.1";
102 } 103 }
103 } 104 }
104} 105} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
index b009a56..0dc3338 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
@@ -25,6 +25,7 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Data; 31using System.Data;
@@ -32,7 +33,6 @@ using System.Data.SqlClient;
32using System.IO; 33using System.IO;
33using System.Reflection; 34using System.Reflection;
34using libsecondlife; 35using libsecondlife;
35
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37 37
38namespace OpenSim.Framework.Data.MSSQL 38namespace OpenSim.Framework.Data.MSSQL
@@ -40,12 +40,12 @@ namespace OpenSim.Framework.Data.MSSQL
40 /// <summary> 40 /// <summary>
41 /// A management class for the MS SQL Storage Engine 41 /// A management class for the MS SQL Storage Engine
42 /// </summary> 42 /// </summary>
43 class MSSQLManager 43 internal class MSSQLManager
44 { 44 {
45 /// <summary> 45 /// <summary>
46 /// The database connection object 46 /// The database connection object
47 /// </summary> 47 /// </summary>
48 IDbConnection dbcon; 48 private IDbConnection dbcon;
49 49
50 /// <summary> 50 /// <summary>
51 /// Connection string for ADO.net 51 /// Connection string for ADO.net
@@ -60,12 +60,14 @@ namespace OpenSim.Framework.Data.MSSQL
60 /// <param name="username">The username logging into the database</param> 60 /// <param name="username">The username logging into the database</param>
61 /// <param name="password">The password for the user logging in</param> 61 /// <param name="password">The password for the user logging in</param>
62 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> 62 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
63 public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId, string password) 63 public MSSQLManager(string dataSource, string initialCatalog, string persistSecurityInfo, string userId,
64 string password)
64 { 65 {
65 try 66 try
66 { 67 {
67 68 connectionString = "Data Source=" + dataSource + ";Initial Catalog=" + initialCatalog +
68 connectionString = "Data Source=" + dataSource + ";Initial Catalog=" + initialCatalog + ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" + password+";"; 69 ";Persist Security Info=" + persistSecurityInfo + ";User ID=" + userId + ";Password=" +
70 password + ";";
69 dbcon = new SqlConnection(connectionString); 71 dbcon = new SqlConnection(connectionString);
70 TestTables(dbcon); 72 TestTables(dbcon);
71 dbcon.Open(); 73 dbcon.Open();
@@ -78,7 +80,7 @@ namespace OpenSim.Framework.Data.MSSQL
78 80
79 private bool TestTables(IDbConnection conn) 81 private bool TestTables(IDbConnection conn)
80 { 82 {
81 IDbCommand cmd = this.Query("SELECT * FROM regions", new Dictionary<string, string>()); 83 IDbCommand cmd = Query("SELECT * FROM regions", new Dictionary<string, string>());
82 //SqlCommand cmd = (SqlCommand)dbcon.CreateCommand(); 84 //SqlCommand cmd = (SqlCommand)dbcon.CreateCommand();
83 //cmd.CommandText = "SELECT * FROM regions"; 85 //cmd.CommandText = "SELECT * FROM regions";
84 try 86 try
@@ -90,7 +92,7 @@ namespace OpenSim.Framework.Data.MSSQL
90 } 92 }
91 catch (Exception) 93 catch (Exception)
92 { 94 {
93 MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating"); 95 MainLog.Instance.Verbose("DATASTORE", "MSSQL Database doesn't exist... creating");
94 InitDB(conn); 96 InitDB(conn);
95 } 97 }
96 return true; 98 return true;
@@ -100,66 +102,66 @@ namespace OpenSim.Framework.Data.MSSQL
100 { 102 {
101 string createRegions = defineTable(createRegionsTable()); 103 string createRegions = defineTable(createRegionsTable());
102 Dictionary<string, string> param = new Dictionary<string, string>(); 104 Dictionary<string, string> param = new Dictionary<string, string>();
103 IDbCommand pcmd = this.Query(createRegions, param); 105 IDbCommand pcmd = Query(createRegions, param);
104 if (conn.State == ConnectionState.Closed) { 106 if (conn.State == ConnectionState.Closed)
107 {
105 conn.Open(); 108 conn.Open();
106 } 109 }
107 pcmd.ExecuteNonQuery(); 110 pcmd.ExecuteNonQuery();
108 pcmd.Dispose(); 111 pcmd.Dispose();
109 112
110 this.ExecuteResourceSql("Mssql-users.sql"); 113 ExecuteResourceSql("Mssql-users.sql");
111 this.ExecuteResourceSql("Mssql-agents.sql"); 114 ExecuteResourceSql("Mssql-agents.sql");
112 this.ExecuteResourceSql("Mssql-logs.sql"); 115 ExecuteResourceSql("Mssql-logs.sql");
113 116
114 conn.Close(); 117 conn.Close();
115
116 } 118 }
117 119
118 private DataTable createRegionsTable() 120 private DataTable createRegionsTable()
119 { 121 {
120 DataTable regions = new DataTable("regions"); 122 DataTable regions = new DataTable("regions");
121 123
122 createCol(regions, "regionHandle", typeof(ulong)); 124 createCol(regions, "regionHandle", typeof (ulong));
123 createCol(regions, "regionName", typeof(System.String)); 125 createCol(regions, "regionName", typeof (String));
124 createCol(regions, "uuid", typeof(System.String)); 126 createCol(regions, "uuid", typeof (String));
125 127
126 createCol(regions, "regionRecvKey", typeof(System.String)); 128 createCol(regions, "regionRecvKey", typeof (String));
127 createCol(regions, "regionSecret", typeof(System.String)); 129 createCol(regions, "regionSecret", typeof (String));
128 createCol(regions, "regionSendKey", typeof(System.String)); 130 createCol(regions, "regionSendKey", typeof (String));
129 131
130 createCol(regions, "regionDataURI", typeof(System.String)); 132 createCol(regions, "regionDataURI", typeof (String));
131 createCol(regions, "serverIP", typeof(System.String)); 133 createCol(regions, "serverIP", typeof (String));
132 createCol(regions, "serverPort", typeof(System.String)); 134 createCol(regions, "serverPort", typeof (String));
133 createCol(regions, "serverURI", typeof(System.String)); 135 createCol(regions, "serverURI", typeof (String));
134 136
135 137
136 createCol(regions, "locX", typeof(uint)); 138 createCol(regions, "locX", typeof (uint));
137 createCol(regions, "locY", typeof(uint)); 139 createCol(regions, "locY", typeof (uint));
138 createCol(regions, "locZ", typeof(uint)); 140 createCol(regions, "locZ", typeof (uint));
139 141
140 createCol(regions, "eastOverrideHandle", typeof(ulong)); 142 createCol(regions, "eastOverrideHandle", typeof (ulong));
141 createCol(regions, "westOverrideHandle", typeof(ulong)); 143 createCol(regions, "westOverrideHandle", typeof (ulong));
142 createCol(regions, "southOverrideHandle", typeof(ulong)); 144 createCol(regions, "southOverrideHandle", typeof (ulong));
143 createCol(regions, "northOverrideHandle", typeof(ulong)); 145 createCol(regions, "northOverrideHandle", typeof (ulong));
144 146
145 createCol(regions, "regionAssetURI", typeof(System.String)); 147 createCol(regions, "regionAssetURI", typeof (String));
146 createCol(regions, "regionAssetRecvKey", typeof(System.String)); 148 createCol(regions, "regionAssetRecvKey", typeof (String));
147 createCol(regions, "regionAssetSendKey", typeof(System.String)); 149 createCol(regions, "regionAssetSendKey", typeof (String));
148 150
149 createCol(regions, "regionUserURI", typeof(System.String)); 151 createCol(regions, "regionUserURI", typeof (String));
150 createCol(regions, "regionUserRecvKey", typeof(System.String)); 152 createCol(regions, "regionUserRecvKey", typeof (String));
151 createCol(regions, "regionUserSendKey", typeof(System.String)); 153 createCol(regions, "regionUserSendKey", typeof (String));
152 154
153 createCol(regions, "regionMapTexture", typeof(System.String)); 155 createCol(regions, "regionMapTexture", typeof (String));
154 createCol(regions, "serverHttpPort", typeof(System.String)); 156 createCol(regions, "serverHttpPort", typeof (String));
155 createCol(regions, "serverRemotingPort", typeof(uint)); 157 createCol(regions, "serverRemotingPort", typeof (uint));
156 158
157 // Add in contraints 159 // Add in contraints
158 regions.PrimaryKey = new DataColumn[] { regions.Columns["UUID"] }; 160 regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]};
159 return regions; 161 return regions;
160 } 162 }
161 163
162 protected static void createCol(DataTable dt, string name, System.Type type) 164 protected static void createCol(DataTable dt, string name, Type type)
163 { 165 {
164 DataColumn col = new DataColumn(name, type); 166 DataColumn col = new DataColumn(name, type);
165 dt.Columns.Add(col); 167 dt.Columns.Add(col);
@@ -172,10 +174,11 @@ namespace OpenSim.Framework.Data.MSSQL
172 foreach (DataColumn col in dt.Columns) 174 foreach (DataColumn col in dt.Columns)
173 { 175 {
174 if (subsql.Length > 0) 176 if (subsql.Length > 0)
175 { // a map function would rock so much here 177 {
178 // a map function would rock so much here
176 subsql += ",\n"; 179 subsql += ",\n";
177 } 180 }
178 181
179 subsql += col.ColumnName + " " + SqlType(col.DataType); 182 subsql += col.ColumnName + " " + SqlType(col.DataType);
180 if (col == dt.PrimaryKey[0]) 183 if (col == dt.PrimaryKey[0])
181 { 184 {
@@ -192,19 +195,19 @@ namespace OpenSim.Framework.Data.MSSQL
192 // slightly differently. 195 // slightly differently.
193 private static string SqlType(Type type) 196 private static string SqlType(Type type)
194 { 197 {
195 if (type == typeof(System.String)) 198 if (type == typeof (String))
196 { 199 {
197 return "varchar(255)"; 200 return "varchar(255)";
198 } 201 }
199 else if (type == typeof(System.Int32)) 202 else if (type == typeof (Int32))
200 { 203 {
201 return "integer"; 204 return "integer";
202 } 205 }
203 else if (type == typeof(System.Double)) 206 else if (type == typeof (Double))
204 { 207 {
205 return "float"; 208 return "float";
206 } 209 }
207 else if (type == typeof(System.Byte[])) 210 else if (type == typeof (Byte[]))
208 { 211 {
209 return "image"; 212 return "image";
210 } 213 }
@@ -254,14 +257,14 @@ namespace OpenSim.Framework.Data.MSSQL
254 /// <returns>A Sql DB Command</returns> 257 /// <returns>A Sql DB Command</returns>
255 public IDbCommand Query(string sql, Dictionary<string, string> parameters) 258 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
256 { 259 {
257 SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); 260 SqlCommand dbcommand = (SqlCommand) dbcon.CreateCommand();
258 dbcommand.CommandText = sql; 261 dbcommand.CommandText = sql;
259 foreach (KeyValuePair<string, string> param in parameters) 262 foreach (KeyValuePair<string, string> param in parameters)
260 { 263 {
261 dbcommand.Parameters.AddWithValue(param.Key, param.Value); 264 dbcommand.Parameters.AddWithValue(param.Key, param.Value);
262 } 265 }
263 266
264 return (IDbCommand)dbcommand; 267 return (IDbCommand) dbcommand;
265 } 268 }
266 269
267 /// <summary> 270 /// <summary>
@@ -277,20 +280,20 @@ namespace OpenSim.Framework.Data.MSSQL
277 { 280 {
278 // Region Main 281 // Region Main
279 regionprofile.regionHandle = Convert.ToUInt64(reader["regionHandle"]); 282 regionprofile.regionHandle = Convert.ToUInt64(reader["regionHandle"]);
280 regionprofile.regionName = (string)reader["regionName"]; 283 regionprofile.regionName = (string) reader["regionName"];
281 regionprofile.UUID = new LLUUID((string)reader["uuid"]); 284 regionprofile.UUID = new LLUUID((string) reader["uuid"]);
282 285
283 // Secrets 286 // Secrets
284 regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; 287 regionprofile.regionRecvKey = (string) reader["regionRecvKey"];
285 regionprofile.regionSecret = (string)reader["regionSecret"]; 288 regionprofile.regionSecret = (string) reader["regionSecret"];
286 regionprofile.regionSendKey = (string)reader["regionSendKey"]; 289 regionprofile.regionSendKey = (string) reader["regionSendKey"];
287 290
288 // Region Server 291 // Region Server
289 regionprofile.regionDataURI = (string)reader["regionDataURI"]; 292 regionprofile.regionDataURI = (string) reader["regionDataURI"];
290 regionprofile.regionOnline = false; // Needs to be pinged before this can be set. 293 regionprofile.regionOnline = false; // Needs to be pinged before this can be set.
291 regionprofile.serverIP = (string)reader["serverIP"]; 294 regionprofile.serverIP = (string) reader["serverIP"];
292 regionprofile.serverPort = Convert.ToUInt32(reader["serverPort"]); 295 regionprofile.serverPort = Convert.ToUInt32(reader["serverPort"]);
293 regionprofile.serverURI = (string)reader["serverURI"]; 296 regionprofile.serverURI = (string) reader["serverURI"];
294 regionprofile.httpPort = Convert.ToUInt32(reader["serverHttpPort"]); 297 regionprofile.httpPort = Convert.ToUInt32(reader["serverHttpPort"]);
295 regionprofile.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"]); 298 regionprofile.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"]);
296 299
@@ -307,14 +310,14 @@ namespace OpenSim.Framework.Data.MSSQL
307 regionprofile.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"]); 310 regionprofile.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"]);
308 311
309 // Assets 312 // Assets
310 regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; 313 regionprofile.regionAssetURI = (string) reader["regionAssetURI"];
311 regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; 314 regionprofile.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
312 regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; 315 regionprofile.regionAssetSendKey = (string) reader["regionAssetSendKey"];
313 316
314 // Userserver 317 // Userserver
315 regionprofile.regionUserURI = (string)reader["regionUserURI"]; 318 regionprofile.regionUserURI = (string) reader["regionUserURI"];
316 regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; 319 regionprofile.regionUserRecvKey = (string) reader["regionUserRecvKey"];
317 regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; 320 regionprofile.regionUserSendKey = (string) reader["regionUserSendKey"];
318 321
319 // World Map Addition 322 // World Map Addition
320 string tempRegionMap = reader["regionMapTexture"].ToString(); 323 string tempRegionMap = reader["regionMapTexture"].ToString();
@@ -331,7 +334,6 @@ namespace OpenSim.Framework.Data.MSSQL
331 { 334 {
332 reader.Close(); 335 reader.Close();
333 throw new Exception("No rows to return"); 336 throw new Exception("No rows to return");
334
335 } 337 }
336 return regionprofile; 338 return regionprofile;
337 } 339 }
@@ -347,12 +349,12 @@ namespace OpenSim.Framework.Data.MSSQL
347 349
348 if (reader.Read()) 350 if (reader.Read())
349 { 351 {
350 retval.UUID = new LLUUID((string)reader["UUID"]); 352 retval.UUID = new LLUUID((string) reader["UUID"]);
351 retval.username = (string)reader["username"]; 353 retval.username = (string) reader["username"];
352 retval.surname = (string)reader["lastname"]; 354 retval.surname = (string) reader["lastname"];
353 355
354 retval.passwordHash = (string)reader["passwordHash"]; 356 retval.passwordHash = (string) reader["passwordHash"];
355 retval.passwordSalt = (string)reader["passwordSalt"]; 357 retval.passwordSalt = (string) reader["passwordSalt"];
356 358
357 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); 359 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString());
358 retval.homeLocation = new LLVector3( 360 retval.homeLocation = new LLVector3(
@@ -367,18 +369,17 @@ namespace OpenSim.Framework.Data.MSSQL
367 retval.created = Convert.ToInt32(reader["created"].ToString()); 369 retval.created = Convert.ToInt32(reader["created"].ToString());
368 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); 370 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString());
369 371
370 retval.userInventoryURI = (string)reader["userInventoryURI"]; 372 retval.userInventoryURI = (string) reader["userInventoryURI"];
371 retval.userAssetURI = (string)reader["userAssetURI"]; 373 retval.userAssetURI = (string) reader["userAssetURI"];
372 374
373 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); 375 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString());
374 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); 376 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString());
375 377
376 retval.profileAboutText = (string)reader["profileAboutText"]; 378 retval.profileAboutText = (string) reader["profileAboutText"];
377 retval.profileFirstText = (string)reader["profileFirstText"]; 379 retval.profileFirstText = (string) reader["profileFirstText"];
378
379 retval.profileImage = new LLUUID((string)reader["profileImage"]);
380 retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]);
381 380
381 retval.profileImage = new LLUUID((string) reader["profileImage"]);
382 retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]);
382 } 383 }
383 else 384 else
384 { 385 {
@@ -399,12 +400,12 @@ namespace OpenSim.Framework.Data.MSSQL
399 if (reader.Read()) 400 if (reader.Read())
400 { 401 {
401 // Agent IDs 402 // Agent IDs
402 retval.UUID = new LLUUID((string)reader["UUID"]); 403 retval.UUID = new LLUUID((string) reader["UUID"]);
403 retval.sessionID = new LLUUID((string)reader["sessionID"]); 404 retval.sessionID = new LLUUID((string) reader["sessionID"]);
404 retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); 405 retval.secureSessionID = new LLUUID((string) reader["secureSessionID"]);
405 406
406 // Agent Who? 407 // Agent Who?
407 retval.agentIP = (string)reader["agentIP"]; 408 retval.agentIP = (string) reader["agentIP"];
408 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); 409 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString());
409 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); 410 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString());
410 411
@@ -413,9 +414,9 @@ namespace OpenSim.Framework.Data.MSSQL
413 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); 414 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString());
414 415
415 // Current position 416 // Current position
416 retval.currentRegion = (string)reader["currentRegion"]; 417 retval.currentRegion = (string) reader["currentRegion"];
417 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); 418 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString());
418 LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); 419 LLVector3.TryParse((string) reader["currentPos"], out retval.currentPos);
419 } 420 }
420 else 421 else
421 { 422 {
@@ -426,20 +427,19 @@ namespace OpenSim.Framework.Data.MSSQL
426 427
427 public AssetBase getAssetRow(IDataReader reader) 428 public AssetBase getAssetRow(IDataReader reader)
428 { 429 {
429 AssetBase asset = new AssetBase(); 430 AssetBase asset = new AssetBase();
430 if (reader.Read()) 431 if (reader.Read())
431 { 432 {
432 // Region Main 433 // Region Main
433 434
434 asset = new AssetBase(); 435 asset = new AssetBase();
435 asset.Data = (byte[])reader["data"]; 436 asset.Data = (byte[]) reader["data"];
436 asset.Description = (string)reader["description"]; 437 asset.Description = (string) reader["description"];
437 asset.FullID = new LLUUID((string)reader["id"]); 438 asset.FullID = new LLUUID((string) reader["id"]);
438 asset.InvType = Convert.ToSByte(reader["invType"]); 439 asset.InvType = Convert.ToSByte(reader["invType"]);
439 asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false; 440 asset.Local = Convert.ToBoolean(reader["local"]); // ((sbyte)reader["local"]) != 0 ? true : false;
440 asset.Name = (string)reader["name"]; 441 asset.Name = (string) reader["name"];
441 asset.Type = Convert.ToSByte(reader["assetType"]); 442 asset.Type = Convert.ToSByte(reader["assetType"]);
442
443 } 443 }
444 else 444 else
445 { 445 {
@@ -455,15 +455,19 @@ namespace OpenSim.Framework.Data.MSSQL
455 /// <returns>Successful?</returns> 455 /// <returns>Successful?</returns>
456 public bool insertRegionRow(RegionProfileData profile) 456 public bool insertRegionRow(RegionProfileData profile)
457 { 457 {
458
459 //Insert new region 458 //Insert new region
460 string sql = "INSERT INTO regions ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], "; 459 string sql =
461 sql += "[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], "; 460 "INSERT INTO regions ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], ";
462 sql += "[regionAssetSendKey], [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], [serverRemotingPort]) VALUES "; 461 sql +=
462 "[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], ";
463 sql +=
464 "[regionAssetSendKey], [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], [serverRemotingPort]) VALUES ";
463 465
464 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; 466 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
465 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; 467 sql +=
466 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort);"; 468 "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
469 sql +=
470 "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort);";
467 471
468 Dictionary<string, string> parameters = new Dictionary<string, string>(); 472 Dictionary<string, string> parameters = new Dictionary<string, string>();
469 473
@@ -498,9 +502,9 @@ namespace OpenSim.Framework.Data.MSSQL
498 bool returnval = false; 502 bool returnval = false;
499 503
500 try 504 try
501 { 505 {
502 IDbCommand result = Query(sql, parameters); 506 IDbCommand result = Query(sql, parameters);
503 507
504 if (result.ExecuteNonQuery() == 1) 508 if (result.ExecuteNonQuery() == 1)
505 returnval = true; 509 returnval = true;
506 510
@@ -509,15 +513,12 @@ namespace OpenSim.Framework.Data.MSSQL
509 catch (Exception e) 513 catch (Exception e)
510 { 514 {
511 MainLog.Instance.Error("MSSQLManager : " + e.ToString()); 515 MainLog.Instance.Error("MSSQLManager : " + e.ToString());
512
513 } 516 }
514 517
515 return returnval; 518 return returnval;
516
517 } 519 }
518 520
519 521
520
521 /// <summary> 522 /// <summary>
522 /// Inserts a new row into the log database 523 /// Inserts a new row into the log database
523 /// </summary> 524 /// </summary>
@@ -528,7 +529,8 @@ namespace OpenSim.Framework.Data.MSSQL
528 /// <param name="priority">How critical is this?</param> 529 /// <param name="priority">How critical is this?</param>
529 /// <param name="logMessage">Extra message info</param> 530 /// <param name="logMessage">Extra message info</param>
530 /// <returns>Saved successfully?</returns> 531 /// <returns>Saved successfully?</returns>
531 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) 532 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority,
533 string logMessage)
532 { 534 {
533 string sql = "INSERT INTO logs ([target], [server], [method], [arguments], [priority], [message]) VALUES "; 535 string sql = "INSERT INTO logs ([target], [server], [method], [arguments], [priority], [message]) VALUES ";
534 sql += "(@target, @server, @method, @arguments, @priority, @message);"; 536 sql += "(@target, @server, @method, @arguments, @priority, @message);";
@@ -588,19 +590,26 @@ namespace OpenSim.Framework.Data.MSSQL
588 /// <param name="profileImage">UUID for profile image</param> 590 /// <param name="profileImage">UUID for profile image</param>
589 /// <param name="firstImage">UUID for firstlife image</param> 591 /// <param name="firstImage">UUID for firstlife image</param>
590 /// <returns>Success?</returns> 592 /// <returns>Success?</returns>
591 public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, 593 public bool insertUserRow(LLUUID uuid, string username, string lastname, string passwordHash,
592 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, 594 string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
593 libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage) 595 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
596 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
597 string aboutText, string firstText,
598 LLUUID profileImage, LLUUID firstImage)
594 { 599 {
595 string sql = "INSERT INTO users "; 600 string sql = "INSERT INTO users ";
596 sql += "([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], "; 601 sql += "([UUID], [username], [lastname], [passwordHash], [passwordSalt], [homeRegion], ";
597 sql += "[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], "; 602 sql +=
598 sql += "[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], "; 603 "[homeLocationX], [homeLocationY], [homeLocationZ], [homeLookAtX], [homeLookAtY], [homeLookAtZ], [created], ";
604 sql +=
605 "[lastLogin], [userInventoryURI], [userAssetURI], [profileCanDoMask], [profileWantDoMask], [profileAboutText], ";
599 sql += "[profileFirstText], [profileImage], [profileFirstImage]) VALUES "; 606 sql += "[profileFirstText], [profileImage], [profileFirstImage]) VALUES ";
600 607
601 sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, "; 608 sql += "(@UUID, @username, @lastname, @passwordHash, @passwordSalt, @homeRegion, ";
602 sql += "@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, "; 609 sql +=
603 sql += "@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, "; 610 "@homeLocationX, @homeLocationY, @homeLocationZ, @homeLookAtX, @homeLookAtY, @homeLookAtZ, @created, ";
611 sql +=
612 "@lastLogin, @userInventoryURI, @userAssetURI, @profileCanDoMask, @profileWantDoMask, @profileAboutText, ";
604 sql += "@profileFirstText, @profileImage, @profileFirstImage);"; 613 sql += "@profileFirstText, @profileImage, @profileFirstImage);";
605 614
606 Dictionary<string, string> parameters = new Dictionary<string, string>(); 615 Dictionary<string, string> parameters = new Dictionary<string, string>();
@@ -624,13 +633,13 @@ namespace OpenSim.Framework.Data.MSSQL
624 parameters["profileWantDoMask"] = "0"; 633 parameters["profileWantDoMask"] = "0";
625 parameters["profileAboutText"] = ""; 634 parameters["profileAboutText"] = "";
626 parameters["profileFirstText"] = ""; 635 parameters["profileFirstText"] = "";
627 parameters["profileImage"] = libsecondlife.LLUUID.Zero.ToString(); 636 parameters["profileImage"] = LLUUID.Zero.ToString();
628 parameters["profileFirstImage"] = libsecondlife.LLUUID.Zero.ToString(); 637 parameters["profileFirstImage"] = LLUUID.Zero.ToString();
629 638
630 bool returnval = false; 639 bool returnval = false;
631 640
632 try 641 try
633 { 642 {
634 IDbCommand result = Query(sql, parameters); 643 IDbCommand result = Query(sql, parameters);
635 644
636 if (result.ExecuteNonQuery() == 1) 645 if (result.ExecuteNonQuery() == 1)
@@ -655,8 +664,7 @@ namespace OpenSim.Framework.Data.MSSQL
655 { 664 {
656 try 665 try
657 { 666 {
658 667 SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection) dbcon);
659 SqlCommand cmd = new SqlCommand(getResourceString(name), (SqlConnection)dbcon);
660 cmd.ExecuteNonQuery(); 668 cmd.ExecuteNonQuery();
661 cmd.Dispose(); 669 cmd.Dispose();
662 } 670 }
@@ -668,7 +676,7 @@ namespace OpenSim.Framework.Data.MSSQL
668 676
669 public SqlConnection getConnection() 677 public SqlConnection getConnection()
670 { 678 {
671 return (SqlConnection)dbcon; 679 return (SqlConnection) dbcon;
672 } 680 }
673 681
674 /// <summary> 682 /// <summary>
@@ -681,14 +689,15 @@ namespace OpenSim.Framework.Data.MSSQL
681 { 689 {
682 Dictionary<string, string> param = new Dictionary<string, string>(); 690 Dictionary<string, string> param = new Dictionary<string, string>();
683 param["dbname"] = dbcon.Database; 691 param["dbname"] = dbcon.Database;
684 IDbCommand tablesCmd = this.Query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG=@dbname", param); 692 IDbCommand tablesCmd =
693 Query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG=@dbname", param);
685 using (IDataReader tables = tablesCmd.ExecuteReader()) 694 using (IDataReader tables = tablesCmd.ExecuteReader())
686 { 695 {
687 while (tables.Read()) 696 while (tables.Read())
688 { 697 {
689 try 698 try
690 { 699 {
691 string tableName = (string)tables["TABLE_NAME"]; 700 string tableName = (string) tables["TABLE_NAME"];
692 if (tableList.ContainsKey(tableName)) 701 if (tableList.ContainsKey(tableName))
693 tableList[tableName] = tableName; 702 tableList[tableName] = tableName;
694 } 703 }
@@ -704,7 +713,7 @@ namespace OpenSim.Framework.Data.MSSQL
704 713
705 private string getResourceString(string name) 714 private string getResourceString(string name)
706 { 715 {
707 Assembly assem = this.GetType().Assembly; 716 Assembly assem = GetType().Assembly;
708 string[] names = assem.GetManifestResourceNames(); 717 string[] names = assem.GetManifestResourceNames();
709 718
710 foreach (string s in names) 719 foreach (string s in names)
@@ -726,16 +735,14 @@ namespace OpenSim.Framework.Data.MSSQL
726 /// <returns>A string containing the DB provider</returns> 735 /// <returns>A string containing the DB provider</returns>
727 public string getVersion() 736 public string getVersion()
728 { 737 {
729 System.Reflection.Module module = this.GetType().Module; 738 Module module = GetType().Module;
730 string dllName = module.Assembly.ManifestModule.Name; 739 string dllName = module.Assembly.ManifestModule.Name;
731 Version dllVersion = module.Assembly.GetName().Version; 740 Version dllVersion = module.Assembly.GetName().Version;
732 741
733 742
734 return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); 743 return
744 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
745 dllVersion.Revision);
735 } 746 }
736
737 } 747 }
738 748} \ No newline at end of file
739
740
741}
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
index eac9826..01ef559 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLUserData.cs
@@ -37,7 +37,7 @@ namespace OpenSim.Framework.Data.MSSQL
37 /// <summary> 37 /// <summary>
38 /// A database interface class to a user profile storage system 38 /// A database interface class to a user profile storage system
39 /// </summary> 39 /// </summary>
40 class MSSQLUserData : IUserData 40 internal class MSSQLUserData : IUserData
41 { 41 {
42 /// <summary> 42 /// <summary>
43 /// Database manager for MySQL 43 /// Database manager for MySQL
@@ -58,7 +58,9 @@ namespace OpenSim.Framework.Data.MSSQL
58 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 58 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
59 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 59 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
60 60
61 database = new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId, settingPassword); 61 database =
62 new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
63 settingPassword);
62 } 64 }
63 65
64 /// <summary> 66 /// <summary>
@@ -77,11 +79,12 @@ namespace OpenSim.Framework.Data.MSSQL
77 param["first"] = user; 79 param["first"] = user;
78 param["second"] = last; 80 param["second"] = last;
79 81
80 IDbCommand result = database.Query("SELECT * FROM users WHERE username = @first AND lastname = @second", param); 82 IDbCommand result =
83 database.Query("SELECT * FROM users WHERE username = @first AND lastname = @second", param);
81 IDataReader reader = result.ExecuteReader(); 84 IDataReader reader = result.ExecuteReader();
82 85
83 UserProfileData row = database.readUserRow(reader); 86 UserProfileData row = database.readUserRow(reader);
84 87
85 reader.Close(); 88 reader.Close();
86 result.Dispose(); 89 result.Dispose();
87 90
@@ -96,9 +99,9 @@ namespace OpenSim.Framework.Data.MSSQL
96 } 99 }
97 } 100 }
98 101
99 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 102 public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
100 { 103 {
101 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); 104 List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>();
102 string[] querysplit; 105 string[] querysplit;
103 querysplit = query.Split(' '); 106 querysplit = query.Split(' ');
104 if (querysplit.Length == 2) 107 if (querysplit.Length == 2)
@@ -112,18 +115,19 @@ namespace OpenSim.Framework.Data.MSSQL
112 param["second"] = querysplit[1]; 115 param["second"] = querysplit[1];
113 116
114 IDbCommand result = 117 IDbCommand result =
115 database.Query("SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second", param); 118 database.Query(
119 "SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second",
120 param);
116 IDataReader reader = result.ExecuteReader(); 121 IDataReader reader = result.ExecuteReader();
117 122
118 123
119 while (reader.Read()) 124 while (reader.Read())
120 { 125 {
121 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 126 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
122 user.AvatarID = new LLUUID((string)reader["UUID"]); 127 user.AvatarID = new LLUUID((string) reader["UUID"]);
123 user.firstName = (string)reader["username"]; 128 user.firstName = (string) reader["username"];
124 user.lastName = (string)reader["surname"]; 129 user.lastName = (string) reader["surname"];
125 returnlist.Add(user); 130 returnlist.Add(user);
126
127 } 131 }
128 reader.Close(); 132 reader.Close();
129 result.Dispose(); 133 result.Dispose();
@@ -135,13 +139,9 @@ namespace OpenSim.Framework.Data.MSSQL
135 MainLog.Instance.Error(e.ToString()); 139 MainLog.Instance.Error(e.ToString());
136 return returnlist; 140 return returnlist;
137 } 141 }
138
139
140
141 } 142 }
142 else if (querysplit.Length == 1) 143 else if (querysplit.Length == 1)
143 { 144 {
144
145 try 145 try
146 { 146 {
147 lock (database) 147 lock (database)
@@ -151,18 +151,19 @@ namespace OpenSim.Framework.Data.MSSQL
151 param["second"] = querysplit[1]; 151 param["second"] = querysplit[1];
152 152
153 IDbCommand result = 153 IDbCommand result =
154 database.Query("SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second", param); 154 database.Query(
155 "SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second",
156 param);
155 IDataReader reader = result.ExecuteReader(); 157 IDataReader reader = result.ExecuteReader();
156 158
157 159
158 while (reader.Read()) 160 while (reader.Read())
159 { 161 {
160 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 162 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
161 user.AvatarID = new LLUUID((string)reader["UUID"]); 163 user.AvatarID = new LLUUID((string) reader["UUID"]);
162 user.firstName = (string)reader["username"]; 164 user.firstName = (string) reader["username"];
163 user.lastName = (string)reader["surname"]; 165 user.lastName = (string) reader["surname"];
164 returnlist.Add(user); 166 returnlist.Add(user);
165
166 } 167 }
167 reader.Close(); 168 reader.Close();
168 result.Dispose(); 169 result.Dispose();
@@ -268,21 +269,25 @@ namespace OpenSim.Framework.Data.MSSQL
268 /// <param name="user">The user profile to create</param> 269 /// <param name="user">The user profile to create</param>
269 public void AddNewUserProfile(UserProfileData user) 270 public void AddNewUserProfile(UserProfileData user)
270 { 271 {
271 try 272 try
272 { 273 {
273 lock (database) 274 lock (database)
274 { 275 {
275 database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, 276 database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt,
276 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, 277 user.homeRegion, user.homeLocation.X, user.homeLocation.Y,
277 user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage); 278 user.homeLocation.Z,
278 } 279 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created,
279 } 280 user.lastLogin, user.userInventoryURI, user.userAssetURI,
280 catch (Exception e) 281 user.profileCanDoMask, user.profileWantDoMask,
281 { 282 user.profileAboutText, user.profileFirstText, user.profileImage,
282 database.Reconnect(); 283 user.profileFirstImage);
283 MainLog.Instance.Error(e.ToString()); 284 }
284 } 285 }
285 286 catch (Exception e)
287 {
288 database.Reconnect();
289 MainLog.Instance.Error(e.ToString());
290 }
286 } 291 }
287 292
288 /// <summary> 293 /// <summary>
@@ -293,34 +298,33 @@ namespace OpenSim.Framework.Data.MSSQL
293 { 298 {
294 // Do nothing. 299 // Do nothing.
295 } 300 }
296 301
297 302
298 public bool UpdateUserProfile(UserProfileData user) 303 public bool UpdateUserProfile(UserProfileData user)
299 { 304 {
300
301 SqlCommand command = new SqlCommand("UPDATE users set UUID = @uuid, " + 305 SqlCommand command = new SqlCommand("UPDATE users set UUID = @uuid, " +
302 "username = @username, " + 306 "username = @username, " +
303 "lastname = @lastname," + 307 "lastname = @lastname," +
304 "passwordHash = @passwordHash," + 308 "passwordHash = @passwordHash," +
305 "passwordSalt = @passwordSalt," + 309 "passwordSalt = @passwordSalt," +
306 "homeRegion = @homeRegion," + 310 "homeRegion = @homeRegion," +
307 "homeLocationX = @homeLocationX," + 311 "homeLocationX = @homeLocationX," +
308 "homeLocationY = @homeLocationY," + 312 "homeLocationY = @homeLocationY," +
309 "homeLocationZ = @homeLocationZ," + 313 "homeLocationZ = @homeLocationZ," +
310 "homeLookAtX = @homeLookAtX," + 314 "homeLookAtX = @homeLookAtX," +
311 "homeLookAtY = @homeLookAtY," + 315 "homeLookAtY = @homeLookAtY," +
312 "homeLookAtZ = @homeLookAtZ," + 316 "homeLookAtZ = @homeLookAtZ," +
313 "created = @created," + 317 "created = @created," +
314 "lastLogin = @lastLogin," + 318 "lastLogin = @lastLogin," +
315 "userInventoryURI = @userInventoryURI," + 319 "userInventoryURI = @userInventoryURI," +
316 "userAssetURI = @userAssetURI," + 320 "userAssetURI = @userAssetURI," +
317 "profileCanDoMask = @profileCanDoMask," + 321 "profileCanDoMask = @profileCanDoMask," +
318 "profileWantDoMask = @profileWantDoMask," + 322 "profileWantDoMask = @profileWantDoMask," +
319 "profileAboutText = @profileAboutText," + 323 "profileAboutText = @profileAboutText," +
320 "profileFirstText = @profileFirstText," + 324 "profileFirstText = @profileFirstText," +
321 "profileImage = @profileImage," + 325 "profileImage = @profileImage," +
322 "profileFirstImage = @profileFirstImage where " + 326 "profileFirstImage = @profileFirstImage where " +
323 "UUID = @keyUUUID;", database.getConnection()); 327 "UUID = @keyUUUID;", database.getConnection());
324 SqlParameter param1 = new SqlParameter("@uuid", user.UUID.ToString()); 328 SqlParameter param1 = new SqlParameter("@uuid", user.UUID.ToString());
325 SqlParameter param2 = new SqlParameter("@username", user.username); 329 SqlParameter param2 = new SqlParameter("@username", user.username);
326 SqlParameter param3 = new SqlParameter("@lastname", user.surname); 330 SqlParameter param3 = new SqlParameter("@lastname", user.surname);
@@ -341,8 +345,8 @@ namespace OpenSim.Framework.Data.MSSQL
341 SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.profileWantDoMask)); 345 SqlParameter param18 = new SqlParameter("@profileWantDoMask", Convert.ToInt32(user.profileWantDoMask));
342 SqlParameter param19 = new SqlParameter("@profileAboutText", user.profileAboutText); 346 SqlParameter param19 = new SqlParameter("@profileAboutText", user.profileAboutText);
343 SqlParameter param20 = new SqlParameter("@profileFirstText", user.profileFirstText); 347 SqlParameter param20 = new SqlParameter("@profileFirstText", user.profileFirstText);
344 SqlParameter param21 = new SqlParameter("@profileImage", libsecondlife.LLUUID.Zero.ToString()); 348 SqlParameter param21 = new SqlParameter("@profileImage", LLUUID.Zero.ToString());
345 SqlParameter param22 = new SqlParameter("@profileFirstImage", libsecondlife.LLUUID.Zero.ToString()); 349 SqlParameter param22 = new SqlParameter("@profileFirstImage", LLUUID.Zero.ToString());
346 SqlParameter param23 = new SqlParameter("@keyUUUID", user.UUID.ToString()); 350 SqlParameter param23 = new SqlParameter("@keyUUUID", user.UUID.ToString());
347 command.Parameters.Add(param1); 351 command.Parameters.Add(param1);
348 command.Parameters.Add(param2); 352 command.Parameters.Add(param2);
@@ -370,9 +374,12 @@ namespace OpenSim.Framework.Data.MSSQL
370 try 374 try
371 { 375 {
372 int affected = command.ExecuteNonQuery(); 376 int affected = command.ExecuteNonQuery();
373 if (affected != 0) { 377 if (affected != 0)
378 {
374 return true; 379 return true;
375 } else { 380 }
381 else
382 {
376 return false; 383 return false;
377 } 384 }
378 } 385 }
@@ -433,6 +440,5 @@ namespace OpenSim.Framework.Data.MSSQL
433 public void runQuery(string query) 440 public void runQuery(string query)
434 { 441 {
435 } 442 }
436
437 } 443 }
438} 444} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
index 19ae115..b20c54e 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs
@@ -83,13 +83,13 @@ namespace OpenSim.Framework.Data.MySQL
83 if (dbReader.Read()) 83 if (dbReader.Read())
84 { 84 {
85 asset = new AssetBase(); 85 asset = new AssetBase();
86 asset.Data = (byte[])dbReader["data"]; 86 asset.Data = (byte[]) dbReader["data"];
87 asset.Description = (string)dbReader["description"]; 87 asset.Description = (string) dbReader["description"];
88 asset.FullID = assetID; 88 asset.FullID = assetID;
89 asset.InvType = (sbyte)dbReader["invType"]; 89 asset.InvType = (sbyte) dbReader["invType"];
90 asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false; 90 asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false;
91 asset.Name = (string)dbReader["name"]; 91 asset.Name = (string) dbReader["name"];
92 asset.Type = (sbyte)dbReader["assetType"]; 92 asset.Type = (sbyte) dbReader["assetType"];
93 } 93 }
94 dbReader.Close(); 94 dbReader.Close();
95 cmd.Dispose(); 95 cmd.Dispose();
@@ -98,7 +98,7 @@ namespace OpenSim.Framework.Data.MySQL
98 catch (Exception) 98 catch (Exception)
99 { 99 {
100 MainLog.Instance.Warn("ASSETS", "MySql failure fetching asset"); 100 MainLog.Instance.Warn("ASSETS", "MySql failure fetching asset");
101 } 101 }
102 } 102 }
103 return asset; 103 return asset;
104 } 104 }
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
index c48c88f..fcf8c6f 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs
@@ -31,15 +31,12 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.Diagnostics; 32using System.Diagnostics;
33using System.IO; 33using System.IO;
34using System.Text;
35using libsecondlife; 34using libsecondlife;
36using MySql.Data.MySqlClient; 35using MySql.Data.MySqlClient;
37using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
38using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Environment.LandManagement; 38using OpenSim.Region.Environment.LandManagement;
40using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
41using System.Data.SqlClient;
42using System.Data.Common;
43 40
44namespace OpenSim.Framework.Data.MySQL 41namespace OpenSim.Framework.Data.MySQL
45{ 42{
@@ -130,7 +127,7 @@ namespace OpenSim.Framework.Data.MySQL
130 { 127 {
131 foreach (SceneObjectPart prim in obj.Children.Values) 128 foreach (SceneObjectPart prim in obj.Children.Values)
132 { 129 {
133 if ((prim.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) 130 if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0)
134 { 131 {
135 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); 132 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID);
136 addPrim(prim, obj.UUID, regionUUID); 133 addPrim(prim, obj.UUID, regionUUID);
@@ -156,7 +153,7 @@ namespace OpenSim.Framework.Data.MySQL
156 DataRow[] primRows = prims.Select(selectExp); 153 DataRow[] primRows = prims.Select(selectExp);
157 foreach (DataRow row in primRows) 154 foreach (DataRow row in primRows)
158 { 155 {
159 LLUUID uuid = new LLUUID((string)row["UUID"]); 156 LLUUID uuid = new LLUUID((string) row["UUID"]);
160 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(uuid)); 157 DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(uuid));
161 if (shapeRow != null) 158 if (shapeRow != null)
162 { 159 {
@@ -191,8 +188,8 @@ namespace OpenSim.Framework.Data.MySQL
191 { 188 {
192 try 189 try
193 { 190 {
194 string uuid = (string)primRow["UUID"]; 191 string uuid = (string) primRow["UUID"];
195 string objID = (string)primRow["SceneGroupID"]; 192 string objID = (string) primRow["SceneGroupID"];
196 if (uuid == objID) //is new SceneObjectGroup ? 193 if (uuid == objID) //is new SceneObjectGroup ?
197 { 194 {
198 SceneObjectGroup group = new SceneObjectGroup(); 195 SceneObjectGroup group = new SceneObjectGroup();
@@ -255,10 +252,9 @@ namespace OpenSim.Framework.Data.MySQL
255 lock (m_dataSet) 252 lock (m_dataSet)
256 { 253 {
257 MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" + 254 MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" +
258 " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection); 255 " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection);
259 using (cmd) 256 using (cmd)
260 { 257 {
261
262 cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); 258 cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID)));
263 cmd.Parameters.Add(new MySqlParameter("?Revision", revision)); 259 cmd.Parameters.Add(new MySqlParameter("?Revision", revision));
264 cmd.Parameters.Add(new MySqlParameter("?Heightfield", serializeTerrain(ter))); 260 cmd.Parameters.Add(new MySqlParameter("?Heightfield", serializeTerrain(ter)));
@@ -269,7 +265,7 @@ namespace OpenSim.Framework.Data.MySQL
269 265
270 public double[,] LoadTerrain(LLUUID regionID) 266 public double[,] LoadTerrain(LLUUID regionID)
271 { 267 {
272 double[,] terret = new double[256, 256]; 268 double[,] terret = new double[256,256];
273 terret.Initialize(); 269 terret.Initialize();
274 270
275 MySqlCommand cmd = new MySqlCommand( 271 MySqlCommand cmd = new MySqlCommand(
@@ -278,7 +274,7 @@ namespace OpenSim.Framework.Data.MySQL
278 , m_connection); 274 , m_connection);
279 275
280 MySqlParameter param = new MySqlParameter(); 276 MySqlParameter param = new MySqlParameter();
281 cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); 277 cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID)));
282 278
283 if (m_connection.State != ConnectionState.Open) 279 if (m_connection.State != ConnectionState.Open)
284 { 280 {
@@ -290,15 +286,15 @@ namespace OpenSim.Framework.Data.MySQL
290 int rev = 0; 286 int rev = 0;
291 if (row.Read()) 287 if (row.Read())
292 { 288 {
293 byte[] heightmap = (byte[])row["Heightfield"]; 289 byte[] heightmap = (byte[]) row["Heightfield"];
294 for (int x = 0; x < 256; x++) 290 for (int x = 0; x < 256; x++)
295 { 291 {
296 for (int y = 0; y < 256; y++) 292 for (int y = 0; y < 256; y++)
297 { 293 {
298 terret[x, y] = BitConverter.ToDouble(heightmap, ((x * 256) + y) * 8); 294 terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8);
299 } 295 }
300 } 296 }
301 rev = (int)row["Revision"]; 297 rev = (int) row["Revision"];
302 } 298 }
303 else 299 else
304 { 300 {
@@ -322,7 +318,9 @@ namespace OpenSim.Framework.Data.MySQL
322 cmd.ExecuteNonQuery(); 318 cmd.ExecuteNonQuery();
323 } 319 }
324 320
325 using (MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?UUID", m_connection)) 321 using (
322 MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?UUID", m_connection)
323 )
326 { 324 {
327 cmd.Parameters.Add(new MySqlParameter("?UUID", Util.ToRawUuidString(globalID))); 325 cmd.Parameters.Add(new MySqlParameter("?UUID", Util.ToRawUuidString(globalID)));
328 cmd.ExecuteNonQuery(); 326 cmd.ExecuteNonQuery();
@@ -336,7 +334,7 @@ namespace OpenSim.Framework.Data.MySQL
336 { 334 {
337 DataTable land = m_landTable; 335 DataTable land = m_landTable;
338 DataTable landaccesslist = m_landAccessListTable; 336 DataTable landaccesslist = m_landAccessListTable;
339 337
340 DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.globalID)); 338 DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.globalID));
341 if (landRow == null) 339 if (landRow == null)
342 { 340 {
@@ -349,7 +347,9 @@ namespace OpenSim.Framework.Data.MySQL
349 fillLandRow(landRow, parcel.landData, regionUUID); 347 fillLandRow(landRow, parcel.landData, regionUUID);
350 } 348 }
351 349
352 using (MySqlCommand cmd = new MySqlCommand("delete from landaccesslist where LandUUID=?LandUUID", m_connection)) 350 using (
351 MySqlCommand cmd =
352 new MySqlCommand("delete from landaccesslist where LandUUID=?LandUUID", m_connection))
353 { 353 {
354 cmd.Parameters.Add(new MySqlParameter("?LandUUID", Util.ToRawUuidString(parcel.landData.globalID))); 354 cmd.Parameters.Add(new MySqlParameter("?LandUUID", Util.ToRawUuidString(parcel.landData.globalID)));
355 cmd.ExecuteNonQuery(); 355 cmd.ExecuteNonQuery();
@@ -361,13 +361,12 @@ namespace OpenSim.Framework.Data.MySQL
361 fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID); 361 fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID);
362 landaccesslist.Rows.Add(newAccessRow); 362 landaccesslist.Rows.Add(newAccessRow);
363 } 363 }
364
365 } 364 }
366 365
367 Commit(); 366 Commit();
368 } 367 }
369 368
370 public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID) 369 public List<LandData> LoadLandObjects(LLUUID regionUUID)
371 { 370 {
372 List<LandData> landDataForRegion = new List<LandData>(); 371 List<LandData> landDataForRegion = new List<LandData>();
373 lock (m_dataSet) 372 lock (m_dataSet)
@@ -403,7 +402,7 @@ namespace OpenSim.Framework.Data.MySQL
403 foreach (DataRow row in table.Rows) 402 foreach (DataRow row in table.Rows)
404 { 403 {
405 //--- Display the original values, if there are any. 404 //--- Display the original values, if there are any.
406 if (row.HasVersion(System.Data.DataRowVersion.Original)) 405 if (row.HasVersion(DataRowVersion.Original))
407 { 406 {
408 Debug.Write("Original Row Values ===> "); 407 Debug.Write("Original Row Values ===> ");
409 foreach (DataColumn column in table.Columns) 408 foreach (DataColumn column in table.Columns)
@@ -412,7 +411,7 @@ namespace OpenSim.Framework.Data.MySQL
412 Debug.WriteLine(""); 411 Debug.WriteLine("");
413 } 412 }
414 //--- Display the current values, if there are any. 413 //--- Display the current values, if there are any.
415 if (row.HasVersion(System.Data.DataRowVersion.Current)) 414 if (row.HasVersion(DataRowVersion.Current))
416 { 415 {
417 Debug.Write("Current Row Values ====> "); 416 Debug.Write("Current Row Values ====> ");
418 foreach (DataColumn column in table.Columns) 417 foreach (DataColumn column in table.Columns)
@@ -470,9 +469,9 @@ namespace OpenSim.Framework.Data.MySQL
470 { 469 {
471 DataTable terrain = new DataTable("terrain"); 470 DataTable terrain = new DataTable("terrain");
472 471
473 createCol(terrain, "RegionUUID", typeof(String)); 472 createCol(terrain, "RegionUUID", typeof (String));
474 createCol(terrain, "Revision", typeof(Int32)); 473 createCol(terrain, "Revision", typeof (Int32));
475 DataColumn heightField = createCol(terrain, "Heightfield", typeof(Byte[])); 474 DataColumn heightField = createCol(terrain, "Heightfield", typeof (Byte[]));
476 return terrain; 475 return terrain;
477 } 476 }
478 477
@@ -480,62 +479,62 @@ namespace OpenSim.Framework.Data.MySQL
480 { 479 {
481 DataTable prims = new DataTable("prims"); 480 DataTable prims = new DataTable("prims");
482 481
483 createCol(prims, "UUID", typeof(String)); 482 createCol(prims, "UUID", typeof (String));
484 createCol(prims, "RegionUUID", typeof(String)); 483 createCol(prims, "RegionUUID", typeof (String));
485 createCol(prims, "ParentID", typeof(Int32)); 484 createCol(prims, "ParentID", typeof (Int32));
486 createCol(prims, "CreationDate", typeof(Int32)); 485 createCol(prims, "CreationDate", typeof (Int32));
487 createCol(prims, "Name", typeof(String)); 486 createCol(prims, "Name", typeof (String));
488 createCol(prims, "SceneGroupID", typeof(String)); 487 createCol(prims, "SceneGroupID", typeof (String));
489 // various text fields 488 // various text fields
490 createCol(prims, "Text", typeof(String)); 489 createCol(prims, "Text", typeof (String));
491 createCol(prims, "Description", typeof(String)); 490 createCol(prims, "Description", typeof (String));
492 createCol(prims, "SitName", typeof(String)); 491 createCol(prims, "SitName", typeof (String));
493 createCol(prims, "TouchName", typeof(String)); 492 createCol(prims, "TouchName", typeof (String));
494 // permissions 493 // permissions
495 createCol(prims, "ObjectFlags", typeof(Int32)); 494 createCol(prims, "ObjectFlags", typeof (Int32));
496 createCol(prims, "CreatorID", typeof(String)); 495 createCol(prims, "CreatorID", typeof (String));
497 createCol(prims, "OwnerID", typeof(String)); 496 createCol(prims, "OwnerID", typeof (String));
498 createCol(prims, "GroupID", typeof(String)); 497 createCol(prims, "GroupID", typeof (String));
499 createCol(prims, "LastOwnerID", typeof(String)); 498 createCol(prims, "LastOwnerID", typeof (String));
500 createCol(prims, "OwnerMask", typeof(Int32)); 499 createCol(prims, "OwnerMask", typeof (Int32));
501 createCol(prims, "NextOwnerMask", typeof(Int32)); 500 createCol(prims, "NextOwnerMask", typeof (Int32));
502 createCol(prims, "GroupMask", typeof(Int32)); 501 createCol(prims, "GroupMask", typeof (Int32));
503 createCol(prims, "EveryoneMask", typeof(Int32)); 502 createCol(prims, "EveryoneMask", typeof (Int32));
504 createCol(prims, "BaseMask", typeof(Int32)); 503 createCol(prims, "BaseMask", typeof (Int32));
505 // vectors 504 // vectors
506 createCol(prims, "PositionX", typeof(Double)); 505 createCol(prims, "PositionX", typeof (Double));
507 createCol(prims, "PositionY", typeof(Double)); 506 createCol(prims, "PositionY", typeof (Double));
508 createCol(prims, "PositionZ", typeof(Double)); 507 createCol(prims, "PositionZ", typeof (Double));
509 createCol(prims, "GroupPositionX", typeof(Double)); 508 createCol(prims, "GroupPositionX", typeof (Double));
510 createCol(prims, "GroupPositionY", typeof(Double)); 509 createCol(prims, "GroupPositionY", typeof (Double));
511 createCol(prims, "GroupPositionZ", typeof(Double)); 510 createCol(prims, "GroupPositionZ", typeof (Double));
512 createCol(prims, "VelocityX", typeof(Double)); 511 createCol(prims, "VelocityX", typeof (Double));
513 createCol(prims, "VelocityY", typeof(Double)); 512 createCol(prims, "VelocityY", typeof (Double));
514 createCol(prims, "VelocityZ", typeof(Double)); 513 createCol(prims, "VelocityZ", typeof (Double));
515 createCol(prims, "AngularVelocityX", typeof(Double)); 514 createCol(prims, "AngularVelocityX", typeof (Double));
516 createCol(prims, "AngularVelocityY", typeof(Double)); 515 createCol(prims, "AngularVelocityY", typeof (Double));
517 createCol(prims, "AngularVelocityZ", typeof(Double)); 516 createCol(prims, "AngularVelocityZ", typeof (Double));
518 createCol(prims, "AccelerationX", typeof(Double)); 517 createCol(prims, "AccelerationX", typeof (Double));
519 createCol(prims, "AccelerationY", typeof(Double)); 518 createCol(prims, "AccelerationY", typeof (Double));
520 createCol(prims, "AccelerationZ", typeof(Double)); 519 createCol(prims, "AccelerationZ", typeof (Double));
521 // quaternions 520 // quaternions
522 createCol(prims, "RotationX", typeof(Double)); 521 createCol(prims, "RotationX", typeof (Double));
523 createCol(prims, "RotationY", typeof(Double)); 522 createCol(prims, "RotationY", typeof (Double));
524 createCol(prims, "RotationZ", typeof(Double)); 523 createCol(prims, "RotationZ", typeof (Double));
525 createCol(prims, "RotationW", typeof(Double)); 524 createCol(prims, "RotationW", typeof (Double));
526 // sit target 525 // sit target
527 createCol(prims, "SitTargetOffsetX", typeof(Double)); 526 createCol(prims, "SitTargetOffsetX", typeof (Double));
528 createCol(prims, "SitTargetOffsetY", typeof(Double)); 527 createCol(prims, "SitTargetOffsetY", typeof (Double));
529 createCol(prims, "SitTargetOffsetZ", typeof(Double)); 528 createCol(prims, "SitTargetOffsetZ", typeof (Double));
530 529
531 createCol(prims, "SitTargetOrientW", typeof(Double)); 530 createCol(prims, "SitTargetOrientW", typeof (Double));
532 createCol(prims, "SitTargetOrientX", typeof(Double)); 531 createCol(prims, "SitTargetOrientX", typeof (Double));
533 createCol(prims, "SitTargetOrientY", typeof(Double)); 532 createCol(prims, "SitTargetOrientY", typeof (Double));
534 createCol(prims, "SitTargetOrientZ", typeof(Double)); 533 createCol(prims, "SitTargetOrientZ", typeof (Double));
535 534
536 535
537 // Add in contraints 536 // Add in contraints
538 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; 537 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
539 538
540 return prims; 539 return prims;
541 } 540 }
@@ -543,42 +542,42 @@ namespace OpenSim.Framework.Data.MySQL
543 private DataTable createLandTable() 542 private DataTable createLandTable()
544 { 543 {
545 DataTable land = new DataTable("land"); 544 DataTable land = new DataTable("land");
546 createCol(land, "UUID", typeof(String)); 545 createCol(land, "UUID", typeof (String));
547 createCol(land, "RegionUUID", typeof(String)); 546 createCol(land, "RegionUUID", typeof (String));
548 createCol(land, "LocalLandID", typeof(Int32)); 547 createCol(land, "LocalLandID", typeof (Int32));
549 548
550 // Bitmap is a byte[512] 549 // Bitmap is a byte[512]
551 createCol(land, "Bitmap", typeof(Byte[])); 550 createCol(land, "Bitmap", typeof (Byte[]));
552 551
553 createCol(land, "Name", typeof(String)); 552 createCol(land, "Name", typeof (String));
554 createCol(land, "Description", typeof(String)); 553 createCol(land, "Description", typeof (String));
555 createCol(land, "OwnerUUID", typeof(String)); 554 createCol(land, "OwnerUUID", typeof (String));
556 createCol(land, "IsGroupOwned", typeof(Int32)); 555 createCol(land, "IsGroupOwned", typeof (Int32));
557 createCol(land, "Area", typeof(Int32)); 556 createCol(land, "Area", typeof (Int32));
558 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented 557 createCol(land, "AuctionID", typeof (Int32)); //Unemplemented
559 createCol(land, "Category", typeof(Int32)); //Enum libsecondlife.Parcel.ParcelCategory 558 createCol(land, "Category", typeof (Int32)); //Enum libsecondlife.Parcel.ParcelCategory
560 createCol(land, "ClaimDate", typeof(Int32)); 559 createCol(land, "ClaimDate", typeof (Int32));
561 createCol(land, "ClaimPrice", typeof(Int32)); 560 createCol(land, "ClaimPrice", typeof (Int32));
562 createCol(land, "GroupUUID", typeof(String)); 561 createCol(land, "GroupUUID", typeof (String));
563 createCol(land, "SalePrice", typeof(Int32)); 562 createCol(land, "SalePrice", typeof (Int32));
564 createCol(land, "LandStatus", typeof(Int32)); //Enum. libsecondlife.Parcel.ParcelStatus 563 createCol(land, "LandStatus", typeof (Int32)); //Enum. libsecondlife.Parcel.ParcelStatus
565 createCol(land, "LandFlags", typeof(Int32)); 564 createCol(land, "LandFlags", typeof (Int32));
566 createCol(land, "LandingType", typeof(Int32)); 565 createCol(land, "LandingType", typeof (Int32));
567 createCol(land, "MediaAutoScale", typeof(Int32)); 566 createCol(land, "MediaAutoScale", typeof (Int32));
568 createCol(land, "MediaTextureUUID", typeof(String)); 567 createCol(land, "MediaTextureUUID", typeof (String));
569 createCol(land, "MediaURL", typeof(String)); 568 createCol(land, "MediaURL", typeof (String));
570 createCol(land, "MusicURL", typeof(String)); 569 createCol(land, "MusicURL", typeof (String));
571 createCol(land, "PassHours", typeof(Double)); 570 createCol(land, "PassHours", typeof (Double));
572 createCol(land, "PassPrice", typeof(Int32)); 571 createCol(land, "PassPrice", typeof (Int32));
573 createCol(land, "SnapshotUUID", typeof(String)); 572 createCol(land, "SnapshotUUID", typeof (String));
574 createCol(land, "UserLocationX", typeof(Double)); 573 createCol(land, "UserLocationX", typeof (Double));
575 createCol(land, "UserLocationY", typeof(Double)); 574 createCol(land, "UserLocationY", typeof (Double));
576 createCol(land, "UserLocationZ", typeof(Double)); 575 createCol(land, "UserLocationZ", typeof (Double));
577 createCol(land, "UserLookAtX", typeof(Double)); 576 createCol(land, "UserLookAtX", typeof (Double));
578 createCol(land, "UserLookAtY", typeof(Double)); 577 createCol(land, "UserLookAtY", typeof (Double));
579 createCol(land, "UserLookAtZ", typeof(Double)); 578 createCol(land, "UserLookAtZ", typeof (Double));
580 579
581 land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; 580 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
582 581
583 return land; 582 return land;
584 } 583 }
@@ -586,9 +585,9 @@ namespace OpenSim.Framework.Data.MySQL
586 private DataTable createLandAccessListTable() 585 private DataTable createLandAccessListTable()
587 { 586 {
588 DataTable landaccess = new DataTable("landaccesslist"); 587 DataTable landaccess = new DataTable("landaccesslist");
589 createCol(landaccess, "LandUUID", typeof(String)); 588 createCol(landaccess, "LandUUID", typeof (String));
590 createCol(landaccess, "AccessUUID", typeof(String)); 589 createCol(landaccess, "AccessUUID", typeof (String));
591 createCol(landaccess, "Flags", typeof(Int32)); 590 createCol(landaccess, "Flags", typeof (Int32));
592 591
593 return landaccess; 592 return landaccess;
594 } 593 }
@@ -596,38 +595,38 @@ namespace OpenSim.Framework.Data.MySQL
596 private DataTable createShapeTable() 595 private DataTable createShapeTable()
597 { 596 {
598 DataTable shapes = new DataTable("primshapes"); 597 DataTable shapes = new DataTable("primshapes");
599 createCol(shapes, "UUID", typeof(String)); 598 createCol(shapes, "UUID", typeof (String));
600 // shape is an enum 599 // shape is an enum
601 createCol(shapes, "Shape", typeof(Int32)); 600 createCol(shapes, "Shape", typeof (Int32));
602 // vectors 601 // vectors
603 createCol(shapes, "ScaleX", typeof(Double)); 602 createCol(shapes, "ScaleX", typeof (Double));
604 createCol(shapes, "ScaleY", typeof(Double)); 603 createCol(shapes, "ScaleY", typeof (Double));
605 createCol(shapes, "ScaleZ", typeof(Double)); 604 createCol(shapes, "ScaleZ", typeof (Double));
606 // paths 605 // paths
607 createCol(shapes, "PCode", typeof(Int32)); 606 createCol(shapes, "PCode", typeof (Int32));
608 createCol(shapes, "PathBegin", typeof(Int32)); 607 createCol(shapes, "PathBegin", typeof (Int32));
609 createCol(shapes, "PathEnd", typeof(Int32)); 608 createCol(shapes, "PathEnd", typeof (Int32));
610 createCol(shapes, "PathScaleX", typeof(Int32)); 609 createCol(shapes, "PathScaleX", typeof (Int32));
611 createCol(shapes, "PathScaleY", typeof(Int32)); 610 createCol(shapes, "PathScaleY", typeof (Int32));
612 createCol(shapes, "PathShearX", typeof(Int32)); 611 createCol(shapes, "PathShearX", typeof (Int32));
613 createCol(shapes, "PathShearY", typeof(Int32)); 612 createCol(shapes, "PathShearY", typeof (Int32));
614 createCol(shapes, "PathSkew", typeof(Int32)); 613 createCol(shapes, "PathSkew", typeof (Int32));
615 createCol(shapes, "PathCurve", typeof(Int32)); 614 createCol(shapes, "PathCurve", typeof (Int32));
616 createCol(shapes, "PathRadiusOffset", typeof(Int32)); 615 createCol(shapes, "PathRadiusOffset", typeof (Int32));
617 createCol(shapes, "PathRevolutions", typeof(Int32)); 616 createCol(shapes, "PathRevolutions", typeof (Int32));
618 createCol(shapes, "PathTaperX", typeof(Int32)); 617 createCol(shapes, "PathTaperX", typeof (Int32));
619 createCol(shapes, "PathTaperY", typeof(Int32)); 618 createCol(shapes, "PathTaperY", typeof (Int32));
620 createCol(shapes, "PathTwist", typeof(Int32)); 619 createCol(shapes, "PathTwist", typeof (Int32));
621 createCol(shapes, "PathTwistBegin", typeof(Int32)); 620 createCol(shapes, "PathTwistBegin", typeof (Int32));
622 // profile 621 // profile
623 createCol(shapes, "ProfileBegin", typeof(Int32)); 622 createCol(shapes, "ProfileBegin", typeof (Int32));
624 createCol(shapes, "ProfileEnd", typeof(Int32)); 623 createCol(shapes, "ProfileEnd", typeof (Int32));
625 createCol(shapes, "ProfileCurve", typeof(Int32)); 624 createCol(shapes, "ProfileCurve", typeof (Int32));
626 createCol(shapes, "ProfileHollow", typeof(Int32)); 625 createCol(shapes, "ProfileHollow", typeof (Int32));
627 createCol(shapes, "Texture", typeof(Byte[])); 626 createCol(shapes, "Texture", typeof (Byte[]));
628 createCol(shapes, "ExtraParams", typeof(Byte[])); 627 createCol(shapes, "ExtraParams", typeof (Byte[]));
629 628
630 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; 629 shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
631 630
632 return shapes; 631 return shapes;
633 } 632 }
@@ -643,23 +642,23 @@ namespace OpenSim.Framework.Data.MySQL
643 private SceneObjectPart buildPrim(DataRow row) 642 private SceneObjectPart buildPrim(DataRow row)
644 { 643 {
645 SceneObjectPart prim = new SceneObjectPart(); 644 SceneObjectPart prim = new SceneObjectPart();
646 prim.UUID = new LLUUID((String)row["UUID"]); 645 prim.UUID = new LLUUID((String) row["UUID"]);
647 // explicit conversion of integers is required, which sort 646 // explicit conversion of integers is required, which sort
648 // of sucks. No idea if there is a shortcut here or not. 647 // of sucks. No idea if there is a shortcut here or not.
649 prim.ParentID = Convert.ToUInt32(row["ParentID"]); 648 prim.ParentID = Convert.ToUInt32(row["ParentID"]);
650 prim.CreationDate = Convert.ToInt32(row["CreationDate"]); 649 prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
651 prim.Name = (String)row["Name"]; 650 prim.Name = (String) row["Name"];
652 // various text fields 651 // various text fields
653 prim.Text = (String)row["Text"]; 652 prim.Text = (String) row["Text"];
654 prim.Description = (String)row["Description"]; 653 prim.Description = (String) row["Description"];
655 prim.SitName = (String)row["SitName"]; 654 prim.SitName = (String) row["SitName"];
656 prim.TouchName = (String)row["TouchName"]; 655 prim.TouchName = (String) row["TouchName"];
657 // permissions 656 // permissions
658 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); 657 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]);
659 prim.CreatorID = new LLUUID((String)row["CreatorID"]); 658 prim.CreatorID = new LLUUID((String) row["CreatorID"]);
660 prim.OwnerID = new LLUUID((String)row["OwnerID"]); 659 prim.OwnerID = new LLUUID((String) row["OwnerID"]);
661 prim.GroupID = new LLUUID((String)row["GroupID"]); 660 prim.GroupID = new LLUUID((String) row["GroupID"]);
662 prim.LastOwnerID = new LLUUID((String)row["LastOwnerID"]); 661 prim.LastOwnerID = new LLUUID((String) row["LastOwnerID"]);
663 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); 662 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
664 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); 663 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
665 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); 664 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
@@ -701,19 +700,27 @@ namespace OpenSim.Framework.Data.MySQL
701 try 700 try
702 { 701 {
703 prim.SetSitTargetLL(new LLVector3( 702 prim.SetSitTargetLL(new LLVector3(
704 Convert.ToSingle(row["SitTargetOffsetX"]), 703 Convert.ToSingle(row["SitTargetOffsetX"]),
705 Convert.ToSingle(row["SitTargetOffsetY"]), 704 Convert.ToSingle(row["SitTargetOffsetY"]),
706 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( 705 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
707 Convert.ToSingle(row["SitTargetOrientX"]), 706 Convert.ToSingle(
708 Convert.ToSingle(row["SitTargetOrientY"]), 707 row["SitTargetOrientX"]),
709 Convert.ToSingle(row["SitTargetOrientZ"]), 708 Convert.ToSingle(
710 Convert.ToSingle(row["SitTargetOrientW"]))); 709 row["SitTargetOrientY"]),
710 Convert.ToSingle(
711 row["SitTargetOrientZ"]),
712 Convert.ToSingle(
713 row["SitTargetOrientW"])));
711 } 714 }
712 catch (System.InvalidCastException) 715 catch (InvalidCastException)
713 { 716 {
714 // Database table was created before we got here and needs to be created! :P 717 // Database table was created before we got here and needs to be created! :P
715 718
716 using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection)) 719 using (
720 MySqlCommand cmd =
721 new MySqlCommand(
722 "ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;",
723 m_connection))
717 { 724 {
718 cmd.ExecuteNonQuery(); 725 cmd.ExecuteNonQuery();
719 } 726 }
@@ -725,36 +732,42 @@ namespace OpenSim.Framework.Data.MySQL
725 { 732 {
726 LandData newData = new LandData(); 733 LandData newData = new LandData();
727 734
728 newData.globalID = new LLUUID((String)row["UUID"]); 735 newData.globalID = new LLUUID((String) row["UUID"]);
729 newData.localID = Convert.ToInt32(row["LocalLandID"]); 736 newData.localID = Convert.ToInt32(row["LocalLandID"]);
730 737
731 // Bitmap is a byte[512] 738 // Bitmap is a byte[512]
732 newData.landBitmapByteArray = (Byte[])row["Bitmap"]; 739 newData.landBitmapByteArray = (Byte[]) row["Bitmap"];
733 740
734 newData.landName = (String)row["Name"]; 741 newData.landName = (String) row["Name"];
735 newData.landDesc = (String)row["Description"]; 742 newData.landDesc = (String) row["Description"];
736 newData.ownerID = (String)row["OwnerUUID"]; 743 newData.ownerID = (String) row["OwnerUUID"];
737 newData.isGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]); 744 newData.isGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
738 newData.area = Convert.ToInt32(row["Area"]); 745 newData.area = Convert.ToInt32(row["Area"]);
739 newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented 746 newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
740 newData.category = (Parcel.ParcelCategory)Convert.ToInt32(row["Category"]); //Enum libsecondlife.Parcel.ParcelCategory 747 newData.category = (Parcel.ParcelCategory) Convert.ToInt32(row["Category"]);
748 //Enum libsecondlife.Parcel.ParcelCategory
741 newData.claimDate = Convert.ToInt32(row["ClaimDate"]); 749 newData.claimDate = Convert.ToInt32(row["ClaimDate"]);
742 newData.claimPrice = Convert.ToInt32(row["ClaimPrice"]); 750 newData.claimPrice = Convert.ToInt32(row["ClaimPrice"]);
743 newData.groupID = new LLUUID((String)row["GroupUUID"]); 751 newData.groupID = new LLUUID((String) row["GroupUUID"]);
744 newData.salePrice = Convert.ToInt32(row["SalePrice"]); 752 newData.salePrice = Convert.ToInt32(row["SalePrice"]);
745 newData.landStatus = (Parcel.ParcelStatus)Convert.ToInt32(row["LandStatus"]); //Enum. libsecondlife.Parcel.ParcelStatus 753 newData.landStatus = (Parcel.ParcelStatus) Convert.ToInt32(row["LandStatus"]);
754 //Enum. libsecondlife.Parcel.ParcelStatus
746 newData.landFlags = Convert.ToUInt32(row["LandFlags"]); 755 newData.landFlags = Convert.ToUInt32(row["LandFlags"]);
747 newData.landingType = Convert.ToByte(row["LandingType"]); 756 newData.landingType = Convert.ToByte(row["LandingType"]);
748 newData.mediaAutoScale = Convert.ToByte(row["MediaAutoScale"]); 757 newData.mediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
749 newData.mediaID = new LLUUID((String)row["MediaTextureUUID"]); 758 newData.mediaID = new LLUUID((String) row["MediaTextureUUID"]);
750 newData.mediaURL = (String)row["MediaURL"]; 759 newData.mediaURL = (String) row["MediaURL"];
751 newData.musicURL = (String)row["MusicURL"]; 760 newData.musicURL = (String) row["MusicURL"];
752 newData.passHours = Convert.ToSingle(row["PassHours"]); 761 newData.passHours = Convert.ToSingle(row["PassHours"]);
753 newData.passPrice = Convert.ToInt32(row["PassPrice"]); 762 newData.passPrice = Convert.ToInt32(row["PassPrice"]);
754 newData.snapshotID = (String)row["SnapshotUUID"]; 763 newData.snapshotID = (String) row["SnapshotUUID"];
755 764
756 newData.userLocation = new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]), Convert.ToSingle(row["UserLocationZ"])); 765 newData.userLocation =
757 newData.userLookAt = new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), Convert.ToSingle(row["UserLookAtZ"])); 766 new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
767 Convert.ToSingle(row["UserLocationZ"]));
768 newData.userLookAt =
769 new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
770 Convert.ToSingle(row["UserLookAtZ"]));
758 newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); 771 newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
759 772
760 return newData; 773 return newData;
@@ -763,7 +776,7 @@ namespace OpenSim.Framework.Data.MySQL
763 private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) 776 private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
764 { 777 {
765 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 778 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
766 entry.AgentID = new LLUUID((string)row["AccessUUID"]); 779 entry.AgentID = new LLUUID((string) row["AccessUUID"]);
767 entry.Flags = (ParcelManager.AccessList) Convert.ToInt32(row["Flags"]); 780 entry.Flags = (ParcelManager.AccessList) Convert.ToInt32(row["Flags"]);
768 entry.Time = new DateTime(); 781 entry.Time = new DateTime();
769 return entry; 782 return entry;
@@ -771,7 +784,7 @@ namespace OpenSim.Framework.Data.MySQL
771 784
772 private Array serializeTerrain(double[,] val) 785 private Array serializeTerrain(double[,] val)
773 { 786 {
774 MemoryStream str = new MemoryStream(65536 * sizeof(double)); 787 MemoryStream str = new MemoryStream(65536*sizeof (double));
775 BinaryWriter bw = new BinaryWriter(str); 788 BinaryWriter bw = new BinaryWriter(str);
776 789
777 // TODO: COMPATIBILITY - Add byte-order conversions 790 // TODO: COMPATIBILITY - Add byte-order conversions
@@ -789,7 +802,8 @@ namespace OpenSim.Framework.Data.MySQL
789 row["ParentID"] = prim.ParentID; 802 row["ParentID"] = prim.ParentID;
790 row["CreationDate"] = prim.CreationDate; 803 row["CreationDate"] = prim.CreationDate;
791 row["Name"] = prim.Name; 804 row["Name"] = prim.Name;
792 row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID); // the UUID of the root part for this SceneObjectGroup 805 row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID);
806 // the UUID of the root part for this SceneObjectGroup
793 // various text fields 807 // various text fields
794 row["Text"] = prim.Text; 808 row["Text"] = prim.Text;
795 row["Description"] = prim.Description; 809 row["Description"] = prim.Description;
@@ -841,18 +855,20 @@ namespace OpenSim.Framework.Data.MySQL
841 row["SitTargetOrientX"] = sitTargetOrient.X; 855 row["SitTargetOrientX"] = sitTargetOrient.X;
842 row["SitTargetOrientY"] = sitTargetOrient.Y; 856 row["SitTargetOrientY"] = sitTargetOrient.Y;
843 row["SitTargetOrientZ"] = sitTargetOrient.Z; 857 row["SitTargetOrientZ"] = sitTargetOrient.Z;
844 } 858 }
845 catch (MySql.Data.MySqlClient.MySqlException) 859 catch (MySqlException)
846 { 860 {
847 // Database table was created before we got here and needs to be created! :P 861 // Database table was created before we got here and needs to be created! :P
848 862
849 using (MySqlCommand cmd = new MySqlCommand("ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;", m_connection)) 863 using (
864 MySqlCommand cmd =
865 new MySqlCommand(
866 "ALTER TABLE `prims` ADD COLUMN `SitTargetOffsetX` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetY` float NOT NULL default 0, ADD COLUMN `SitTargetOffsetZ` float NOT NULL default 0, ADD COLUMN `SitTargetOrientW` float NOT NULL default 0, ADD COLUMN `SitTargetOrientX` float NOT NULL default 0, ADD COLUMN `SitTargetOrientY` float NOT NULL default 0, ADD COLUMN `SitTargetOrientZ` float NOT NULL default 0;",
867 m_connection))
850 { 868 {
851 cmd.ExecuteNonQuery(); 869 cmd.ExecuteNonQuery();
852 } 870 }
853 } 871 }
854
855
856 } 872 }
857 873
858 private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) 874 private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
@@ -929,11 +945,11 @@ namespace OpenSim.Framework.Data.MySQL
929 s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); 945 s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]);
930 s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); 946 s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
931 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); 947 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
932 948
933 byte[] textureEntry = (byte[])row["Texture"]; 949 byte[] textureEntry = (byte[]) row["Texture"];
934 s.TextureEntry = textureEntry; 950 s.TextureEntry = textureEntry;
935 951
936 s.ExtraParams = (byte[])row["ExtraParams"]; 952 s.ExtraParams = (byte[]) row["ExtraParams"];
937 953
938 return s; 954 return s;
939 } 955 }
@@ -1146,7 +1162,7 @@ namespace OpenSim.Framework.Data.MySQL
1146 da.UpdateCommand = updateCommand; 1162 da.UpdateCommand = updateCommand;
1147 1163
1148 MySqlCommand delete = new MySqlCommand("delete from prims where UUID=?UUID"); 1164 MySqlCommand delete = new MySqlCommand("delete from prims where UUID=?UUID");
1149 delete.Parameters.Add(createMySqlParameter("UUID", typeof(String))); 1165 delete.Parameters.Add(createMySqlParameter("UUID", typeof (String)));
1150 delete.Connection = conn; 1166 delete.Connection = conn;
1151 da.DeleteCommand = delete; 1167 da.DeleteCommand = delete;
1152 } 1168 }
@@ -1181,7 +1197,7 @@ namespace OpenSim.Framework.Data.MySQL
1181 da.UpdateCommand.Connection = conn; 1197 da.UpdateCommand.Connection = conn;
1182 1198
1183 MySqlCommand delete = new MySqlCommand("delete from primshapes where UUID = ?UUID"); 1199 MySqlCommand delete = new MySqlCommand("delete from primshapes where UUID = ?UUID");
1184 delete.Parameters.Add(createMySqlParameter("UUID", typeof(String))); 1200 delete.Parameters.Add(createMySqlParameter("UUID", typeof (String)));
1185 delete.Connection = conn; 1201 delete.Connection = conn;
1186 da.DeleteCommand = delete; 1202 da.DeleteCommand = delete;
1187 } 1203 }
@@ -1337,27 +1353,27 @@ namespace OpenSim.Framework.Data.MySQL
1337 1353
1338 private DbType dbtypeFromType(Type type) 1354 private DbType dbtypeFromType(Type type)
1339 { 1355 {
1340 if (type == typeof(String)) 1356 if (type == typeof (String))
1341 { 1357 {
1342 return DbType.String; 1358 return DbType.String;
1343 } 1359 }
1344 else if (type == typeof(Int32)) 1360 else if (type == typeof (Int32))
1345 { 1361 {
1346 return DbType.Int32; 1362 return DbType.Int32;
1347 } 1363 }
1348 else if (type == typeof(Double)) 1364 else if (type == typeof (Double))
1349 { 1365 {
1350 return DbType.Double; 1366 return DbType.Double;
1351 } 1367 }
1352 else if (type == typeof(Byte)) 1368 else if (type == typeof (Byte))
1353 { 1369 {
1354 return DbType.Byte; 1370 return DbType.Byte;
1355 } 1371 }
1356 else if (type == typeof(Double)) 1372 else if (type == typeof (Double))
1357 { 1373 {
1358 return DbType.Double; 1374 return DbType.Double;
1359 } 1375 }
1360 else if (type == typeof(Byte[])) 1376 else if (type == typeof (Byte[]))
1361 { 1377 {
1362 return DbType.Binary; 1378 return DbType.Binary;
1363 } 1379 }
@@ -1371,19 +1387,19 @@ namespace OpenSim.Framework.Data.MySQL
1371 // slightly differently. 1387 // slightly differently.
1372 private string MySqlType(Type type) 1388 private string MySqlType(Type type)
1373 { 1389 {
1374 if (type == typeof(String)) 1390 if (type == typeof (String))
1375 { 1391 {
1376 return "varchar(255)"; 1392 return "varchar(255)";
1377 } 1393 }
1378 else if (type == typeof(Int32)) 1394 else if (type == typeof (Int32))
1379 { 1395 {
1380 return "integer"; 1396 return "integer";
1381 } 1397 }
1382 else if (type == typeof(Double)) 1398 else if (type == typeof (Double))
1383 { 1399 {
1384 return "float"; 1400 return "float";
1385 } 1401 }
1386 else if (type == typeof(Byte[])) 1402 else if (type == typeof (Byte[]))
1387 { 1403 {
1388 return "longblob"; 1404 return "longblob";
1389 } 1405 }
@@ -1393,4 +1409,4 @@ namespace OpenSim.Framework.Data.MySQL
1393 } 1409 }
1394 } 1410 }
1395 } 1411 }
1396} 1412} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
index 7843562..7cfac12 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.Security.Cryptography; 32using System.Security.Cryptography;
33using System.Text; 33using System.Text;
34using System.Text.RegularExpressions;
34using libsecondlife; 35using libsecondlife;
35using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
36 37
@@ -62,7 +63,7 @@ namespace OpenSim.Framework.Data.MySQL
62 database = 63 database =
63 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, 64 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
64 settingPort); 65 settingPort);
65 66
66 TestTables(); 67 TestTables();
67 } 68 }
68 69
@@ -80,7 +81,7 @@ namespace OpenSim.Framework.Data.MySQL
80 81
81 UpgradeRegionsTable(tableList["regions"]); 82 UpgradeRegionsTable(tableList["regions"]);
82 } 83 }
83 84
84 /// <summary> 85 /// <summary>
85 /// Create or upgrade the table if necessary 86 /// Create or upgrade the table if necessary
86 /// </summary> 87 /// </summary>
@@ -94,10 +95,10 @@ namespace OpenSim.Framework.Data.MySQL
94 database.ExecuteResourceSql("CreateRegionsTable.sql"); 95 database.ExecuteResourceSql("CreateRegionsTable.sql");
95 return; 96 return;
96 } 97 }
97 } 98 }
98 99
99 #endregion 100 #endregion
100 101
101 /// <summary> 102 /// <summary>
102 /// Shuts down the grid interface 103 /// Shuts down the grid interface
103 /// </summary> 104 /// </summary>
@@ -203,42 +204,41 @@ namespace OpenSim.Framework.Data.MySQL
203 return null; 204 return null;
204 } 205 }
205 } 206 }
207
206 /// <summary> 208 /// <summary>
207 /// // Returns a list of avatar and UUIDs that match the query 209 /// // Returns a list of avatar and UUIDs that match the query
208 /// </summary> 210 /// </summary>
209
210 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 211 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
211 { 212 {
212 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 213 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
213 214
214 System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]"); 215 Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
215 216
216 string[] querysplit; 217 string[] querysplit;
217 querysplit = query.Split(' '); 218 querysplit = query.Split(' ');
218 if (querysplit.Length == 2) 219 if (querysplit.Length == 2)
219 { 220 {
220 Dictionary<string, string> param = new Dictionary<string, string>(); 221 Dictionary<string, string> param = new Dictionary<string, string>();
221 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%"; 222 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
222 param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%"; 223 param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%";
223 try 224 try
224 { 225 {
225 lock (database) 226 lock (database)
226 { 227 {
227
228
229 IDbCommand result = 228 IDbCommand result =
230 database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param); 229 database.Query(
230 "SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100",
231 param);
231 IDataReader reader = result.ExecuteReader(); 232 IDataReader reader = result.ExecuteReader();
232 233
233 234
234 while (reader.Read()) 235 while (reader.Read())
235 { 236 {
236 AvatarPickerAvatar user = new AvatarPickerAvatar(); 237 AvatarPickerAvatar user = new AvatarPickerAvatar();
237 user.AvatarID = new LLUUID((string)reader["UUID"]); 238 user.AvatarID = new LLUUID((string) reader["UUID"]);
238 user.firstName = (string)reader["username"]; 239 user.firstName = (string) reader["username"];
239 user.lastName = (string)reader["surname"]; 240 user.lastName = (string) reader["surname"];
240 returnlist.Add(user); 241 returnlist.Add(user);
241
242 } 242 }
243 reader.Close(); 243 reader.Close();
244 result.Dispose(); 244 result.Dispose();
@@ -250,33 +250,30 @@ namespace OpenSim.Framework.Data.MySQL
250 MainLog.Instance.Error(e.ToString()); 250 MainLog.Instance.Error(e.ToString());
251 return returnlist; 251 return returnlist;
252 } 252 }
253
254
255
256 } 253 }
257 else if (querysplit.Length == 1) 254 else if (querysplit.Length == 1)
258 { 255 {
259
260 try 256 try
261 { 257 {
262 lock (database) 258 lock (database)
263 { 259 {
264 Dictionary<string, string> param = new Dictionary<string, string>(); 260 Dictionary<string, string> param = new Dictionary<string, string>();
265 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0],"") + "%"; 261 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
266 262
267 IDbCommand result = 263 IDbCommand result =
268 database.Query("SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second", param); 264 database.Query(
265 "SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second",
266 param);
269 IDataReader reader = result.ExecuteReader(); 267 IDataReader reader = result.ExecuteReader();
270 268
271 269
272 while (reader.Read()) 270 while (reader.Read())
273 { 271 {
274 AvatarPickerAvatar user = new AvatarPickerAvatar(); 272 AvatarPickerAvatar user = new AvatarPickerAvatar();
275 user.AvatarID = new LLUUID((string)reader["UUID"]); 273 user.AvatarID = new LLUUID((string) reader["UUID"]);
276 user.firstName = (string)reader["username"]; 274 user.firstName = (string) reader["username"];
277 user.lastName = (string)reader["surname"]; 275 user.lastName = (string) reader["surname"];
278 returnlist.Add(user); 276 returnlist.Add(user);
279
280 } 277 }
281 reader.Close(); 278 reader.Close();
282 result.Dispose(); 279 result.Dispose();
@@ -413,4 +410,4 @@ namespace OpenSim.Framework.Data.MySQL
413 } 410 }
414 } 411 }
415 } 412 }
416} 413} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index a47a126..c317f4a 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
@@ -232,7 +232,7 @@ namespace OpenSim.Framework.Data.MySQL
232 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 232 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
233 while (reader.Read()) 233 while (reader.Read())
234 items.Add(readInventoryFolder(reader)); 234 items.Add(readInventoryFolder(reader));
235 235
236 InventoryFolderBase rootFolder = null; 236 InventoryFolderBase rootFolder = null;
237 237
238 // There should only ever be one root folder for a user. However, if there's more 238 // There should only ever be one root folder for a user. However, if there's more
@@ -637,4 +637,4 @@ namespace OpenSim.Framework.Data.MySQL
637 } 637 }
638 } 638 }
639 } 639 }
640} 640} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs
index eda5cc5..d2605fa 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs
@@ -103,4 +103,4 @@ namespace OpenSim.Framework.Data.MySQL
103 return "0.1"; 103 return "0.1";
104 } 104 }
105 } 105 }
106} 106} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index d652db8..96f0c4d 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -666,4 +666,4 @@ namespace OpenSim.Framework.Data.MySQL
666 return returnval; 666 return returnval;
667 } 667 }
668 } 668 }
669} 669} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
index 4b86d80..2d96f6e 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using System.Text.RegularExpressions;
31using libsecondlife; 32using libsecondlife;
32using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
33 34
@@ -61,7 +62,7 @@ namespace OpenSim.Framework.Data.MySQL
61 database = 62 database =
62 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, 63 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
63 settingPort); 64 settingPort);
64 65
65 TestTables(); 66 TestTables();
66 } 67 }
67 68
@@ -81,7 +82,7 @@ namespace OpenSim.Framework.Data.MySQL
81 UpgradeAgentsTable(tableList["agents"]); 82 UpgradeAgentsTable(tableList["agents"]);
82 UpgradeUsersTable(tableList["users"]); 83 UpgradeUsersTable(tableList["users"]);
83 } 84 }
84 85
85 /// <summary> 86 /// <summary>
86 /// Create or upgrade the table if necessary 87 /// Create or upgrade the table if necessary
87 /// </summary> 88 /// </summary>
@@ -95,8 +96,8 @@ namespace OpenSim.Framework.Data.MySQL
95 database.ExecuteResourceSql("CreateAgentsTable.sql"); 96 database.ExecuteResourceSql("CreateAgentsTable.sql");
96 return; 97 return;
97 } 98 }
98 } 99 }
99 100
100 /// <summary> 101 /// <summary>
101 /// Create or upgrade the table if necessary 102 /// Create or upgrade the table if necessary
102 /// </summary> 103 /// </summary>
@@ -110,8 +111,8 @@ namespace OpenSim.Framework.Data.MySQL
110 database.ExecuteResourceSql("CreateUsersTable.sql"); 111 database.ExecuteResourceSql("CreateUsersTable.sql");
111 return; 112 return;
112 } 113 }
113 } 114 }
114 115
115 #endregion 116 #endregion
116 117
117 // see IUserData 118 // see IUserData
@@ -144,11 +145,11 @@ namespace OpenSim.Framework.Data.MySQL
144 } 145 }
145 } 146 }
146 147
147 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 148 public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
148 { 149 {
149 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); 150 List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>();
150 151
151 System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]"); 152 Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
152 153
153 string[] querysplit; 154 string[] querysplit;
154 querysplit = query.Split(' '); 155 querysplit = query.Split(' ');
@@ -161,21 +162,20 @@ namespace OpenSim.Framework.Data.MySQL
161 { 162 {
162 lock (database) 163 lock (database)
163 { 164 {
164
165
166 IDbCommand result = 165 IDbCommand result =
167 database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100", param); 166 database.Query(
167 "SELECT UUID,username,lastname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100",
168 param);
168 IDataReader reader = result.ExecuteReader(); 169 IDataReader reader = result.ExecuteReader();
169 170
170 171
171 while (reader.Read()) 172 while (reader.Read())
172 { 173 {
173 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 174 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
174 user.AvatarID = new LLUUID((string)reader["UUID"]); 175 user.AvatarID = new LLUUID((string) reader["UUID"]);
175 user.firstName = (string)reader["username"]; 176 user.firstName = (string) reader["username"];
176 user.lastName = (string)reader["lastname"]; 177 user.lastName = (string) reader["lastname"];
177 returnlist.Add(user); 178 returnlist.Add(user);
178
179 } 179 }
180 reader.Close(); 180 reader.Close();
181 result.Dispose(); 181 result.Dispose();
@@ -187,13 +187,9 @@ namespace OpenSim.Framework.Data.MySQL
187 MainLog.Instance.Error(e.ToString()); 187 MainLog.Instance.Error(e.ToString());
188 return returnlist; 188 return returnlist;
189 } 189 }
190
191
192
193 } 190 }
194 else if (querysplit.Length == 1) 191 else if (querysplit.Length == 1)
195 { 192 {
196
197 try 193 try
198 { 194 {
199 lock (database) 195 lock (database)
@@ -202,18 +198,19 @@ namespace OpenSim.Framework.Data.MySQL
202 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%"; 198 param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
203 199
204 IDbCommand result = 200 IDbCommand result =
205 database.Query("SELECT UUID,username,lastname FROM users WHERE username like ?first OR lastname like ?first LIMIT 100", param); 201 database.Query(
202 "SELECT UUID,username,lastname FROM users WHERE username like ?first OR lastname like ?first LIMIT 100",
203 param);
206 IDataReader reader = result.ExecuteReader(); 204 IDataReader reader = result.ExecuteReader();
207 205
208 206
209 while (reader.Read()) 207 while (reader.Read())
210 { 208 {
211 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 209 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
212 user.AvatarID = new LLUUID((string)reader["UUID"]); 210 user.AvatarID = new LLUUID((string) reader["UUID"]);
213 user.firstName = (string)reader["username"]; 211 user.firstName = (string) reader["username"];
214 user.lastName = (string)reader["lastname"]; 212 user.lastName = (string) reader["lastname"];
215 returnlist.Add(user); 213 returnlist.Add(user);
216
217 } 214 }
218 reader.Close(); 215 reader.Close();
219 result.Dispose(); 216 result.Dispose();
@@ -402,4 +399,4 @@ namespace OpenSim.Framework.Data.MySQL
402 return "0.1"; 399 return "0.1";
403 } 400 }
404 } 401 }
405} 402} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs
index 3723343..462c433 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs
@@ -313,4 +313,4 @@ namespace OpenSim.Framework.Data.SQLite
313 313
314 #endregion 314 #endregion
315 } 315 }
316} 316} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs b/OpenSim/Framework/Data.SQLite/SQLiteBase.cs
index d9aaa97..2e8d341 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteBase.cs
@@ -263,4 +263,4 @@ namespace OpenSim.Framework.Data.SQLite
263 } 263 }
264 } 264 }
265 } 265 }
266} 266} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
index dddc085..4b790c3 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs
@@ -130,16 +130,17 @@ namespace OpenSim.Framework.Data.SQLite
130 130
131 return row; 131 return row;
132 } 132 }
133
133 /// <summary> 134 /// <summary>
134 /// // Returns a list of avatar and UUIDs that match the query 135 /// // Returns a list of avatar and UUIDs that match the query
135 /// </summary> 136 /// </summary>
136
137 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 137 public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
138 { 138 {
139 //Do nothing yet 139 //Do nothing yet
140 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 140 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
141 return returnlist; 141 return returnlist;
142 } 142 }
143
143 /// <summary> 144 /// <summary>
144 /// Adds a new specified region to the database 145 /// Adds a new specified region to the database
145 /// </summary> 146 /// </summary>
@@ -201,4 +202,4 @@ namespace OpenSim.Framework.Data.SQLite
201 return null; 202 return null;
202 } 203 }
203 } 204 }
204} 205} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index c696259..64a27f0 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -159,6 +159,7 @@ namespace OpenSim.Framework.Data.SQLite
159 159
160 invFoldersDa.Update(ds, "inventoryfolders"); 160 invFoldersDa.Update(ds, "inventoryfolders");
161 } 161 }
162
162 private void addItem(InventoryItemBase item) 163 private void addItem(InventoryItemBase item)
163 { 164 {
164 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 165 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
@@ -248,7 +249,8 @@ namespace OpenSim.Framework.Data.SQLite
248 { 249 {
249 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 250 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
250 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 251 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
251 string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" + Util.ToRawUuidString(LLUUID.Zero) + "'"; 252 string selectExp = "agentID = '" + Util.ToRawUuidString(user) + "' AND parentID = '" +
253 Util.ToRawUuidString(LLUUID.Zero) + "'";
252 DataRow[] rows = inventoryFolderTable.Select(selectExp); 254 DataRow[] rows = inventoryFolderTable.Select(selectExp);
253 foreach (DataRow row in rows) 255 foreach (DataRow row in rows)
254 { 256 {
@@ -627,4 +629,4 @@ namespace OpenSim.Framework.Data.SQLite
627 return true; 629 return true;
628 } 630 }
629 } 631 }
630} 632} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs
index cac37d4..a97b146 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs
@@ -275,4 +275,4 @@ namespace OpenSim.Framework.Data.SQLite
275 return returnval; 275 return returnval;
276 } 276 }
277 } 277 }
278} 278} \ No newline at end of file
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
index 811e0fa..a719fa2 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using libsecondlife; 31using libsecondlife;
32using Mono.Data.SqliteClient; 32using Mono.Data.SqliteClient;
33using OpenSim.Framework;
34using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
35 34
36namespace OpenSim.Framework.Data.SQLite 35namespace OpenSim.Framework.Data.SQLite
@@ -38,7 +37,6 @@ namespace OpenSim.Framework.Data.SQLite
38 /// <summary> 37 /// <summary>
39 /// A User storage interface for the SQLite database system 38 /// A User storage interface for the SQLite database system
40 /// </summary> 39 /// </summary>
41
42 public class SQLiteUserData : SQLiteBase, IUserData 40 public class SQLiteUserData : SQLiteBase, IUserData
43 { 41 {
44 /// <summary> 42 /// <summary>
@@ -119,46 +117,46 @@ namespace OpenSim.Framework.Data.SQLite
119 } 117 }
120 } 118 }
121 119
122 public List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) 120 public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
123 { 121 {
124 List<OpenSim.Framework.AvatarPickerAvatar> returnlist = new List<OpenSim.Framework.AvatarPickerAvatar>(); 122 List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>();
125 string[] querysplit; 123 string[] querysplit;
126 querysplit = query.Split(' '); 124 querysplit = query.Split(' ');
127 if (querysplit.Length == 2) 125 if (querysplit.Length == 2)
128 { 126 {
129 string select = "username like '" + querysplit[0] + "%' and surname like '" + querysplit[1] + "%'"; 127 string select = "username like '" + querysplit[0] + "%' and surname like '" + querysplit[1] + "%'";
130 lock(ds) 128 lock (ds)
131 { 129 {
132 DataRow[] rows = ds.Tables["users"].Select(select); 130 DataRow[] rows = ds.Tables["users"].Select(select);
133 if (rows.Length > 0) 131 if (rows.Length > 0)
134 { 132 {
135 for (int i = 0; i < rows.Length; i++) 133 for (int i = 0; i < rows.Length; i++)
136 { 134 {
137 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 135 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
138 DataRow row = rows[i]; 136 DataRow row = rows[i];
139 user.AvatarID = new LLUUID((string)row["UUID"]); 137 user.AvatarID = new LLUUID((string) row["UUID"]);
140 user.firstName = (string)row["username"]; 138 user.firstName = (string) row["username"];
141 user.lastName = (string)row["surname"]; 139 user.lastName = (string) row["surname"];
142 returnlist.Add(user); 140 returnlist.Add(user);
143 } 141 }
144 } 142 }
145 } 143 }
146 } 144 }
147 else if (querysplit.Length == 1) 145 else if (querysplit.Length == 1)
148 { 146 {
149
150 string select = "username like '" + querysplit[0] + "%' OR surname like '" + querysplit[0] + "%'"; 147 string select = "username like '" + querysplit[0] + "%' OR surname like '" + querysplit[0] + "%'";
151 lock(ds) 148 lock (ds)
152 { 149 {
153 DataRow[] rows = ds.Tables["users"].Select(select); 150 DataRow[] rows = ds.Tables["users"].Select(select);
154 if (rows.Length > 0) 151 if (rows.Length > 0)
155 { 152 {
156 for (int i = 0;i<rows.Length;i++) { 153 for (int i = 0; i < rows.Length; i++)
157 OpenSim.Framework.AvatarPickerAvatar user = new OpenSim.Framework.AvatarPickerAvatar(); 154 {
155 Framework.AvatarPickerAvatar user = new Framework.AvatarPickerAvatar();
158 DataRow row = rows[i]; 156 DataRow row = rows[i];
159 user.AvatarID = new LLUUID((string)row[0]); 157 user.AvatarID = new LLUUID((string) row[0]);
160 user.firstName = (string)row[1]; 158 user.firstName = (string) row[1];
161 user.lastName = (string)row[2]; 159 user.lastName = (string) row[2];
162 returnlist.Add(user); 160 returnlist.Add(user);
163 } 161 }
164 } 162 }
@@ -166,6 +164,7 @@ namespace OpenSim.Framework.Data.SQLite
166 } 164 }
167 return returnlist; 165 return returnlist;
168 } 166 }
167
169 /// <summary> 168 /// <summary>
170 /// Returns a user by UUID direct 169 /// Returns a user by UUID direct
171 /// </summary> 170 /// </summary>
@@ -263,7 +262,6 @@ namespace OpenSim.Framework.Data.SQLite
263 } 262 }
264 else 263 else
265 { 264 {
266
267 row.Delete(); 265 row.Delete();
268 ua.AcceptChanges(); 266 ua.AcceptChanges();
269 } 267 }
@@ -595,4 +593,4 @@ namespace OpenSim.Framework.Data.SQLite
595 return true; 593 return true;
596 } 594 }
597 } 595 }
598} 596} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs
index 7864dda..6072600 100644
--- a/OpenSim/Framework/Data/GridData.cs
+++ b/OpenSim/Framework/Data/GridData.cs
@@ -25,8 +25,8 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife;
29using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife;
30 30
31namespace OpenSim.Framework.Data 31namespace OpenSim.Framework.Data
32{ 32{
@@ -35,10 +35,12 @@ namespace OpenSim.Framework.Data
35 public LLUUID AvatarID; 35 public LLUUID AvatarID;
36 public string firstName; 36 public string firstName;
37 public string lastName; 37 public string lastName;
38
38 public AvatarPickerAvatar() 39 public AvatarPickerAvatar()
39 { 40 {
40 } 41 }
41 } 42 }
43
42 public enum DataResponse 44 public enum DataResponse
43 { 45 {
44 RESPONSE_OK, 46 RESPONSE_OK,
@@ -78,6 +80,7 @@ namespace OpenSim.Framework.Data
78 80
79 81
80 List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); 82 List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
83
81 /// <summary> 84 /// <summary>
82 /// Authenticates a sim by use of its recv key. 85 /// Authenticates a sim by use of its recv key.
83 /// WARNING: Insecure 86 /// WARNING: Insecure
@@ -119,4 +122,4 @@ namespace OpenSim.Framework.Data
119 122
120 ReservationData GetReservationAtPoint(uint x, uint y); 123 ReservationData GetReservationAtPoint(uint x, uint y);
121 } 124 }
122} 125} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/ILogData.cs b/OpenSim/Framework/Data/ILogData.cs
index 2c05f4f..8765b5c 100644
--- a/OpenSim/Framework/Data/ILogData.cs
+++ b/OpenSim/Framework/Data/ILogData.cs
@@ -88,4 +88,4 @@ namespace OpenSim.Framework.Data
88 /// <returns>A string containing the plugin version</returns> 88 /// <returns>A string containing the plugin version</returns>
89 string getVersion(); 89 string getVersion();
90 } 90 }
91} 91} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/IniConfig.cs b/OpenSim/Framework/Data/IniConfig.cs
index 6b02553..6af9770 100644
--- a/OpenSim/Framework/Data/IniConfig.cs
+++ b/OpenSim/Framework/Data/IniConfig.cs
@@ -95,4 +95,4 @@ namespace OpenSim.Framework.Data
95 95
96 private string _iniFileName; 96 private string _iniFileName;
97 } 97 }
98} 98} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs
index a1fe901..ec50baa 100644
--- a/OpenSim/Framework/Data/RegionProfileData.cs
+++ b/OpenSim/Framework/Data/RegionProfileData.cs
@@ -198,4 +198,4 @@ namespace OpenSim.Framework.Data
198 return simData; 198 return simData;
199 } 199 }
200 } 200 }
201} 201} \ No newline at end of file
diff --git a/OpenSim/Framework/Data/ReservationData.cs b/OpenSim/Framework/Data/ReservationData.cs
index acab400..285f9ca 100644
--- a/OpenSim/Framework/Data/ReservationData.cs
+++ b/OpenSim/Framework/Data/ReservationData.cs
@@ -44,4 +44,4 @@ namespace OpenSim.Framework.Data
44 public string gridSendKey = ""; 44 public string gridSendKey = "";
45 public string gridRecvKey = ""; 45 public string gridRecvKey = "";
46 } 46 }
47} 47} \ No newline at end of file
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index b95ca83..8c9d7f4 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -482,7 +482,7 @@ namespace OpenSim.Framework
482 // I don't think there is a reason that this actually 482 // I don't think there is a reason that this actually
483 // needs to be written back to the estate settings 483 // needs to be written back to the estate settings
484 // file. 484 // file.
485 485
486 // configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString()); 486 // configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString());
487 } 487 }
488 } 488 }
@@ -708,4 +708,4 @@ namespace OpenSim.Framework
708 return true; 708 return true;
709 } 709 }
710 } 710 }
711} 711} \ No newline at end of file
diff --git a/OpenSim/Framework/GridConfig.cs b/OpenSim/Framework/GridConfig.cs
index 799be46..8821010 100644
--- a/OpenSim/Framework/GridConfig.cs
+++ b/OpenSim/Framework/GridConfig.cs
@@ -93,7 +93,8 @@ namespace OpenSim.Framework
93 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, 93 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
94 "Http Listener port", DefaultHttpPort.ToString(), false); 94 "Http Listener port", DefaultHttpPort.ToString(), false);
95 95
96 configMember.addConfigurationOption("allow_forceful_banlines", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 96 configMember.addConfigurationOption("allow_forceful_banlines",
97 ConfigurationOption.ConfigurationTypes.TYPE_STRING,
97 "Allow Forceful Banlines", "TRUE", true); 98 "Allow Forceful Banlines", "TRUE", true);
98 } 99 }
99 100
@@ -135,7 +136,7 @@ namespace OpenSim.Framework
135 HttpPort = (uint) configuration_result; 136 HttpPort = (uint) configuration_result;
136 break; 137 break;
137 case "allow_forceful_banlines": 138 case "allow_forceful_banlines":
138 AllowForcefulBanlines = (string)configuration_result; 139 AllowForcefulBanlines = (string) configuration_result;
139 break; 140 break;
140 } 141 }
141 142
diff --git a/OpenSim/Framework/IAssetServer.cs b/OpenSim/Framework/IAssetServer.cs
index 2fa77a0..afd3687 100644
--- a/OpenSim/Framework/IAssetServer.cs
+++ b/OpenSim/Framework/IAssetServer.cs
@@ -60,4 +60,4 @@ namespace OpenSim.Framework
60 { 60 {
61 IAssetServer GetAssetServer(); 61 IAssetServer GetAssetServer();
62 } 62 }
63} 63} \ No newline at end of file
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 18ecd92..8ef5576 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -229,7 +229,8 @@ namespace OpenSim.Framework
229 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); 229 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
230 230
231 public delegate void ModifyTerrain( 231 public delegate void ModifyTerrain(
232 float height, float seconds, byte size, byte action, float north, float west, float south, float east, IClientAPI remoteClient); 232 float height, float seconds, byte size, byte action, float north, float west, float south, float east,
233 IClientAPI remoteClient);
233 234
234 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); 235 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
235 236
@@ -269,7 +270,8 @@ namespace OpenSim.Framework
269 270
270 public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); 271 public delegate void ObjectSelect(uint localID, IClientAPI remoteClient);
271 272
272 public delegate void RequestObjectPropertiesFamily(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags, LLUUID TaskID); 273 public delegate void RequestObjectPropertiesFamily(
274 IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags, LLUUID TaskID);
273 275
274 public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); 276 public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient);
275 277
@@ -297,13 +299,17 @@ namespace OpenSim.Framework
297 299
298 public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); 300 public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID);
299 301
300 public delegate void AvatarPickerRequest(IClientAPI remoteClient, LLUUID agentdata, LLUUID queryID, string UserQuery); 302 public delegate void AvatarPickerRequest(IClientAPI remoteClient, LLUUID agentdata, LLUUID queryID, string UserQuery
303 );
301 304
302 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); 305 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
303 306
304 public delegate void ParcelAccessListRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID,IClientAPI remote_client); 307 public delegate void ParcelAccessListRequest(
305 308 LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client);
306 public delegate void ParcelAccessListUpdateRequest(LLUUID agentID, LLUUID sessionID,uint flags, int landLocalID, List<libsecondlife.ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client); 309
310 public delegate void ParcelAccessListUpdateRequest(
311 LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID, List<ParcelManager.ParcelAccessEntry> entries,
312 IClientAPI remote_client);
307 313
308 public delegate void ParcelPropertiesRequest( 314 public delegate void ParcelPropertiesRequest(
309 int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); 315 int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
@@ -330,13 +336,14 @@ namespace OpenSim.Framework
330 336
331 public delegate void RequestGodlikePowers(LLUUID AgentID, LLUUID SessionID, LLUUID token, IClientAPI remote_client); 337 public delegate void RequestGodlikePowers(LLUUID AgentID, LLUUID SessionID, LLUUID token, IClientAPI remote_client);
332 338
333 public delegate void GodKickUser(LLUUID GodAgentID, LLUUID GodSessionID, LLUUID AgentID, uint kickflags, byte[] reason); 339 public delegate void GodKickUser(
340 LLUUID GodAgentID, LLUUID GodSessionID, LLUUID AgentID, uint kickflags, byte[] reason);
334 341
335 public delegate void CreateInventoryFolder( 342 public delegate void CreateInventoryFolder(
336 IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); 343 IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID);
337 344
338 public delegate void UpdateInventoryFolder( 345 public delegate void UpdateInventoryFolder(
339 IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID); 346 IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID);
340 347
341 public delegate void MoveInventoryFolder( 348 public delegate void MoveInventoryFolder(
342 IClientAPI remoteClient, LLUUID folderID, LLUUID parentID); 349 IClientAPI remoteClient, LLUUID folderID, LLUUID parentID);
@@ -360,7 +367,8 @@ namespace OpenSim.Framework
360 uint nextOwnerMask); 367 uint nextOwnerMask);
361 368
362 public delegate void CopyInventoryItem( 369 public delegate void CopyInventoryItem(
363 IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, string newName); 370 IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID,
371 string newName);
364 372
365 public delegate void MoveInventoryItem( 373 public delegate void MoveInventoryItem(
366 IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, string newName); 374 IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, string newName);
@@ -372,15 +380,18 @@ namespace OpenSim.Framework
372 public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID); 380 public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID);
373 381
374 public delegate void UDPAssetUploadRequest( 382 public delegate void UDPAssetUploadRequest(
375 IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal, bool tempFile); 383 IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal,
384 bool tempFile);
376 385
377 public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); 386 public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data);
378 387
379 public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); 388 public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName);
380 389
381 public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); 390 public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID);
382 391
383 public delegate void ObjectPermissions(IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID, List<ObjectPermissionsPacket.ObjectDataBlock> permChanges); 392 public delegate void ObjectPermissions(
393 IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID,
394 List<ObjectPermissionsPacket.ObjectDataBlock> permChanges);
384 395
385 public interface IClientAPI 396 public interface IClientAPI
386 { 397 {
@@ -472,19 +483,19 @@ namespace OpenSim.Framework
472 event EstateOwnerMessageRequest OnEstateOwnerMessage; 483 event EstateOwnerMessageRequest OnEstateOwnerMessage;
473 event RegionInfoRequest OnRegionInfoRequest; 484 event RegionInfoRequest OnRegionInfoRequest;
474 event EstateCovenantRequest OnEstateCovenantRequest; 485 event EstateCovenantRequest OnEstateCovenantRequest;
475 486
476 LLVector3 StartPos { get; set; } 487 LLVector3 StartPos { get; set; }
477 488
478 LLUUID AgentId { get; } 489 LLUUID AgentId { get; }
479 490
480 LLUUID SessionId { get; } 491 LLUUID SessionId { get; }
481 492
482 LLUUID SecureSessionId { get; } 493 LLUUID SecureSessionId { get; }
483 494
484 string FirstName { get; } 495 string FirstName { get; }
485 496
486 string LastName { get; } 497 string LastName { get; }
487 498
488 /// <summary> 499 /// <summary>
489 /// Returns the full name of the agent/avatar represented by this client 500 /// Returns the full name of the agent/avatar represented by this client
490 /// </summary> 501 /// </summary>
@@ -536,26 +547,29 @@ namespace OpenSim.Framework
536 547
537 void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); 548 void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
538 void SetChildAgentThrottle(byte[] throttle); 549 void SetChildAgentThrottle(byte[] throttle);
550
539 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, 551 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
540 LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, 552 LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color,
541 uint parentID, byte[] particleSystem, LLQuaternion rotation, byte clickAction); 553 uint parentID, byte[] particleSystem, LLQuaternion rotation, byte clickAction);
542 554
543 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, 555 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
544 LLQuaternion rotation); 556 LLQuaternion rotation);
557
545 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, 558 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
546 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity); 559 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity);
547 560
548 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, 561 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items,
549 List<InventoryFolderBase> folders, bool fetchFolders, 562 List<InventoryFolderBase> folders, bool fetchFolders,
550 bool fetchItems); 563 bool fetchItems);
564
551 void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); 565 void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
552 566
553 /// <summary> 567 /// <summary>
554 /// Tell the client that we have created the item it requested. 568 /// Tell the client that we have created the item it requested.
555 /// </summary> 569 /// </summary>
556 /// <param name="Item"></param> 570 /// <param name="Item"></param>
557 void SendInventoryItemCreateUpdate(InventoryItemBase Item); 571 void SendInventoryItemCreateUpdate(InventoryItemBase Item);
558 572
559 void SendRemoveInventoryItem(LLUUID itemID); 573 void SendRemoveInventoryItem(LLUUID itemID);
560 void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); 574 void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName);
561 void SendXferPacket(ulong xferID, uint packet, byte[] data); 575 void SendXferPacket(ulong xferID, uint packet, byte[] data);
@@ -566,7 +580,7 @@ namespace OpenSim.Framework
566 580
567 void SendNameReply(LLUUID profileId, string firstname, string lastname); 581 void SendNameReply(LLUUID profileId, string firstname, string lastname);
568 void SendAlertMessage(string message); 582 void SendAlertMessage(string message);
569 583
570 void SendAgentAlertMessage(string message, bool modal); 584 void SendAgentAlertMessage(string message, bool modal);
571 void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); 585 void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
572 bool AddMoney(int debit); 586 bool AddMoney(int debit);
@@ -587,4 +601,4 @@ namespace OpenSim.Framework
587 event Action<IClientAPI> OnConnectionClosed; 601 event Action<IClientAPI> OnConnectionClosed;
588 void SendLogoutPacket(); 602 void SendLogoutPacket();
589 } 603 }
590} 604} \ No newline at end of file
diff --git a/OpenSim/Framework/IGenericConfig.cs b/OpenSim/Framework/IGenericConfig.cs
index cf742cc..0c9689c 100644
--- a/OpenSim/Framework/IGenericConfig.cs
+++ b/OpenSim/Framework/IGenericConfig.cs
@@ -37,4 +37,4 @@ namespace OpenSim.Framework
37 void Commit(); 37 void Commit();
38 void Close(); 38 void Close();
39 } 39 }
40} 40} \ No newline at end of file
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs
index 363ab27..19608c8 100644
--- a/OpenSim/Framework/IRegionCommsListener.cs
+++ b/OpenSim/Framework/IRegionCommsListener.cs
@@ -51,8 +51,6 @@ namespace OpenSim.Framework
51 public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData); 51 public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
52 52
53 53
54
55
56 public interface IRegionCommsListener 54 public interface IRegionCommsListener
57 { 55 {
58 event ExpectUserDelegate OnExpectUser; 56 event ExpectUserDelegate OnExpectUser;
@@ -66,6 +64,5 @@ namespace OpenSim.Framework
66 event CloseAgentConnection OnCloseAgentConnection; 64 event CloseAgentConnection OnCloseAgentConnection;
67 event RegionUp OnRegionUp; 65 event RegionUp OnRegionUp;
68 event ChildAgentUpdate OnChildAgentUpdate; 66 event ChildAgentUpdate OnChildAgentUpdate;
69
70 } 67 }
71} 68} \ No newline at end of file
diff --git a/OpenSim/Framework/IRegionLoader.cs b/OpenSim/Framework/IRegionLoader.cs
index fe74737..f3e0a23 100644
--- a/OpenSim/Framework/IRegionLoader.cs
+++ b/OpenSim/Framework/IRegionLoader.cs
@@ -26,11 +26,8 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Framework;
33using Nini.Config; 29using Nini.Config;
30
34namespace OpenSim.Framework 31namespace OpenSim.Framework
35{ 32{
36 public interface IRegionLoader 33 public interface IRegionLoader
@@ -38,4 +35,4 @@ namespace OpenSim.Framework
38 void SetIniConfigSource(IniConfigSource configSource); 35 void SetIniConfigSource(IniConfigSource configSource);
39 RegionInfo[] LoadRegions(); 36 RegionInfo[] LoadRegions();
40 } 37 }
41} 38} \ No newline at end of file
diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs
index 4b6e9a5..7b9eced 100644
--- a/OpenSim/Framework/IScene.cs
+++ b/OpenSim/Framework/IScene.cs
@@ -29,7 +29,8 @@ using libsecondlife;
29 29
30namespace OpenSim.Framework 30namespace OpenSim.Framework
31{ 31{
32 public delegate void restart( RegionInfo thisRegion ); 32 public delegate void restart(RegionInfo thisRegion);
33
33 //public delegate void regionup ( RegionInfo thisRegion ); 34 //public delegate void regionup ( RegionInfo thisRegion );
34 35
35 public enum RegionStatus : int 36 public enum RegionStatus : int
@@ -38,7 +39,7 @@ namespace OpenSim.Framework
38 Up = 1, 39 Up = 1,
39 Crashed = 2, 40 Crashed = 2,
40 Starting = 3 41 Starting = 3
41 }; 42 } ;
42 43
43 public interface IScene 44 public interface IScene
44 { 45 {
@@ -58,4 +59,4 @@ namespace OpenSim.Framework
58 59
59 ClientManager ClientManager { get; } 60 ClientManager ClientManager { get; }
60 } 61 }
61} 62} \ No newline at end of file
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs
index 0679a68..d06784c 100644
--- a/OpenSim/Framework/IUserData.cs
+++ b/OpenSim/Framework/IUserData.cs
@@ -25,8 +25,8 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife;
29using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife;
30 30
31namespace OpenSim.Framework 31namespace OpenSim.Framework
32{ 32{
@@ -50,7 +50,7 @@ namespace OpenSim.Framework
50 /// <returns>The user data profile</returns> 50 /// <returns>The user data profile</returns>
51 UserProfileData GetUserByName(string fname, string lname); 51 UserProfileData GetUserByName(string fname, string lname);
52 52
53 List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); 53 List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
54 54
55 /// <summary> 55 /// <summary>
56 /// Returns the current agent for a user searching by it's UUID 56 /// Returns the current agent for a user searching by it's UUID
@@ -127,13 +127,15 @@ namespace OpenSim.Framework
127 /// </summary> 127 /// </summary>
128 void Initialise(); 128 void Initialise();
129 } 129 }
130
130 public class AvatarPickerAvatar 131 public class AvatarPickerAvatar
131 { 132 {
132 public LLUUID AvatarID; 133 public LLUUID AvatarID;
133 public string firstName; 134 public string firstName;
134 public string lastName; 135 public string lastName;
136
135 public AvatarPickerAvatar() 137 public AvatarPickerAvatar()
136 { 138 {
137 } 139 }
138 } 140 }
139} 141} \ No newline at end of file
diff --git a/OpenSim/Framework/IUserService.cs b/OpenSim/Framework/IUserService.cs
index 3440e30..2b08582 100644
--- a/OpenSim/Framework/IUserService.cs
+++ b/OpenSim/Framework/IUserService.cs
@@ -25,8 +25,8 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife;
29using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife;
30 30
31namespace OpenSim.Framework 31namespace OpenSim.Framework
32{ 32{
@@ -48,4 +48,4 @@ namespace OpenSim.Framework
48 /// <param name="user"></param> 48 /// <param name="user"></param>
49 LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); 49 LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
50 } 50 }
51} 51} \ No newline at end of file
diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs
index 8cb3e73..c60fb01 100644
--- a/OpenSim/Framework/InventoryItemBase.cs
+++ b/OpenSim/Framework/InventoryItemBase.cs
@@ -291,4 +291,4 @@ namespace OpenSim.Framework
291 291
292 [XmlElement(ElementName = "folder", IsNullable = true)] public SerializableFolder root; 292 [XmlElement(ElementName = "folder", IsNullable = true)] public SerializableFolder root;
293 } 293 }
294} 294} \ No newline at end of file
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index 1a94cfd..885545d 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -25,8 +25,9 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife;
29using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife;
30
30namespace OpenSim.Framework 31namespace OpenSim.Framework
31{ 32{
32 public class LandData 33 public class LandData
@@ -53,7 +54,7 @@ namespace OpenSim.Framework
53 public int simwideArea = 0; 54 public int simwideArea = 0;
54 public int salePrice = 0; //Unemeplemented. Parcels price. 55 public int salePrice = 0; //Unemeplemented. Parcels price.
55 public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased; 56 public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased;
56 57
57 public uint landFlags = (uint) Parcel.ParcelFlags.AllowFly | (uint) Parcel.ParcelFlags.AllowLandmark | 58 public uint landFlags = (uint) Parcel.ParcelFlags.AllowFly | (uint) Parcel.ParcelFlags.AllowLandmark |
58 (uint) Parcel.ParcelFlags.AllowAllObjectEntry | 59 (uint) Parcel.ParcelFlags.AllowAllObjectEntry |
59 (uint) Parcel.ParcelFlags.AllowDeedToGroup | (uint) Parcel.ParcelFlags.AllowTerraform | 60 (uint) Parcel.ParcelFlags.AllowDeedToGroup | (uint) Parcel.ParcelFlags.AllowTerraform |
@@ -133,4 +134,4 @@ namespace OpenSim.Framework
133 return landData; 134 return landData;
134 } 135 }
135 } 136 }
136} 137} \ No newline at end of file
diff --git a/OpenSim/Framework/Login.cs b/OpenSim/Framework/Login.cs
index 1da0a2b..5228fe9 100644
--- a/OpenSim/Framework/Login.cs
+++ b/OpenSim/Framework/Login.cs
@@ -47,4 +47,4 @@ namespace OpenSim.Framework
47 StartPos = new LLVector3(128, 128, 70); 47 StartPos = new LLVector3(128, 128, 70);
48 } 48 }
49 } 49 }
50} 50} \ No newline at end of file
diff --git a/OpenSim/Framework/NeighbourInfo.cs b/OpenSim/Framework/NeighbourInfo.cs
index ca98cd1..ddf9df6 100644
--- a/OpenSim/Framework/NeighbourInfo.cs
+++ b/OpenSim/Framework/NeighbourInfo.cs
@@ -39,4 +39,4 @@ namespace OpenSim.Framework
39 public string sim_ip; 39 public string sim_ip;
40 public uint sim_port; 40 public uint sim_port;
41 } 41 }
42} 42} \ No newline at end of file
diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs
index 6f8ff7d..cf1457d 100644
--- a/OpenSim/Framework/NetworkServersInfo.cs
+++ b/OpenSim/Framework/NetworkServersInfo.cs
@@ -80,8 +80,10 @@ namespace OpenSim.Framework
80 m_defaultHomeLocX = (uint) config.Configs["StandAlone"].GetInt("default_location_x", 1000); 80 m_defaultHomeLocX = (uint) config.Configs["StandAlone"].GetInt("default_location_x", 1000);
81 m_defaultHomeLocY = (uint) config.Configs["StandAlone"].GetInt("default_location_y", 1000); 81 m_defaultHomeLocY = (uint) config.Configs["StandAlone"].GetInt("default_location_y", 1000);
82 82
83 HttpListenerPort = (uint) config.Configs["Network"].GetInt("http_listener_port", (int) DefaultHttpListenerPort); 83 HttpListenerPort =
84 RemotingListenerPort = (uint) config.Configs["Network"].GetInt("remoting_listener_port", (int) RemotingListenerPort); 84 (uint) config.Configs["Network"].GetInt("http_listener_port", (int) DefaultHttpListenerPort);
85 RemotingListenerPort =
86 (uint) config.Configs["Network"].GetInt("remoting_listener_port", (int) RemotingListenerPort);
85 GridURL = 87 GridURL =
86 config.Configs["Network"].GetString("grid_server_url", 88 config.Configs["Network"].GetString("grid_server_url",
87 "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); 89 "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString());
@@ -98,4 +100,4 @@ namespace OpenSim.Framework
98 InventoryConfig.DefaultHttpPort.ToString()); 100 InventoryConfig.DefaultHttpPort.ToString());
99 } 101 }
100 } 102 }
101} 103} \ No newline at end of file
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 98e583e..c29b973 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using System;
29using System.Xml.Serialization; 30using System.Xml.Serialization;
30using libsecondlife; 31using libsecondlife;
31using System;
32 32
33namespace OpenSim.Framework 33namespace OpenSim.Framework
34{ 34{
@@ -91,32 +91,21 @@ namespace OpenSim.Framework
91 public sbyte PathTwist; 91 public sbyte PathTwist;
92 public sbyte PathTwistBegin; 92 public sbyte PathTwistBegin;
93 93
94 [XmlIgnore] 94 [XmlIgnore]
95 public LLObject.TextureEntry Textures 95 public LLObject.TextureEntry Textures
96 { 96 {
97 get 97 get { return new LLObject.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); }
98 {
99 return new LLObject.TextureEntry(m_textureEntry, 0, m_textureEntry.Length);
100 }
101 98
102 set 99 set { m_textureEntry = value.ToBytes(); }
103 {
104 m_textureEntry = value.ToBytes();
105 }
106 } 100 }
107 101
108 private byte[] m_textureEntry; 102 private byte[] m_textureEntry;
103
109 public byte[] TextureEntry 104 public byte[] TextureEntry
110 { 105 {
111 get 106 get { return m_textureEntry; }
112 {
113 return m_textureEntry;
114 }
115 107
116 set 108 set { m_textureEntry = value; }
117 {
118 m_textureEntry = value;
119 }
120 } 109 }
121 110
122 public byte[] ExtraParams; 111 public byte[] ExtraParams;
@@ -134,11 +123,11 @@ namespace OpenSim.Framework
134 [XmlIgnore] 123 [XmlIgnore]
135 public HollowShape HollowShape 124 public HollowShape HollowShape
136 { 125 {
137 get { return (HollowShape)(ProfileCurve & 0xf0); } 126 get { return (HollowShape) (ProfileCurve & 0xf0); }
138 set 127 set
139 { 128 {
140 byte oldValueMasked = (byte)(ProfileCurve & 0x0f); 129 byte oldValueMasked = (byte) (ProfileCurve & 0x0f);
141 ProfileCurve = (byte)(oldValueMasked | (byte)value); 130 ProfileCurve = (byte) (oldValueMasked | (byte) value);
142 } 131 }
143 } 132 }
144 133
@@ -147,7 +136,6 @@ namespace OpenSim.Framework
147 get { return Scale; } 136 get { return Scale; }
148 } 137 }
149 138
150
151 139
152 static PrimitiveBaseShape() 140 static PrimitiveBaseShape()
153 { 141 {
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs
index a146778..9472a9e 100644
--- a/OpenSim/Framework/RegionCommsListener.cs
+++ b/OpenSim/Framework/RegionCommsListener.cs
@@ -44,10 +44,10 @@ namespace OpenSim.Framework
44 public event CloseAgentConnection OnCloseAgentConnection; 44 public event CloseAgentConnection OnCloseAgentConnection;
45 public event RegionUp OnRegionUp; 45 public event RegionUp OnRegionUp;
46 public event ChildAgentUpdate OnChildAgentUpdate; 46 public event ChildAgentUpdate OnChildAgentUpdate;
47
48 47
49 public string debugRegionName=""; 48
50 49 public string debugRegionName = "";
50
51 51
52 /// <summary> 52 /// <summary>
53 /// 53 ///
@@ -66,7 +66,6 @@ namespace OpenSim.Framework
66 } 66 }
67 67
68 68
69
70 public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData) 69 public virtual bool TriggerExpectPrim(ulong regionHandle, LLUUID primID, string objData)
71 { 70 {
72 if (OnExpectUser != null) 71 if (OnExpectUser != null)
@@ -107,7 +106,9 @@ namespace OpenSim.Framework
107 } 106 }
108 return false; 107 return false;
109 } 108 }
110 public virtual bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) 109
110 public virtual bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position,
111 bool isPhysical)
111 { 112 {
112 if (OnPrimCrossingIntoRegion != null) 113 if (OnPrimCrossingIntoRegion != null)
113 { 114 {
@@ -178,4 +179,4 @@ namespace OpenSim.Framework
178 return false; 179 return false;
179 } 180 }
180 } 181 }
181} 182} \ No newline at end of file
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index c4557f8..8c25603 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -26,16 +26,11 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Globalization;
30using System.Net; 29using System.Net;
31using System.Xml;
32using System.Net.Sockets; 30using System.Net.Sockets;
33using Nini.Config; 31using System.Xml;
34using libsecondlife; 32using libsecondlife;
35using OpenSim.Framework.Console; 33using Nini.Config;
36using OpenSim.Framework;
37
38
39 34
40namespace OpenSim.Framework 35namespace OpenSim.Framework
41{ 36{
@@ -64,6 +59,7 @@ namespace OpenSim.Framework
64 59
65 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port); 60 m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
66 } 61 }
62
67 public SimpleRegionInfo(RegionInfo ConvertFrom) 63 public SimpleRegionInfo(RegionInfo ConvertFrom)
68 { 64 {
69 m_regionLocX = ConvertFrom.RegionLocX; 65 m_regionLocX = ConvertFrom.RegionLocX;
@@ -78,16 +74,11 @@ namespace OpenSim.Framework
78 public LLUUID RegionID = LLUUID.Zero; 74 public LLUUID RegionID = LLUUID.Zero;
79 75
80 public uint m_remotingPort; 76 public uint m_remotingPort;
77
81 public uint RemotingPort 78 public uint RemotingPort
82 { 79 {
83 get 80 get { return m_remotingPort; }
84 { 81 set { m_remotingPort = value; }
85 return m_remotingPort;
86 }
87 set
88 {
89 m_remotingPort = value;
90 }
91 } 82 }
92 83
93 public string RemotingAddress; 84 public string RemotingAddress;
@@ -123,73 +114,47 @@ namespace OpenSim.Framework
123 return new IPEndPoint(ia, m_internalEndPoint.Port); 114 return new IPEndPoint(ia, m_internalEndPoint.Port);
124 } 115 }
125 116
126 set 117 set { m_externalHostName = value.ToString(); }
127 {
128 m_externalHostName = value.ToString();
129 }
130 } 118 }
131 119
132 protected string m_externalHostName; 120 protected string m_externalHostName;
121
133 public string ExternalHostName 122 public string ExternalHostName
134 { 123 {
135 get 124 get { return m_externalHostName; }
136 { 125 set { m_externalHostName = value; }
137 return m_externalHostName;
138 }
139 set
140 {
141 m_externalHostName = value;
142 }
143 } 126 }
144 127
145 protected IPEndPoint m_internalEndPoint; 128 protected IPEndPoint m_internalEndPoint;
129
146 public IPEndPoint InternalEndPoint 130 public IPEndPoint InternalEndPoint
147 { 131 {
148 get 132 get { return m_internalEndPoint; }
149 { 133 set { m_internalEndPoint = value; }
150 return m_internalEndPoint;
151 }
152 set
153 {
154 m_internalEndPoint = value;
155 }
156 } 134 }
157 135
158 protected uint? m_regionLocX; 136 protected uint? m_regionLocX;
137
159 public uint RegionLocX 138 public uint RegionLocX
160 { 139 {
161 get 140 get { return m_regionLocX.Value; }
162 { 141 set { m_regionLocX = value; }
163 return m_regionLocX.Value;
164 }
165 set
166 {
167 m_regionLocX = value;
168 }
169 } 142 }
170 143
171 protected uint? m_regionLocY; 144 protected uint? m_regionLocY;
145
172 public uint RegionLocY 146 public uint RegionLocY
173 { 147 {
174 get 148 get { return m_regionLocY.Value; }
175 { 149 set { m_regionLocY = value; }
176 return m_regionLocY.Value;
177 }
178 set
179 {
180 m_regionLocY = value;
181 }
182 } 150 }
183 151
184 public ulong RegionHandle 152 public ulong RegionHandle
185 { 153 {
186 get 154 get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); }
187 {
188 return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
189 }
190 } 155 }
191 } 156 }
192 157
193 public class RegionInfo : SimpleRegionInfo 158 public class RegionInfo : SimpleRegionInfo
194 { 159 {
195 public string RegionName = ""; 160 public string RegionName = "";
@@ -206,15 +171,16 @@ namespace OpenSim.Framework
206 171
207 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 172 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
208 private static EstateSettings m_estateSettings; 173 private static EstateSettings m_estateSettings;
174
209 public EstateSettings EstateSettings 175 public EstateSettings EstateSettings
210 { 176 {
211 get 177 get
212 { 178 {
213 if( m_estateSettings == null ) 179 if (m_estateSettings == null)
214 { 180 {
215 m_estateSettings = new EstateSettings(); 181 m_estateSettings = new EstateSettings();
216 } 182 }
217 183
218 return m_estateSettings; 184 return m_estateSettings;
219 } 185 }
220 } 186 }
@@ -223,14 +189,18 @@ namespace OpenSim.Framework
223 189
224 public RegionInfo(string description, string filename) 190 public RegionInfo(string description, string filename)
225 { 191 {
226 configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); 192 configMember =
193 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
227 configMember.performConfigurationRetrieve(); 194 configMember.performConfigurationRetrieve();
228 } 195 }
196
229 public RegionInfo(string description, XmlNode xmlNode) 197 public RegionInfo(string description, XmlNode xmlNode)
230 { 198 {
231 configMember = new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration); 199 configMember =
200 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration);
232 configMember.performConfigurationRetrieve(); 201 configMember.performConfigurationRetrieve();
233 } 202 }
203
234 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : 204 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) :
235 base(regionLocX, regionLocY, internalEndPoint, externalUri) 205 base(regionLocX, regionLocY, internalEndPoint, externalUri)
236 { 206 {
@@ -239,6 +209,7 @@ namespace OpenSim.Framework
239 public RegionInfo() 209 public RegionInfo()
240 { 210 {
241 } 211 }
212
242 public RegionInfo(SearializableRegionInfo ConvertFrom) 213 public RegionInfo(SearializableRegionInfo ConvertFrom)
243 { 214 {
244 m_regionLocX = ConvertFrom.RegionLocX; 215 m_regionLocX = ConvertFrom.RegionLocX;
@@ -249,6 +220,7 @@ namespace OpenSim.Framework
249 RemotingAddress = ConvertFrom.RemotingAddress; 220 RemotingAddress = ConvertFrom.RemotingAddress;
250 RegionID = LLUUID.Zero; 221 RegionID = LLUUID.Zero;
251 } 222 }
223
252 public RegionInfo(SimpleRegionInfo ConvertFrom) 224 public RegionInfo(SimpleRegionInfo ConvertFrom)
253 { 225 {
254 m_regionLocX = ConvertFrom.RegionLocX; 226 m_regionLocX = ConvertFrom.RegionLocX;
@@ -259,47 +231,49 @@ namespace OpenSim.Framework
259 RemotingAddress = ConvertFrom.RemotingAddress; 231 RemotingAddress = ConvertFrom.RemotingAddress;
260 RegionID = LLUUID.Zero; 232 RegionID = LLUUID.Zero;
261 } 233 }
234
262 //not in use, should swap to nini though. 235 //not in use, should swap to nini though.
263 public void LoadFromNiniSource(IConfigSource source) 236 public void LoadFromNiniSource(IConfigSource source)
264 { 237 {
265 this.LoadFromNiniSource(source, "RegionInfo"); 238 LoadFromNiniSource(source, "RegionInfo");
266 } 239 }
267 240
268 //not in use, should swap to nini though. 241 //not in use, should swap to nini though.
269 public void LoadFromNiniSource(IConfigSource source, string sectionName) 242 public void LoadFromNiniSource(IConfigSource source, string sectionName)
270 { 243 {
271 string errorMessage = ""; 244 string errorMessage = "";
272 this.RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToString())); 245 RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToString()));
273 this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); 246 RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test");
274 this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); 247 m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000"));
275 this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); 248 m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000"));
276 // this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); 249 // this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db");
277 250
278 string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); 251 string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0");
279 IPAddress ipAddressResult; 252 IPAddress ipAddressResult;
280 if (IPAddress.TryParse(ipAddress, out ipAddressResult)) 253 if (IPAddress.TryParse(ipAddress, out ipAddressResult))
281 { 254 {
282 this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); 255 m_internalEndPoint = new IPEndPoint(ipAddressResult, 0);
283 } 256 }
284 else 257 else
285 { 258 {
286 errorMessage = "needs an IP Address (IPAddress)"; 259 errorMessage = "needs an IP Address (IPAddress)";
287 } 260 }
288 this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", (int) NetworkServersInfo.DefaultHttpListenerPort); 261 m_internalEndPoint.Port =
262 source.Configs[sectionName].GetInt("internal_ip_port", (int) NetworkServersInfo.DefaultHttpListenerPort);
289 263
290 string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); 264 string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1");
291 if (externalHost != "SYSTEMIP") 265 if (externalHost != "SYSTEMIP")
292 { 266 {
293 this.m_externalHostName = externalHost; 267 m_externalHostName = externalHost;
294 } 268 }
295 else 269 else
296 { 270 {
297 this.m_externalHostName = Util.GetLocalHost().ToString(); 271 m_externalHostName = Util.GetLocalHost().ToString();
298 } 272 }
299 273
300 this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); 274 MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test");
301 this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); 275 MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User");
302 this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); 276 MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test");
303 277
304 if (errorMessage != "") 278 if (errorMessage != "")
305 { 279 {
@@ -309,19 +283,45 @@ namespace OpenSim.Framework
309 283
310 public void loadConfigurationOptions() 284 public void loadConfigurationOptions()
311 { 285 {
312 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Region (Default is recommended, random UUID)", LLUUID.Random().ToString(), true); 286 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
313 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Region Name", "OpenSim Test", false); 287 "UUID of Region (Default is recommended, random UUID)",
314 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); 288 LLUUID.Random().ToString(), true);
315 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); 289 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
290 "Region Name", "OpenSim Test", false);
291 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
292 "Grid Location (X Axis)", "1000", false);
293 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
294 "Grid Location (Y Axis)", "1000", false);
316 //configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); 295 //configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
317 configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); 296 configMember.addConfigurationOption("internal_ip_address",
318 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); 297 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
319 configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); 298 "Internal IP Address for incoming UDP client connections", "0.0.0.0",
320 configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Master Avatar UUID", LLUUID.Zero.ToString(), true); 299 false);
321 configMember.addConfigurationOption("estate_covanant_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Estate Covenant", LLUUID.Zero.ToString(), true); 300 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
322 configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false,(ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked); 301 "Internal IP Port for incoming UDP client connections",
323 configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false, (ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked); 302 NetworkServersInfo.DefaultHttpListenerPort.ToString(), false);
324 configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false, (ConfigurationOption.ConfigurationOptionShouldBeAsked)shouldMasterAvatarDetailsBeAsked); 303 configMember.addConfigurationOption("external_host_name",
304 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
305 "External Host Name", "127.0.0.1", false);
306 configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
307 "Master Avatar UUID", LLUUID.Zero.ToString(), true);
308 configMember.addConfigurationOption("estate_covanant_uuid",
309 ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Estate Covenant",
310 LLUUID.Zero.ToString(), true);
311 configMember.addConfigurationOption("master_avatar_first",
312 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
313 "First Name of Master Avatar", "Test", false,
314 (ConfigurationOption.ConfigurationOptionShouldBeAsked)
315 shouldMasterAvatarDetailsBeAsked);
316 configMember.addConfigurationOption("master_avatar_last",
317 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
318 "Last Name of Master Avatar", "User", false,
319 (ConfigurationOption.ConfigurationOptionShouldBeAsked)
320 shouldMasterAvatarDetailsBeAsked);
321 configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
322 "(Sandbox Mode Only)Password for Master Avatar account", "test", false,
323 (ConfigurationOption.ConfigurationOptionShouldBeAsked)
324 shouldMasterAvatarDetailsBeAsked);
325 } 325 }
326 326
327 public bool shouldMasterAvatarDetailsBeAsked(string configuration_key) 327 public bool shouldMasterAvatarDetailsBeAsked(string configuration_key)
@@ -338,58 +338,57 @@ namespace OpenSim.Framework
338 switch (configuration_key) 338 switch (configuration_key)
339 { 339 {
340 case "sim_UUID": 340 case "sim_UUID":
341 this.RegionID = (LLUUID)configuration_result; 341 RegionID = (LLUUID) configuration_result;
342 break; 342 break;
343 case "sim_name": 343 case "sim_name":
344 this.RegionName = (string)configuration_result; 344 RegionName = (string) configuration_result;
345 break; 345 break;
346 case "sim_location_x": 346 case "sim_location_x":
347 this.m_regionLocX = (uint)configuration_result; 347 m_regionLocX = (uint) configuration_result;
348 break; 348 break;
349 case "sim_location_y": 349 case "sim_location_y":
350 this.m_regionLocY = (uint)configuration_result; 350 m_regionLocY = (uint) configuration_result;
351 break; 351 break;
352 case "datastore": 352 case "datastore":
353 this.DataStore = (string)configuration_result; 353 DataStore = (string) configuration_result;
354 break; 354 break;
355 case "internal_ip_address": 355 case "internal_ip_address":
356 IPAddress address = (IPAddress)configuration_result; 356 IPAddress address = (IPAddress) configuration_result;
357 this.m_internalEndPoint = new IPEndPoint(address, 0); 357 m_internalEndPoint = new IPEndPoint(address, 0);
358 break; 358 break;
359 case "internal_ip_port": 359 case "internal_ip_port":
360 this.m_internalEndPoint.Port = (int)configuration_result; 360 m_internalEndPoint.Port = (int) configuration_result;
361 break; 361 break;
362 case "external_host_name": 362 case "external_host_name":
363 if ((string)configuration_result != "SYSTEMIP") 363 if ((string) configuration_result != "SYSTEMIP")
364 { 364 {
365 this.m_externalHostName = (string)configuration_result; 365 m_externalHostName = (string) configuration_result;
366 } 366 }
367 else 367 else
368 { 368 {
369 this.m_externalHostName = Util.GetLocalHost().ToString(); 369 m_externalHostName = Util.GetLocalHost().ToString();
370 } 370 }
371 break; 371 break;
372 case "master_avatar_uuid": 372 case "master_avatar_uuid":
373 this.MasterAvatarAssignedUUID = (LLUUID)configuration_result; 373 MasterAvatarAssignedUUID = (LLUUID) configuration_result;
374 break; 374 break;
375 case "estate_covanant_uuid": 375 case "estate_covanant_uuid":
376 this.CovenantID = (LLUUID)configuration_result; 376 CovenantID = (LLUUID) configuration_result;
377 break; 377 break;
378 378
379 case "master_avatar_first": 379 case "master_avatar_first":
380 this.MasterAvatarFirstName = (string)configuration_result; 380 MasterAvatarFirstName = (string) configuration_result;
381 break; 381 break;
382 case "master_avatar_last": 382 case "master_avatar_last":
383 this.MasterAvatarLastName = (string)configuration_result; 383 MasterAvatarLastName = (string) configuration_result;
384 break; 384 break;
385 case "master_avatar_pass": 385 case "master_avatar_pass":
386 string tempMD5Passwd = (string)configuration_result; 386 string tempMD5Passwd = (string) configuration_result;
387 this.MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); 387 MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
388 break; 388 break;
389 } 389 }
390 390
391 return true; 391 return true;
392 } 392 }
393
394 } 393 }
395} 394} \ No newline at end of file
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
index fb50171..a710f50 100644
--- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
+++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
@@ -25,12 +25,8 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic;
30using System.Text;
31using Nini.Config;
32using OpenSim.Framework;
33using System.IO; 28using System.IO;
29using Nini.Config;
34 30
35namespace OpenSim.Framework.RegionLoader.Filesystem 31namespace OpenSim.Framework.RegionLoader.Filesystem
36{ 32{
@@ -67,4 +63,4 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
67 return regionInfos; 63 return regionInfos;
68 } 64 }
69 } 65 }
70} 66} \ No newline at end of file
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
index ec7059a..1625fa6 100644
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
@@ -25,48 +25,46 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Net;
30using System.IO; 28using System.IO;
29using System.Net;
31using System.Xml; 30using System.Xml;
32using System.Collections.Generic;
33using System.Text;
34using Nini.Config; 31using Nini.Config;
35using OpenSim.Framework; 32using OpenSim.Framework.Console;
36 33
37namespace OpenSim.Framework.RegionLoader.Web 34namespace OpenSim.Framework.RegionLoader.Web
38{ 35{
39 public class RegionLoaderWebServer : IRegionLoader 36 public class RegionLoaderWebServer : IRegionLoader
40 { 37 {
41 private IniConfigSource m_configSouce; 38 private IniConfigSource m_configSouce;
39
42 public void SetIniConfigSource(IniConfigSource configSource) 40 public void SetIniConfigSource(IniConfigSource configSource)
43 { 41 {
44 m_configSouce = configSource; 42 m_configSouce = configSource;
45 } 43 }
44
46 public RegionInfo[] LoadRegions() 45 public RegionInfo[] LoadRegions()
47 { 46 {
48 if (m_configSouce == null) 47 if (m_configSouce == null)
49 { 48 {
50 Console.MainLog.Instance.Error("WEBLOADER", "Unable to load configuration source!"); 49 MainLog.Instance.Error("WEBLOADER", "Unable to load configuration source!");
51 return null; 50 return null;
52 } 51 }
53 else 52 else
54 { 53 {
55 IniConfig startupConfig = (IniConfig)m_configSouce.Configs["Startup"]; 54 IniConfig startupConfig = (IniConfig) m_configSouce.Configs["Startup"];
56 string url = startupConfig.GetString("regionload_webserver_url","").Trim(); 55 string url = startupConfig.GetString("regionload_webserver_url", "").Trim();
57 if (url == "") 56 if (url == "")
58 { 57 {
59 Console.MainLog.Instance.Error("WEBLOADER", "Unable to load webserver URL - URL was empty."); 58 MainLog.Instance.Error("WEBLOADER", "Unable to load webserver URL - URL was empty.");
60 return null; 59 return null;
61 } 60 }
62 else 61 else
63 { 62 {
64 63 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
65 HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
66 webRequest.Timeout = 30000; //30 Second Timeout 64 webRequest.Timeout = 30000; //30 Second Timeout
67 Console.MainLog.Instance.Debug("WEBLOADER", "Sending Download Request..."); 65 MainLog.Instance.Debug("WEBLOADER", "Sending Download Request...");
68 HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); 66 HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
69 Console.MainLog.Instance.Debug("WEBLOADER", "Downloading Region Information From Remote Server..."); 67 MainLog.Instance.Debug("WEBLOADER", "Downloading Region Information From Remote Server...");
70 StreamReader reader = new StreamReader(webResponse.GetResponseStream()); 68 StreamReader reader = new StreamReader(webResponse.GetResponseStream());
71 string xmlSource = ""; 69 string xmlSource = "";
72 string tempStr = reader.ReadLine(); 70 string tempStr = reader.ReadLine();
@@ -75,7 +73,9 @@ namespace OpenSim.Framework.RegionLoader.Web
75 xmlSource = xmlSource + tempStr; 73 xmlSource = xmlSource + tempStr;
76 tempStr = reader.ReadLine(); 74 tempStr = reader.ReadLine();
77 } 75 }
78 Console.MainLog.Instance.Debug("WEBLOADER", "Done downloading region information from server. Total Bytes: " + xmlSource.Length); 76 MainLog.Instance.Debug("WEBLOADER",
77 "Done downloading region information from server. Total Bytes: " +
78 xmlSource.Length);
79 XmlDocument xmlDoc = new XmlDocument(); 79 XmlDocument xmlDoc = new XmlDocument();
80 xmlDoc.LoadXml(xmlSource); 80 xmlDoc.LoadXml(xmlSource);
81 if (xmlDoc.FirstChild.Name == "Regions") 81 if (xmlDoc.FirstChild.Name == "Regions")
@@ -84,8 +84,9 @@ namespace OpenSim.Framework.RegionLoader.Web
84 int i; 84 int i;
85 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++) 85 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
86 { 86 {
87 Console.MainLog.Instance.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml); 87 MainLog.Instance.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
88 regionInfos[i] = new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i]); 88 regionInfos[i] =
89 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i]);
89 } 90 }
90 91
91 return regionInfos; 92 return regionInfos;
@@ -95,4 +96,4 @@ namespace OpenSim.Framework.RegionLoader.Web
95 } 96 }
96 } 97 }
97 } 98 }
98} 99} \ No newline at end of file
diff --git a/OpenSim/Framework/Remoting.cs b/OpenSim/Framework/Remoting.cs
index 9cf0d11..ddc1cfb 100644
--- a/OpenSim/Framework/Remoting.cs
+++ b/OpenSim/Framework/Remoting.cs
@@ -131,4 +131,4 @@ namespace OpenSim.Framework
131 return c; 131 return c;
132 } 132 }
133 } 133 }
134} 134} \ No newline at end of file
diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs
index 5df22cd..18a3829 100644
--- a/OpenSim/Framework/SerializableRegionInfo.cs
+++ b/OpenSim/Framework/SerializableRegionInfo.cs
@@ -26,15 +26,10 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Globalization;
30using System.Net; 29using System.Net;
31using System.Xml;
32using System.Net.Sockets; 30using System.Net.Sockets;
33using libsecondlife; 31using libsecondlife;
34 32
35
36
37
38namespace OpenSim.Framework 33namespace OpenSim.Framework
39{ 34{
40 [Serializable] 35 [Serializable]
@@ -46,7 +41,8 @@ namespace OpenSim.Framework
46 public SearializableRegionInfo() 41 public SearializableRegionInfo()
47 { 42 {
48 } 43 }
49 public SearializableRegionInfo(RegionInfo ConvertFrom) 44
45 public SearializableRegionInfo(RegionInfo ConvertFrom)
50 { 46 {
51 m_regionLocX = ConvertFrom.RegionLocX; 47 m_regionLocX = ConvertFrom.RegionLocX;
52 m_regionLocY = ConvertFrom.RegionLocY; 48 m_regionLocY = ConvertFrom.RegionLocY;
@@ -55,9 +51,9 @@ namespace OpenSim.Framework
55 m_remotingPort = ConvertFrom.RemotingPort; 51 m_remotingPort = ConvertFrom.RemotingPort;
56 RemotingAddress = ConvertFrom.RemotingAddress; 52 RemotingAddress = ConvertFrom.RemotingAddress;
57 } 53 }
54
58 public SearializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 55 public SearializableRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
59 { 56 {
60
61 m_regionLocX = regionLocX; 57 m_regionLocX = regionLocX;
62 m_regionLocY = regionLocY; 58 m_regionLocY = regionLocY;
63 59
@@ -78,16 +74,11 @@ namespace OpenSim.Framework
78 public Guid RegionID = LLUUID.Zero.UUID; 74 public Guid RegionID = LLUUID.Zero.UUID;
79 75
80 public uint m_remotingPort; 76 public uint m_remotingPort;
77
81 public uint RemotingPort 78 public uint RemotingPort
82 { 79 {
83 get 80 get { return m_remotingPort; }
84 { 81 set { m_remotingPort = value; }
85 return m_remotingPort;
86 }
87 set
88 {
89 m_remotingPort = value;
90 }
91 } 82 }
92 83
93 public string RemotingAddress; 84 public string RemotingAddress;
@@ -120,77 +111,49 @@ namespace OpenSim.Framework
120 ia = Adr; 111 ia = Adr;
121 break; 112 break;
122 } 113 }
123
124 } 114 }
125 115
126 return new IPEndPoint(ia, m_internalEndPoint.Port); 116 return new IPEndPoint(ia, m_internalEndPoint.Port);
127 } 117 }
128 118
129 set 119 set { m_externalHostName = value.ToString(); }
130 {
131 m_externalHostName = value.ToString();
132 }
133 } 120 }
134 121
135 protected string m_externalHostName; 122 protected string m_externalHostName;
123
136 public string ExternalHostName 124 public string ExternalHostName
137 { 125 {
138 get 126 get { return m_externalHostName; }
139 { 127 set { m_externalHostName = value; }
140 return m_externalHostName;
141 }
142 set
143 {
144 m_externalHostName = value;
145 }
146 } 128 }
147 129
148 protected IPEndPoint m_internalEndPoint; 130 protected IPEndPoint m_internalEndPoint;
131
149 public IPEndPoint InternalEndPoint 132 public IPEndPoint InternalEndPoint
150 { 133 {
151 get 134 get { return m_internalEndPoint; }
152 { 135 set { m_internalEndPoint = value; }
153 return m_internalEndPoint;
154 }
155 set
156 {
157 m_internalEndPoint = value;
158 }
159 } 136 }
160 137
161 protected uint? m_regionLocX; 138 protected uint? m_regionLocX;
139
162 public uint RegionLocX 140 public uint RegionLocX
163 { 141 {
164 get 142 get { return m_regionLocX.Value; }
165 { 143 set { m_regionLocX = value; }
166 return m_regionLocX.Value;
167 }
168 set
169 {
170 m_regionLocX = value;
171 }
172 } 144 }
173 145
174 protected uint? m_regionLocY; 146 protected uint? m_regionLocY;
147
175 public uint RegionLocY 148 public uint RegionLocY
176 { 149 {
177 get 150 get { return m_regionLocY.Value; }
178 { 151 set { m_regionLocY = value; }
179 return m_regionLocY.Value;
180 }
181 set
182 {
183 m_regionLocY = value;
184 }
185 } 152 }
186 153
187 public ulong RegionHandle 154 public ulong RegionHandle
188 { 155 {
189 get 156 get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); }
190 {
191 return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
192 }
193 } 157 }
194 } 158 }
195 159} \ No newline at end of file
196}
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index d865ae8..7af1716 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Framework.Servers
97 97
98 HttpListenerRequest request = context.Request; 98 HttpListenerRequest request = context.Request;
99 HttpListenerResponse response = context.Response; 99 HttpListenerResponse response = context.Response;
100 100
101 101
102 response.KeepAlive = false; 102 response.KeepAlive = false;
103 response.SendChunked = false; 103 response.SendChunked = false;
@@ -192,15 +192,12 @@ namespace OpenSim.Framework.Servers
192 MainLog.Instance.Error("XML", responseString); 192 MainLog.Instance.Error("XML", responseString);
193 string[] querystringkeys = request.QueryString.AllKeys; 193 string[] querystringkeys = request.QueryString.AllKeys;
194 string[] rHeaders = request.Headers.AllKeys; 194 string[] rHeaders = request.Headers.AllKeys;
195
196
197 195
198 196
199 foreach (string queryname in querystringkeys) 197 foreach (string queryname in querystringkeys)
200 { 198 {
201 keysvals.Add(queryname, request.QueryString[queryname]); 199 keysvals.Add(queryname, request.QueryString[queryname]);
202 MainLog.Instance.Warn("HTTP", queryname + "=" + request.QueryString[queryname]); 200 MainLog.Instance.Warn("HTTP", queryname + "=" + request.QueryString[queryname]);
203
204 } 201 }
205 foreach (string headername in rHeaders) 202 foreach (string headername in rHeaders)
206 { 203 {
@@ -218,7 +215,6 @@ namespace OpenSim.Framework.Servers
218 string methodName = xmlRprcRequest.MethodName; 215 string methodName = xmlRprcRequest.MethodName;
219 if (methodName != null) 216 if (methodName != null)
220 { 217 {
221
222 XmlRpcResponse xmlRpcResponse; 218 XmlRpcResponse xmlRpcResponse;
223 219
224 XmlRpcMethod method; 220 XmlRpcMethod method;
@@ -241,8 +237,8 @@ namespace OpenSim.Framework.Servers
241 } 237 }
242 else 238 else
243 { 239 {
244 System.Console.WriteLine("Handler not found for http request " +request.RawUrl); 240 System.Console.WriteLine("Handler not found for http request " + request.RawUrl);
245 responseString = "Error"; 241 responseString = "Error";
246 } 242 }
247 } 243 }
248 244
@@ -266,7 +262,8 @@ namespace OpenSim.Framework.Servers
266 response.OutputStream.Close(); 262 response.OutputStream.Close();
267 } 263 }
268 } 264 }
269 public void HandleHTTPRequest(Hashtable keysvals, HttpListenerRequest request, HttpListenerResponse response) 265
266 public void HandleHTTPRequest(Hashtable keysvals, HttpListenerRequest request, HttpListenerResponse response)
270 { 267 {
271 // This is a test. There's a workable alternative.. as this way sucks. 268 // This is a test. There's a workable alternative.. as this way sucks.
272 // We'd like to put this into a text file parhaps that's easily editable. 269 // We'd like to put this into a text file parhaps that's easily editable.
@@ -280,12 +277,14 @@ namespace OpenSim.Framework.Servers
280 // to display the form, or process it. 277 // to display the form, or process it.
281 // a better way would be nifty. 278 // a better way would be nifty.
282 279
283 if ((string)keysvals["show_login_form"] == "TRUE") 280 if ((string) keysvals["show_login_form"] == "TRUE")
284 { 281 {
285 string responseString = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; 282 string responseString =
283 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
286 responseString = responseString + "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; 284 responseString = responseString + "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
287 responseString = responseString + "<head>"; 285 responseString = responseString + "<head>";
288 responseString = responseString + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"; 286 responseString = responseString +
287 "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
289 responseString = responseString + "<meta http-equiv=\"cache-control\" content=\"no-cache\">"; 288 responseString = responseString + "<meta http-equiv=\"cache-control\" content=\"no-cache\">";
290 responseString = responseString + "<meta http-equiv=\"Pragma\" content=\"no-cache\">"; 289 responseString = responseString + "<meta http-equiv=\"Pragma\" content=\"no-cache\">";
291 responseString = responseString + "<title>Second Life Login</title>"; 290 responseString = responseString + "<title>Second Life Login</title>";
@@ -299,37 +298,50 @@ namespace OpenSim.Framework.Servers
299 responseString = responseString + "</div>"; 298 responseString = responseString + "</div>";
300 responseString = responseString + "<fieldset id=\"firstname\">"; 299 responseString = responseString + "<fieldset id=\"firstname\">";
301 responseString = responseString + "<legend>First Name:</legend>"; 300 responseString = responseString + "<legend>First Name:</legend>";
302 responseString = responseString + "<input type=\"text\" id=\"firstname_input\" size=\"15\" maxlength=\"100\" name=\"username\" value=\"" + keysvals["username"] + "\" />"; 301 responseString = responseString +
302 "<input type=\"text\" id=\"firstname_input\" size=\"15\" maxlength=\"100\" name=\"username\" value=\"" +
303 keysvals["username"] + "\" />";
303 responseString = responseString + "</fieldset>"; 304 responseString = responseString + "</fieldset>";
304 responseString = responseString + "<fieldset id=\"lastname\">"; 305 responseString = responseString + "<fieldset id=\"lastname\">";
305 responseString = responseString + "<legend>Last Name:</legend>"; 306 responseString = responseString + "<legend>Last Name:</legend>";
306 responseString = responseString + "<input type=\"text\" size=\"15\" maxlength=\"100\" name=\"lastname\" value=\"" + keysvals["lastname"] + "\" />"; 307 responseString = responseString +
308 "<input type=\"text\" size=\"15\" maxlength=\"100\" name=\"lastname\" value=\"" +
309 keysvals["lastname"] + "\" />";
307 responseString = responseString + "</fieldset>"; 310 responseString = responseString + "</fieldset>";
308 responseString = responseString + "<fieldset id=\"password\">"; 311 responseString = responseString + "<fieldset id=\"password\">";
309 responseString = responseString + "<legend>Password:</legend>"; 312 responseString = responseString + "<legend>Password:</legend>";
310 responseString = responseString + "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; 313 responseString = responseString + "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
311 responseString = responseString + "<tr>"; 314 responseString = responseString + "<tr>";
312 responseString = responseString + "<td colspan=\"2\"><input type=\"password\" size=\"15\" maxlength=\"100\" name=\"password\" value=\"" + keysvals["password"] + "\" /></td>"; 315 responseString = responseString +
316 "<td colspan=\"2\"><input type=\"password\" size=\"15\" maxlength=\"100\" name=\"password\" value=\"" +
317 keysvals["password"] + "\" /></td>";
313 responseString = responseString + "</tr>"; 318 responseString = responseString + "</tr>";
314 responseString = responseString + "<tr>"; 319 responseString = responseString + "<tr>";
315 responseString = responseString + "<td valign=\"middle\"><input type=\"checkbox\" name=\"remember_password\" id=\"remember_password\" value=\"" + keysvals["remember_password"] + "\" checked style=\"margin-left:0px;\"/></td>"; 320 responseString = responseString +
321 "<td valign=\"middle\"><input type=\"checkbox\" name=\"remember_password\" id=\"remember_password\" value=\"" +
322 keysvals["remember_password"] + "\" checked style=\"margin-left:0px;\"/></td>";
316 responseString = responseString + "<td><label for=\"remember_password\">Remember password</label></td>"; 323 responseString = responseString + "<td><label for=\"remember_password\">Remember password</label></td>";
317 responseString = responseString + "</tr>"; 324 responseString = responseString + "</tr>";
318 responseString = responseString + "</table>"; 325 responseString = responseString + "</table>";
319 responseString = responseString + "</fieldset>"; 326 responseString = responseString + "</fieldset>";
320 responseString = responseString + "<input type=\"hidden\" name=\"show_login_form\" value=\"FALSE\" />"; 327 responseString = responseString + "<input type=\"hidden\" name=\"show_login_form\" value=\"FALSE\" />";
321 responseString = responseString + "<input type=\"hidden\" id=\"grid\" name=\"grid\" value=\"" + keysvals["grid"] + "\" />"; 328 responseString = responseString + "<input type=\"hidden\" id=\"grid\" name=\"grid\" value=\"" +
329 keysvals["grid"] + "\" />";
322 responseString = responseString + "<div id=\"submitbtn\">"; 330 responseString = responseString + "<div id=\"submitbtn\">";
323 responseString = responseString + "<input class=\"input_over\" type=\"submit\" value=\"Connect\" />"; 331 responseString = responseString + "<input class=\"input_over\" type=\"submit\" value=\"Connect\" />";
324 responseString = responseString + "</div>"; 332 responseString = responseString + "</div>";
325 responseString = responseString + "<div id=\"connecting\" style=\"visibility:hidden\"><img src=\"/_img/sl_logo_rotate_black.gif\" align=\"absmiddle\"> Connecting...</div>"; 333 responseString = responseString +
334 "<div id=\"connecting\" style=\"visibility:hidden\"><img src=\"/_img/sl_logo_rotate_black.gif\" align=\"absmiddle\"> Connecting...</div>";
326 335
327 responseString = responseString + "<div id=\"helplinks\">"; 336 responseString = responseString + "<div id=\"helplinks\">";
328 responseString = responseString + "<a href=\"http://www.secondlife.com/join/index.php\" target=\"_blank\">Create new account</a> | "; 337 responseString = responseString +
329 responseString = responseString + "<a href=\"http://www.secondlife.com/account/request.php\" target=\"_blank\">Forgot password?</a>"; 338 "<a href=\"http://www.secondlife.com/join/index.php\" target=\"_blank\">Create new account</a> | ";
339 responseString = responseString +
340 "<a href=\"http://www.secondlife.com/account/request.php\" target=\"_blank\">Forgot password?</a>";
330 responseString = responseString + "</div>"; 341 responseString = responseString + "</div>";
331 342
332 responseString = responseString + "<div id=\"channelinfo\"> " + keysvals["channel"] + " | " + keysvals["version"] + "=" + keysvals["lang"] + "</div>"; 343 responseString = responseString + "<div id=\"channelinfo\"> " + keysvals["channel"] + " | " +
344 keysvals["version"] + "=" + keysvals["lang"] + "</div>";
333 responseString = responseString + "</form>"; 345 responseString = responseString + "</form>";
334 responseString = responseString + "<script language=\"JavaScript\">"; 346 responseString = responseString + "<script language=\"JavaScript\">";
335 responseString = responseString + "document.getElementById('firstname_input').focus();"; 347 responseString = responseString + "document.getElementById('firstname_input').focus();";
@@ -359,7 +371,7 @@ namespace OpenSim.Framework.Servers
359 } 371 }
360 } // show_login_form == "TRUE" 372 } // show_login_form == "TRUE"
361 else 373 else
362 { 374 {
363 // show_login_form is present but FALSE 375 // show_login_form is present but FALSE
364 // 376 //
365 // The idea here is that we're telling the client to log in immediately here using the following information 377 // The idea here is that we're telling the client to log in immediately here using the following information
@@ -371,12 +383,14 @@ namespace OpenSim.Framework.Servers
371 // 383 //
372 384
373 response.StatusCode = 301; 385 response.StatusCode = 301;
374 response.RedirectLocation = "secondlife:///app/login?first_name=" + keysvals["username"] + "&last_name=" + keysvals["lastname"] + "&location=home&grid=Other&web_login_key=796f2b2a-0131-41e4-af12-00f60c24c458"; 386 response.RedirectLocation = "secondlife:///app/login?first_name=" + keysvals["username"] + "&last_name=" +
375 387 keysvals["lastname"] +
388 "&location=home&grid=Other&web_login_key=796f2b2a-0131-41e4-af12-00f60c24c458";
389
376 response.OutputStream.Close(); 390 response.OutputStream.Close();
377 } // show_login_form == "FALSE" 391 } // show_login_form == "FALSE"
378
379 } 392 }
393
380 public void Start() 394 public void Start()
381 { 395 {
382 MainLog.Instance.Verbose("HTTPD", "Starting up HTTP Server"); 396 MainLog.Instance.Verbose("HTTPD", "Starting up HTTP Server");
@@ -422,4 +436,4 @@ namespace OpenSim.Framework.Servers
422 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); 436 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path));
423 } 437 }
424 } 438 }
425} 439} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs
index e3a5df3..47b3f24 100644
--- a/OpenSim/Framework/Servers/CheckSumServer.cs
+++ b/OpenSim/Framework/Servers/CheckSumServer.cs
@@ -124,4 +124,4 @@ namespace OpenSim.Framework.Servers
124 } 124 }
125 * } 125 * }
126 */ 126 */
127} 127} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs
index 34e2669..ce2239b 100644
--- a/OpenSim/Framework/Servers/RestMethod.cs
+++ b/OpenSim/Framework/Servers/RestMethod.cs
@@ -28,4 +28,4 @@
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{ 29{
30 public delegate string RestMethod(string request, string path, string param); 30 public delegate string RestMethod(string request, string path, string param);
31} 31} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/RestObjectPoster.cs b/OpenSim/Framework/Servers/RestObjectPoster.cs
index b1565f1..212361c 100644
--- a/OpenSim/Framework/Servers/RestObjectPoster.cs
+++ b/OpenSim/Framework/Servers/RestObjectPoster.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -44,7 +44,7 @@ namespace OpenSim.Framework.Servers
44 44
45 public static void BeginPostObject<TRequest>(string verb, string requestUrl, TRequest obj) 45 public static void BeginPostObject<TRequest>(string verb, string requestUrl, TRequest obj)
46 { 46 {
47 Type type = typeof(TRequest); 47 Type type = typeof (TRequest);
48 48
49 WebRequest request = WebRequest.Create(requestUrl); 49 WebRequest request = WebRequest.Create(requestUrl);
50 request.Method = verb; 50 request.Method = verb;
@@ -62,7 +62,7 @@ namespace OpenSim.Framework.Servers
62 writer.Flush(); 62 writer.Flush();
63 } 63 }
64 64
65 int length = (int)buffer.Length; 65 int length = (int) buffer.Length;
66 request.ContentLength = length; 66 request.ContentLength = length;
67 67
68 Stream requestStream = request.GetRequestStream(); 68 Stream requestStream = request.GetRequestStream();
@@ -72,7 +72,7 @@ namespace OpenSim.Framework.Servers
72 72
73 private static void AsyncCallback(IAsyncResult result) 73 private static void AsyncCallback(IAsyncResult result)
74 { 74 {
75 WebRequest request = (WebRequest)result.AsyncState; 75 WebRequest request = (WebRequest) result.AsyncState;
76 using (WebResponse resp = request.EndGetResponse(result)) 76 using (WebResponse resp = request.EndGetResponse(result))
77 { 77 {
78 } 78 }
diff --git a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
index 9d1f819..2961e04 100644
--- a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
+++ b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers
48 48
49 public void BeginPostObject<TRequest>(string verb, string requestUrl, TRequest obj) 49 public void BeginPostObject<TRequest>(string verb, string requestUrl, TRequest obj)
50 { 50 {
51 Type type = typeof(TRequest); 51 Type type = typeof (TRequest);
52 52
53 WebRequest request = WebRequest.Create(requestUrl); 53 WebRequest request = WebRequest.Create(requestUrl);
54 request.Method = verb; 54 request.Method = verb;
@@ -66,7 +66,7 @@ namespace OpenSim.Framework.Servers
66 writer.Flush(); 66 writer.Flush();
67 } 67 }
68 68
69 int length = (int)buffer.Length; 69 int length = (int) buffer.Length;
70 request.ContentLength = length; 70 request.ContentLength = length;
71 71
72 Stream requestStream = request.GetRequestStream(); 72 Stream requestStream = request.GetRequestStream();
@@ -76,12 +76,12 @@ namespace OpenSim.Framework.Servers
76 76
77 private void AsyncCallback(IAsyncResult result) 77 private void AsyncCallback(IAsyncResult result)
78 { 78 {
79 WebRequest request = (WebRequest)result.AsyncState; 79 WebRequest request = (WebRequest) result.AsyncState;
80 using (WebResponse resp = request.EndGetResponse(result)) 80 using (WebResponse resp = request.EndGetResponse(result))
81 { 81 {
82 TResponse deserial; 82 TResponse deserial;
83 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 83 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
84 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); 84 deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream());
85 85
86 if (deserial != null && ResponseCallback != null) 86 if (deserial != null && ResponseCallback != null)
87 { 87 {
@@ -90,4 +90,4 @@ namespace OpenSim.Framework.Servers
90 } 90 }
91 } 91 }
92 } 92 }
93} 93} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
index 6338531..cfb585b 100644
--- a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
+++ b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -39,7 +39,7 @@ namespace OpenSim.Framework.Servers
39 { 39 {
40 public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) 40 public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
41 { 41 {
42 Type type = typeof(TRequest); 42 Type type = typeof (TRequest);
43 43
44 WebRequest request = WebRequest.Create(requestUrl); 44 WebRequest request = WebRequest.Create(requestUrl);
45 request.Method = verb; 45 request.Method = verb;
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Servers
57 writer.Flush(); 57 writer.Flush();
58 } 58 }
59 59
60 int length = (int)buffer.Length; 60 int length = (int) buffer.Length;
61 request.ContentLength = length; 61 request.ContentLength = length;
62 62
63 Stream requestStream = request.GetRequestStream(); 63 Stream requestStream = request.GetRequestStream();
@@ -65,12 +65,10 @@ namespace OpenSim.Framework.Servers
65 TResponse deserial = default(TResponse); 65 TResponse deserial = default(TResponse);
66 using (WebResponse resp = request.GetResponse()) 66 using (WebResponse resp = request.GetResponse())
67 { 67 {
68 68 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
69 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 69 deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream());
70 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream());
71 } 70 }
72 return deserial; 71 return deserial;
73 } 72 }
74
75 } 73 }
76} 74} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/XmlRpcMethod.cs b/OpenSim/Framework/Servers/XmlRpcMethod.cs
index e4993e3..b156cdd 100644
--- a/OpenSim/Framework/Servers/XmlRpcMethod.cs
+++ b/OpenSim/Framework/Servers/XmlRpcMethod.cs
@@ -30,4 +30,4 @@ using Nwc.XmlRpc;
30namespace OpenSim.Framework.Servers 30namespace OpenSim.Framework.Servers
31{ 31{
32 public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request); 32 public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request);
33} 33} \ No newline at end of file
diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs
index 39b1599..7ca2512 100644
--- a/OpenSim/Framework/UserConfig.cs
+++ b/OpenSim/Framework/UserConfig.cs
@@ -76,7 +76,8 @@ namespace OpenSim.Framework
76 configMember.addConfigurationOption("default_inventory_server", 76 configMember.addConfigurationOption("default_inventory_server",
77 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 77 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
78 "Default Inventory Server URI", 78 "Default Inventory Server URI",
79 "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString() + "/", false); 79 "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString() + "/",
80 false);
80 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 81 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
81 "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); 82 "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
82 83
@@ -107,7 +108,7 @@ namespace OpenSim.Framework
107 GridRecvKey = (string) configuration_result; 108 GridRecvKey = (string) configuration_result;
108 break; 109 break;
109 case "default_inventory_server": 110 case "default_inventory_server":
110 InventoryUrl = (string)configuration_result; 111 InventoryUrl = (string) configuration_result;
111 break; 112 break;
112 case "database_provider": 113 case "database_provider":
113 DatabaseProvider = (string) configuration_result; 114 DatabaseProvider = (string) configuration_result;
@@ -116,13 +117,13 @@ namespace OpenSim.Framework
116 HttpPort = (uint) configuration_result; 117 HttpPort = (uint) configuration_result;
117 break; 118 break;
118 case "http_ssl": 119 case "http_ssl":
119 HttpSSL = (bool)configuration_result; 120 HttpSSL = (bool) configuration_result;
120 break; 121 break;
121 case "default_X": 122 case "default_X":
122 DefaultX = (uint)configuration_result; 123 DefaultX = (uint) configuration_result;
123 break; 124 break;
124 case "default_Y": 125 case "default_Y":
125 DefaultY = (uint)configuration_result; 126 DefaultY = (uint) configuration_result;
126 break; 127 break;
127 } 128 }
128 129
diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs
index 40a3d78..4df1ebd 100644
--- a/OpenSim/Framework/UserProfileData.cs
+++ b/OpenSim/Framework/UserProfileData.cs
@@ -150,14 +150,13 @@ namespace OpenSim.Framework
150 /// </summary> 150 /// </summary>
151 //public class AvatarPickerAvatar 151 //public class AvatarPickerAvatar
152 //{ 152 //{
153 //public LLUUID AvatarID; 153 //public LLUUID AvatarID;
154 //public string firstName; 154 //public string firstName;
155 //public string lastName; 155 //public string lastName;
156 //public AvatarPickerAvatar() 156 //public AvatarPickerAvatar()
157 //{ 157 //{
158 //} 158 //}
159 //} 159 //}
160
161 /// <summary> 160 /// <summary>
162 /// Information about a users session 161 /// Information about a users session
163 /// </summary> 162 /// </summary>
@@ -224,4 +223,4 @@ namespace OpenSim.Framework
224 /// </summary> 223 /// </summary>
225 public LLVector3 currentPos; 224 public LLVector3 currentPos;
226 } 225 }
227} 226} \ No newline at end of file
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 1c8f273..3654a7d 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -46,12 +46,13 @@ namespace OpenSim.Framework
46 private static object XferLock = new object(); 46 private static object XferLock = new object();
47 private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>(); 47 private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
48 48
49 public static double GetDistanceTo(LLVector3 a, LLVector3 b) { 49 public static double GetDistanceTo(LLVector3 a, LLVector3 b)
50 float dx = a.X - b.X; 50 {
51 float dy = a.Y - b.Y; 51 float dx = a.X - b.X;
52 float dz = a.Z - b.Z; 52 float dy = a.Y - b.Y;
53 return Math.Sqrt(dx * dx + dy * dy + dz * dz); 53 float dz = a.Z - b.Z;
54 } 54 return Math.Sqrt(dx*dx + dy*dy + dz*dz);
55 }
55 56
56 public static ulong UIntsToLong(uint X, uint Y) 57 public static ulong UIntsToLong(uint X, uint Y)
57 { 58 {
@@ -383,7 +384,7 @@ namespace OpenSim.Framework
383 { 384 {
384 return Math.Min(Math.Max(x, min), max); 385 return Math.Min(Math.Max(x, min), max);
385 } 386 }
386 387
387 /// <summary> 388 /// <summary>
388 /// Convert an LLUUID to a raw uuid string. Right now this is a string without hyphens. 389 /// Convert an LLUUID to a raw uuid string. Right now this is a string without hyphens.
389 /// </summary> 390 /// </summary>
@@ -394,4 +395,4 @@ namespace OpenSim.Framework
394 return lluuid.UUID.ToString("n"); 395 return lluuid.UUID.ToString("n");
395 } 396 }
396 } 397 }
397} 398} \ No newline at end of file
diff --git a/OpenSim/Framework/sLLVector3.cs b/OpenSim/Framework/sLLVector3.cs
index e74378d..2e2c005 100644
--- a/OpenSim/Framework/sLLVector3.cs
+++ b/OpenSim/Framework/sLLVector3.cs
@@ -29,7 +29,6 @@
29using System; 29using System;
30using libsecondlife; 30using libsecondlife;
31 31
32
33namespace OpenSim.Framework 32namespace OpenSim.Framework
34{ 33{
35 [Serializable] 34 [Serializable]
@@ -37,17 +36,17 @@ namespace OpenSim.Framework
37 { 36 {
38 public sLLVector3() 37 public sLLVector3()
39 { 38 {
40
41 } 39 }
40
42 public sLLVector3(LLVector3 v) 41 public sLLVector3(LLVector3 v)
43 { 42 {
44 x = v.X; 43 x = v.X;
45 y = v.Y; 44 y = v.Y;
46 z = v.Z; 45 z = v.Z;
47 } 46 }
47
48 public float x; 48 public float x;
49 public float y; 49 public float y;
50 public float z; 50 public float z;
51 } 51 }
52 52} \ No newline at end of file
53}
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs
index c4e8e64..5d3d265 100644
--- a/OpenSim/Grid/AssetServer/Main.cs
+++ b/OpenSim/Grid/AssetServer/Main.cs
@@ -242,4 +242,4 @@ namespace OpenSim.Grid.AssetServer
242 { 242 {
243 } 243 }
244 } 244 }
245} 245} \ No newline at end of file
diff --git a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
index 6608bd0..d598094 100644
--- a/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/AssetServer/Properties/AssemblyInfo.cs
@@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
60// 60//
61 61
62[assembly : AssemblyVersion("1.0.0.0")] 62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")] 63[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs
index 1f44686..ee44108 100644
--- a/OpenSim/Grid/AssetServer/RestService.cs
+++ b/OpenSim/Grid/AssetServer/RestService.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Grid.AssetServer
45 45
46 public override byte[] Handle(string path, Stream request) 46 public override byte[] Handle(string path, Stream request)
47 { 47 {
48 MainLog.Instance.Verbose("REST", "In Handle"); 48 MainLog.Instance.Verbose("REST", "In Handle");
49 string param = GetParam(path); 49 string param = GetParam(path);
50 byte[] result = new byte[] {}; 50 byte[] result = new byte[] {};
51 try 51 try
@@ -129,4 +129,4 @@ namespace OpenSim.Grid.AssetServer
129 m_assetProvider = assetProvider; 129 m_assetProvider = assetProvider;
130 } 130 }
131 } 131 }
132} 132} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index cb9f979..65df708 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -434,8 +434,8 @@ namespace OpenSim.Grid.GridServer
434 } 434 }
435 else 435 else
436 { 436 {
437 MainLog.Instance.Verbose("DATA", "found " + (string)simData.regionName + " regionHandle = " + 437 MainLog.Instance.Verbose("DATA", "found " + (string) simData.regionName + " regionHandle = " +
438 (string)requestData["region_handle"]); 438 (string) requestData["region_handle"]);
439 responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString(); 439 responseData["sim_ip"] = Util.GetHostFromDNS(simData.serverIP).ToString();
440 responseData["sim_port"] = simData.serverPort.ToString(); 440 responseData["sim_port"] = simData.serverPort.ToString();
441 responseData["http_port"] = simData.httpPort.ToString(); 441 responseData["http_port"] = simData.httpPort.ToString();
@@ -513,7 +513,7 @@ namespace OpenSim.Grid.GridServer
513 simProfileList.Add(simProfileBlock); 513 simProfileList.Add(simProfileBlock);
514 } 514 }
515 MainLog.Instance.Verbose("MAP", "Fast map " + simProfileList.Count.ToString() + 515 MainLog.Instance.Verbose("MAP", "Fast map " + simProfileList.Count.ToString() +
516 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")" ); 516 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
517 } 517 }
518 else 518 else
519 { 519 {
@@ -548,7 +548,7 @@ namespace OpenSim.Grid.GridServer
548 } 548 }
549 } 549 }
550 MainLog.Instance.Verbose("MAP", "Std map " + simProfileList.Count.ToString() + 550 MainLog.Instance.Verbose("MAP", "Std map " + simProfileList.Count.ToString() +
551 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")"); 551 " regions @ (" + xmin + "," + ymin + ")..(" + xmax + "," + ymax + ")");
552 } 552 }
553 553
554 responseData["sim-profiles"] = simProfileList; 554 responseData["sim-profiles"] = simProfileList;
@@ -713,7 +713,8 @@ namespace OpenSim.Grid.GridServer
713 713
714 try 714 try
715 { 715 {
716 MainLog.Instance.Verbose("DATA", "Updating / adding via " + _plugins.Count + " storage provider(s) registered."); 716 MainLog.Instance.Verbose("DATA",
717 "Updating / adding via " + _plugins.Count + " storage provider(s) registered.");
717 foreach (KeyValuePair<string, IGridData> kvp in _plugins) 718 foreach (KeyValuePair<string, IGridData> kvp in _plugins)
718 { 719 {
719 try 720 try
@@ -733,14 +734,14 @@ namespace OpenSim.Grid.GridServer
733 { 734 {
734 MainLog.Instance.Warn("grid", 735 MainLog.Instance.Warn("grid",
735 "Unable to update region (RestSetSimMethod): Incorrect reservation auth key."); 736 "Unable to update region (RestSetSimMethod): Incorrect reservation auth key.");
736 // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + "."); 737 // Wanted: " + reserveData.gridRecvKey + ", Got: " + TheSim.regionRecvKey + ".");
737 return "Unable to update region (RestSetSimMethod): Incorrect auth key."; 738 return "Unable to update region (RestSetSimMethod): Incorrect auth key.";
738 } 739 }
739 } 740 }
740 catch (Exception e) 741 catch (Exception e)
741 { 742 {
742 MainLog.Instance.Warn("GRID", "getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + 743 MainLog.Instance.Warn("GRID", "getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " +
743 e.ToString()); 744 e.ToString());
744 } 745 }
745 } 746 }
746 return "OK"; 747 return "OK";
@@ -751,4 +752,4 @@ namespace OpenSim.Grid.GridServer
751 } 752 }
752 } 753 }
753 } 754 }
754} 755} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs
index 5bae6a6..cdd37c4 100644
--- a/OpenSim/Grid/GridServer/Main.cs
+++ b/OpenSim/Grid/GridServer/Main.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Grid.GridServer
103 public void Startup() 103 public void Startup()
104 { 104 {
105 Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); 105 Cfg = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml")));
106 //Yeah srsly, that's it. 106 //Yeah srsly, that's it.
107 if (setuponly) Environment.Exit(0); 107 if (setuponly) Environment.Exit(0);
108 108
109 m_console.Verbose("GRID", "Connecting to Storage Server"); 109 m_console.Verbose("GRID", "Connecting to Storage Server");
@@ -218,4 +218,4 @@ namespace OpenSim.Grid.GridServer
218 } 218 }
219 }*/ 219 }*/
220 } 220 }
221} 221} \ No newline at end of file
diff --git a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
index 0399b3b..6f837e6 100644
--- a/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/GridServer/Properties/AssemblyInfo.cs
@@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
60// 60//
61 61
62[assembly : AssemblyVersion("1.0.0.0")] 62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")] 63[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
index ca2e526..d36a915 100644
--- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs
+++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -28,23 +28,22 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using libsecondlife;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Communications; 33using OpenSim.Framework.Communications;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using libsecondlife;
36 35
37namespace OpenSim.Grid.InventoryServer 36namespace OpenSim.Grid.InventoryServer
38{ 37{
39 public class GridInventoryService : InventoryServiceBase 38 public class GridInventoryService : InventoryServiceBase
40 { 39 {
41 public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, 40 public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
42 InventoryItemInfo itemCallBack) 41 InventoryItemInfo itemCallBack)
43 { 42 {
44
45 } 43 }
46 44
47 private bool TryGetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList, out List<InventoryItemBase> itemsList) 45 private bool TryGetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList,
46 out List<InventoryItemBase> itemsList)
48 { 47 {
49 List<InventoryFolderBase> rootFolders = RequestFirstLevelFolders(userID); 48 List<InventoryFolderBase> rootFolders = RequestFirstLevelFolders(userID);
50 List<InventoryItemBase> allItems = new List<InventoryItemBase>(); 49 List<InventoryItemBase> allItems = new List<InventoryItemBase>();
@@ -107,10 +106,10 @@ namespace OpenSim.Grid.InventoryServer
107 public InventoryCollection GetUserInventory(Guid rawUserID) 106 public InventoryCollection GetUserInventory(Guid rawUserID)
108 { 107 {
109 LLUUID userID = new LLUUID(rawUserID); 108 LLUUID userID = new LLUUID(rawUserID);
110 109
111 // We get enough verbose messages later on for diagnostics 110 // We get enough verbose messages later on for diagnostics
112 //MainLog.Instance.Verbose("INVENTORY", "Request for inventory for " + userID.ToString()); 111 //MainLog.Instance.Verbose("INVENTORY", "Request for inventory for " + userID.ToString());
113 112
114 InventoryCollection invCollection = new InventoryCollection(); 113 InventoryCollection invCollection = new InventoryCollection();
115 List<InventoryFolderBase> folders; 114 List<InventoryFolderBase> folders;
116 List<InventoryItemBase> allItems; 115 List<InventoryItemBase> allItems;
@@ -126,14 +125,14 @@ namespace OpenSim.Grid.InventoryServer
126 public bool CreateUsersInventory(Guid rawUserID) 125 public bool CreateUsersInventory(Guid rawUserID)
127 { 126 {
128 LLUUID userID = new LLUUID(rawUserID); 127 LLUUID userID = new LLUUID(rawUserID);
129 128
130 MainLog.Instance.Verbose( 129 MainLog.Instance.Verbose(
131 "INVENTORY", "Creating new set of inventory folders for " + userID.ToString()); 130 "INVENTORY", "Creating new set of inventory folders for " + userID.ToString());
132 131
133 CreateNewUserInventory(userID); 132 CreateNewUserInventory(userID);
134 return true; 133 return true;
135 } 134 }
136 135
137 136
138 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) 137 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
139 { 138 {
@@ -156,30 +155,30 @@ namespace OpenSim.Grid.InventoryServer
156 MainLog.Instance.Verbose( 155 MainLog.Instance.Verbose(
157 "INVENTORY", 156 "INVENTORY",
158 "Updating in " + folder.parentID.ToString() 157 "Updating in " + folder.parentID.ToString()
159 + ", folder " + folder.name); 158 + ", folder " + folder.name);
160 159
161 AddNewInventoryFolder(folder.agentID, folder); 160 AddNewInventoryFolder(folder.agentID, folder);
162 return true; 161 return true;
163 } 162 }
164 163
165 public bool MoveInventoryFolder(InventoryFolderBase folder) 164 public bool MoveInventoryFolder(InventoryFolderBase folder)
166 { 165 {
167 MainLog.Instance.Verbose( 166 MainLog.Instance.Verbose(
168 "INVENTORY", 167 "INVENTORY",
169 "Moving folder " + folder.folderID 168 "Moving folder " + folder.folderID
170 + " to " + folder.parentID.ToString()); 169 + " to " + folder.parentID.ToString());
171 170
172 MoveExistingInventoryFolder(folder); 171 MoveExistingInventoryFolder(folder);
173 return true; 172 return true;
174 } 173 }
175 174
176 public bool AddInventoryItem( InventoryItemBase item) 175 public bool AddInventoryItem(InventoryItemBase item)
177 { 176 {
178 // Right now, this actions act more like an update/insert combination than a simple create. 177 // Right now, this actions act more like an update/insert combination than a simple create.
179 MainLog.Instance.Verbose( 178 MainLog.Instance.Verbose(
180 "INVENTORY", 179 "INVENTORY",
181 "Updating in " + item.parentFolderID.ToString() 180 "Updating in " + item.parentFolderID.ToString()
182 + ", item " + item.inventoryName); 181 + ", item " + item.inventoryName);
183 182
184 AddNewInventoryItem(item.avatarID, item); 183 AddNewInventoryItem(item.avatarID, item);
185 return true; 184 return true;
@@ -191,15 +190,15 @@ namespace OpenSim.Grid.InventoryServer
191 MainLog.Instance.Verbose( 190 MainLog.Instance.Verbose(
192 "INVENTORY", 191 "INVENTORY",
193 "Deleting in " + item.parentFolderID.ToString() 192 "Deleting in " + item.parentFolderID.ToString()
194 + ", item " + item.inventoryName); 193 + ", item " + item.inventoryName);
195 194
196 DeleteItem(item); 195 DeleteItem(item);
197 } 196 }
198 197
199 public bool DeleteInvItem( InventoryItemBase item) 198 public bool DeleteInvItem(InventoryItemBase item)
200 { 199 {
201 DeleteInventoryItem(item.avatarID, item); 200 DeleteInventoryItem(item.avatarID, item);
202 return true; 201 return true;
203 } 202 }
204 } 203 }
205} 204} \ No newline at end of file
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs
index 1070bcf..a003ce3 100644
--- a/OpenSim/Grid/InventoryServer/InventoryManager.cs
+++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs
@@ -25,26 +25,23 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.IO; 30using System.IO;
30using System.Text;
31using System.Reflection; 31using System.Reflection;
32using System.Collections; 32using System.Text;
33using System.Collections.Generic;
34using System.Xml; 33using System.Xml;
35using System.Xml.Serialization; 34using System.Xml.Serialization;
36using libsecondlife; 35using libsecondlife;
37
38using OpenSim.Framework; 36using OpenSim.Framework;
39using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
40using OpenSim.Framework.Servers; 38using OpenSim.Framework.Servers;
41 39
42namespace OpenSim.Grid.InventoryServer 40namespace OpenSim.Grid.InventoryServer
43{ 41{
44
45 public class InventoryManager 42 public class InventoryManager
46 { 43 {
47 IInventoryData _databasePlugin; 44 private IInventoryData _databasePlugin;
48 45
49 /// <summary> 46 /// <summary>
50 /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. 47 /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded.
@@ -55,7 +52,8 @@ namespace OpenSim.Grid.InventoryServer
55 MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Attempting to load " + FileName); 52 MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Attempting to load " + FileName);
56 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 53 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
57 54
58 MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 55 MainLog.Instance.Verbose(OpenInventory_Main.LogName,
56 "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
59 foreach (Type pluginType in pluginAssembly.GetTypes()) 57 foreach (Type pluginType in pluginAssembly.GetTypes())
60 { 58 {
61 if (!pluginType.IsAbstract) 59 if (!pluginType.IsAbstract)
@@ -64,10 +62,12 @@ namespace OpenSim.Grid.InventoryServer
64 62
65 if (typeInterface != null) 63 if (typeInterface != null)
66 { 64 {
67 IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 65 IInventoryData plug =
66 (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
68 plug.Initialise(); 67 plug.Initialise();
69 _databasePlugin = plug; 68 _databasePlugin = plug;
70 MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Added IInventoryData Interface"); 69 MainLog.Instance.Verbose(OpenInventory_Main.LogName,
70 "Invenstorage: Added IInventoryData Interface");
71 break; 71 break;
72 } 72 }
73 73
@@ -82,8 +82,8 @@ namespace OpenSim.Grid.InventoryServer
82 { 82 {
83 FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); 83 FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
84 XmlReader reader = new XmlTextReader(fs); 84 XmlReader reader = new XmlTextReader(fs);
85 XmlSerializer x = new XmlSerializer(typeof(SerializableInventory)); 85 XmlSerializer x = new XmlSerializer(typeof (SerializableInventory));
86 SerializableInventory inventory = (SerializableInventory)x.Deserialize(reader); 86 SerializableInventory inventory = (SerializableInventory) x.Deserialize(reader);
87 fs.Close(); 87 fs.Close();
88 fs.Dispose(); 88 fs.Dispose();
89 return inventory; 89 return inventory;
@@ -93,11 +93,12 @@ namespace OpenSim.Grid.InventoryServer
93 { 93 {
94 XmlTextWriter writer = new XmlTextWriter(s, Encoding.UTF8); 94 XmlTextWriter writer = new XmlTextWriter(s, Encoding.UTF8);
95 writer.Formatting = Formatting.Indented; 95 writer.Formatting = Formatting.Indented;
96 XmlSerializer x = new XmlSerializer(typeof(SerializableInventory)); 96 XmlSerializer x = new XmlSerializer(typeof (SerializableInventory));
97 x.Serialize(writer, inventory); 97 x.Serialize(writer, inventory);
98 } 98 }
99 99
100 protected static bool fixupFolder(SerializableInventory.SerializableFolder f, SerializableInventory.SerializableFolder parent) 100 protected static bool fixupFolder(SerializableInventory.SerializableFolder f,
101 SerializableInventory.SerializableFolder parent)
101 { 102 {
102 bool modified = false; 103 bool modified = false;
103 104
@@ -142,6 +143,7 @@ namespace OpenSim.Grid.InventoryServer
142 { 143 {
143 private SerializableInventory _inventory; 144 private SerializableInventory _inventory;
144 private InventoryManager _manager; 145 private InventoryManager _manager;
146
145 public GetInventory(InventoryManager manager) 147 public GetInventory(InventoryManager manager)
146 : base("GET", "/inventory") 148 : base("GET", "/inventory")
147 { 149 {
@@ -165,23 +167,24 @@ namespace OpenSim.Grid.InventoryServer
165 private byte[] GetUserInventory(LLUUID userID) 167 private byte[] GetUserInventory(LLUUID userID)
166 { 168 {
167 MainLog.Instance.Notice(OpenInventory_Main.LogName, "Getting Inventory for user {0}", userID.ToString()); 169 MainLog.Instance.Notice(OpenInventory_Main.LogName, "Getting Inventory for user {0}", userID.ToString());
168 byte[] result = new byte[] { }; 170 byte[] result = new byte[] {};
169 171
170 InventoryFolderBase fb = _manager._databasePlugin.getUserRootFolder(userID); 172 InventoryFolderBase fb = _manager._databasePlugin.getUserRootFolder(userID);
171 if (fb == null) 173 if (fb == null)
172 { 174 {
173 MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new", userID.ToString()); 175 MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new",
176 userID.ToString());
174 CreateDefaultInventory(userID); 177 CreateDefaultInventory(userID);
175 } 178 }
176 179
177 return result; 180 return result;
178 } 181 }
179 182
180 override public byte[] Handle(string path, Stream request) 183 public override byte[] Handle(string path, Stream request)
181 { 184 {
182 byte[] result = new byte[] { }; 185 byte[] result = new byte[] {};
183 186
184 string[] parms = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); 187 string[] parms = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
185 if (parms.Length > 1) 188 if (parms.Length > 1)
186 { 189 {
187 if (string.Compare(parms[1], "library", true) == 0) 190 if (string.Compare(parms[1], "library", true) == 0)
@@ -190,7 +193,7 @@ namespace OpenSim.Grid.InventoryServer
190 saveInventoryToStream(_inventory, ms); 193 saveInventoryToStream(_inventory, ms);
191 194
192 result = ms.GetBuffer(); 195 result = ms.GetBuffer();
193 Array.Resize<byte>(ref result, (int)ms.Length); 196 Array.Resize<byte>(ref result, (int) ms.Length);
194 } 197 }
195 else if (string.Compare(parms[1], "user", true) == 0) 198 else if (string.Compare(parms[1], "user", true) == 0)
196 { 199 {
@@ -204,4 +207,4 @@ namespace OpenSim.Grid.InventoryServer
204 } 207 }
205 } 208 }
206 } 209 }
207} 210} \ No newline at end of file
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index df854f9..ce371bf 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -25,29 +25,23 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using System.IO; 31using System.IO;
33using System.Text;
34
35using libsecondlife; 32using libsecondlife;
36
37using OpenSim.Framework; 33using OpenSim.Framework;
38using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
39using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
40 36
41using InventoryManager = OpenSim.Grid.InventoryServer.InventoryManager;
42
43namespace OpenSim.Grid.InventoryServer 37namespace OpenSim.Grid.InventoryServer
44{ 38{
45 public class OpenInventory_Main : conscmd_callback 39 public class OpenInventory_Main : conscmd_callback
46 { 40 {
47 LogBase m_console; 41 private LogBase m_console;
48 InventoryManager m_inventoryManager; 42 private InventoryManager m_inventoryManager;
49 InventoryConfig m_config; 43 private InventoryConfig m_config;
50 GridInventoryService m_inventoryService; 44 private GridInventoryService m_inventoryService;
51 45
52 public const string LogName = "INVENTORY"; 46 public const string LogName = "INVENTORY";
53 47
@@ -72,20 +66,20 @@ namespace OpenSim.Grid.InventoryServer
72 m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml"))); 66 m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));
73 67
74 m_inventoryService = new GridInventoryService(); 68 m_inventoryService = new GridInventoryService();
75 // m_inventoryManager = new InventoryManager(); 69 // m_inventoryManager = new InventoryManager();
76 m_inventoryService.AddPlugin(m_config.DatabaseProvider); 70 m_inventoryService.AddPlugin(m_config.DatabaseProvider);
77 71
78 MainLog.Instance.Notice(LogName, "Starting HTTP server ..."); 72 MainLog.Instance.Notice(LogName, "Starting HTTP server ...");
79 BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); 73 BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort);
80 httpServer.AddStreamHandler( 74 httpServer.AddStreamHandler(
81 new RestDeserialisehandler<Guid, InventoryCollection>("POST", "/GetInventory/", 75 new RestDeserialisehandler<Guid, InventoryCollection>("POST", "/GetInventory/",
82 m_inventoryService.GetUserInventory)); 76 m_inventoryService.GetUserInventory));
83 httpServer.AddStreamHandler( 77 httpServer.AddStreamHandler(
84 new RestDeserialisehandler<Guid, bool>("POST", "/CreateInventory/", 78 new RestDeserialisehandler<Guid, bool>("POST", "/CreateInventory/",
85 m_inventoryService.CreateUsersInventory)); 79 m_inventoryService.CreateUsersInventory));
86 httpServer.AddStreamHandler( 80 httpServer.AddStreamHandler(
87 new RestDeserialisehandler<InventoryFolderBase, bool>("POST", "/NewFolder/", 81 new RestDeserialisehandler<InventoryFolderBase, bool>("POST", "/NewFolder/",
88 m_inventoryService.AddInventoryFolder)); 82 m_inventoryService.AddInventoryFolder));
89 83
90 httpServer.AddStreamHandler( 84 httpServer.AddStreamHandler(
91 new RestDeserialisehandler<InventoryFolderBase, bool>("POST", "/MoveFolder/", 85 new RestDeserialisehandler<InventoryFolderBase, bool>("POST", "/MoveFolder/",
@@ -93,16 +87,16 @@ namespace OpenSim.Grid.InventoryServer
93 87
94 httpServer.AddStreamHandler( 88 httpServer.AddStreamHandler(
95 new RestDeserialisehandler<InventoryItemBase, bool>("POST", "/NewItem/", 89 new RestDeserialisehandler<InventoryItemBase, bool>("POST", "/NewItem/",
96 m_inventoryService.AddInventoryItem)); 90 m_inventoryService.AddInventoryItem));
97 httpServer.AddStreamHandler( 91 httpServer.AddStreamHandler(
98 new RestDeserialisehandler<InventoryItemBase, bool>("POST", "/DeleteItem/", 92 new RestDeserialisehandler<InventoryItemBase, bool>("POST", "/DeleteItem/",
99 m_inventoryService.DeleteInvItem)); 93 m_inventoryService.DeleteInvItem));
100 94
101 httpServer.AddStreamHandler( 95 httpServer.AddStreamHandler(
102 new RestDeserialisehandler<Guid, List<InventoryFolderBase>>("POST", "/RootFolders/", 96 new RestDeserialisehandler<Guid, List<InventoryFolderBase>>("POST", "/RootFolders/",
103 m_inventoryService.RequestFirstLevelFolders)); 97 m_inventoryService.RequestFirstLevelFolders));
104 98
105 // httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); 99 // httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager));
106 100
107 httpServer.Start(); 101 httpServer.Start();
108 MainLog.Instance.Notice(LogName, "Started HTTP server"); 102 MainLog.Instance.Notice(LogName, "Started HTTP server");
@@ -137,4 +131,4 @@ namespace OpenSim.Grid.InventoryServer
137 { 131 {
138 } 132 }
139 } 133 }
140} 134} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/Application.cs b/OpenSim/Grid/ScriptServer/Application.cs
index dd1da66..5076618 100644
--- a/OpenSim/Grid/ScriptServer/Application.cs
+++ b/OpenSim/Grid/ScriptServer/Application.cs
@@ -52,4 +52,4 @@ namespace OpenSim.Grid.ScriptServer
52 Console.WriteLine(e.ExceptionObject.ToString()); 52 Console.WriteLine(e.ExceptionObject.ToString());
53 } 53 }
54 } 54 }
55} 55} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
index 87198d1..7d29129 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
@@ -101,4 +101,4 @@ namespace OpenSim.Grid.ScriptServer
101 Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null)); 101 Regions.Add(new RegionConnectionManager(m_ScriptServerMain, m_log, null));
102 } 102 }
103 } 103 }
104} 104} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs
index fc6939c..518c198 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineInterface.cs
@@ -35,4 +35,4 @@ namespace OpenSim.Grid.ScriptServer
35 void Shutdown(); 35 void Shutdown();
36// void StartScript(string ScriptID, IScriptHost ObjectID); 36// void StartScript(string ScriptID, IScriptHost ObjectID);
37 } 37 }
38} 38} \ No newline at end of file
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs
index d02955e..7f39931 100644
--- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngineManager/ScriptEngineLoader.cs
@@ -121,4 +121,4 @@ namespace OpenSim.Grid.ScriptServer
121 return ret; 121 return ret;
122 } 122 }
123 } 123 }
124} 124} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 4806e52..6e3ccb7 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -129,7 +129,8 @@ namespace OpenSim.Grid.UserServer
129 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); 129 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
130 130
131 LLUUID userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); 131 LLUUID userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
132 RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); 132 RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/",
133 userID.UUID);
133 m_lastCreatedUser = userID; 134 m_lastCreatedUser = userID;
134 break; 135 break;
135 } 136 }
@@ -154,17 +155,23 @@ namespace OpenSim.Grid.UserServer
154 break; 155 break;
155 156
156 case "test-inventory": 157 case "test-inventory":
157 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>(); 158 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
158 // requester.ReturnResponseVal = TestResponse; 159 // requester.ReturnResponseVal = TestResponse;
159 // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); 160 // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
160 List<InventoryFolderBase> folders = SynchronousRestObjectPoster.BeginPostObject< LLUUID, List<InventoryFolderBase>>("POST",m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); 161 List<InventoryFolderBase> folders =
162 SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST",
163 m_userManager.
164 _config.
165 InventoryUrl +
166 "RootFolders/",
167 m_lastCreatedUser);
161 break; 168 break;
162 } 169 }
163 } 170 }
164 171
165 public void TestResponse(List<InventoryFolderBase> resp) 172 public void TestResponse(List<InventoryFolderBase> resp)
166 { 173 {
167 System.Console.WriteLine("response got"); 174 Console.WriteLine("response got");
168 } 175 }
169 176
170 /*private void ConfigDB(IGenericConfig configData) 177 /*private void ConfigDB(IGenericConfig configData)
@@ -194,4 +201,4 @@ namespace OpenSim.Grid.UserServer
194 { 201 {
195 } 202 }
196 } 203 }
197} 204} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 9b9360d..0eb2db1 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -29,16 +29,15 @@
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Net;
33using System.Threading; 32using System.Threading;
34using Nwc.XmlRpc;
35using libsecondlife; 33using libsecondlife;
34using Nwc.XmlRpc;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
38using OpenSim.Framework.Servers;
39using OpenSim.Framework.Data; 37using OpenSim.Framework.Data;
38using OpenSim.Framework.Servers;
40using OpenSim.Framework.UserManagement; 39using OpenSim.Framework.UserManagement;
41using InventoryFolder = OpenSim.Framework.InventoryFolder; 40using InventoryFolder=OpenSim.Framework.InventoryFolder;
42 41
43namespace OpenSim.Grid.UserServer 42namespace OpenSim.Grid.UserServer
44{ 43{
@@ -72,8 +71,8 @@ namespace OpenSim.Grid.UserServer
72 // Customise the response 71 // Customise the response
73 //CFK: This is redundant and the next message should always appear. 72 //CFK: This is redundant and the next message should always appear.
74 //CFK: MainLog.Instance.Verbose("LOGIN", "Home Location"); 73 //CFK: MainLog.Instance.Verbose("LOGIN", "Home Location");
75 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + 74 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
76 (SimInfo.regionLocY * 256).ToString() + "], " + 75 (SimInfo.regionLocY*256).ToString() + "], " +
77 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + 76 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
78 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 77 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
79 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + 78 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
@@ -106,7 +105,7 @@ namespace OpenSim.Grid.UserServer
106 SimParams["firstname"] = theUser.username; 105 SimParams["firstname"] = theUser.username;
107 SimParams["lastname"] = theUser.surname; 106 SimParams["lastname"] = theUser.surname;
108 SimParams["agent_id"] = theUser.UUID.ToString(); 107 SimParams["agent_id"] = theUser.UUID.ToString();
109 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); 108 SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
110 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); 109 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
111 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); 110 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
112 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); 111 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
@@ -119,9 +118,9 @@ namespace OpenSim.Grid.UserServer
119 theUser.currentAgent.currentRegion = SimInfo.UUID; 118 theUser.currentAgent.currentRegion = SimInfo.UUID;
120 theUser.currentAgent.currentHandle = SimInfo.regionHandle; 119 theUser.currentAgent.currentHandle = SimInfo.regionHandle;
121 120
122 MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " + 121 MainLog.Instance.Verbose("LOGIN", SimInfo.regionName + " @ " + SimInfo.httpServerURI + " " +
123 SimInfo.regionLocX + "," + SimInfo.regionLocY); 122 SimInfo.regionLocX + "," + SimInfo.regionLocY);
124 123
125 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 124 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
126 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); 125 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
127 } 126 }
@@ -129,17 +128,17 @@ namespace OpenSim.Grid.UserServer
129 { 128 {
130 tryDefault = true; 129 tryDefault = true;
131 } 130 }
132 if(tryDefault) 131 if (tryDefault)
133 { 132 {
134 // Send him to default region instead 133 // Send him to default region instead
135 // Load information from the gridserver 134 // Load information from the gridserver
136 135
137 ulong defaultHandle = (((ulong)m_config.DefaultX * 256) << 32) | ((ulong) m_config.DefaultY * 256); 136 ulong defaultHandle = (((ulong) m_config.DefaultX*256) << 32) | ((ulong) m_config.DefaultY*256);
138 137
139 MainLog.Instance.Warn( 138 MainLog.Instance.Warn(
140 "LOGIN", 139 "LOGIN",
141 "Home region not available: sending to default " + defaultHandle.ToString()); 140 "Home region not available: sending to default " + defaultHandle.ToString());
142 141
143 SimInfo = new RegionProfileData(); 142 SimInfo = new RegionProfileData();
144 try 143 try
145 { 144 {
@@ -149,15 +148,16 @@ namespace OpenSim.Grid.UserServer
149 148
150 // Customise the response 149 // Customise the response
151 MainLog.Instance.Verbose("LOGIN", "Home Location"); 150 MainLog.Instance.Verbose("LOGIN", "Home Location");
152 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + 151 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
153 (SimInfo.regionLocY * 256).ToString() + "], " + 152 (SimInfo.regionLocY*256).ToString() + "], " +
154 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + 153 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
155 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 154 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
156 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + 155 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
157 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}"; 156 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
158 157
159 // Destination 158 // Destination
160 MainLog.Instance.Verbose("LOGIN", "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + 159 MainLog.Instance.Verbose("LOGIN",
160 "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
161 SimInfo.regionLocY); 161 SimInfo.regionLocY);
162 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString(); 162 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
163 response.SimPort = (uint) SimInfo.serverPort; 163 response.SimPort = (uint) SimInfo.serverPort;
@@ -182,7 +182,7 @@ namespace OpenSim.Grid.UserServer
182 SimParams["firstname"] = theUser.username; 182 SimParams["firstname"] = theUser.username;
183 SimParams["lastname"] = theUser.surname; 183 SimParams["lastname"] = theUser.surname;
184 SimParams["agent_id"] = theUser.UUID.ToString(); 184 SimParams["agent_id"] = theUser.UUID.ToString();
185 SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode); 185 SimParams["circuit_code"] = (Int32) Convert.ToUInt32(response.CircuitCode);
186 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString(); 186 SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
187 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString(); 187 SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
188 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString(); 188 SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
@@ -202,35 +202,34 @@ namespace OpenSim.Grid.UserServer
202 MainLog.Instance.Warn("LOGIN", "Default region also not available"); 202 MainLog.Instance.Warn("LOGIN", "Default region also not available");
203 MainLog.Instance.Warn("LOGIN", e.ToString()); 203 MainLog.Instance.Warn("LOGIN", e.ToString());
204 } 204 }
205
206 } 205 }
207 } 206 }
208 207
209 protected override InventoryData CreateInventoryData(LLUUID userID) 208 protected override InventoryData CreateInventoryData(LLUUID userID)
210 { 209 {
211 List<InventoryFolderBase> folders 210 List<InventoryFolderBase> folders
212 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( 211 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
213 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); 212 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
214 213
215 // In theory, the user will only ever be missing a root folder in situations where a grid 214 // In theory, the user will only ever be missing a root folder in situations where a grid
216 // which didn't previously run a grid wide inventory server is being transitioned to one 215 // which didn't previously run a grid wide inventory server is being transitioned to one
217 // which does. 216 // which does.
218 if (null == folders | folders.Count == 0) 217 if (null == folders | folders.Count == 0)
219 { 218 {
220 MainLog.Instance.Warn( 219 MainLog.Instance.Warn(
221 "LOGIN", 220 "LOGIN",
222 "A root inventory folder for user ID " + userID + " was not found. A new set" 221 "A root inventory folder for user ID " + userID + " was not found. A new set"
223 + " of empty inventory folders is being created."); 222 + " of empty inventory folders is being created.");
224 223
225 RestObjectPoster.BeginPostObject<Guid>( 224 RestObjectPoster.BeginPostObject<Guid>(
226 m_config.InventoryUrl + "CreateInventory/", userID.UUID); 225 m_config.InventoryUrl + "CreateInventory/", userID.UUID);
227 226
228 // A big delay should be okay here since the recreation of the user's root folders should 227 // A big delay should be okay here since the recreation of the user's root folders should
229 // only ever happen once. We need to sleep to let the inventory server do its work - 228 // only ever happen once. We need to sleep to let the inventory server do its work -
230 // previously 1000ms has been found to be too short. 229 // previously 1000ms has been found to be too short.
231 Thread.Sleep(10000); 230 Thread.Sleep(10000);
232 folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( 231 folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
233 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); 232 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
234 } 233 }
235 234
236 if (folders.Count > 0) 235 if (folders.Count > 0)
@@ -247,8 +246,8 @@ namespace OpenSim.Grid.UserServer
247 TempHash = new Hashtable(); 246 TempHash = new Hashtable();
248 TempHash["name"] = InvFolder.name; 247 TempHash["name"] = InvFolder.name;
249 TempHash["parent_id"] = InvFolder.parentID.ToString(); 248 TempHash["parent_id"] = InvFolder.parentID.ToString();
250 TempHash["version"] = (Int32)InvFolder.version; 249 TempHash["version"] = (Int32) InvFolder.version;
251 TempHash["type_default"] = (Int32)InvFolder.type; 250 TempHash["type_default"] = (Int32) InvFolder.type;
252 TempHash["folder_id"] = InvFolder.folderID.ToString(); 251 TempHash["folder_id"] = InvFolder.folderID.ToString();
253 AgentInventoryArray.Add(TempHash); 252 AgentInventoryArray.Add(TempHash);
254 } 253 }
@@ -257,8 +256,8 @@ namespace OpenSim.Grid.UserServer
257 else 256 else
258 { 257 {
259 MainLog.Instance.Warn("LOGIN", "The root inventory folder could still not be retrieved" + 258 MainLog.Instance.Warn("LOGIN", "The root inventory folder could still not be retrieved" +
260 " for user ID " + userID); 259 " for user ID " + userID);
261 260
262 AgentInventory userInventory = new AgentInventory(); 261 AgentInventory userInventory = new AgentInventory();
263 userInventory.CreateRootFolder(userID, false); 262 userInventory.CreateRootFolder(userID, false);
264 263
@@ -269,8 +268,8 @@ namespace OpenSim.Grid.UserServer
269 TempHash = new Hashtable(); 268 TempHash = new Hashtable();
270 TempHash["name"] = InvFolder.FolderName; 269 TempHash["name"] = InvFolder.FolderName;
271 TempHash["parent_id"] = InvFolder.ParentID.ToString(); 270 TempHash["parent_id"] = InvFolder.ParentID.ToString();
272 TempHash["version"] = (Int32)InvFolder.Version; 271 TempHash["version"] = (Int32) InvFolder.Version;
273 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 272 TempHash["type_default"] = (Int32) InvFolder.DefaultType;
274 TempHash["folder_id"] = InvFolder.FolderID.ToString(); 273 TempHash["folder_id"] = InvFolder.FolderID.ToString();
275 AgentInventoryArray.Add(TempHash); 274 AgentInventoryArray.Add(TempHash);
276 } 275 }
@@ -279,4 +278,4 @@ namespace OpenSim.Grid.UserServer
279 } 278 }
280 } 279 }
281 } 280 }
282} 281} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index be9e6f1..a50419e 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text.RegularExpressions;
31using libsecondlife; 32using libsecondlife;
32using Nwc.XmlRpc; 33using Nwc.XmlRpc;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -76,8 +77,8 @@ namespace OpenSim.Grid.UserServer
76 XmlRpcResponse response = new XmlRpcResponse(); 77 XmlRpcResponse response = new XmlRpcResponse();
77 Hashtable responseData = new Hashtable(); 78 Hashtable responseData = new Hashtable();
78 // Query Result Information 79 // Query Result Information
79 responseData["queryid"] = (string)queryID.ToString(); 80 responseData["queryid"] = (string) queryID.ToString();
80 responseData["avcount"] = (string)returnUsers.Count.ToString(); 81 responseData["avcount"] = (string) returnUsers.Count.ToString();
81 82
82 for (int i = 0; i < returnUsers.Count; i++) 83 for (int i = 0; i < returnUsers.Count; i++)
83 { 84 {
@@ -86,9 +87,10 @@ namespace OpenSim.Grid.UserServer
86 responseData["lastname" + i.ToString()] = returnUsers[i].lastName; 87 responseData["lastname" + i.ToString()] = returnUsers[i].lastName;
87 } 88 }
88 response.Value = responseData; 89 response.Value = responseData;
89 90
90 return response; 91 return response;
91 } 92 }
93
92 /// <summary> 94 /// <summary>
93 /// Converts a user profile to an XML element which can be returned 95 /// Converts a user profile to an XML element which can be returned
94 /// </summary> 96 /// </summary>
@@ -135,18 +137,18 @@ namespace OpenSim.Grid.UserServer
135 public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request) 137 public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request)
136 { 138 {
137 XmlRpcResponse response = new XmlRpcResponse(); 139 XmlRpcResponse response = new XmlRpcResponse();
138 Hashtable requestData = (Hashtable)request.Params[0]; 140 Hashtable requestData = (Hashtable) request.Params[0];
139 List<AvatarPickerAvatar> returnAvatar = new List<AvatarPickerAvatar>(); 141 List<AvatarPickerAvatar> returnAvatar = new List<AvatarPickerAvatar>();
140 LLUUID queryID = new LLUUID(LLUUID.Zero.ToString()); 142 LLUUID queryID = new LLUUID(LLUUID.Zero.ToString());
141 143
142 if (requestData.Contains("avquery") && requestData.Contains("queryid")) 144 if (requestData.Contains("avquery") && requestData.Contains("queryid"))
143 { 145 {
144 queryID = new LLUUID((string)requestData["queryid"]); 146 queryID = new LLUUID((string) requestData["queryid"]);
145 returnAvatar = GenerateAgentPickerRequestResponse(queryID,(string)requestData["avquery"]); 147 returnAvatar = GenerateAgentPickerRequestResponse(queryID, (string) requestData["avquery"]);
146 } 148 }
147 149
148 Console.WriteLine("[AVATARINFO]: Servicing Avatar Query: " + (string)requestData["avquery"]); 150 Console.WriteLine("[AVATARINFO]: Servicing Avatar Query: " + (string) requestData["avquery"]);
149 return AvatarPickerListtoXmlRPCResponse(queryID,returnAvatar); 151 return AvatarPickerListtoXmlRPCResponse(queryID, returnAvatar);
150 } 152 }
151 153
152 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request) 154 public XmlRpcResponse XmlRPCGetUserMethodName(XmlRpcRequest request)
@@ -156,16 +158,16 @@ namespace OpenSim.Grid.UserServer
156 UserProfileData userProfile; 158 UserProfileData userProfile;
157 if (requestData.Contains("avatar_name")) 159 if (requestData.Contains("avatar_name"))
158 { 160 {
159 string query = (string)requestData["avatar_name"]; 161 string query = (string) requestData["avatar_name"];
160 162
161 System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9]"); 163 Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
162 164
163 string[] querysplit; 165 string[] querysplit;
164 querysplit = query.Split(' '); 166 querysplit = query.Split(' ');
165 167
166 if (querysplit.Length == 2) 168 if (querysplit.Length == 2)
167 { 169 {
168 userProfile = GetUserProfile(querysplit[0],querysplit[1]); 170 userProfile = GetUserProfile(querysplit[0], querysplit[1]);
169 if (userProfile == null) 171 if (userProfile == null)
170 { 172 {
171 return CreateUnknownUserErrorResponse(); 173 return CreateUnknownUserErrorResponse();
@@ -196,11 +198,11 @@ namespace OpenSim.Grid.UserServer
196 LLUUID guess = new LLUUID(); 198 LLUUID guess = new LLUUID();
197 try 199 try
198 { 200 {
199 guess = new LLUUID((string)requestData["avatar_uuid"]); 201 guess = new LLUUID((string) requestData["avatar_uuid"]);
200 202
201 userProfile = GetUserProfile(guess); 203 userProfile = GetUserProfile(guess);
202 } 204 }
203 catch (System.FormatException) 205 catch (FormatException)
204 { 206 {
205 return CreateUnknownUserErrorResponse(); 207 return CreateUnknownUserErrorResponse();
206 } 208 }
@@ -231,9 +233,9 @@ namespace OpenSim.Grid.UserServer
231 throw new Exception("The method or operation is not implemented."); 233 throw new Exception("The method or operation is not implemented.");
232 } 234 }
233 235
234 public override UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid) 236 public override UserProfileData SetupMasterUser(LLUUID uuid)
235 { 237 {
236 throw new Exception("The method or operation is not implemented."); 238 throw new Exception("The method or operation is not implemented.");
237 } 239 }
238 } 240 }
239} 241} \ No newline at end of file
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index 130199d..cb3bd40 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -77,4 +77,4 @@ namespace OpenSim
77 } 77 }
78 } 78 }
79 } 79 }
80} 80} \ No newline at end of file
diff --git a/OpenSim/Region/Application/IApplicationPlugin.cs b/OpenSim/Region/Application/IApplicationPlugin.cs
index 17c81e1..4f81354 100644
--- a/OpenSim/Region/Application/IApplicationPlugin.cs
+++ b/OpenSim/Region/Application/IApplicationPlugin.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -26,13 +26,10 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using Mono.Addins; 29using Mono.Addins;
33using Mono.Addins.Description;
34 30
35[assembly: AddinRoot("OpenSim", "0.4")] 31[assembly : AddinRoot("OpenSim", "0.4")]
32
36namespace OpenSim 33namespace OpenSim
37{ 34{
38 [TypeExtensionPoint("/OpenSim/Startup")] 35 [TypeExtensionPoint("/OpenSim/Startup")]
@@ -41,4 +38,4 @@ namespace OpenSim
41 void Initialise(OpenSimMain openSim); 38 void Initialise(OpenSimMain openSim);
42 void Close(); 39 void Close();
43 } 40 }
44} 41} \ No newline at end of file
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index b3daf0c..fa2a989 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -30,6 +30,10 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Text; 32using System.Text;
33using System.Threading;
34using System.Timers;
35using libsecondlife;
36using Mono.Addins;
33using Nini.Config; 37using Nini.Config;
34using OpenSim.Framework; 38using OpenSim.Framework;
35using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
@@ -42,9 +46,7 @@ using OpenSim.Region.Environment;
42using OpenSim.Region.Environment.Interfaces; 46using OpenSim.Region.Environment.Interfaces;
43using OpenSim.Region.Environment.Scenes; 47using OpenSim.Region.Environment.Scenes;
44using OpenSim.Region.Physics.Manager; 48using OpenSim.Region.Physics.Manager;
45using libsecondlife; 49using Timer=System.Timers.Timer;
46using Mono.Addins;
47using Mono.Addins.Description;
48 50
49namespace OpenSim 51namespace OpenSim
50{ 52{
@@ -86,7 +88,7 @@ namespace OpenSim
86 private string m_assetStorage = "sqlite"; 88 private string m_assetStorage = "sqlite";
87 89
88 private string m_timedScript = "disabled"; 90 private string m_timedScript = "disabled";
89 private System.Timers.Timer m_scriptTimer; 91 private Timer m_scriptTimer;
90 92
91 public ConsoleCommand CreateAccount = null; 93 public ConsoleCommand CreateAccount = null;
92 private bool m_dumpAssetsToFile; 94 private bool m_dumpAssetsToFile;
@@ -238,7 +240,7 @@ namespace OpenSim
238 m_permissions = startupConfig.GetBoolean("serverside_object_permissions", false); 240 m_permissions = startupConfig.GetBoolean("serverside_object_permissions", false);
239 241
240 m_storageDll = startupConfig.GetString("storage_plugin", "OpenSim.DataStore.MonoSqlite.dll"); 242 m_storageDll = startupConfig.GetString("storage_plugin", "OpenSim.DataStore.MonoSqlite.dll");
241 m_storageConnectionString 243 m_storageConnectionString
242 = startupConfig.GetString("storage_connection_string", "URI=file:OpenSim.db,version=3"); 244 = startupConfig.GetString("storage_connection_string", "URI=file:OpenSim.db,version=3");
243 245
244 m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", ""); 246 m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", "");
@@ -268,7 +270,7 @@ namespace OpenSim
268 if (!m_sandbox) 270 if (!m_sandbox)
269 m_SendChildAgentTaskData = false; 271 m_SendChildAgentTaskData = false;
270 272
271 273
272 m_networkServersInfo.loadFromConfiguration(m_config); 274 m_networkServersInfo.loadFromConfiguration(m_config);
273 } 275 }
274 276
@@ -327,16 +329,16 @@ namespace OpenSim
327 MainLog.Instance.Verbose("Plugins", "Loading OpenSim application plugins"); 329 MainLog.Instance.Verbose("Plugins", "Loading OpenSim application plugins");
328 foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/Startup")) 330 foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/Startup"))
329 { 331 {
330 IApplicationPlugin plugin = (IApplicationPlugin)node.CreateInstance(); 332 IApplicationPlugin plugin = (IApplicationPlugin) node.CreateInstance();
331 plugin.Initialise(this); 333 plugin.Initialise(this);
332 m_plugins.Add(plugin); 334 m_plugins.Add(plugin);
333 } 335 }
334 336
335 // Start UDP servers 337 // Start UDP servers
336 //for (int i = 0; i < m_udpServers.Count; i++) 338 //for (int i = 0; i < m_udpServers.Count; i++)
337 //{ 339 //{
338 // m_udpServers[i].ServerListener(); 340 // m_udpServers[i].ServerListener();
339 // } 341 // }
340 342
341 //Run Startup Commands 343 //Run Startup Commands
342 if (m_startupCommandsFile != "") 344 if (m_startupCommandsFile != "")
@@ -353,10 +355,10 @@ namespace OpenSim
353 355
354 if (m_timedScript != "disabled") 356 if (m_timedScript != "disabled")
355 { 357 {
356 m_scriptTimer = new System.Timers.Timer(); 358 m_scriptTimer = new Timer();
357 m_scriptTimer.Enabled = true; 359 m_scriptTimer.Enabled = true;
358 m_scriptTimer.Interval = (int)(1200 * 1000); 360 m_scriptTimer.Interval = (int) (1200*1000);
359 m_scriptTimer.Elapsed += new System.Timers.ElapsedEventHandler(RunAutoTimerScript); 361 m_scriptTimer.Elapsed += new ElapsedEventHandler(RunAutoTimerScript);
360 } 362 }
361 } 363 }
362 364
@@ -402,11 +404,13 @@ namespace OpenSim
402 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); 404 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
403 if (m_SendChildAgentTaskData) 405 if (m_SendChildAgentTaskData)
404 { 406 {
405 MainLog.Instance.Error("WARNING", "Send Child Agent Task Updates is enabled. This is for testing only. It doesn't work on grid mode!"); 407 MainLog.Instance.Error("WARNING",
406 System.Threading.Thread.Sleep(12000); 408 "Send Child Agent Task Updates is enabled. This is for testing only. It doesn't work on grid mode!");
409 Thread.Sleep(12000);
407 } 410 }
408 return 411 return
409 new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer, 412 new Scene(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache,
413 storageManager, m_httpServer,
410 m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_SendChildAgentTaskData); 414 m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_SendChildAgentTaskData);
411 } 415 }
412 416
@@ -440,16 +444,15 @@ namespace OpenSim
440 m_assetCache = new AssetCache(assetServer, m_log); 444 m_assetCache = new AssetCache(assetServer, m_log);
441 // m_assetCache = new assetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey); 445 // m_assetCache = new assetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
442 m_sceneManager.OnRestartSim += handleRestartRegion; 446 m_sceneManager.OnRestartSim += handleRestartRegion;
443
444 } 447 }
445 448
446 public void handleRestartRegion(RegionInfo whichRegion) 449 public void handleRestartRegion(RegionInfo whichRegion)
447 { 450 {
448 MainLog.Instance.Error("MAIN", "Got restart signal from SceneManager"); 451 MainLog.Instance.Error("MAIN", "Got restart signal from SceneManager");
449 // Shutting down the UDP server 452 // Shutting down the UDP server
450 bool foundUDPServer = false; 453 bool foundUDPServer = false;
451 int UDPServerElement = 0; 454 int UDPServerElement = 0;
452 455
453 for (int i = 0; i < m_udpServers.Count; i++) 456 for (int i = 0; i < m_udpServers.Count; i++)
454 { 457 {
455 if (m_udpServers[i].RegionHandle == whichRegion.RegionHandle) 458 if (m_udpServers[i].RegionHandle == whichRegion.RegionHandle)
@@ -459,9 +462,9 @@ namespace OpenSim
459 break; 462 break;
460 } 463 }
461 } 464 }
462 if (foundUDPServer) 465 if (foundUDPServer)
463 { 466 {
464 // m_udpServers[UDPServerElement].Server.End 467 // m_udpServers[UDPServerElement].Server.End
465 m_udpServers[UDPServerElement].Server.Close(); 468 m_udpServers[UDPServerElement].Server.Close();
466 m_udpServers.RemoveAt(UDPServerElement); 469 m_udpServers.RemoveAt(UDPServerElement);
467 } 470 }
@@ -479,7 +482,7 @@ namespace OpenSim
479 { 482 {
480 m_regionData.RemoveAt(RegionHandleElement); 483 m_regionData.RemoveAt(RegionHandleElement);
481 } 484 }
482 485
483 CreateRegion(whichRegion); 486 CreateRegion(whichRegion);
484 //UDPServer restartingRegion = CreateRegion(whichRegion); 487 //UDPServer restartingRegion = CreateRegion(whichRegion);
485 //restartingRegion.ServerListener(); 488 //restartingRegion.ServerListener();
@@ -537,7 +540,7 @@ namespace OpenSim
537 { 540 {
538 RunCommandScript(m_shutdownCommandsFile); 541 RunCommandScript(m_shutdownCommandsFile);
539 } 542 }
540 543
541 m_log.Verbose("SHUTDOWN", "Closing all threads"); 544 m_log.Verbose("SHUTDOWN", "Closing all threads");
542 m_log.Verbose("SHUTDOWN", "Killing listener thread"); 545 m_log.Verbose("SHUTDOWN", "Killing listener thread");
543 m_log.Verbose("SHUTDOWN", "Killing clients"); 546 m_log.Verbose("SHUTDOWN", "Killing clients");
@@ -557,6 +560,7 @@ namespace OpenSim
557 RunCommandScript(m_timedScript); 560 RunCommandScript(m_timedScript);
558 } 561 }
559 } 562 }
563
560 #region Console Commands 564 #region Console Commands
561 565
562 /// <summary> 566 /// <summary>
@@ -679,10 +683,17 @@ namespace OpenSim
679 } 683 }
680 if (cmdparams.Length > 2) 684 if (cmdparams.Length > 2)
681 { 685 {
682 loadOffset.X = (float)Convert.ToDecimal(cmdparams[2]); 686 loadOffset.X = (float) Convert.ToDecimal(cmdparams[2]);
683 if (cmdparams.Length > 3) { loadOffset.Y = (float)Convert.ToDecimal(cmdparams[3]); } 687 if (cmdparams.Length > 3)
684 if (cmdparams.Length > 4) { loadOffset.Z = (float)Convert.ToDecimal(cmdparams[4]); } 688 {
685 m_log.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," + loadOffset.Z + ">"); 689 loadOffset.Y = (float) Convert.ToDecimal(cmdparams[3]);
690 }
691 if (cmdparams.Length > 4)
692 {
693 loadOffset.Z = (float) Convert.ToDecimal(cmdparams[4]);
694 }
695 m_log.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," +
696 loadOffset.Z + ">");
686 } 697 }
687 } 698 }
688 m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset); 699 m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset);
@@ -795,12 +806,13 @@ namespace OpenSim
795 806
796 if (m_sceneManager.CurrentScene == null) 807 if (m_sceneManager.CurrentScene == null)
797 { 808 {
798 MainLog.Instance.Verbose("CONSOLE", 809 MainLog.Instance.Verbose("CONSOLE",
799 "Currently at Root level. To change region please use 'change-region <regioname>'"); 810 "Currently at Root level. To change region please use 'change-region <regioname>'");
800 } 811 }
801 else 812 else
802 { 813 {
803 MainLog.Instance.Verbose("CONSOLE", "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + 814 MainLog.Instance.Verbose("CONSOLE",
815 "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName +
804 ". To change region please use 'change-region <regioname>'"); 816 ". To change region please use 'change-region <regioname>'");
805 } 817 }
806 818
@@ -901,10 +913,13 @@ namespace OpenSim
901 break; 913 break;
902 914
903 case "regions": 915 case "regions":
904 m_sceneManager.ForEachScene(delegate(Scene scene) 916 m_sceneManager.ForEachScene(
905 { 917 delegate(Scene scene)
906 m_log.Error("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " + scene.RegionInfo.RegionLocX + " , Region YLoc: " + scene.RegionInfo.RegionLocY); 918 {
907 }); 919 m_log.Error("Region Name: " + scene.RegionInfo.RegionName + " , Region XLoc: " +
920 scene.RegionInfo.RegionLocX + " , Region YLoc: " +
921 scene.RegionInfo.RegionLocY);
922 });
908 break; 923 break;
909 } 924 }
910 } 925 }
@@ -922,4 +937,4 @@ namespace OpenSim
922 937
923 #endregion 938 #endregion
924 } 939 }
925} 940} \ No newline at end of file
diff --git a/OpenSim/Region/Application/VersionInfo.cs b/OpenSim/Region/Application/VersionInfo.cs
index 8d8217f..0f798e4 100644
--- a/OpenSim/Region/Application/VersionInfo.cs
+++ b/OpenSim/Region/Application/VersionInfo.cs
@@ -33,4 +33,4 @@ namespace OpenSim
33 { 33 {
34 public static string Version = "0.4, SVN build "; 34 public static string Version = "0.4, SVN build ";
35 } 35 }
36} 36} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs
index 7bfadea..b3af1cc 100644
--- a/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs
+++ b/OpenSim/Region/ClientStack/ClientStackNetworkHandler.cs
@@ -35,4 +35,4 @@ namespace OpenSim.Region.ClientStack
35 void RemoveClientCircuit(uint circuitcode); 35 void RemoveClientCircuit(uint circuitcode);
36 void RegisterPacketServer(PacketServer server); 36 void RegisterPacketServer(PacketServer server);
37 } 37 }
38} 38} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index f29d2f9..b232ed6 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -38,6 +38,7 @@ using libsecondlife.Packets;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Console; 40using OpenSim.Framework.Console;
41using OpenSim.Region.Environment.Scenes;
41using Timer=System.Timers.Timer; 42using Timer=System.Timers.Timer;
42 43
43namespace OpenSim.Region.ClientStack 44namespace OpenSim.Region.ClientStack
@@ -71,9 +72,10 @@ namespace OpenSim.Region.ClientStack
71 private readonly uint m_circuitCode; 72 private readonly uint m_circuitCode;
72 private int m_moneyBalance; 73 private int m_moneyBalance;
73 74
74 private readonly byte[] m_channelVersion=new byte[] { 0x00} ; // Dummy value needed by libSL 75 private readonly byte[] m_channelVersion = new byte[] {0x00}; // Dummy value needed by libSL
75 76
76 /* protected variables */ 77 /* protected variables */
78
77 protected static Dictionary<PacketType, PacketMethod> PacketHandlers = 79 protected static Dictionary<PacketType, PacketMethod> PacketHandlers =
78 new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients 80 new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
79 81
@@ -94,7 +96,7 @@ namespace OpenSim.Region.ClientStack
94 protected const int RESEND_TIMEOUT = 4000; 96 protected const int RESEND_TIMEOUT = 4000;
95 protected const int MAX_SEQUENCE = 0xFFFFFF; 97 protected const int MAX_SEQUENCE = 0xFFFFFF;
96 protected PacketServer m_networkServer; 98 protected PacketServer m_networkServer;
97 99
98 /* public variables */ 100 /* public variables */
99 protected string m_firstName; 101 protected string m_firstName;
100 protected string m_lastName; 102 protected string m_lastName;
@@ -103,11 +105,12 @@ namespace OpenSim.Region.ClientStack
103 protected EndPoint m_userEndPoint; 105 protected EndPoint m_userEndPoint;
104 106
105 /* Properties */ 107 /* Properties */
108
106 public LLUUID SecureSessionId 109 public LLUUID SecureSessionId
107 { 110 {
108 get { return m_secureSessionId; } 111 get { return m_secureSessionId; }
109 } 112 }
110 113
111 public IScene Scene 114 public IScene Scene
112 { 115 {
113 get { return m_scene; } 116 get { return m_scene; }
@@ -144,7 +147,7 @@ namespace OpenSim.Region.ClientStack
144 { 147 {
145 get { return m_lastName; } 148 get { return m_lastName; }
146 } 149 }
147 150
148 /// <summary> 151 /// <summary>
149 /// Full name of the client (first name and last name) 152 /// Full name of the client (first name and last name)
150 /// </summary> 153 /// </summary>
@@ -162,10 +165,11 @@ namespace OpenSim.Region.ClientStack
162 { 165 {
163 get { return m_moneyBalance; } 166 get { return m_moneyBalance; }
164 } 167 }
165 168
166 /* METHODS */ 169 /* METHODS */
167 170
168 public ClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions, LLUUID agentId, LLUUID sessionId, uint circuitCode) 171 public ClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, PacketServer packServer,
172 AgentCircuitManager authenSessions, LLUUID agentId, LLUUID sessionId, uint circuitCode)
169 { 173 {
170 m_moneyBalance = 1000; 174 m_moneyBalance = 1000;
171 175
@@ -209,7 +213,6 @@ namespace OpenSim.Region.ClientStack
209 213
210 private void CloseCleanup() 214 private void CloseCleanup()
211 { 215 {
212
213 m_scene.RemoveClient(AgentId); 216 m_scene.RemoveClient(AgentId);
214 // Send the STOP packet 217 // Send the STOP packet
215 DisableSimulatorPacket disable = new DisableSimulatorPacket(); 218 DisableSimulatorPacket disable = new DisableSimulatorPacket();
@@ -222,9 +225,6 @@ namespace OpenSim.Region.ClientStack
222 225
223 Thread.Sleep(2000); 226 Thread.Sleep(2000);
224 227
225
226
227
228 228
229 // Shut down timers 229 // Shut down timers
230 m_ackTimer.Stop(); 230 m_ackTimer.Stop();
@@ -243,18 +243,15 @@ namespace OpenSim.Region.ClientStack
243 243
244 public void Close(bool ShutdownCircult) 244 public void Close(bool ShutdownCircult)
245 { 245 {
246
247 // Pull Client out of Region 246 // Pull Client out of Region
248 MainLog.Instance.Verbose("CLIENT", "Close has been called"); 247 MainLog.Instance.Verbose("CLIENT", "Close has been called");
249 248
250 //raiseevent on the packet server to Shutdown the circuit 249 //raiseevent on the packet server to Shutdown the circuit
251 if (ShutdownCircult) 250 if (ShutdownCircult)
252 OnConnectionClosed(this); 251 OnConnectionClosed(this);
253
254 252
255 CloseCleanup();
256 253
257 254 CloseCleanup();
258 } 255 }
259 256
260 public void Kick(string message) 257 public void Kick(string message)
@@ -262,8 +259,8 @@ namespace OpenSim.Region.ClientStack
262 KickUserPacket kupack = new KickUserPacket(); 259 KickUserPacket kupack = new KickUserPacket();
263 kupack.UserInfo.AgentID = AgentId; 260 kupack.UserInfo.AgentID = AgentId;
264 kupack.UserInfo.SessionID = SessionId; 261 kupack.UserInfo.SessionID = SessionId;
265 kupack.TargetBlock.TargetIP = (uint)0; 262 kupack.TargetBlock.TargetIP = (uint) 0;
266 kupack.TargetBlock.TargetPort = (ushort)0; 263 kupack.TargetBlock.TargetPort = (ushort) 0;
267 kupack.UserInfo.Reason = Helpers.StringToField(message); 264 kupack.UserInfo.Reason = Helpers.StringToField(message);
268 OutPacket(kupack, ThrottleOutPacketType.Task); 265 OutPacket(kupack, ThrottleOutPacketType.Task);
269 } 266 }
@@ -340,9 +337,9 @@ namespace OpenSim.Region.ClientStack
340 if (m_debug < 254 && packet.Type == PacketType.ViewerEffect) 337 if (m_debug < 254 && packet.Type == PacketType.ViewerEffect)
341 return; 338 return;
342 if (m_debug < 253 && ( 339 if (m_debug < 253 && (
343 packet.Type == PacketType.CompletePingCheck || 340 packet.Type == PacketType.CompletePingCheck ||
344 packet.Type == PacketType.StartPingCheck 341 packet.Type == PacketType.StartPingCheck
345 )) 342 ))
346 return; 343 return;
347 if (m_debug < 252 && packet.Type == PacketType.PacketAck) 344 if (m_debug < 252 && packet.Type == PacketType.PacketAck)
348 return; 345 return;
@@ -552,7 +549,7 @@ namespace OpenSim.Region.ClientStack
552 public event EstateOwnerMessageRequest OnEstateOwnerMessage; 549 public event EstateOwnerMessageRequest OnEstateOwnerMessage;
553 public event RegionInfoRequest OnRegionInfoRequest; 550 public event RegionInfoRequest OnRegionInfoRequest;
554 public event EstateCovenantRequest OnEstateCovenantRequest; 551 public event EstateCovenantRequest OnEstateCovenantRequest;
555 552
556 #region Scene/Avatar to Client 553 #region Scene/Avatar to Client
557 554
558 /// <summary> 555 /// <summary>
@@ -561,7 +558,8 @@ namespace OpenSim.Region.ClientStack
561 /// <param name="regionInfo"></param> 558 /// <param name="regionInfo"></param>
562 public void SendRegionHandshake(RegionInfo regionInfo) 559 public void SendRegionHandshake(RegionInfo regionInfo)
563 { 560 {
564 RegionHandshakePacket handshake = (RegionHandshakePacket) PacketPool.Instance.GetPacket(PacketType.RegionHandshake); 561 RegionHandshakePacket handshake =
562 (RegionHandshakePacket) PacketPool.Instance.GetPacket(PacketType.RegionHandshake);
565 563
566 handshake.RegionInfo.BillableFactor = regionInfo.EstateSettings.billableFactor; 564 handshake.RegionInfo.BillableFactor = regionInfo.EstateSettings.billableFactor;
567 handshake.RegionInfo.IsEstateManager = false; 565 handshake.RegionInfo.IsEstateManager = false;
@@ -645,7 +643,7 @@ namespace OpenSim.Region.ClientStack
645 643
646 OutPacket(reply, ThrottleOutPacketType.Task); 644 OutPacket(reply, ThrottleOutPacketType.Task);
647 } 645 }
648 646
649 /// <summary> 647 /// <summary>
650 /// 648 ///
651 /// </summary> 649 /// </summary>
@@ -861,7 +859,7 @@ namespace OpenSim.Region.ClientStack
861 public void SendTeleportFailed() 859 public void SendTeleportFailed()
862 { 860 {
863 TeleportFailedPacket tpFailed = new TeleportFailedPacket(); 861 TeleportFailedPacket tpFailed = new TeleportFailedPacket();
864 tpFailed.Info.AgentID = this.AgentId; 862 tpFailed.Info.AgentID = AgentId;
865 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport"); 863 tpFailed.Info.Reason = Helpers.StringToField("unknown failure of teleport");
866 OutPacket(tpFailed, ThrottleOutPacketType.Task); 864 OutPacket(tpFailed, ThrottleOutPacketType.Task);
867 } 865 }
@@ -914,8 +912,8 @@ namespace OpenSim.Region.ClientStack
914 /// <param name="items">The items contained in the folder identified by folderID</param> 912 /// <param name="items">The items contained in the folder identified by folderID</param>
915 /// <param name="fetchFolders">Do we need to send folder information?</param> 913 /// <param name="fetchFolders">Do we need to send folder information?</param>
916 /// <param name="fetchItems">Do we need to send item information?</param> 914 /// <param name="fetchItems">Do we need to send item information?</param>
917 public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, 915 public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items,
918 List<InventoryFolderBase> folders, 916 List<InventoryFolderBase> folders,
919 bool fetchFolders, bool fetchItems) 917 bool fetchFolders, bool fetchItems)
920 { 918 {
921 // An inventory descendents packet consists of a single agent section and an inventory details 919 // An inventory descendents packet consists of a single agent section and an inventory details
@@ -929,14 +927,14 @@ namespace OpenSim.Region.ClientStack
929 // for one example of this kind of thing. So we'll go for a cautious max 927 // for one example of this kind of thing. So we'll go for a cautious max
930 // items of 20 which gives a packet size of about 11k 928 // items of 20 which gives a packet size of about 11k
931 int MAX_ITEMS_PER_PACKET = 20; 929 int MAX_ITEMS_PER_PACKET = 20;
932 930
933 Encoding enc = Encoding.ASCII; 931 Encoding enc = Encoding.ASCII;
934 uint FULL_MASK_PERMISSIONS = 2147483647; 932 uint FULL_MASK_PERMISSIONS = 2147483647;
935 933
936 if (fetchItems) 934 if (fetchItems)
937 { 935 {
938 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); 936 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
939 937
940 if (items.Count < MAX_ITEMS_PER_PACKET) 938 if (items.Count < MAX_ITEMS_PER_PACKET)
941 { 939 {
942 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count]; 940 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count];
@@ -947,7 +945,7 @@ namespace OpenSim.Region.ClientStack
947 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET]; 945 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET];
948 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET; 946 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
949 } 947 }
950 948
951 // Even if we aren't fetching the folders, we still need to include the folder count 949 // Even if we aren't fetching the folders, we still need to include the folder count
952 // in the total number of descendents. Failure to do so will cause subtle bugs such 950 // in the total number of descendents. Failure to do so will cause subtle bugs such
953 // as the failure of textures which haven't been expanded in inventory to show up 951 // as the failure of textures which haven't been expanded in inventory to show up
@@ -956,7 +954,7 @@ namespace OpenSim.Region.ClientStack
956 { 954 {
957 descend.AgentData.Descendents += folders.Count; 955 descend.AgentData.Descendents += folders.Count;
958 } 956 }
959 957
960 int count = 0; 958 int count = 0;
961 int i = 0; 959 int i = 0;
962 foreach (InventoryItemBase item in items) 960 foreach (InventoryItemBase item in items)
@@ -973,28 +971,31 @@ namespace OpenSim.Region.ClientStack
973 descend.ItemData[i].FolderID = item.parentFolderID; 971 descend.ItemData[i].FolderID = item.parentFolderID;
974 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 972 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
975 descend.ItemData[i].GroupMask = 0; 973 descend.ItemData[i].GroupMask = 0;
976 descend.ItemData[i].InvType = (sbyte)item.invType; 974 descend.ItemData[i].InvType = (sbyte) item.invType;
977 descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName); 975 descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName);
978 descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; 976 descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions;
979 descend.ItemData[i].OwnerID = item.avatarID; 977 descend.ItemData[i].OwnerID = item.avatarID;
980 descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; 978 descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions;
981 descend.ItemData[i].SalePrice = 0; 979 descend.ItemData[i].SalePrice = 0;
982 descend.ItemData[i].SaleType = 0; 980 descend.ItemData[i].SaleType = 0;
983 descend.ItemData[i].Type = (sbyte)item.assetType; 981 descend.ItemData[i].Type = (sbyte) item.assetType;
984 descend.ItemData[i].CRC = 982 descend.ItemData[i].CRC =
985 Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, 983 Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType,
986 descend.ItemData[i].InvType, descend.ItemData[i].Type, 984 descend.ItemData[i].InvType, descend.ItemData[i].Type,
987 descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, descend.ItemData[i].SalePrice, 985 descend.ItemData[i].AssetID, descend.ItemData[i].GroupID,
986 descend.ItemData[i].SalePrice,
988 descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, 987 descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID,
989 descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, descend.ItemData[i].EveryoneMask, 988 descend.ItemData[i].ItemID, descend.ItemData[i].FolderID,
990 descend.ItemData[i].Flags, descend.ItemData[i].OwnerMask, descend.ItemData[i].GroupMask, item.inventoryCurrentPermissions); 989 descend.ItemData[i].EveryoneMask,
991 990 descend.ItemData[i].Flags, descend.ItemData[i].OwnerMask,
991 descend.ItemData[i].GroupMask, item.inventoryCurrentPermissions);
992
992 i++; 993 i++;
993 count++; 994 count++;
994 if (i == MAX_ITEMS_PER_PACKET) 995 if (i == MAX_ITEMS_PER_PACKET)
995 { 996 {
996 OutPacket(descend, ThrottleOutPacketType.Asset); 997 OutPacket(descend, ThrottleOutPacketType.Asset);
997 998
998 if ((items.Count - count) > 0) 999 if ((items.Count - count) > 0)
999 { 1000 {
1000 descend = CreateInventoryDescendentsPacket(ownerID, folderID); 1001 descend = CreateInventoryDescendentsPacket(ownerID, folderID);
@@ -1012,7 +1013,7 @@ namespace OpenSim.Region.ClientStack
1012 } 1013 }
1013 } 1014 }
1014 } 1015 }
1015 1016
1016 if (i < MAX_ITEMS_PER_PACKET) 1017 if (i < MAX_ITEMS_PER_PACKET)
1017 { 1018 {
1018 OutPacket(descend, ThrottleOutPacketType.Asset); 1019 OutPacket(descend, ThrottleOutPacketType.Asset);
@@ -1023,7 +1024,7 @@ namespace OpenSim.Region.ClientStack
1023 if (fetchFolders) 1024 if (fetchFolders)
1024 { 1025 {
1025 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); 1026 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
1026 1027
1027 if (folders.Count < MAX_ITEMS_PER_PACKET) 1028 if (folders.Count < MAX_ITEMS_PER_PACKET)
1028 { 1029 {
1029 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count]; 1030 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
@@ -1034,14 +1035,14 @@ namespace OpenSim.Region.ClientStack
1034 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; 1035 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
1035 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET; 1036 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
1036 } 1037 }
1037 1038
1038 // Not sure if this scenario ever actually occurs, but nonetheless we include the items 1039 // Not sure if this scenario ever actually occurs, but nonetheless we include the items
1039 // count even if we're not sending item data for the same reasons as above. 1040 // count even if we're not sending item data for the same reasons as above.
1040 if (!fetchItems) 1041 if (!fetchItems)
1041 { 1042 {
1042 descend.AgentData.Descendents += items.Count; 1043 descend.AgentData.Descendents += items.Count;
1043 } 1044 }
1044 1045
1045 int i = 0; 1046 int i = 0;
1046 int count = 0; 1047 int count = 0;
1047 foreach (InventoryFolderBase folder in folders) 1048 foreach (InventoryFolderBase folder in folders)
@@ -1050,32 +1051,34 @@ namespace OpenSim.Region.ClientStack
1050 descend.FolderData[i].FolderID = folder.folderID; 1051 descend.FolderData[i].FolderID = folder.folderID;
1051 descend.FolderData[i].Name = Helpers.StringToField(folder.name); 1052 descend.FolderData[i].Name = Helpers.StringToField(folder.name);
1052 descend.FolderData[i].ParentID = folder.parentID; 1053 descend.FolderData[i].ParentID = folder.parentID;
1053 descend.FolderData[i].Type = (sbyte)folder.type; 1054 descend.FolderData[i].Type = (sbyte) folder.type;
1054 1055
1055 i++; 1056 i++;
1056 count++; 1057 count++;
1057 if (i == MAX_ITEMS_PER_PACKET) 1058 if (i == MAX_ITEMS_PER_PACKET)
1058 { 1059 {
1059 OutPacket(descend, ThrottleOutPacketType.Asset); 1060 OutPacket(descend, ThrottleOutPacketType.Asset);
1060 1061
1061 if ((folders.Count - count) > 0) 1062 if ((folders.Count - count) > 0)
1062 { 1063 {
1063 descend = CreateInventoryDescendentsPacket(ownerID, folderID); 1064 descend = CreateInventoryDescendentsPacket(ownerID, folderID);
1064 if ((folders.Count - count) < MAX_ITEMS_PER_PACKET) 1065 if ((folders.Count - count) < MAX_ITEMS_PER_PACKET)
1065 { 1066 {
1066 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count]; 1067 descend.FolderData =
1068 new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count];
1067 descend.AgentData.Descendents = folders.Count - count; 1069 descend.AgentData.Descendents = folders.Count - count;
1068 } 1070 }
1069 else 1071 else
1070 { 1072 {
1071 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; 1073 descend.FolderData =
1074 new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
1072 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET; 1075 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
1073 } 1076 }
1074 i = 0; 1077 i = 0;
1075 } 1078 }
1076 } 1079 }
1077 } 1080 }
1078 1081
1079 if (i < MAX_ITEMS_PER_PACKET) 1082 if (i < MAX_ITEMS_PER_PACKET)
1080 { 1083 {
1081 OutPacket(descend, ThrottleOutPacketType.Asset); 1084 OutPacket(descend, ThrottleOutPacketType.Asset);
@@ -1204,6 +1207,7 @@ namespace OpenSim.Region.ClientStack
1204 sendXfer.DataPacket.Data = data; 1207 sendXfer.DataPacket.Data = data;
1205 OutPacket(sendXfer, ThrottleOutPacketType.Task); 1208 OutPacket(sendXfer, ThrottleOutPacketType.Task);
1206 } 1209 }
1210
1207 public void SendAvatarPickerReply(AvatarPickerReplyPacket replyPacket) 1211 public void SendAvatarPickerReply(AvatarPickerReplyPacket replyPacket)
1208 { 1212 {
1209 OutPacket(replyPacket, ThrottleOutPacketType.Task); 1213 OutPacket(replyPacket, ThrottleOutPacketType.Task);
@@ -1272,7 +1276,7 @@ namespace OpenSim.Region.ClientStack
1272 OutPacket(sound, ThrottleOutPacketType.Task); 1276 OutPacket(sound, ThrottleOutPacketType.Task);
1273 } 1277 }
1274 1278
1275 public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel) 1279 public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel)
1276 { 1280 {
1277 SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket(); 1281 SimulatorViewerTimeMessagePacket viewertime = new SimulatorViewerTimeMessagePacket();
1278 viewertime.TimeInfo.SunDirection = sunPos; 1282 viewertime.TimeInfo.SunDirection = sunPos;
@@ -1524,12 +1528,13 @@ namespace OpenSim.Region.ClientStack
1524 1528
1525 OutPacket(attach, ThrottleOutPacketType.Task); 1529 OutPacket(attach, ThrottleOutPacketType.Task);
1526 } 1530 }
1527 1531
1528 1532
1529 public void SendPrimitiveToClient( 1533 public void SendPrimitiveToClient(
1530 ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, 1534 ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos,
1531 uint flags, 1535 uint flags,
1532 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, LLQuaternion rotation, byte clickAction) 1536 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem,
1537 LLQuaternion rotation, byte clickAction)
1533 { 1538 {
1534 ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); 1539 ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
1535 outPacket.RegionData.RegionHandle = regionHandle; 1540 outPacket.RegionData.RegionHandle = regionHandle;
@@ -1572,8 +1577,8 @@ namespace OpenSim.Region.ClientStack
1572 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, 1577 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
1573 LLQuaternion rotation) 1578 LLQuaternion rotation)
1574 { 1579 {
1575 LLVector3 velocity = new LLVector3(0f,0f,0f); 1580 LLVector3 velocity = new LLVector3(0f, 0f, 0f);
1576 LLVector3 rotationalvelocity = new LLVector3(0f,0f,0f); 1581 LLVector3 rotationalvelocity = new LLVector3(0f, 0f, 0f);
1577 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 1582 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
1578 terse.RegionData.RegionHandle = regionHandle; 1583 terse.RegionData.RegionHandle = regionHandle;
1579 terse.RegionData.TimeDilation = timeDilation; 1584 terse.RegionData.TimeDilation = timeDilation;
@@ -1582,10 +1587,10 @@ namespace OpenSim.Region.ClientStack
1582 1587
1583 OutPacket(terse, ThrottleOutPacketType.Task); 1588 OutPacket(terse, ThrottleOutPacketType.Task);
1584 } 1589 }
1590
1585 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, 1591 public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
1586 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity) 1592 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity)
1587 { 1593 {
1588
1589 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); 1594 ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
1590 terse.RegionData.RegionHandle = regionHandle; 1595 terse.RegionData.RegionHandle = regionHandle;
1591 terse.RegionData.TimeDilation = timeDilation; 1596 terse.RegionData.TimeDilation = timeDilation;
@@ -1594,7 +1599,6 @@ namespace OpenSim.Region.ClientStack
1594 1599
1595 OutPacket(terse, ThrottleOutPacketType.Task); 1600 OutPacket(terse, ThrottleOutPacketType.Task);
1596 } 1601 }
1597
1598 1602
1599 #endregion 1603 #endregion
1600 1604
@@ -1696,7 +1700,9 @@ namespace OpenSim.Region.ClientStack
1696 /// <returns></returns> 1700 /// <returns></returns>
1697 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, 1701 protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID,
1698 LLVector3 position, 1702 LLVector3 position,
1699 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity) 1703 LLQuaternion rotation,
1704 LLVector3 velocity,
1705 LLVector3 rotationalvelocity)
1700 { 1706 {
1701 uint ID = localID; 1707 uint ID = localID;
1702 byte[] bytes = new byte[60]; 1708 byte[] bytes = new byte[60];
@@ -1724,16 +1730,16 @@ namespace OpenSim.Region.ClientStack
1724 vel.y += 1; 1730 vel.y += 1;
1725 vel.z += 1; 1731 vel.z += 1;
1726 //vel 1732 //vel
1727 velx = (ushort)(32768 * (vel.x)); 1733 velx = (ushort) (32768*(vel.x));
1728 vely = (ushort)(32768 * (vel.y)); 1734 vely = (ushort) (32768*(vel.y));
1729 velz = (ushort)(32768 * (vel.z)); 1735 velz = (ushort) (32768*(vel.z));
1730 1736
1731 bytes[i++] = (byte) (velx % 256); 1737 bytes[i++] = (byte) (velx%256);
1732 bytes[i++] = (byte) ((velx >> 8) % 256); 1738 bytes[i++] = (byte) ((velx >> 8)%256);
1733 bytes[i++] = (byte) (vely % 256); 1739 bytes[i++] = (byte) (vely%256);
1734 bytes[i++] = (byte) ((vely >> 8) % 256); 1740 bytes[i++] = (byte) ((vely >> 8)%256);
1735 bytes[i++] = (byte) (velz % 256); 1741 bytes[i++] = (byte) (velz%256);
1736 bytes[i++] = (byte) ((velz >> 8) % 256); 1742 bytes[i++] = (byte) ((velz >> 8)%256);
1737 1743
1738 //accel 1744 //accel
1739 bytes[i++] = (byte) (ac%256); 1745 bytes[i++] = (byte) (ac%256);
@@ -1763,21 +1769,21 @@ namespace OpenSim.Region.ClientStack
1763 ushort rvelx, rvely, rvelz; 1769 ushort rvelx, rvely, rvelz;
1764 Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z); 1770 Vector3 rvel = new Vector3(rotationalvelocity.X, rotationalvelocity.Y, rotationalvelocity.Z);
1765 1771
1766 rvel = rvel / 128.0f; 1772 rvel = rvel/128.0f;
1767 rvel.x += 1; 1773 rvel.x += 1;
1768 rvel.y += 1; 1774 rvel.y += 1;
1769 rvel.z += 1; 1775 rvel.z += 1;
1770 //vel 1776 //vel
1771 rvelx = (ushort)(32768 * (rvel.x)); 1777 rvelx = (ushort) (32768*(rvel.x));
1772 rvely = (ushort)(32768 * (rvel.y)); 1778 rvely = (ushort) (32768*(rvel.y));
1773 rvelz = (ushort)(32768 * (rvel.z)); 1779 rvelz = (ushort) (32768*(rvel.z));
1774 1780
1775 bytes[i++] = (byte)(rvelx % 256); 1781 bytes[i++] = (byte) (rvelx%256);
1776 bytes[i++] = (byte)((rvelx >> 8) % 256); 1782 bytes[i++] = (byte) ((rvelx >> 8)%256);
1777 bytes[i++] = (byte)(rvely % 256); 1783 bytes[i++] = (byte) (rvely%256);
1778 bytes[i++] = (byte)((rvely >> 8) % 256); 1784 bytes[i++] = (byte) ((rvely >> 8)%256);
1779 bytes[i++] = (byte)(rvelz % 256); 1785 bytes[i++] = (byte) (rvelz%256);
1780 bytes[i++] = (byte)((rvelz >> 8) % 256); 1786 bytes[i++] = (byte) ((rvelz >> 8)%256);
1781 1787
1782 dat.Data = bytes; 1788 dat.Data = bytes;
1783 return dat; 1789 return dat;
@@ -1906,7 +1912,7 @@ namespace OpenSim.Region.ClientStack
1906 objdata.Sound = LLUUID.Zero; 1912 objdata.Sound = LLUUID.Zero;
1907 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); 1913 LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
1908 objdata.TextureEntry = ntex.ToBytes(); 1914 objdata.TextureEntry = ntex.ToBytes();
1909 1915
1910 objdata.State = 0; 1916 objdata.State = 0;
1911 objdata.Data = new byte[0]; 1917 objdata.Data = new byte[0];
1912 1918
@@ -1993,13 +1999,13 @@ namespace OpenSim.Region.ClientStack
1993 { 1999 {
1994 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket) packet; 2000 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket) packet;
1995 // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString()); 2001 // System.Console.WriteLine("new multi update packet " + multipleupdate.ToString());
1996 OpenSim.Region.Environment.Scenes.Scene tScene = (OpenSim.Region.Environment.Scenes.Scene)this.m_scene; 2002 Scene tScene = (Scene) m_scene;
1997 2003
1998 for (int i = 0; i < multipleupdate.ObjectData.Length; i++) 2004 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
1999 { 2005 {
2000 // Can't act on Null Data 2006 // Can't act on Null Data
2001 if (multipleupdate.ObjectData[i].Data != null) 2007 if (multipleupdate.ObjectData[i].Data != null)
2002 { 2008 {
2003 LLUUID editobj = tScene.GetSceneObjectPart(multipleupdate.ObjectData[i].ObjectLocalID).UUID; 2009 LLUUID editobj = tScene.GetSceneObjectPart(multipleupdate.ObjectData[i].ObjectLocalID).UUID;
2004 if (editobj != null) 2010 if (editobj != null)
2005 { 2011 {
@@ -2024,8 +2030,8 @@ namespace OpenSim.Region.ClientStack
2024 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); 2030 OnUpdatePrimSinglePosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
2025 } 2031 }
2026 } 2032 }
2027 #endregion position 2033 #endregion position
2028 #region rotation 2034 #region rotation
2029 2035
2030 else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab 2036 else if (multipleupdate.ObjectData[i].Type == 2) // single item of group rotation from tab
2031 { 2037 {
@@ -2062,11 +2068,12 @@ namespace OpenSim.Region.ClientStack
2062 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true); 2068 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
2063 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z); 2069 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
2064 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W); 2070 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
2065 OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this); 2071 OnUpdatePrimGroupMouseRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot,
2072 this);
2066 } 2073 }
2067 } 2074 }
2068 #endregion 2075 #endregion
2069 #region scale 2076 #region scale
2070 2077
2071 else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab 2078 else if (multipleupdate.ObjectData[i].Type == 13) //group scale from object tab
2072 { 2079 {
@@ -2118,9 +2125,9 @@ namespace OpenSim.Region.ClientStack
2118 else 2125 else
2119 { 2126 {
2120 // It's a ghost! tell the client to delete it from view. 2127 // It's a ghost! tell the client to delete it from view.
2121 simClient.SendKillObject(this.Scene.RegionInfo.RegionHandle, multipleupdate.ObjectData[i].ObjectLocalID); 2128 simClient.SendKillObject(Scene.RegionInfo.RegionHandle,
2129 multipleupdate.ObjectData[i].ObjectLocalID);
2122 } 2130 }
2123
2124 } 2131 }
2125 } 2132 }
2126 return true; 2133 return true;
@@ -2173,10 +2180,12 @@ namespace OpenSim.Region.ClientStack
2173 this.OutPacket(mbReply, ThrottleOutPacketType.Land); 2180 this.OutPacket(mbReply, ThrottleOutPacketType.Land);
2174 */ 2181 */
2175 } 2182 }
2183
2176 public void SetChildAgentThrottle(byte[] throttles) 2184 public void SetChildAgentThrottle(byte[] throttles)
2177 { 2185 {
2178 m_packetQueue.SetThrottleFromClient(throttles); 2186 m_packetQueue.SetThrottleFromClient(throttles);
2179 } 2187 }
2188
2180 // Previously ClientView.m_packetQueue 2189 // Previously ClientView.m_packetQueue
2181 2190
2182 // A thread safe sequence number allocator. 2191 // A thread safe sequence number allocator.
@@ -2198,7 +2207,7 @@ namespace OpenSim.Region.ClientStack
2198 } 2207 }
2199 return seq; 2208 return seq;
2200 } 2209 }
2201 2210
2202 protected void AddAck(Packet Pack) 2211 protected void AddAck(Packet Pack)
2203 { 2212 {
2204 lock (m_needAck) 2213 lock (m_needAck)
@@ -2236,13 +2245,13 @@ namespace OpenSim.Region.ClientStack
2236 { 2245 {
2237 Pack.Header.AckList = new uint[m_pendingAcks.Count]; 2246 Pack.Header.AckList = new uint[m_pendingAcks.Count];
2238 int i = 0; 2247 int i = 0;
2239 2248
2240 foreach (uint ack in m_pendingAcks.Values) 2249 foreach (uint ack in m_pendingAcks.Values)
2241 { 2250 {
2242 Pack.Header.AckList[i] = ack; 2251 Pack.Header.AckList[i] = ack;
2243 i++; 2252 i++;
2244 } 2253 }
2245 2254
2246 m_pendingAcks.Clear(); 2255 m_pendingAcks.Clear();
2247 Pack.Header.AppendedAcks = true; 2256 Pack.Header.AppendedAcks = true;
2248 } 2257 }
@@ -2272,22 +2281,22 @@ namespace OpenSim.Region.ClientStack
2272 // Actually make the byte array and send it 2281 // Actually make the byte array and send it
2273 try 2282 try
2274 { 2283 {
2275 byte[] sendbuffer = Pack.ToBytes(); 2284 byte[] sendbuffer = Pack.ToBytes();
2276 if (Pack is RegionHandshakePacket) 2285 if (Pack is RegionHandshakePacket)
2277 { 2286 {
2278 PacketPool.Instance.ReturnPacket(Pack); 2287 PacketPool.Instance.ReturnPacket(Pack);
2279 } 2288 }
2280 2289
2281 if (Pack.Header.Zerocoded) 2290 if (Pack.Header.Zerocoded)
2282 { 2291 {
2283 byte[] ZeroOutBuffer = new byte[4096]; 2292 byte[] ZeroOutBuffer = new byte[4096];
2284 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); 2293 int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
2285 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); 2294 m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
2286 } 2295 }
2287 else 2296 else
2288 { 2297 {
2289 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); 2298 m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
2290 } 2299 }
2291 } 2300 }
2292 catch (Exception e) 2301 catch (Exception e)
2293 { 2302 {
@@ -2298,7 +2307,7 @@ namespace OpenSim.Region.ClientStack
2298 Close(true); 2307 Close(true);
2299 } 2308 }
2300 } 2309 }
2301 2310
2302 public virtual void InPacket(Packet NewPack) 2311 public virtual void InPacket(Packet NewPack)
2303 { 2312 {
2304 // Handle appended ACKs 2313 // Handle appended ACKs
@@ -2314,7 +2323,7 @@ namespace OpenSim.Region.ClientStack
2314 } 2323 }
2315 } 2324 }
2316 } 2325 }
2317 2326
2318 2327
2319 // Handle PacketAck packets 2328 // Handle PacketAck packets
2320 if (NewPack.Type == PacketType.PacketAck) 2329 if (NewPack.Type == PacketType.PacketAck)
@@ -2353,7 +2362,7 @@ namespace OpenSim.Region.ClientStack
2353 item.Packet = NewPack; 2362 item.Packet = NewPack;
2354 item.Incoming = false; 2363 item.Incoming = false;
2355 item.throttleType = throttlePacketType; // Packet throttle type 2364 item.throttleType = throttlePacketType; // Packet throttle type
2356 m_packetQueue.Enqueue(item); 2365 m_packetQueue.Enqueue(item);
2357 } 2366 }
2358 2367
2359 # region Low Level Packet Methods 2368 # region Low Level Packet Methods
@@ -2392,7 +2401,7 @@ namespace OpenSim.Region.ClientStack
2392 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) 2401 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
2393 { 2402 {
2394 MainLog.Instance.Verbose("NETWORK", "Resending " + packet.Type.ToString() + " packet, " + 2403 MainLog.Instance.Verbose("NETWORK", "Resending " + packet.Type.ToString() + " packet, " +
2395 (now - packet.TickCount) + "ms have passed"); 2404 (now - packet.TickCount) + "ms have passed");
2396 2405
2397 packet.Header.Resent = true; 2406 packet.Header.Resent = true;
2398 OutPacket(packet, ThrottleOutPacketType.Resend); 2407 OutPacket(packet, ThrottleOutPacketType.Resend);
@@ -2442,6 +2451,7 @@ namespace OpenSim.Region.ClientStack
2442 } 2451 }
2443 2452
2444 #endregion 2453 #endregion
2454
2445 // Previously ClientView.ProcessPackets 2455 // Previously ClientView.ProcessPackets
2446 2456
2447 public bool AddMoney(int debit) 2457 public bool AddMoney(int debit)
@@ -2539,12 +2549,13 @@ namespace OpenSim.Region.ClientStack
2539 { 2549 {
2540 if (OnModifyTerrain != null) 2550 if (OnModifyTerrain != null)
2541 { 2551 {
2542 for (int i=0; i < modify.ParcelData.Length; i++) 2552 for (int i = 0; i < modify.ParcelData.Length; i++)
2543 { 2553 {
2544 OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds, 2554 OnModifyTerrain(modify.ModifyBlock.Height, modify.ModifyBlock.Seconds,
2545 modify.ModifyBlock.BrushSize, 2555 modify.ModifyBlock.BrushSize,
2546 modify.ModifyBlock.Action, modify.ParcelData[i].North, 2556 modify.ModifyBlock.Action, modify.ParcelData[i].North,
2547 modify.ParcelData[i].West, modify.ParcelData[i].South, modify.ParcelData[i].East, this); 2557 modify.ParcelData[i].West, modify.ParcelData[i].South,
2558 modify.ParcelData[i].East, this);
2548 } 2559 }
2549 } 2560 }
2550 } 2561 }
@@ -2558,7 +2569,7 @@ namespace OpenSim.Region.ClientStack
2558 case PacketType.AgentWearablesRequest: 2569 case PacketType.AgentWearablesRequest:
2559 if (OnRequestWearables != null) 2570 if (OnRequestWearables != null)
2560 { 2571 {
2561 OnRequestWearables( ); 2572 OnRequestWearables();
2562 } 2573 }
2563 if (OnRequestAvatarsData != null) 2574 if (OnRequestAvatarsData != null)
2564 { 2575 {
@@ -2575,21 +2586,23 @@ namespace OpenSim.Region.ClientStack
2575 case PacketType.AgentIsNowWearing: 2586 case PacketType.AgentIsNowWearing:
2576 if (OnAvatarNowWearing != null) 2587 if (OnAvatarNowWearing != null)
2577 { 2588 {
2578 AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket)Pack; 2589 AgentIsNowWearingPacket nowWearing = (AgentIsNowWearingPacket) Pack;
2579 AvatarWearingArgs wearingArgs = new AvatarWearingArgs(); 2590 AvatarWearingArgs wearingArgs = new AvatarWearingArgs();
2580 for (int i = 0; i < nowWearing.WearableData.Length; i++) 2591 for (int i = 0; i < nowWearing.WearableData.Length; i++)
2581 { 2592 {
2582 AvatarWearingArgs.Wearable wearable = new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID, nowWearing.WearableData[i].WearableType); 2593 AvatarWearingArgs.Wearable wearable =
2594 new AvatarWearingArgs.Wearable(nowWearing.WearableData[i].ItemID,
2595 nowWearing.WearableData[i].WearableType);
2583 wearingArgs.NowWearing.Add(wearable); 2596 wearingArgs.NowWearing.Add(wearable);
2584 } 2597 }
2585 OnAvatarNowWearing(this, wearingArgs); 2598 OnAvatarNowWearing(this, wearingArgs);
2586 } 2599 }
2587 break; 2600 break;
2588 case PacketType.SetAlwaysRun: 2601 case PacketType.SetAlwaysRun:
2589 SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; 2602 SetAlwaysRunPacket run = (SetAlwaysRunPacket) Pack;
2590 2603
2591 if (OnSetAlwaysRun != null) 2604 if (OnSetAlwaysRun != null)
2592 OnSetAlwaysRun(this,run.AgentData.AlwaysRun); 2605 OnSetAlwaysRun(this, run.AgentData.AlwaysRun);
2593 2606
2594 break; 2607 break;
2595 case PacketType.CompleteAgentMovement: 2608 case PacketType.CompleteAgentMovement:
@@ -2603,7 +2616,8 @@ namespace OpenSim.Region.ClientStack
2603 { 2616 {
2604 AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack; 2617 AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack;
2605 2618
2606 OnAgentUpdate(this, agenUpdate); //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa); 2619 OnAgentUpdate(this, agenUpdate);
2620 //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa);
2607 } 2621 }
2608 break; 2622 break;
2609 case PacketType.AgentAnimation: 2623 case PacketType.AgentAnimation:
@@ -2642,15 +2656,17 @@ namespace OpenSim.Region.ClientStack
2642 } 2656 }
2643 break; 2657 break;
2644 case PacketType.AvatarPickerRequest: 2658 case PacketType.AvatarPickerRequest:
2645 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; 2659 AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket) Pack;
2646 AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData; 2660 AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData;
2647 AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data; 2661 AvatarPickerRequestPacket.DataBlock querydata = avRequestQuery.Data;
2648 //System.Console.WriteLine("Agent Sends:" + Helpers.FieldToUTF8String(querydata.Name)); 2662 //System.Console.WriteLine("Agent Sends:" + Helpers.FieldToUTF8String(querydata.Name));
2649 if (OnAvatarPickerRequest != null) 2663 if (OnAvatarPickerRequest != null)
2650 { 2664 {
2651 OnAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID, Helpers.FieldToUTF8String(querydata.Name)); 2665 OnAvatarPickerRequest(this, Requestdata.AgentID, Requestdata.QueryID,
2666 Helpers.FieldToUTF8String(querydata.Name));
2652 } 2667 }
2653 break; 2668 break;
2669
2654 #endregion 2670 #endregion
2655 2671
2656 #region Objects/m_sceneObjects 2672 #region Objects/m_sceneObjects
@@ -2675,7 +2691,7 @@ namespace OpenSim.Region.ClientStack
2675 break; 2691 break;
2676 case PacketType.ObjectDelink: 2692 case PacketType.ObjectDelink:
2677 ObjectDelinkPacket delink = (ObjectDelinkPacket) Pack; 2693 ObjectDelinkPacket delink = (ObjectDelinkPacket) Pack;
2678 2694
2679 // It appears the prim at index 0 is not always the root prim (for 2695 // It appears the prim at index 0 is not always the root prim (for
2680 // instance, when one prim of a link set has been edited independently 2696 // instance, when one prim of a link set has been edited independently
2681 // of the others). Therefore, we'll pass all the ids onto the delink 2697 // of the others). Therefore, we'll pass all the ids onto the delink
@@ -2683,11 +2699,11 @@ namespace OpenSim.Region.ClientStack
2683 List<uint> prims = new List<uint>(); 2699 List<uint> prims = new List<uint>();
2684 for (int i = 0; i < delink.ObjectData.Length; i++) 2700 for (int i = 0; i < delink.ObjectData.Length; i++)
2685 { 2701 {
2686 prims.Add(delink.ObjectData[i].ObjectLocalID); 2702 prims.Add(delink.ObjectData[i].ObjectLocalID);
2687 } 2703 }
2688 2704
2689 if (OnDelinkObjects != null) 2705 if (OnDelinkObjects != null)
2690 { 2706 {
2691 OnDelinkObjects(prims); 2707 OnDelinkObjects(prims);
2692 } 2708 }
2693 2709
@@ -2706,7 +2722,8 @@ namespace OpenSim.Region.ClientStack
2706 { 2722 {
2707 if (OnUpdatePrimShape != null) 2723 if (OnUpdatePrimShape != null)
2708 { 2724 {
2709 OnUpdatePrimShape(this.m_agentId, shapePacket.ObjectData[i].ObjectLocalID, shapePacket.ObjectData[i]); 2725 OnUpdatePrimShape(m_agentId, shapePacket.ObjectData[i].ObjectLocalID,
2726 shapePacket.ObjectData[i]);
2710 } 2727 }
2711 } 2728 }
2712 break; 2729 break;
@@ -2714,7 +2731,8 @@ namespace OpenSim.Region.ClientStack
2714 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket) Pack; 2731 ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket) Pack;
2715 if (OnUpdateExtraParams != null) 2732 if (OnUpdateExtraParams != null)
2716 { 2733 {
2717 OnUpdateExtraParams(this.m_agentId, extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType, 2734 OnUpdateExtraParams(m_agentId, extraPar.ObjectData[0].ObjectLocalID,
2735 extraPar.ObjectData[0].ParamType,
2718 extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); 2736 extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData);
2719 } 2737 }
2720 break; 2738 break;
@@ -2726,7 +2744,8 @@ namespace OpenSim.Region.ClientStack
2726 if (OnObjectDuplicate != null) 2744 if (OnObjectDuplicate != null)
2727 { 2745 {
2728 OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset, 2746 OnObjectDuplicate(dupe.ObjectData[i].ObjectLocalID, dupe.SharedData.Offset,
2729 dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID, AgentandGroupData.GroupID); 2747 dupe.SharedData.DuplicateFlags, AgentandGroupData.AgentID,
2748 AgentandGroupData.GroupID);
2730 } 2749 }
2731 } 2750 }
2732 2751
@@ -2809,21 +2828,23 @@ namespace OpenSim.Region.ClientStack
2809 { 2828 {
2810 if (OnObjectName != null) 2829 if (OnObjectName != null)
2811 { 2830 {
2812 OnObjectName(this, objName.ObjectData[i].LocalID, m_encoding.GetString(objName.ObjectData[i].Name)); 2831 OnObjectName(this, objName.ObjectData[i].LocalID,
2832 m_encoding.GetString(objName.ObjectData[i].Name));
2813 } 2833 }
2814 } 2834 }
2815 break; 2835 break;
2816 case PacketType.ObjectPermissions: 2836 case PacketType.ObjectPermissions:
2817 MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString()); 2837 MainLog.Instance.Warn("CLIENT", "unhandled packet " + PacketType.ObjectPermissions.ToString());
2818 ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack; 2838 ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket) Pack;
2839
2840 List<ObjectPermissionsPacket.ObjectDataBlock> permChanges =
2841 new List<ObjectPermissionsPacket.ObjectDataBlock>();
2819 2842
2820 List<ObjectPermissionsPacket.ObjectDataBlock> permChanges = new List<ObjectPermissionsPacket.ObjectDataBlock>();
2821
2822 for (int i = 0; i < newobjPerms.ObjectData.Length; i++) 2843 for (int i = 0; i < newobjPerms.ObjectData.Length; i++)
2823 { 2844 {
2824 permChanges.Add(newobjPerms.ObjectData[i]); 2845 permChanges.Add(newobjPerms.ObjectData[i]);
2825 } 2846 }
2826 2847
2827 // Here's our data, 2848 // Here's our data,
2828 // PermField contains the field the info goes into 2849 // PermField contains the field the info goes into
2829 // PermField determines which mask we're changing 2850 // PermField determines which mask we're changing
@@ -2847,16 +2868,15 @@ namespace OpenSim.Region.ClientStack
2847 2868
2848 case PacketType.RequestObjectPropertiesFamily: 2869 case PacketType.RequestObjectPropertiesFamily:
2849 //This powers the little tooltip that appears when you move your mouse over an object 2870 //This powers the little tooltip that appears when you move your mouse over an object
2850 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket)Pack; 2871 RequestObjectPropertiesFamilyPacket packToolTip = (RequestObjectPropertiesFamilyPacket) Pack;
2851 2872
2852 2873
2853 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData; 2874 RequestObjectPropertiesFamilyPacket.ObjectDataBlock packObjBlock = packToolTip.ObjectData;
2854 2875
2855 if (OnRequestObjectPropertiesFamily != null) 2876 if (OnRequestObjectPropertiesFamily != null)
2856 { 2877 {
2857 OnRequestObjectPropertiesFamily(this, this.m_agentId, packObjBlock.RequestFlags, packObjBlock.ObjectID); 2878 OnRequestObjectPropertiesFamily(this, m_agentId, packObjBlock.RequestFlags,
2858 2879 packObjBlock.ObjectID);
2859
2860 } 2880 }
2861 2881
2862 break; 2882 break;
@@ -2882,7 +2902,7 @@ namespace OpenSim.Region.ClientStack
2882 OnRequestTexture(this, args); 2902 OnRequestTexture(this, args);
2883 } 2903 }
2884 2904
2885 // m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image, 2905 // m_assetCache.AddTextureRequest(this, imageRequest.RequestImage[i].Image,
2886 // imageRequest.RequestImage[i].Packet, 2906 // imageRequest.RequestImage[i].Packet,
2887 // imageRequest.RequestImage[i].DiscardLevel); 2907 // imageRequest.RequestImage[i].DiscardLevel);
2888 } 2908 }
@@ -2898,10 +2918,11 @@ namespace OpenSim.Region.ClientStack
2898 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString()); 2918 // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToString());
2899 if (OnAssetUploadRequest != null) 2919 if (OnAssetUploadRequest != null)
2900 { 2920 {
2901 LLUUID temp=libsecondlife.LLUUID.Combine(request.AssetBlock.TransactionID, SecureSessionId); 2921 LLUUID temp = LLUUID.Combine(request.AssetBlock.TransactionID, SecureSessionId);
2902 OnAssetUploadRequest(this, temp, 2922 OnAssetUploadRequest(this, temp,
2903 request.AssetBlock.TransactionID, request.AssetBlock.Type, 2923 request.AssetBlock.TransactionID, request.AssetBlock.Type,
2904 request.AssetBlock.AssetData, request.AssetBlock.StoreLocal, request.AssetBlock.Tempfile); 2924 request.AssetBlock.AssetData, request.AssetBlock.StoreLocal,
2925 request.AssetBlock.Tempfile);
2905 } 2926 }
2906 break; 2927 break;
2907 case PacketType.RequestXfer: 2928 case PacketType.RequestXfer:
@@ -2938,24 +2959,24 @@ namespace OpenSim.Region.ClientStack
2938 case PacketType.UpdateInventoryFolder: 2959 case PacketType.UpdateInventoryFolder:
2939 if (OnUpdateInventoryFolder != null) 2960 if (OnUpdateInventoryFolder != null)
2940 { 2961 {
2941 UpdateInventoryFolderPacket invFolder = (UpdateInventoryFolderPacket)Pack; 2962 UpdateInventoryFolderPacket invFolder = (UpdateInventoryFolderPacket) Pack;
2942 for (int i = 0; i < invFolder.FolderData.Length; i++) 2963 for (int i = 0; i < invFolder.FolderData.Length; i++)
2943 { 2964 {
2944 OnUpdateInventoryFolder(this, invFolder.FolderData[i].FolderID, 2965 OnUpdateInventoryFolder(this, invFolder.FolderData[i].FolderID,
2945 (ushort)invFolder.FolderData[i].Type, 2966 (ushort) invFolder.FolderData[i].Type,
2946 Util.FieldToString(invFolder.FolderData[i].Name), 2967 Util.FieldToString(invFolder.FolderData[i].Name),
2947 invFolder.FolderData[i].ParentID); 2968 invFolder.FolderData[i].ParentID);
2948 } 2969 }
2949 } 2970 }
2950 break; 2971 break;
2951 case PacketType.MoveInventoryFolder: 2972 case PacketType.MoveInventoryFolder:
2952 if (OnMoveInventoryFolder != null) 2973 if (OnMoveInventoryFolder != null)
2953 { 2974 {
2954 MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket)Pack; 2975 MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket) Pack;
2955 for (int i = 0; i < invFolder.InventoryData.Length; i++) 2976 for (int i = 0; i < invFolder.InventoryData.Length; i++)
2956 { 2977 {
2957 OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID, 2978 OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID,
2958 invFolder.InventoryData[i].ParentID); 2979 invFolder.InventoryData[i].ParentID);
2959 } 2980 }
2960 } 2981 }
2961 break; 2982 break;
@@ -2997,7 +3018,7 @@ namespace OpenSim.Region.ClientStack
2997 case PacketType.PurgeInventoryDescendents: 3018 case PacketType.PurgeInventoryDescendents:
2998 if (OnPurgeInventoryDescendents != null) 3019 if (OnPurgeInventoryDescendents != null)
2999 { 3020 {
3000 PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket)Pack; 3021 PurgeInventoryDescendentsPacket Purge = (PurgeInventoryDescendentsPacket) Pack;
3001 OnPurgeInventoryDescendents(this, Purge.InventoryData.FolderID); 3022 OnPurgeInventoryDescendents(this, Purge.InventoryData.FolderID);
3002 } 3023 }
3003 break; 3024 break;
@@ -3007,11 +3028,11 @@ namespace OpenSim.Region.ClientStack
3007 { 3028 {
3008 for (int i = 0; i < update.InventoryData.Length; i++) 3029 for (int i = 0; i < update.InventoryData.Length; i++)
3009 { 3030 {
3010 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, 3031 OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID,
3011 update.InventoryData[i].ItemID, 3032 update.InventoryData[i].ItemID,
3012 Util.FieldToString(update.InventoryData[i].Name), 3033 Util.FieldToString(update.InventoryData[i].Name),
3013 Util.FieldToString(update.InventoryData[i].Description), 3034 Util.FieldToString(update.InventoryData[i].Description),
3014 update.InventoryData[i].NextOwnerMask); 3035 update.InventoryData[i].NextOwnerMask);
3015 } 3036 }
3016 } 3037 }
3017 //Console.WriteLine(Pack.ToString()); 3038 //Console.WriteLine(Pack.ToString());
@@ -3051,17 +3072,20 @@ namespace OpenSim.Region.ClientStack
3051 { 3072 {
3052 foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData) 3073 foreach (CopyInventoryItemPacket.InventoryDataBlock datablock in copyitem.InventoryData)
3053 { 3074 {
3054 OnCopyInventoryItem(this, datablock.CallbackID, datablock.OldAgentID, datablock.OldItemID, datablock.NewFolderID, Util.FieldToString(datablock.NewName)); 3075 OnCopyInventoryItem(this, datablock.CallbackID, datablock.OldAgentID,
3076 datablock.OldItemID, datablock.NewFolderID,
3077 Util.FieldToString(datablock.NewName));
3055 } 3078 }
3056 } 3079 }
3057 break; 3080 break;
3058 case PacketType.MoveInventoryItem: 3081 case PacketType.MoveInventoryItem:
3059 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket)Pack; 3082 MoveInventoryItemPacket moveitem = (MoveInventoryItemPacket) Pack;
3060 if (OnMoveInventoryItem != null) 3083 if (OnMoveInventoryItem != null)
3061 { 3084 {
3062 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) 3085 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
3063 { 3086 {
3064 OnMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length, Util.FieldToString(datablock.NewName)); 3087 OnMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length,
3088 Util.FieldToString(datablock.NewName));
3065 } 3089 }
3066 } 3090 }
3067 break; 3091 break;
@@ -3115,7 +3139,7 @@ namespace OpenSim.Region.ClientStack
3115 case PacketType.MapNameRequest: 3139 case PacketType.MapNameRequest:
3116 MapNameRequestPacket map = (MapNameRequestPacket) Pack; 3140 MapNameRequestPacket map = (MapNameRequestPacket) Pack;
3117 string mapName = UTF8Encoding.UTF8.GetString(map.NameData.Name, 0, 3141 string mapName = UTF8Encoding.UTF8.GetString(map.NameData.Name, 0,
3118 map.NameData.Name.Length - 1); 3142 map.NameData.Name.Length - 1);
3119 if (OnMapNameRequest != null) 3143 if (OnMapNameRequest != null)
3120 { 3144 {
3121 OnMapNameRequest(this, mapName); 3145 OnMapNameRequest(this, mapName);
@@ -3202,29 +3226,34 @@ namespace OpenSim.Region.ClientStack
3202 break; 3226 break;
3203 3227
3204 #region Parcel related packets 3228 #region Parcel related packets
3229
3205 case PacketType.ParcelAccessListRequest: 3230 case PacketType.ParcelAccessListRequest:
3206 ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack; 3231 ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket) Pack;
3207 if (OnParcelAccessListRequest != null) 3232 if (OnParcelAccessListRequest != null)
3208 { 3233 {
3209 OnParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID, requestPacket.Data.Flags, requestPacket.Data.SequenceID, requestPacket.Data.LocalID,this); 3234 OnParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID,
3235 requestPacket.Data.Flags, requestPacket.Data.SequenceID,
3236 requestPacket.Data.LocalID, this);
3210 } 3237 }
3211 break; 3238 break;
3212 3239
3213 case PacketType.ParcelAccessListUpdate: 3240 case PacketType.ParcelAccessListUpdate:
3214 ParcelAccessListUpdatePacket updatePacket = (ParcelAccessListUpdatePacket)Pack; 3241 ParcelAccessListUpdatePacket updatePacket = (ParcelAccessListUpdatePacket) Pack;
3215 List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>(); 3242 List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>();
3216 foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) 3243 foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List)
3217 { 3244 {
3218 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 3245 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
3219 entry.AgentID = block.ID; 3246 entry.AgentID = block.ID;
3220 entry.Flags = (ParcelManager.AccessList)block.Flags; 3247 entry.Flags = (ParcelManager.AccessList) block.Flags;
3221 entry.Time = new DateTime(); 3248 entry.Time = new DateTime();
3222 entries.Add(entry); 3249 entries.Add(entry);
3223 } 3250 }
3224 3251
3225 if (OnParcelAccessListUpdateRequest != null) 3252 if (OnParcelAccessListUpdateRequest != null)
3226 { 3253 {
3227 OnParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID, updatePacket.AgentData.SessionID, updatePacket.Data.Flags, updatePacket.Data.LocalID, entries, this); 3254 OnParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID,
3255 updatePacket.AgentData.SessionID, updatePacket.Data.Flags,
3256 updatePacket.Data.LocalID, entries, this);
3228 } 3257 }
3229 break; 3258 break;
3230 case PacketType.ParcelPropertiesRequest: 3259 case PacketType.ParcelPropertiesRequest:
@@ -3296,28 +3325,30 @@ namespace OpenSim.Region.ClientStack
3296 } 3325 }
3297 break; 3326 break;
3298 case PacketType.RequestRegionInfo: 3327 case PacketType.RequestRegionInfo:
3299 RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData; 3328 RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket) Pack).AgentData;
3300 if (OnRegionInfoRequest != null) 3329 if (OnRegionInfoRequest != null)
3301 { 3330 {
3302 OnRegionInfoRequest(this, mPacket.SessionID); 3331 OnRegionInfoRequest(this, mPacket.SessionID);
3303 } 3332 }
3304 break; 3333 break;
3305 case PacketType.EstateCovenantRequest: 3334 case PacketType.EstateCovenantRequest:
3306 // TODO: handle this packet 3335 // TODO: handle this packet
3307 EstateCovenantRequestPacket.AgentDataBlock epack = ((EstateCovenantRequestPacket)Pack).AgentData; 3336 EstateCovenantRequestPacket.AgentDataBlock epack =
3337 ((EstateCovenantRequestPacket) Pack).AgentData;
3308 if (OnEstateCovenantRequest != null) 3338 if (OnEstateCovenantRequest != null)
3309 { 3339 {
3310 OnEstateCovenantRequest(this, epack.SessionID); 3340 OnEstateCovenantRequest(this, epack.SessionID);
3311 } 3341 }
3312 break; 3342 break;
3313 case PacketType.AgentThrottle: 3343 case PacketType.AgentThrottle:
3314 AgentThrottlePacket atpack = (AgentThrottlePacket)Pack; 3344 AgentThrottlePacket atpack = (AgentThrottlePacket) Pack;
3315 m_packetQueue.SetThrottleFromClient(atpack.Throttle.Throttles); 3345 m_packetQueue.SetThrottleFromClient(atpack.Throttle.Throttles);
3316 break; 3346 break;
3317 3347
3318 #endregion 3348 #endregion
3319 3349
3320 #region unimplemented handlers 3350 #region unimplemented handlers
3351
3321 case PacketType.RequestGodlikePowers: 3352 case PacketType.RequestGodlikePowers:
3322 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket) Pack; 3353 RequestGodlikePowersPacket rglpPack = (RequestGodlikePowersPacket) Pack;
3323 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock; 3354 RequestGodlikePowersPacket.RequestBlockBlock rblock = rglpPack.RequestBlock;
@@ -3325,16 +3356,17 @@ namespace OpenSim.Region.ClientStack
3325 RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData; 3356 RequestGodlikePowersPacket.AgentDataBlock ablock = rglpPack.AgentData;
3326 3357
3327 OnRequestGodlikePowers(ablock.AgentID, ablock.SessionID, token, this); 3358 OnRequestGodlikePowers(ablock.AgentID, ablock.SessionID, token, this);
3328 3359
3329 break; 3360 break;
3330 case PacketType.GodKickUser: 3361 case PacketType.GodKickUser:
3331 MainLog.Instance.Warn("CLIENT", "unhandled GodKickUser packet"); 3362 MainLog.Instance.Warn("CLIENT", "unhandled GodKickUser packet");
3332 3363
3333 GodKickUserPacket gkupack = (GodKickUserPacket) Pack; 3364 GodKickUserPacket gkupack = (GodKickUserPacket) Pack;
3334 3365
3335 if (gkupack.UserInfo.GodSessionID == SessionId && this.AgentId == gkupack.UserInfo.GodID) 3366 if (gkupack.UserInfo.GodSessionID == SessionId && AgentId == gkupack.UserInfo.GodID)
3336 { 3367 {
3337 OnGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, gkupack.UserInfo.AgentID, (uint) 0, gkupack.UserInfo.Reason); 3368 OnGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
3369 gkupack.UserInfo.AgentID, (uint) 0, gkupack.UserInfo.Reason);
3338 } 3370 }
3339 else 3371 else
3340 { 3372 {
@@ -3404,7 +3436,7 @@ namespace OpenSim.Region.ClientStack
3404 // TODO: handle this packet 3436 // TODO: handle this packet
3405 MainLog.Instance.Warn("CLIENT", "unhandled AgentDataUpdateRequest packet"); 3437 MainLog.Instance.Warn("CLIENT", "unhandled AgentDataUpdateRequest packet");
3406 break; 3438 break;
3407 3439
3408 case PacketType.ParcelDwellRequest: 3440 case PacketType.ParcelDwellRequest:
3409 // TODO: handle this packet 3441 // TODO: handle this packet
3410 MainLog.Instance.Warn("CLIENT", "unhandled ParcelDwellRequest packet"); 3442 MainLog.Instance.Warn("CLIENT", "unhandled ParcelDwellRequest packet");
@@ -3440,7 +3472,7 @@ namespace OpenSim.Region.ClientStack
3440 default: 3472 default:
3441 MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString()); 3473 MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString());
3442 break; 3474 break;
3443 3475
3444 #endregion 3476 #endregion
3445 } 3477 }
3446 } 3478 }
@@ -3490,4 +3522,4 @@ namespace OpenSim.Region.ClientStack
3490 OutPacket(logReply, ThrottleOutPacketType.Task); 3522 OutPacket(logReply, ThrottleOutPacketType.Task);
3491 } 3523 }
3492 } 3524 }
3493} 3525} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/PacketQueue.cs b/OpenSim/Region/ClientStack/PacketQueue.cs
index 4c9295e..1065f63 100644
--- a/OpenSim/Region/ClientStack/PacketQueue.cs
+++ b/OpenSim/Region/ClientStack/PacketQueue.cs
@@ -27,17 +27,10 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net;
31using System.Net.Sockets;
32using System.Text;
33using System.Threading; 30using System.Threading;
34using System.Timers; 31using System.Timers;
35using Axiom.Math;
36using libsecondlife;
37using libsecondlife.Packets; 32using libsecondlife.Packets;
38using OpenSim.Framework; 33using OpenSim.Framework;
39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Console;
41using Timer=System.Timers.Timer; 34using Timer=System.Timers.Timer;
42 35
43namespace OpenSim.Region.ClientStack 36namespace OpenSim.Region.ClientStack
@@ -47,7 +40,7 @@ namespace OpenSim.Region.ClientStack
47 private bool m_enabled = true; 40 private bool m_enabled = true;
48 41
49 private BlockingQueue<QueItem> SendQueue; 42 private BlockingQueue<QueItem> SendQueue;
50 43
51 private Queue<QueItem> IncomingPacketQueue; 44 private Queue<QueItem> IncomingPacketQueue;
52 private Queue<QueItem> OutgoingPacketQueue; 45 private Queue<QueItem> OutgoingPacketQueue;
53 private Queue<QueItem> ResendOutgoingPacketQueue; 46 private Queue<QueItem> ResendOutgoingPacketQueue;
@@ -57,7 +50,7 @@ namespace OpenSim.Region.ClientStack
57 private Queue<QueItem> TaskOutgoingPacketQueue; 50 private Queue<QueItem> TaskOutgoingPacketQueue;
58 private Queue<QueItem> TextureOutgoingPacketQueue; 51 private Queue<QueItem> TextureOutgoingPacketQueue;
59 private Queue<QueItem> AssetOutgoingPacketQueue; 52 private Queue<QueItem> AssetOutgoingPacketQueue;
60 53
61 private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); 54 private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>();
62 private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); 55 private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>();
63 56
@@ -82,15 +75,15 @@ namespace OpenSim.Region.ClientStack
82 // private long ThrottleInterval; 75 // private long ThrottleInterval;
83 private Timer throttleTimer; 76 private Timer throttleTimer;
84 77
85 public PacketQueue() 78 public PacketQueue()
86 { 79 {
87 // While working on this, the BlockingQueue had me fooled for a bit. 80 // While working on this, the BlockingQueue had me fooled for a bit.
88 // The Blocking queue causes the thread to stop until there's something 81 // The Blocking queue causes the thread to stop until there's something
89 // in it to process. it's an on-purpose threadlock though because 82 // in it to process. it's an on-purpose threadlock though because
90 // without it, the clientloop will suck up all sim resources. 83 // without it, the clientloop will suck up all sim resources.
91 84
92 SendQueue = new BlockingQueue<QueItem>(); 85 SendQueue = new BlockingQueue<QueItem>();
93 86
94 IncomingPacketQueue = new Queue<QueItem>(); 87 IncomingPacketQueue = new Queue<QueItem>();
95 OutgoingPacketQueue = new Queue<QueItem>(); 88 OutgoingPacketQueue = new Queue<QueItem>();
96 ResendOutgoingPacketQueue = new Queue<QueItem>(); 89 ResendOutgoingPacketQueue = new Queue<QueItem>();
@@ -100,7 +93,7 @@ namespace OpenSim.Region.ClientStack
100 TaskOutgoingPacketQueue = new Queue<QueItem>(); 93 TaskOutgoingPacketQueue = new Queue<QueItem>();
101 TextureOutgoingPacketQueue = new Queue<QueItem>(); 94 TextureOutgoingPacketQueue = new Queue<QueItem>();
102 AssetOutgoingPacketQueue = new Queue<QueItem>(); 95 AssetOutgoingPacketQueue = new Queue<QueItem>();
103 96
104 97
105 // Set up the throttle classes (min, max, current) in bytes 98 // Set up the throttle classes (min, max, current) in bytes
106 ResendThrottle = new PacketThrottle(5000, 100000, 50000); 99 ResendThrottle = new PacketThrottle(5000, 100000, 50000);
@@ -114,14 +107,13 @@ namespace OpenSim.Region.ClientStack
114 // Number of bytes allowed to go out per second. (256kbps per client) 107 // Number of bytes allowed to go out per second. (256kbps per client)
115 TotalThrottle = new PacketThrottle(0, 162144, 1536000); 108 TotalThrottle = new PacketThrottle(0, 162144, 1536000);
116 109
117 throttleTimer = new Timer((int)(throttletimems/throttleTimeDivisor)); 110 throttleTimer = new Timer((int) (throttletimems/throttleTimeDivisor));
118 throttleTimer.Elapsed += new ElapsedEventHandler(ThrottleTimerElapsed); 111 throttleTimer.Elapsed += new ElapsedEventHandler(ThrottleTimerElapsed);
119 throttleTimer.Start(); 112 throttleTimer.Start();
120 113
121 // TIMERS needed for this 114 // TIMERS needed for this
122 // LastThrottle = DateTime.Now.Ticks; 115 // LastThrottle = DateTime.Now.Ticks;
123 // ThrottleInterval = (long)(throttletimems/throttleTimeDivisor); 116 // ThrottleInterval = (long)(throttletimems/throttleTimeDivisor);
124
125 } 117 }
126 118
127 /* STANDARD QUEUE MANIPULATION INTERFACES */ 119 /* STANDARD QUEUE MANIPULATION INTERFACES */
@@ -129,44 +121,48 @@ namespace OpenSim.Region.ClientStack
129 121
130 public void Enqueue(QueItem item) 122 public void Enqueue(QueItem item)
131 { 123 {
132 if (!m_enabled) {return;} 124 if (!m_enabled)
125 {
126 return;
127 }
133 // We could micro lock, but that will tend to actually 128 // We could micro lock, but that will tend to actually
134 // probably be worse than just synchronizing on SendQueue 129 // probably be worse than just synchronizing on SendQueue
135 130
136 lock (this) { 131 lock (this)
132 {
137 switch (item.throttleType) 133 switch (item.throttleType)
138 { 134 {
139 case ThrottleOutPacketType.Resend: 135 case ThrottleOutPacketType.Resend:
140 ThrottleCheck(ref ResendThrottle, ref ResendOutgoingPacketQueue, item); 136 ThrottleCheck(ref ResendThrottle, ref ResendOutgoingPacketQueue, item);
141 break; 137 break;
142 case ThrottleOutPacketType.Texture: 138 case ThrottleOutPacketType.Texture:
143 ThrottleCheck(ref TextureThrottle, ref TextureOutgoingPacketQueue, item); 139 ThrottleCheck(ref TextureThrottle, ref TextureOutgoingPacketQueue, item);
144 break; 140 break;
145 case ThrottleOutPacketType.Task: 141 case ThrottleOutPacketType.Task:
146 ThrottleCheck(ref TaskThrottle, ref TaskOutgoingPacketQueue, item); 142 ThrottleCheck(ref TaskThrottle, ref TaskOutgoingPacketQueue, item);
147 break; 143 break;
148 case ThrottleOutPacketType.Land: 144 case ThrottleOutPacketType.Land:
149 ThrottleCheck(ref LandThrottle, ref LandOutgoingPacketQueue, item); 145 ThrottleCheck(ref LandThrottle, ref LandOutgoingPacketQueue, item);
150 break; 146 break;
151 case ThrottleOutPacketType.Asset: 147 case ThrottleOutPacketType.Asset:
152 ThrottleCheck(ref AssetThrottle, ref AssetOutgoingPacketQueue, item); 148 ThrottleCheck(ref AssetThrottle, ref AssetOutgoingPacketQueue, item);
153 break; 149 break;
154 case ThrottleOutPacketType.Cloud: 150 case ThrottleOutPacketType.Cloud:
155 ThrottleCheck(ref CloudThrottle, ref CloudOutgoingPacketQueue, item); 151 ThrottleCheck(ref CloudThrottle, ref CloudOutgoingPacketQueue, item);
156 break; 152 break;
157 case ThrottleOutPacketType.Wind: 153 case ThrottleOutPacketType.Wind:
158 ThrottleCheck(ref WindThrottle, ref WindOutgoingPacketQueue, item); 154 ThrottleCheck(ref WindThrottle, ref WindOutgoingPacketQueue, item);
159 break; 155 break;
160 156
161 default: 157 default:
162 // Acknowledgements and other such stuff should go directly to the blocking Queue 158 // Acknowledgements and other such stuff should go directly to the blocking Queue
163 // Throttling them may and likely 'will' be problematic 159 // Throttling them may and likely 'will' be problematic
164 SendQueue.Enqueue(item); 160 SendQueue.Enqueue(item);
165 break; 161 break;
166 } 162 }
167 } 163 }
168 } 164 }
169 165
170 public QueItem Dequeue() 166 public QueItem Dequeue()
171 { 167 {
172 return SendQueue.Dequeue(); 168 return SendQueue.Dequeue();
@@ -174,7 +170,8 @@ namespace OpenSim.Region.ClientStack
174 170
175 public void Flush() 171 public void Flush()
176 { 172 {
177 lock(this) { 173 lock (this)
174 {
178 while (PacketsWaiting()) 175 while (PacketsWaiting())
179 { 176 {
180 //Now comes the fun part.. we dump all our elements into m_packetQueue that we've saved up. 177 //Now comes the fun part.. we dump all our elements into m_packetQueue that we've saved up.
@@ -211,7 +208,7 @@ namespace OpenSim.Region.ClientStack
211 } 208 }
212 } 209 }
213 210
214 public void Close() 211 public void Close()
215 { 212 {
216 m_enabled = false; 213 m_enabled = false;
217 throttleTimer.Stop(); 214 throttleTimer.Stop();
@@ -242,22 +239,22 @@ namespace OpenSim.Region.ClientStack
242 239
243 public void ProcessThrottle() 240 public void ProcessThrottle()
244 { 241 {
245
246 // I was considering this.. Will an event fire if the thread it's on is blocked? 242 // I was considering this.. Will an event fire if the thread it's on is blocked?
247 243
248 // Then I figured out.. it doesn't really matter.. because this thread won't be blocked for long 244 // Then I figured out.. it doesn't really matter.. because this thread won't be blocked for long
249 // The General overhead of the UDP protocol gets sent to the queue un-throttled by this 245 // The General overhead of the UDP protocol gets sent to the queue un-throttled by this
250 // so This'll pick up about around the right time. 246 // so This'll pick up about around the right time.
251 247
252 int MaxThrottleLoops = 4550; // 50*7 packets can be dequeued at once. 248 int MaxThrottleLoops = 4550; // 50*7 packets can be dequeued at once.
253 int throttleLoops = 0; 249 int throttleLoops = 0;
254 250
255 // We're going to dequeue all of the saved up packets until 251 // We're going to dequeue all of the saved up packets until
256 // we've hit the throttle limit or there's no more packets to send 252 // we've hit the throttle limit or there's no more packets to send
257 lock (this) { 253 lock (this)
254 {
258 ResetCounters(); 255 ResetCounters();
259 // MainLog.Instance.Verbose("THROTTLE", "Entering Throttle"); 256 // MainLog.Instance.Verbose("THROTTLE", "Entering Throttle");
260 while (TotalThrottle.UnderLimit() && PacketsWaiting() && 257 while (TotalThrottle.UnderLimit() && PacketsWaiting() &&
261 (throttleLoops <= MaxThrottleLoops)) 258 (throttleLoops <= MaxThrottleLoops))
262 { 259 {
263 throttleLoops++; 260 throttleLoops++;
@@ -265,7 +262,7 @@ namespace OpenSim.Region.ClientStack
265 if (ResendThrottle.UnderLimit() && ResendOutgoingPacketQueue.Count > 0) 262 if (ResendThrottle.UnderLimit() && ResendOutgoingPacketQueue.Count > 0)
266 { 263 {
267 QueItem qpack = ResendOutgoingPacketQueue.Dequeue(); 264 QueItem qpack = ResendOutgoingPacketQueue.Dequeue();
268 265
269 SendQueue.Enqueue(qpack); 266 SendQueue.Enqueue(qpack);
270 TotalThrottle.Add(qpack.Packet.ToBytes().Length); 267 TotalThrottle.Add(qpack.Packet.ToBytes().Length);
271 ResendThrottle.Add(qpack.Packet.ToBytes().Length); 268 ResendThrottle.Add(qpack.Packet.ToBytes().Length);
@@ -273,7 +270,7 @@ namespace OpenSim.Region.ClientStack
273 if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0) 270 if (LandThrottle.UnderLimit() && LandOutgoingPacketQueue.Count > 0)
274 { 271 {
275 QueItem qpack = LandOutgoingPacketQueue.Dequeue(); 272 QueItem qpack = LandOutgoingPacketQueue.Dequeue();
276 273
277 SendQueue.Enqueue(qpack); 274 SendQueue.Enqueue(qpack);
278 TotalThrottle.Add(qpack.Packet.ToBytes().Length); 275 TotalThrottle.Add(qpack.Packet.ToBytes().Length);
279 LandThrottle.Add(qpack.Packet.ToBytes().Length); 276 LandThrottle.Add(qpack.Packet.ToBytes().Length);
@@ -281,7 +278,7 @@ namespace OpenSim.Region.ClientStack
281 if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0) 278 if (WindThrottle.UnderLimit() && WindOutgoingPacketQueue.Count > 0)
282 { 279 {
283 QueItem qpack = WindOutgoingPacketQueue.Dequeue(); 280 QueItem qpack = WindOutgoingPacketQueue.Dequeue();
284 281
285 SendQueue.Enqueue(qpack); 282 SendQueue.Enqueue(qpack);
286 TotalThrottle.Add(qpack.Packet.ToBytes().Length); 283 TotalThrottle.Add(qpack.Packet.ToBytes().Length);
287 WindThrottle.Add(qpack.Packet.ToBytes().Length); 284 WindThrottle.Add(qpack.Packet.ToBytes().Length);
@@ -289,7 +286,7 @@ namespace OpenSim.Region.ClientStack
289 if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0) 286 if (CloudThrottle.UnderLimit() && CloudOutgoingPacketQueue.Count > 0)
290 { 287 {
291 QueItem qpack = CloudOutgoingPacketQueue.Dequeue(); 288 QueItem qpack = CloudOutgoingPacketQueue.Dequeue();
292 289
293 SendQueue.Enqueue(qpack); 290 SendQueue.Enqueue(qpack);
294 TotalThrottle.Add(qpack.Packet.ToBytes().Length); 291 TotalThrottle.Add(qpack.Packet.ToBytes().Length);
295 CloudThrottle.Add(qpack.Packet.ToBytes().Length); 292 CloudThrottle.Add(qpack.Packet.ToBytes().Length);
@@ -297,7 +294,7 @@ namespace OpenSim.Region.ClientStack
297 if (TaskThrottle.UnderLimit() && TaskOutgoingPacketQueue.Count > 0) 294 if (TaskThrottle.UnderLimit() && TaskOutgoingPacketQueue.Count > 0)
298 { 295 {
299 QueItem qpack = TaskOutgoingPacketQueue.Dequeue(); 296 QueItem qpack = TaskOutgoingPacketQueue.Dequeue();
300 297
301 SendQueue.Enqueue(qpack); 298 SendQueue.Enqueue(qpack);
302 TotalThrottle.Add(qpack.Packet.ToBytes().Length); 299 TotalThrottle.Add(qpack.Packet.ToBytes().Length);
303 TaskThrottle.Add(qpack.Packet.ToBytes().Length); 300 TaskThrottle.Add(qpack.Packet.ToBytes().Length);
@@ -305,7 +302,7 @@ namespace OpenSim.Region.ClientStack
305 if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0) 302 if (TextureThrottle.UnderLimit() && TextureOutgoingPacketQueue.Count > 0)
306 { 303 {
307 QueItem qpack = TextureOutgoingPacketQueue.Dequeue(); 304 QueItem qpack = TextureOutgoingPacketQueue.Dequeue();
308 305
309 SendQueue.Enqueue(qpack); 306 SendQueue.Enqueue(qpack);
310 TotalThrottle.Add(qpack.Packet.ToBytes().Length); 307 TotalThrottle.Add(qpack.Packet.ToBytes().Length);
311 TextureThrottle.Add(qpack.Packet.ToBytes().Length); 308 TextureThrottle.Add(qpack.Packet.ToBytes().Length);
@@ -313,19 +310,18 @@ namespace OpenSim.Region.ClientStack
313 if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0) 310 if (AssetThrottle.UnderLimit() && AssetOutgoingPacketQueue.Count > 0)
314 { 311 {
315 QueItem qpack = AssetOutgoingPacketQueue.Dequeue(); 312 QueItem qpack = AssetOutgoingPacketQueue.Dequeue();
316 313
317 SendQueue.Enqueue(qpack); 314 SendQueue.Enqueue(qpack);
318 TotalThrottle.Add(qpack.Packet.ToBytes().Length); 315 TotalThrottle.Add(qpack.Packet.ToBytes().Length);
319 AssetThrottle.Add(qpack.Packet.ToBytes().Length); 316 AssetThrottle.Add(qpack.Packet.ToBytes().Length);
320 } 317 }
321 } 318 }
322 // MainLog.Instance.Verbose("THROTTLE", "Processed " + throttleLoops + " packets"); 319 // MainLog.Instance.Verbose("THROTTLE", "Processed " + throttleLoops + " packets");
323
324 } 320 }
325 } 321 }
326 322
327 private void ThrottleTimerElapsed(object sender, ElapsedEventArgs e) 323 private void ThrottleTimerElapsed(object sender, ElapsedEventArgs e)
328 { 324 {
329 // just to change the signature, and that ProcessThrottle 325 // just to change the signature, and that ProcessThrottle
330 // will be used elsewhere possibly 326 // will be used elsewhere possibly
331 ProcessThrottle(); 327 ProcessThrottle();
@@ -339,7 +335,7 @@ namespace OpenSim.Region.ClientStack
339 // wait for the timer to fire to put things into the 335 // wait for the timer to fire to put things into the
340 // output queue 336 // output queue
341 337
342 if((q.Count == 0) && (throttle.UnderLimit())) 338 if ((q.Count == 0) && (throttle.UnderLimit()))
343 { 339 {
344 Monitor.Enter(this); 340 Monitor.Enter(this);
345 throttle.Add(item.Packet.ToBytes().Length); 341 throttle.Add(item.Packet.ToBytes().Length);
@@ -357,31 +353,39 @@ namespace OpenSim.Region.ClientStack
357 353
358 private int ScaleThrottle(int value, int curmax, int newmax) 354 private int ScaleThrottle(int value, int curmax, int newmax)
359 { 355 {
360 return (int)(((float)value/(float)curmax) * newmax); 356 return (int) (((float) value/(float) curmax)*newmax);
361 } 357 }
358
362 private byte[] GetThrottlesPacked(float multiplier) 359 private byte[] GetThrottlesPacked(float multiplier)
363 { 360 {
364 int singlefloat = 4; 361 int singlefloat = 4;
365 float tResend = ResendThrottle.Throttle * multiplier; 362 float tResend = ResendThrottle.Throttle*multiplier;
366 float tLand = LandThrottle.Throttle * multiplier; 363 float tLand = LandThrottle.Throttle*multiplier;
367 float tWind = WindThrottle.Throttle * multiplier; 364 float tWind = WindThrottle.Throttle*multiplier;
368 float tCloud = CloudThrottle.Throttle * multiplier; 365 float tCloud = CloudThrottle.Throttle*multiplier;
369 float tTask = TaskThrottle.Throttle * multiplier; 366 float tTask = TaskThrottle.Throttle*multiplier;
370 float tTexture = TextureThrottle.Throttle * multiplier; 367 float tTexture = TextureThrottle.Throttle*multiplier;
371 float tAsset = AssetThrottle.Throttle * multiplier; 368 float tAsset = AssetThrottle.Throttle*multiplier;
372 369
373 byte[] throttles = new byte[singlefloat * 7]; 370 byte[] throttles = new byte[singlefloat*7];
374 int i = 0; 371 int i = 0;
375 Buffer.BlockCopy(BitConverter.GetBytes(tResend), 0, throttles, singlefloat * i, singlefloat); i++; 372 Buffer.BlockCopy(BitConverter.GetBytes(tResend), 0, throttles, singlefloat*i, singlefloat);
376 Buffer.BlockCopy(BitConverter.GetBytes(tLand), 0, throttles, singlefloat * i, singlefloat); i++; 373 i++;
377 Buffer.BlockCopy(BitConverter.GetBytes(tWind), 0, throttles, singlefloat * i, singlefloat); i++; 374 Buffer.BlockCopy(BitConverter.GetBytes(tLand), 0, throttles, singlefloat*i, singlefloat);
378 Buffer.BlockCopy(BitConverter.GetBytes(tCloud), 0, throttles, singlefloat * i, singlefloat); i++; 375 i++;
379 Buffer.BlockCopy(BitConverter.GetBytes(tTask), 0, throttles, singlefloat * i, singlefloat); i++; 376 Buffer.BlockCopy(BitConverter.GetBytes(tWind), 0, throttles, singlefloat*i, singlefloat);
380 Buffer.BlockCopy(BitConverter.GetBytes(tTexture), 0, throttles, singlefloat * i, singlefloat); i++; 377 i++;
381 Buffer.BlockCopy(BitConverter.GetBytes(tAsset), 0, throttles, singlefloat * i, singlefloat); 378 Buffer.BlockCopy(BitConverter.GetBytes(tCloud), 0, throttles, singlefloat*i, singlefloat);
379 i++;
380 Buffer.BlockCopy(BitConverter.GetBytes(tTask), 0, throttles, singlefloat*i, singlefloat);
381 i++;
382 Buffer.BlockCopy(BitConverter.GetBytes(tTexture), 0, throttles, singlefloat*i, singlefloat);
383 i++;
384 Buffer.BlockCopy(BitConverter.GetBytes(tAsset), 0, throttles, singlefloat*i, singlefloat);
382 385
383 return throttles; 386 return throttles;
384 } 387 }
388
385 public void SetThrottleFromClient(byte[] throttle) 389 public void SetThrottleFromClient(byte[] throttle)
386 { 390 {
387 int tResend = -1; 391 int tResend = -1;
@@ -401,25 +405,25 @@ namespace OpenSim.Region.ClientStack
401 // it might be smart to do this check more often... 405 // it might be smart to do this check more often...
402 if (!BitConverter.IsLittleEndian) 406 if (!BitConverter.IsLittleEndian)
403 for (int i = 0; i < 7; i++) 407 for (int i = 0; i < 7; i++)
404 Array.Reverse(throttle, j + i * singlefloat, singlefloat); 408 Array.Reverse(throttle, j + i*singlefloat, singlefloat);
405 409
406 // values gotten from libsecondlife.org/wiki/Throttle. Thanks MW_ 410 // values gotten from libsecondlife.org/wiki/Throttle. Thanks MW_
407 // bytes 411 // bytes
408 // Convert to integer, since.. the full fp space isn't used. 412 // Convert to integer, since.. the full fp space isn't used.
409 tResend = (int)BitConverter.ToSingle(throttle, j); 413 tResend = (int) BitConverter.ToSingle(throttle, j);
410 j += singlefloat; 414 j += singlefloat;
411 tLand = (int)BitConverter.ToSingle(throttle, j); 415 tLand = (int) BitConverter.ToSingle(throttle, j);
412 j += singlefloat; 416 j += singlefloat;
413 tWind = (int)BitConverter.ToSingle(throttle, j); 417 tWind = (int) BitConverter.ToSingle(throttle, j);
414 j += singlefloat; 418 j += singlefloat;
415 tCloud = (int)BitConverter.ToSingle(throttle, j); 419 tCloud = (int) BitConverter.ToSingle(throttle, j);
416 j += singlefloat; 420 j += singlefloat;
417 tTask = (int)BitConverter.ToSingle(throttle, j); 421 tTask = (int) BitConverter.ToSingle(throttle, j);
418 j += singlefloat; 422 j += singlefloat;
419 tTexture = (int)BitConverter.ToSingle(throttle, j); 423 tTexture = (int) BitConverter.ToSingle(throttle, j);
420 j += singlefloat; 424 j += singlefloat;
421 tAsset = (int)BitConverter.ToSingle(throttle, j); 425 tAsset = (int) BitConverter.ToSingle(throttle, j);
422 426
423 tall = tResend + tLand + tWind + tCloud + tTask + tTexture + tAsset; 427 tall = tResend + tLand + tWind + tCloud + tTask + tTexture + tAsset;
424 /* 428 /*
425 MainLog.Instance.Verbose("CLIENT", "Client AgentThrottle - Got throttle:resendbytes=" + tResend + 429 MainLog.Instance.Verbose("CLIENT", "Client AgentThrottle - Got throttle:resendbytes=" + tResend +
@@ -431,13 +435,13 @@ namespace OpenSim.Region.ClientStack
431 " Assetbytes=" + tAsset + 435 " Assetbytes=" + tAsset +
432 " Allbytes=" + tall); 436 " Allbytes=" + tall);
433 */ 437 */
434 438
435 // Total Sanity 439 // Total Sanity
436 // Make sure that the client sent sane total values. 440 // Make sure that the client sent sane total values.
437 441
438 // If the client didn't send acceptable values.... 442 // If the client didn't send acceptable values....
439 // Scale the clients values down until they are acceptable. 443 // Scale the clients values down until they are acceptable.
440 444
441 if (tall <= TotalThrottle.Max) 445 if (tall <= TotalThrottle.Max)
442 { 446 {
443 ResendThrottle.Throttle = tResend; 447 ResendThrottle.Throttle = tResend;
@@ -448,7 +452,7 @@ namespace OpenSim.Region.ClientStack
448 TextureThrottle.Throttle = tTexture; 452 TextureThrottle.Throttle = tTexture;
449 AssetThrottle.Throttle = tAsset; 453 AssetThrottle.Throttle = tAsset;
450 TotalThrottle.Throttle = tall; 454 TotalThrottle.Throttle = tall;
451 } 455 }
452 else if (tall < 1) 456 else if (tall < 1)
453 { 457 {
454 // client is stupid, penalize him by minning everything 458 // client is stupid, penalize him by minning everything
@@ -478,4 +482,4 @@ namespace OpenSim.Region.ClientStack
478 ResetCounters(); 482 ResetCounters();
479 } 483 }
480 } 484 }
481} 485} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs
index a232db8..7e01adf 100644
--- a/OpenSim/Region/ClientStack/PacketServer.cs
+++ b/OpenSim/Region/ClientStack/PacketServer.cs
@@ -68,10 +68,11 @@ namespace OpenSim.Region.ClientStack
68 68
69 protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, 69 protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
70 ClientManager clientManager, IScene scene, AssetCache assetCache, 70 ClientManager clientManager, IScene scene, AssetCache assetCache,
71 PacketServer packServer, AgentCircuitManager authenSessions, LLUUID agentId, LLUUID sessionId, uint circuitCode) 71 PacketServer packServer, AgentCircuitManager authenSessions,
72 LLUUID agentId, LLUUID sessionId, uint circuitCode)
72 { 73 {
73 return 74 return
74 new ClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode ); 75 new ClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode);
75 } 76 }
76 77
77 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache, 78 public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache,
@@ -86,7 +87,8 @@ namespace OpenSim.Region.ClientStack
86 else 87 else
87 { 88 {
88 newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this, 89 newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this,
89 authenticateSessionsClass, useCircuit.CircuitCode.ID, useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code); 90 authenticateSessionsClass, useCircuit.CircuitCode.ID,
91 useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code);
90 92
91 m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser); 93 m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser);
92 94
@@ -123,9 +125,8 @@ namespace OpenSim.Region.ClientStack
123 /// <param name="circuitcode"></param> 125 /// <param name="circuitcode"></param>
124 public virtual void CloseCircuit(uint circuitcode) 126 public virtual void CloseCircuit(uint circuitcode)
125 { 127 {
126
127 m_networkHandler.RemoveClientCircuit(circuitcode); 128 m_networkHandler.RemoveClientCircuit(circuitcode);
128 129
129 //m_scene.ClientManager.CloseAllAgents(circuitcode); 130 //m_scene.ClientManager.CloseAllAgents(circuitcode);
130 } 131 }
131 132
@@ -135,4 +136,4 @@ namespace OpenSim.Region.ClientStack
135 client.Close(false); 136 client.Close(false);
136 } 137 }
137 } 138 }
138} 139} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/PacketThrottle.cs b/OpenSim/Region/ClientStack/PacketThrottle.cs
index f9a5c09..f56f4f8 100644
--- a/OpenSim/Region/ClientStack/PacketThrottle.cs
+++ b/OpenSim/Region/ClientStack/PacketThrottle.cs
@@ -25,26 +25,10 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic;
30using System.Net;
31using System.Net.Sockets;
32using System.Text;
33using System.Threading;
34using System.Timers;
35using Axiom.Math;
36using libsecondlife;
37using libsecondlife.Packets;
38using OpenSim.Framework;
39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Console;
41using Timer=System.Timers.Timer;
42
43namespace OpenSim.Region.ClientStack 28namespace OpenSim.Region.ClientStack
44{ 29{
45 public class PacketThrottle 30 public class PacketThrottle
46 { 31 {
47
48 private int max; // max allowable throttle 32 private int max; // max allowable throttle
49 private int min; // min allowable throttle 33 private int min; // min allowable throttle
50 private int throttle; // current throttle setting 34 private int throttle; // current throttle setting
@@ -63,10 +47,10 @@ namespace OpenSim.Region.ClientStack
63 { 47 {
64 sent = 0; 48 sent = 0;
65 } 49 }
66 50
67 public bool UnderLimit() 51 public bool UnderLimit()
68 { 52 {
69 return (sent < (throttle / divisor)); 53 return (sent < (throttle/divisor));
70 } 54 }
71 55
72 public int Add(int bytes) 56 public int Add(int bytes)
@@ -78,27 +62,32 @@ namespace OpenSim.Region.ClientStack
78 // Properties 62 // Properties
79 public int Max 63 public int Max
80 { 64 {
81 get {return max;} 65 get { return max; }
82 } 66 }
83 67
84 public int Min 68 public int Min
85 { 69 {
86 get {return min;} 70 get { return min; }
87 } 71 }
88 72
89 public int Throttle 73 public int Throttle
90 { 74 {
91 get {return throttle;} 75 get { return throttle; }
92 set 76 set
93 { 77 {
94 if (value > max) { 78 if (value > max)
79 {
95 throttle = max; 80 throttle = max;
96 } else if (value < min) { 81 }
82 else if (value < min)
83 {
97 throttle = min; 84 throttle = min;
98 } else { 85 }
86 else
87 {
99 throttle = value; 88 throttle = value;
100 } 89 }
101 } 90 }
102 } 91 }
103 } 92 }
104} 93} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/QueItem.cs b/OpenSim/Region/ClientStack/QueItem.cs
index 23b1648..ea0f680 100644
--- a/OpenSim/Region/ClientStack/QueItem.cs
+++ b/OpenSim/Region/ClientStack/QueItem.cs
@@ -31,14 +31,14 @@ using OpenSim.Framework;
31 31
32namespace OpenSim.Region.ClientStack 32namespace OpenSim.Region.ClientStack
33{ 33{
34 public class QueItem 34 public class QueItem
35 {
36 public QueItem()
35 { 37 {
36 public QueItem()
37 {
38 }
39
40 public Packet Packet;
41 public bool Incoming;
42 public ThrottleOutPacketType throttleType;
43 } 38 }
44} 39
40 public Packet Packet;
41 public bool Incoming;
42 public ThrottleOutPacketType throttleType;
43 }
44} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index f20b132..e9331e9 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using libsecondlife; 31using libsecondlife;
32using Nini.Config;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Framework.Communications; 33using OpenSim.Framework.Communications;
35using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
@@ -55,7 +54,7 @@ namespace OpenSim.Region.ClientStack
55 protected CommunicationsManager m_commsManager; 54 protected CommunicationsManager m_commsManager;
56 55
57 protected SceneManager m_sceneManager = new SceneManager(); 56 protected SceneManager m_sceneManager = new SceneManager();
58 57
59 protected StorageManager m_storageManager; 58 protected StorageManager m_storageManager;
60 protected string m_storageConnectionString; 59 protected string m_storageConnectionString;
61 60
@@ -73,7 +72,7 @@ namespace OpenSim.Region.ClientStack
73 { 72 {
74 ClientView.TerrainManager = new TerrainManager(new SecondLife()); 73 ClientView.TerrainManager = new TerrainManager(new SecondLife());
75 74
76 m_storageManager = CreateStorageManager(m_storageConnectionString ); 75 m_storageManager = CreateStorageManager(m_storageConnectionString);
77 76
78 Initialize(); 77 Initialize();
79 78
@@ -142,7 +141,7 @@ namespace OpenSim.Region.ClientStack
142 m_log.Verbose("PARCEL", "No master avatar found, using null."); 141 m_log.Verbose("PARCEL", "No master avatar found, using null.");
143 scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero; 142 scene.RegionInfo.MasterAvatarAssignedUUID = LLUUID.Zero;
144 } 143 }
145 144
146 scene.LoadPrimsFromStorage(m_permissions); 145 scene.LoadPrimsFromStorage(m_permissions);
147 scene.loadAllLandObjectsFromStorage(); 146 scene.loadAllLandObjectsFromStorage();
148 scene.performParcelPrimCountUpdate(); 147 scene.performParcelPrimCountUpdate();
@@ -153,4 +152,4 @@ namespace OpenSim.Region.ClientStack
153 protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 152 protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
154 AgentCircuitManager circuitManager); 153 AgentCircuitManager circuitManager);
155 } 154 }
156} 155} \ No newline at end of file
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs
index 47e0b3c..10435bf 100644
--- a/OpenSim/Region/ClientStack/UDPServer.cs
+++ b/OpenSim/Region/ClientStack/UDPServer.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Net.Sockets; 32using System.Net.Sockets;
33using libsecondlife;
33using libsecondlife.Packets; 34using libsecondlife.Packets;
34using OpenSim.Framework; 35using OpenSim.Framework;
35using OpenSim.Framework.Communications.Cache; 36using OpenSim.Framework.Communications.Cache;
@@ -44,24 +45,22 @@ namespace OpenSim.Region.ClientStack
44 { 45 {
45 } 46 }
46 47
47 static readonly PacketPool instance = new PacketPool(); 48 private static readonly PacketPool instance = new PacketPool();
48 49
49 public static PacketPool Instance 50 public static PacketPool Instance
50 { 51 {
51 get 52 get { return instance; }
52 {
53 return instance;
54 }
55 } 53 }
56 54
57 private Hashtable pool = new Hashtable(); 55 private Hashtable pool = new Hashtable();
58 56
59 public Packet GetPacket(PacketType type) { 57 public Packet GetPacket(PacketType type)
58 {
60 Packet packet = null; 59 Packet packet = null;
61 60
62 lock(pool) 61 lock (pool)
63 { 62 {
64 if(pool[type] == null || ((Stack) pool[type]).Count == 0) 63 if (pool[type] == null || ((Stack) pool[type]).Count == 0)
65 { 64 {
66 // Creating a new packet if we cannot reuse an old package 65 // Creating a new packet if we cannot reuse an old package
67 packet = Packet.BuildPacket(type); 66 packet = Packet.BuildPacket(type);
@@ -69,30 +68,33 @@ namespace OpenSim.Region.ClientStack
69 else 68 else
70 { 69 {
71 // Recycle old packages 70 // Recycle old packages
72 packet=(Packet) ((Stack) pool[type]).Pop(); 71 packet = (Packet) ((Stack) pool[type]).Pop();
73 } 72 }
74 } 73 }
75 74
76 return packet; 75 return packet;
77 } 76 }
78 77
79 public Packet GetPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer) { 78 public Packet GetPacket(byte[] bytes, ref int packetEnd, byte[] zeroBuffer)
79 {
80 Packet packet = GetPacket(GetType(bytes, packetEnd, zeroBuffer)); 80 Packet packet = GetPacket(GetType(bytes, packetEnd, zeroBuffer));
81 81
82 int i = 0; 82 int i = 0;
83 packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); 83 packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer);
84 return packet; 84 return packet;
85 } 85 }
86
86 public PacketType GetType(byte[] bytes, int packetEnd, byte[] zeroBuffer) 87 public PacketType GetType(byte[] bytes, int packetEnd, byte[] zeroBuffer)
87 { 88 {
88 //Function removed from LibSL revision 1540 89 //Function removed from LibSL revision 1540
89 // We're using it.. so Built it into UDP server for now.. 90 // We're using it.. so Built it into UDP server for now..
90 ushort id; libsecondlife.PacketFrequency freq; 91 ushort id;
92 PacketFrequency freq;
91 int i = 0, end = packetEnd; 93 int i = 0, end = packetEnd;
92 Header header = Header.BuildHeader(bytes, ref i, ref end); 94 Header header = Header.BuildHeader(bytes, ref i, ref end);
93 if (header.Zerocoded) 95 if (header.Zerocoded)
94 { 96 {
95 end = libsecondlife.Helpers.ZeroDecode(bytes, end + 1, zeroBuffer) - 1; 97 end = Helpers.ZeroDecode(bytes, end + 1, zeroBuffer) - 1;
96 bytes = zeroBuffer; 98 bytes = zeroBuffer;
97 } 99 }
98 100
@@ -100,25 +102,30 @@ namespace OpenSim.Region.ClientStack
100 { 102 {
101 if (bytes[7] == 0xFF) 103 if (bytes[7] == 0xFF)
102 { 104 {
103 id = (ushort)((bytes[8] << 8) + bytes[9]); freq = libsecondlife.PacketFrequency.Low; 105 id = (ushort) ((bytes[8] << 8) + bytes[9]);
106 freq = PacketFrequency.Low;
104 } 107 }
105 else 108 else
106 { 109 {
107 id = (ushort)bytes[7]; freq = libsecondlife.PacketFrequency.Medium; 110 id = (ushort) bytes[7];
111 freq = PacketFrequency.Medium;
108 } 112 }
109 } 113 }
110 else 114 else
111 { 115 {
112 id = (ushort)bytes[6]; freq = libsecondlife.PacketFrequency.High; 116 id = (ushort) bytes[6];
117 freq = PacketFrequency.High;
113 } 118 }
114 return Packet.GetType(id, freq); 119 return Packet.GetType(id, freq);
115 } 120 }
116 public void ReturnPacket(Packet packet) { 121
117 lock(pool) 122 public void ReturnPacket(Packet packet)
123 {
124 lock (pool)
118 { 125 {
119 PacketType type=packet.Type; 126 PacketType type = packet.Type;
120 127
121 if(pool[type] == null) 128 if (pool[type] == null)
122 { 129 {
123 pool[type] = new Stack(); 130 pool[type] = new Stack();
124 } 131 }
@@ -162,15 +169,11 @@ namespace OpenSim.Region.ClientStack
162 m_packetServer.LocalScene = m_localScene; 169 m_packetServer.LocalScene = m_localScene;
163 m_regionHandle = m_localScene.RegionInfo.RegionHandle; 170 m_regionHandle = m_localScene.RegionInfo.RegionHandle;
164 } 171 }
165
166 } 172 }
167 173
168 public ulong RegionHandle 174 public ulong RegionHandle
169 { 175 {
170 get 176 get { return m_regionHandle; }
171 {
172 return m_regionHandle;
173 }
174 } 177 }
175 178
176 public UDPServer() 179 public UDPServer()
@@ -212,30 +215,29 @@ namespace OpenSim.Region.ClientStack
212 case SocketError.AlreadyInProgress: 215 case SocketError.AlreadyInProgress:
213 case SocketError.NetworkReset: 216 case SocketError.NetworkReset:
214 case SocketError.ConnectionReset: 217 case SocketError.ConnectionReset:
215 218
216 try 219 try
217 { 220 {
218 CloseEndPoint(epSender); 221 CloseEndPoint(epSender);
219 } 222 }
220 catch (System.Exception a) 223 catch (Exception a)
221 { 224 {
222 MainLog.Instance.Verbose("UDPSERVER", a.ToString()); 225 MainLog.Instance.Verbose("UDPSERVER", a.ToString());
223 } 226 }
224 try 227 try
225 { 228 {
226 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 229 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
227 230 ReceivedData, null);
231
228 // Ter: For some stupid reason ConnectionReset basically kills our async event structure.. 232 // Ter: For some stupid reason ConnectionReset basically kills our async event structure..
229 // so therefore.. we've got to tell the server to BeginReceiveFrom again. 233 // so therefore.. we've got to tell the server to BeginReceiveFrom again.
230 // This will happen over and over until we've gone through all packets 234 // This will happen over and over until we've gone through all packets
231 // sent to and from this particular user. 235 // sent to and from this particular user.
232 // Stupid I know.. 236 // Stupid I know..
233 // but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method. 237 // but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method.
234
235 } 238 }
236 catch (SocketException) 239 catch (SocketException)
237 { 240 {
238
239 } 241 }
240 break; 242 break;
241 default: 243 default:
@@ -243,13 +245,14 @@ namespace OpenSim.Region.ClientStack
243 { 245 {
244 CloseEndPoint(epSender); 246 CloseEndPoint(epSender);
245 } 247 }
246 catch (System.Exception) 248 catch (Exception)
247 { 249 {
248 //MainLog.Instance.Verbose("UDPSERVER", a.ToString()); 250 //MainLog.Instance.Verbose("UDPSERVER", a.ToString());
249 } 251 }
250 try 252 try
251 { 253 {
252 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 254 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender,
255 ReceivedData, null);
253 256
254 // Ter: For some stupid reason ConnectionReset basically kills our async event structure.. 257 // Ter: For some stupid reason ConnectionReset basically kills our async event structure..
255 // so therefore.. we've got to tell the server to BeginReceiveFrom again. 258 // so therefore.. we've got to tell the server to BeginReceiveFrom again.
@@ -257,17 +260,15 @@ namespace OpenSim.Region.ClientStack
257 // sent to and from this particular user. 260 // sent to and from this particular user.
258 // Stupid I know.. 261 // Stupid I know..
259 // but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method. 262 // but Flusing the buffer would be even more stupid... so, we're stuck with this ugly method.
260
261 } 263 }
262 catch (SocketException) 264 catch (SocketException)
263 { 265 {
264
265 } 266 }
266 267
267 // Here's some reference code! :D 268 // Here's some reference code! :D
268 // Shutdown and restart the UDP listener! hehe 269 // Shutdown and restart the UDP listener! hehe
269 // Shiny 270 // Shiny
270 271
271 //Server.Shutdown(SocketShutdown.Both); 272 //Server.Shutdown(SocketShutdown.Both);
272 //CloseEndPoint(epSender); 273 //CloseEndPoint(epSender);
273 //ServerListener(); 274 //ServerListener();
@@ -276,7 +277,7 @@ namespace OpenSim.Region.ClientStack
276 277
277 return; 278 return;
278 } 279 }
279 catch (System.ObjectDisposedException) 280 catch (ObjectDisposedException)
280 { 281 {
281 //MainLog.Instance.Debug("UDPSERVER", e.ToString()); 282 //MainLog.Instance.Debug("UDPSERVER", e.ToString());
282 return; 283 return;
@@ -288,7 +289,7 @@ namespace OpenSim.Region.ClientStack
288 { 289 {
289 packet = PacketPool.Instance.GetPacket(RecvBuffer, ref packetEnd, ZeroBuffer); 290 packet = PacketPool.Instance.GetPacket(RecvBuffer, ref packetEnd, ZeroBuffer);
290 } 291 }
291 catch(Exception) 292 catch (Exception)
292 { 293 {
293 //MainLog.Instance.Debug("UDPSERVER", e.ToString()); 294 //MainLog.Instance.Debug("UDPSERVER", e.ToString());
294 } 295 }
@@ -311,7 +312,6 @@ namespace OpenSim.Region.ClientStack
311 } 312 }
312 else 313 else
313 { 314 {
314
315 // invalid client 315 // invalid client
316 //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now 316 //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now
317 //m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString()); 317 //m_log.Warn("client", "Got a packet from an invalid client - " + epSender.ToString());
@@ -326,9 +326,7 @@ namespace OpenSim.Region.ClientStack
326 uint circuit; 326 uint circuit;
327 if (clientCircuits.TryGetValue(sender, out circuit)) 327 if (clientCircuits.TryGetValue(sender, out circuit))
328 { 328 {
329
330 m_packetServer.CloseCircuit(circuit); 329 m_packetServer.CloseCircuit(circuit);
331
332 } 330 }
333 } 331 }
334 332
@@ -381,14 +379,11 @@ namespace OpenSim.Region.ClientStack
381 EndPoint sendto = null; 379 EndPoint sendto = null;
382 if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto)) 380 if (clientCircuits_reverse.TryGetValue(circuitcode, out sendto))
383 { 381 {
384
385 clientCircuits.Remove(sendto); 382 clientCircuits.Remove(sendto);
386
387 383
388 384
389 clientCircuits_reverse.Remove(circuitcode); 385 clientCircuits_reverse.Remove(circuitcode);
390
391 } 386 }
392 } 387 }
393 } 388 }
394} 389} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
index 937f7c4..575d9d5 100644
--- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
+++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs
@@ -50,4 +50,4 @@ namespace OpenSim.Region.Communications.Local
50 m_interRegion = interRegionService; 50 m_interRegion = interRegionService;
51 } 51 }
52 } 52 }
53} 53} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index f6137f7..4dec884 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -29,8 +29,8 @@ using System.Collections;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Console;
33using OpenSim.Framework.Communications; 32using OpenSim.Framework.Communications;
33using OpenSim.Framework.Console;
34 34
35namespace OpenSim.Region.Communications.Local 35namespace OpenSim.Region.Communications.Local
36{ 36{
@@ -50,21 +50,17 @@ namespace OpenSim.Region.Communications.Local
50 public string gdebugRegionName 50 public string gdebugRegionName
51 { 51 {
52 get { return _gdebugRegionName; } 52 get { return _gdebugRegionName; }
53 set 53 set { _gdebugRegionName = value; }
54 {
55 _gdebugRegionName = value;
56 }
57 } 54 }
55
58 public string _rdebugRegionName = ""; 56 public string _rdebugRegionName = "";
59 57
60 public string rdebugRegionName 58 public string rdebugRegionName
61 { 59 {
62 get { return _rdebugRegionName; } 60 get { return _rdebugRegionName; }
63 set 61 set { _rdebugRegionName = value; }
64 {
65 _rdebugRegionName = value;
66 }
67 } 62 }
63
68 public LocalBackEndServices() 64 public LocalBackEndServices()
69 { 65 {
70 } 66 }
@@ -85,7 +81,8 @@ namespace OpenSim.Region.Communications.Local
85 RegionCommsListener regionHost = new RegionCommsListener(); 81 RegionCommsListener regionHost = new RegionCommsListener();
86 if (m_regionListeners.ContainsKey(regionInfo.RegionHandle)) 82 if (m_regionListeners.ContainsKey(regionInfo.RegionHandle))
87 { 83 {
88 MainLog.Instance.Error("INTERREGION", "Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up."); 84 MainLog.Instance.Error("INTERREGION",
85 "Error:Region registered twice as an Events listener for Interregion Communications but not as a listed region. In Standalone mode this will cause BIG issues. In grid mode, it means a region went down and came back up.");
89 m_regionListeners.Remove(regionInfo.RegionHandle); 86 m_regionListeners.Remove(regionInfo.RegionHandle);
90 } 87 }
91 m_regionListeners.Add(regionInfo.RegionHandle, regionHost); 88 m_regionListeners.Add(regionInfo.RegionHandle, regionHost);
@@ -195,7 +192,7 @@ namespace OpenSim.Region.Communications.Local
195 return mapBlocks; 192 return mapBlocks;
196 } 193 }
197 194
198 195
199 public virtual bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) 196 public virtual bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
200 { 197 {
201 RegionInfo region = new RegionInfo(sregion); 198 RegionInfo region = new RegionInfo(sregion);
@@ -203,7 +200,7 @@ namespace OpenSim.Region.Communications.Local
203 { 200 {
204 return m_regionListeners[regionhandle].TriggerRegionUp(region); 201 return m_regionListeners[regionhandle].TriggerRegionUp(region);
205 } 202 }
206 203
207 return false; 204 return false;
208 } 205 }
209 206
@@ -224,7 +221,7 @@ namespace OpenSim.Region.Communications.Local
224 // It never gets called. 221 // It never gets called.
225 public virtual Dictionary<string, string> GetGridSettings() 222 public virtual Dictionary<string, string> GetGridSettings()
226 { 223 {
227 Dictionary<string,string> returnGridSettings = new Dictionary<string,string>(); 224 Dictionary<string, string> returnGridSettings = new Dictionary<string, string>();
228 lock (m_queuedGridSettings) 225 lock (m_queuedGridSettings)
229 { 226 {
230 returnGridSettings = m_queuedGridSettings; 227 returnGridSettings = m_queuedGridSettings;
@@ -237,7 +234,6 @@ namespace OpenSim.Region.Communications.Local
237 public virtual void SetForcefulBanlistsDisallowed(ulong regionHandle) 234 public virtual void SetForcefulBanlistsDisallowed(ulong regionHandle)
238 { 235 {
239 m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE"); 236 m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE");
240
241 } 237 }
242 238
243 public bool TriggerRegionUp(RegionInfo region, ulong regionhandle) 239 public bool TriggerRegionUp(RegionInfo region, ulong regionhandle)
@@ -254,7 +250,7 @@ namespace OpenSim.Region.Communications.Local
254 { 250 {
255 if (m_regionListeners.ContainsKey(regionHandle)) 251 if (m_regionListeners.ContainsKey(regionHandle))
256 { 252 {
257 return m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle,cAgentData); 253 return m_regionListeners[regionHandle].TriggerChildAgentUpdate(regionHandle, cAgentData);
258 } 254 }
259 return false; 255 return false;
260 } 256 }
@@ -282,7 +278,7 @@ namespace OpenSim.Region.Communications.Local
282 return false; 278 return false;
283 } 279 }
284 280
285 public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) 281 public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData)
286 { 282 {
287 if (m_regionListeners.ContainsKey(regionHandle)) 283 if (m_regionListeners.ContainsKey(regionHandle))
288 { 284 {
@@ -291,6 +287,7 @@ namespace OpenSim.Region.Communications.Local
291 } 287 }
292 return false; 288 return false;
293 } 289 }
290
294 /// <summary> 291 /// <summary>
295 /// 292 ///
296 /// </summary> 293 /// </summary>
@@ -308,6 +305,7 @@ namespace OpenSim.Region.Communications.Local
308 } 305 }
309 return false; 306 return false;
310 } 307 }
308
311 public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) 309 public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
312 { 310 {
313 if (m_regionListeners.ContainsKey(regionHandle)) 311 if (m_regionListeners.ContainsKey(regionHandle))
@@ -322,7 +320,7 @@ namespace OpenSim.Region.Communications.Local
322 { 320 {
323 if (m_regionListeners.ContainsKey(regionHandle)) 321 if (m_regionListeners.ContainsKey(regionHandle))
324 { 322 {
325 m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID); 323 m_regionListeners[regionHandle].TriggerCloseAgentConnection(regionHandle, agentID);
326 } 324 }
327 } 325 }
328 326
@@ -334,6 +332,7 @@ namespace OpenSim.Region.Communications.Local
334 } 332 }
335 return false; 333 return false;
336 } 334 }
335
337 public bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID) 336 public bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID)
338 { 337 {
339 if (m_regionListeners.ContainsKey(regionHandle)) 338 if (m_regionListeners.ContainsKey(regionHandle))
@@ -415,14 +414,15 @@ namespace OpenSim.Region.Communications.Local
415 { 414 {
416 if (m_regionListeners.ContainsKey(regionHandle)) 415 if (m_regionListeners.ContainsKey(regionHandle))
417 { 416 {
418 return m_regionListeners[regionHandle].TriggerExpectPrimCrossing(regionHandle, primID, position, isPhysical); 417 return
418 m_regionListeners[regionHandle].TriggerExpectPrimCrossing(regionHandle, primID, position, isPhysical);
419 } 419 }
420 return false; 420 return false;
421 } 421 }
422 422
423 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) 423 public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData)
424 { 424 {
425 // MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname); 425 // MainLog.Instance.Verbose("INTER", rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname);
426 426
427 if (m_regionListeners.ContainsKey(regionHandle)) 427 if (m_regionListeners.ContainsKey(regionHandle))
428 { 428 {
@@ -435,4 +435,4 @@ namespace OpenSim.Region.Communications.Local
435 return false; 435 return false;
436 } 436 }
437 } 437 }
438} 438} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index 08bd850..730c40f 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -82,14 +82,14 @@ namespace OpenSim.Region.Communications.Local
82 { 82 {
83 DeleteItem(item); 83 DeleteItem(item);
84 } 84 }
85 85
86 /// <summary> 86 /// <summary>
87 /// Send the given inventory folder and its item contents back to the requester. 87 /// Send the given inventory folder and its item contents back to the requester.
88 /// </summary> 88 /// </summary>
89 /// <param name="userID"></param> 89 /// <param name="userID"></param>
90 /// <param name="folder"></param> 90 /// <param name="folder"></param>
91 private InventoryFolderImpl RequestInventoryFolder(LLUUID userID, InventoryFolderBase folder, 91 private InventoryFolderImpl RequestInventoryFolder(LLUUID userID, InventoryFolderBase folder,
92 InventoryFolderInfo folderCallBack, 92 InventoryFolderInfo folderCallBack,
93 InventoryItemInfo itemCallBack) 93 InventoryItemInfo itemCallBack)
94 { 94 {
95 InventoryFolderImpl newFolder = new InventoryFolderImpl(folder); 95 InventoryFolderImpl newFolder = new InventoryFolderImpl(folder);
@@ -99,9 +99,9 @@ namespace OpenSim.Region.Communications.Local
99 foreach (InventoryItemBase item in items) 99 foreach (InventoryItemBase item in items)
100 { 100 {
101 itemCallBack(userID, item); 101 itemCallBack(userID, item);
102 } 102 }
103 103
104 return newFolder; 104 return newFolder;
105 } 105 }
106 } 106 }
107} 107} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 2c08707..bf5f205 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -73,7 +73,7 @@ namespace OpenSim.Region.Communications.Local
73 if (!authUsers) 73 if (!authUsers)
74 { 74 {
75 //no current user account so make one 75 //no current user account so make one
76 MainLog.Instance.Notice("LOGIN", "No user account found so creating a new one."); 76 MainLog.Instance.Notice("LOGIN", "No user account found so creating a new one.");
77 77
78 m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY); 78 m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
79 79
@@ -93,14 +93,14 @@ namespace OpenSim.Region.Communications.Local
93 if (!authUsers) 93 if (!authUsers)
94 { 94 {
95 //for now we will accept any password in sandbox mode 95 //for now we will accept any password in sandbox mode
96 MainLog.Instance.Notice("LOGIN", "Authorising user (no actual password check)"); 96 MainLog.Instance.Notice("LOGIN", "Authorising user (no actual password check)");
97 97
98 return true; 98 return true;
99 } 99 }
100 else 100 else
101 { 101 {
102 MainLog.Instance.Notice( 102 MainLog.Instance.Notice(
103 "LOGIN", "Authenticating " + profile.username + " " + profile.surname); 103 "LOGIN", "Authenticating " + profile.username + " " + profile.surname);
104 104
105 password = password.Remove(0, 3); //remove $1$ 105 password = password.Remove(0, 3); //remove $1$
106 106
@@ -134,7 +134,7 @@ namespace OpenSim.Region.Communications.Local
134 // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/"; 134 // response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
135 theUser.currentAgent.currentRegion = reg.RegionID; 135 theUser.currentAgent.currentRegion = reg.RegionID;
136 theUser.currentAgent.currentHandle = reg.RegionHandle; 136 theUser.currentAgent.currentHandle = reg.RegionHandle;
137 137
138 LoginResponse.BuddyList buddyList = new LoginResponse.BuddyList(); 138 LoginResponse.BuddyList buddyList = new LoginResponse.BuddyList();
139 buddyList.AddNewBuddy(new LoginResponse.BuddyList.BuddyInfo("11111111-1111-0000-0000-000100bba000")); 139 buddyList.AddNewBuddy(new LoginResponse.BuddyList.BuddyInfo("11111111-1111-0000-0000-000100bba000"));
140 response.BuddList = buddyList; 140 response.BuddList = buddyList;
@@ -157,7 +157,7 @@ namespace OpenSim.Region.Communications.Local
157 } 157 }
158 else 158 else
159 { 159 {
160 MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion); 160 MainLog.Instance.Warn("LOGIN", "Not found region " + currentRegion);
161 } 161 }
162 } 162 }
163 163
@@ -207,4 +207,4 @@ namespace OpenSim.Region.Communications.Local
207 } 207 }
208 } 208 }
209 } 209 }
210} 210} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index d8c4b1d..6269565 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -27,6 +27,7 @@
27*/ 27*/
28 28
29using System; 29using System;
30using libsecondlife;
30using OpenSim.Framework; 31using OpenSim.Framework;
31using OpenSim.Framework.Communications; 32using OpenSim.Framework.Communications;
32using OpenSim.Framework.UserManagement; 33using OpenSim.Framework.UserManagement;
@@ -82,7 +83,7 @@ namespace OpenSim.Region.Communications.Local
82 return profile; 83 return profile;
83 } 84 }
84 85
85 public override UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid) 86 public override UserProfileData SetupMasterUser(LLUUID uuid)
86 { 87 {
87 UserProfileData data = GetUserProfile(uuid); 88 UserProfileData data = GetUserProfile(uuid);
88 if (data == null) 89 if (data == null)
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 2754c4e..8d52eeb 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -60,23 +60,17 @@ namespace OpenSim.Region.Communications.OGS1
60 public string gdebugRegionName 60 public string gdebugRegionName
61 { 61 {
62 get { return _gdebugRegionName; } 62 get { return _gdebugRegionName; }
63 set 63 set { _gdebugRegionName = value; }
64 {
65 _gdebugRegionName = value;
66
67 }
68 } 64 }
65
69 public string _rdebugRegionName = ""; 66 public string _rdebugRegionName = "";
70 67
71 public string rdebugRegionName 68 public string rdebugRegionName
72 { 69 {
73 get { return _rdebugRegionName; } 70 get { return _rdebugRegionName; }
74 set 71 set { _rdebugRegionName = value; }
75 {
76 _rdebugRegionName = value;
77
78 }
79 } 72 }
73
80 /// <summary> 74 /// <summary>
81 /// 75 ///
82 /// </summary> 76 /// </summary>
@@ -128,7 +122,7 @@ namespace OpenSim.Region.Communications.OGS1
128 // Process Response 122 // Process Response
129 if (GridRespData.ContainsKey("error")) 123 if (GridRespData.ContainsKey("error"))
130 { 124 {
131 string errorstring = (string)GridRespData["error"]; 125 string errorstring = (string) GridRespData["error"];
132 MainLog.Instance.Error("Unable to connect to grid: " + errorstring); 126 MainLog.Instance.Error("Unable to connect to grid: " + errorstring);
133 return null; 127 return null;
134 } 128 }
@@ -137,14 +131,12 @@ namespace OpenSim.Region.Communications.OGS1
137 m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY); 131 m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY);
138 if (GridRespData.ContainsKey("allow_forceful_banlines")) 132 if (GridRespData.ContainsKey("allow_forceful_banlines"))
139 { 133 {
140 134 if ((string) GridRespData["allow_forceful_banlines"] != "TRUE")
141 if ((string)GridRespData["allow_forceful_banlines"] != "TRUE")
142 { 135 {
143 //m_localBackend.SetForcefulBanlistsDisallowed(regionInfo.RegionHandle); 136 //m_localBackend.SetForcefulBanlistsDisallowed(regionInfo.RegionHandle);
144 m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE"); 137 m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE");
145 } 138 }
146 } 139 }
147
148 } 140 }
149 return m_localBackend.RegisterRegion(regionInfo); 141 return m_localBackend.RegisterRegion(regionInfo);
150 } 142 }
@@ -153,6 +145,7 @@ namespace OpenSim.Region.Communications.OGS1
153 { 145 {
154 return false; 146 return false;
155 } 147 }
148
156 public virtual Dictionary<string, string> GetGridSettings() 149 public virtual Dictionary<string, string> GetGridSettings()
157 { 150 {
158 Dictionary<string, string> returnGridSettings = new Dictionary<string, string>(); 151 Dictionary<string, string> returnGridSettings = new Dictionary<string, string>();
@@ -161,15 +154,15 @@ namespace OpenSim.Region.Communications.OGS1
161 foreach (string Dictkey in m_queuedGridSettings.Keys) 154 foreach (string Dictkey in m_queuedGridSettings.Keys)
162 { 155 {
163 returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); 156 returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]);
164
165 } 157 }
166 158
167 159
168 m_queuedGridSettings.Clear(); 160 m_queuedGridSettings.Clear();
169 } 161 }
170 162
171 return returnGridSettings; 163 return returnGridSettings;
172 } 164 }
165
173 /// <summary> 166 /// <summary>
174 /// 167 ///
175 /// </summary> 168 /// </summary>
@@ -223,7 +216,7 @@ namespace OpenSim.Region.Communications.OGS1
223 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 216 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
224 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); 217 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
225 218
226 Hashtable responseData = (Hashtable)GridResp.Value; 219 Hashtable responseData = (Hashtable) GridResp.Value;
227 220
228 if (responseData.ContainsKey("error")) 221 if (responseData.ContainsKey("error"))
229 { 222 {
@@ -231,29 +224,30 @@ namespace OpenSim.Region.Communications.OGS1
231 return null; 224 return null;
232 } 225 }
233 226
234 uint regX = Convert.ToUInt32((string)responseData["region_locx"]); 227 uint regX = Convert.ToUInt32((string) responseData["region_locx"]);
235 uint regY = Convert.ToUInt32((string)responseData["region_locy"]); 228 uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
236 string internalIpStr = (string)responseData["sim_ip"]; 229 string internalIpStr = (string) responseData["sim_ip"];
237 uint port = Convert.ToUInt32(responseData["sim_port"]); 230 uint port = Convert.ToUInt32(responseData["sim_port"]);
238 string externalUri = (string)responseData["sim_uri"]; 231 string externalUri = (string) responseData["sim_uri"];
239 232
240 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); 233 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
241 string neighbourExternalUri = externalUri; 234 string neighbourExternalUri = externalUri;
242 regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); 235 regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
243 236
244 regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 237 regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
245 regionInfo.RemotingAddress = internalIpStr; 238 regionInfo.RemotingAddress = internalIpStr;
246 239
247 regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]); 240 regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
248 regionInfo.RegionName = (string)responseData["region_name"]; 241 regionInfo.RegionName = (string) responseData["region_name"];
249 242
250 if (requestData.ContainsKey("regionHandle")) 243 if (requestData.ContainsKey("regionHandle"))
251 { 244 {
252 m_remoteRegionInfoCache.Add(Convert.ToUInt64((string)requestData["regionHandle"]), regionInfo); 245 m_remoteRegionInfoCache.Add(Convert.ToUInt64((string) requestData["regionHandle"]), regionInfo);
253 } 246 }
254 247
255 return regionInfo; 248 return regionInfo;
256 } 249 }
250
257 /// <summary> 251 /// <summary>
258 /// 252 ///
259 /// </summary> 253 /// </summary>
@@ -283,7 +277,7 @@ namespace OpenSim.Region.Communications.OGS1
283 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 277 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
284 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); 278 XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000);
285 279
286 Hashtable responseData = (Hashtable)GridResp.Value; 280 Hashtable responseData = (Hashtable) GridResp.Value;
287 281
288 if (responseData.ContainsKey("error")) 282 if (responseData.ContainsKey("error"))
289 { 283 {
@@ -291,27 +285,29 @@ namespace OpenSim.Region.Communications.OGS1
291 return null; 285 return null;
292 } 286 }
293 287
294 uint regX = Convert.ToUInt32((string)responseData["region_locx"]); 288 uint regX = Convert.ToUInt32((string) responseData["region_locx"]);
295 uint regY = Convert.ToUInt32((string)responseData["region_locy"]); 289 uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
296 string internalIpStr = (string)responseData["sim_ip"]; 290 string internalIpStr = (string) responseData["sim_ip"];
297 uint port = Convert.ToUInt32(responseData["sim_port"]); 291 uint port = Convert.ToUInt32(responseData["sim_port"]);
298 string externalUri = (string)responseData["sim_uri"]; 292 string externalUri = (string) responseData["sim_uri"];
299 293
300 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); 294 IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port);
301 string neighbourExternalUri = externalUri; 295 string neighbourExternalUri = externalUri;
302 regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); 296 regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr);
303 297
304 regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 298 regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
305 regionInfo.RemotingAddress = internalIpStr; 299 regionInfo.RemotingAddress = internalIpStr;
306 300
307 regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]); 301 regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]);
308 regionInfo.RegionName = (string)responseData["region_name"]; 302 regionInfo.RegionName = (string) responseData["region_name"];
309 303
310 m_remoteRegionInfoCache.Add(regionHandle, regionInfo); 304 m_remoteRegionInfoCache.Add(regionHandle, regionInfo);
311 } 305 }
312 catch (System.Net.WebException) 306 catch (WebException)
313 { 307 {
314 MainLog.Instance.Error("GRID", "Region lookup failed for: " + regionHandle.ToString() + " - Is the GridServer down?"); 308 MainLog.Instance.Error("GRID",
309 "Region lookup failed for: " + regionHandle.ToString() +
310 " - Is the GridServer down?");
315 return null; 311 return null;
316 } 312 }
317 } 313 }
@@ -462,12 +458,7 @@ namespace OpenSim.Region.Communications.OGS1
462 458
463 return new XmlRpcResponse(); 459 return new XmlRpcResponse();
464 } 460 }
465
466 461
467
468
469
470
471 #region m_interRegion Comms 462 #region m_interRegion Comms
472 463
473 /// <summary> 464 /// <summary>
@@ -510,8 +501,8 @@ namespace OpenSim.Region.Communications.OGS1
510 bool retValue = false; 501 bool retValue = false;
511 502
512 503
513 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 504 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
514 typeof(OGS1InterRegionRemoting), 505 typeof (OGS1InterRegionRemoting),
515 "tcp://" + regInfo.RemotingAddress + 506 "tcp://" + regInfo.RemotingAddress +
516 ":" + regInfo.RemotingPort + 507 ":" + regInfo.RemotingPort +
517 "/InterRegions"); 508 "/InterRegions");
@@ -525,7 +516,10 @@ namespace OpenSim.Region.Communications.OGS1
525 Console.WriteLine("remoting object not found"); 516 Console.WriteLine("remoting object not found");
526 } 517 }
527 remObject = null; 518 remObject = null;
528 MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to Update Child Agent data on outside region and got " + retValue.ToString()); 519 MainLog.Instance.Verbose("INTER",
520 gdebugRegionName +
521 ": OGS1 tried to Update Child Agent data on outside region and got " +
522 retValue.ToString());
529 523
530 return retValue; 524 return retValue;
531 } 525 }
@@ -534,35 +528,39 @@ namespace OpenSim.Region.Communications.OGS1
534 } 528 }
535 catch (RemotingException e) 529 catch (RemotingException e)
536 { 530 {
537 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 531 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName +
532 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
538 MainLog.Instance.Debug(e.ToString()); 533 MainLog.Instance.Debug(e.ToString());
539 return false; 534 return false;
540 } 535 }
541 catch (SocketException e) 536 catch (SocketException e)
542 { 537 {
543 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 538 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " +
539 regInfo.RegionLocX + "," + regInfo.RegionLocY);
544 MainLog.Instance.Debug(e.ToString()); 540 MainLog.Instance.Debug(e.ToString());
545 return false; 541 return false;
546 } 542 }
547 catch (InvalidCredentialException e) 543 catch (InvalidCredentialException e)
548 { 544 {
549 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 545 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName +
546 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
550 MainLog.Instance.Debug(e.ToString()); 547 MainLog.Instance.Debug(e.ToString());
551 return false; 548 return false;
552 } 549 }
553 catch (AuthenticationException e) 550 catch (AuthenticationException e)
554 { 551 {
555 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 552 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " +
553 regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
556 MainLog.Instance.Debug(e.ToString()); 554 MainLog.Instance.Debug(e.ToString());
557 return false; 555 return false;
558 } 556 }
559 catch (Exception e) 557 catch (Exception e)
560 { 558 {
561 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 559 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName +
560 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
562 MainLog.Instance.Debug(e.ToString()); 561 MainLog.Instance.Debug(e.ToString());
563 return false; 562 return false;
564 } 563 }
565
566 } 564 }
567 565
568 /// <summary> 566 /// <summary>
@@ -571,7 +569,6 @@ namespace OpenSim.Region.Communications.OGS1
571 /// <param name="regionHandle"></param> 569 /// <param name="regionHandle"></param>
572 /// <param name="agentData"></param> 570 /// <param name="agentData"></param>
573 /// <returns></returns> 571 /// <returns></returns>
574
575 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) 572 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
576 { 573 {
577 RegionInfo regInfo = null; 574 RegionInfo regInfo = null;
@@ -604,7 +601,10 @@ namespace OpenSim.Region.Communications.OGS1
604 Console.WriteLine("remoting object not found"); 601 Console.WriteLine("remoting object not found");
605 } 602 }
606 remObject = null; 603 remObject = null;
607 MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + agentData.firstname + " " + agentData.lastname + " and got " + retValue.ToString()); 604 MainLog.Instance.Verbose("INTER",
605 gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " +
606 agentData.firstname + " " + agentData.lastname + " and got " +
607 retValue.ToString());
608 608
609 return retValue; 609 return retValue;
610 } 610 }
@@ -613,31 +613,36 @@ namespace OpenSim.Region.Communications.OGS1
613 } 613 }
614 catch (RemotingException e) 614 catch (RemotingException e)
615 { 615 {
616 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 616 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName +
617 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
617 MainLog.Instance.Debug(e.ToString()); 618 MainLog.Instance.Debug(e.ToString());
618 return false; 619 return false;
619 } 620 }
620 catch (SocketException e) 621 catch (SocketException e)
621 { 622 {
622 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 623 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " +
624 regInfo.RegionLocX + "," + regInfo.RegionLocY);
623 MainLog.Instance.Debug(e.ToString()); 625 MainLog.Instance.Debug(e.ToString());
624 return false; 626 return false;
625 } 627 }
626 catch (InvalidCredentialException e) 628 catch (InvalidCredentialException e)
627 { 629 {
628 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 630 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName +
631 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
629 MainLog.Instance.Debug(e.ToString()); 632 MainLog.Instance.Debug(e.ToString());
630 return false; 633 return false;
631 } 634 }
632 catch (AuthenticationException e) 635 catch (AuthenticationException e)
633 { 636 {
634 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 637 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " +
638 regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
635 MainLog.Instance.Debug(e.ToString()); 639 MainLog.Instance.Debug(e.ToString());
636 return false; 640 return false;
637 } 641 }
638 catch (Exception e) 642 catch (Exception e)
639 { 643 {
640 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 644 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName +
645 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
641 MainLog.Instance.Debug(e.ToString()); 646 MainLog.Instance.Debug(e.ToString());
642 return false; 647 return false;
643 } 648 }
@@ -656,7 +661,7 @@ namespace OpenSim.Region.Communications.OGS1
656 region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle)); 661 region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle));
657 region.RemotingAddress = region.ExternalHostName; 662 region.RemotingAddress = region.ExternalHostName;
658 region.RemotingPort = NetworkServersInfo.RemotingListenerPort; 663 region.RemotingPort = NetworkServersInfo.RemotingListenerPort;
659 if (m_localBackend.RegionUp(region,regionhandle)) 664 if (m_localBackend.RegionUp(region, regionhandle))
660 { 665 {
661 return true; 666 return true;
662 } 667 }
@@ -671,9 +676,11 @@ namespace OpenSim.Region.Communications.OGS1
671 bool retValue = false; 676 bool retValue = false;
672 677
673 678
674 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 679 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
675 typeof(OGS1InterRegionRemoting), 680 typeof (
676 "tcp://" + regInfo.RemotingAddress + 681 OGS1InterRegionRemoting),
682 "tcp://" +
683 regInfo.RemotingAddress +
677 ":" + regInfo.RemotingPort + 684 ":" + regInfo.RemotingPort +
678 "/InterRegions"); 685 "/InterRegions");
679 686
@@ -703,33 +710,39 @@ namespace OpenSim.Region.Communications.OGS1
703 } 710 }
704 catch (RemotingException e) 711 catch (RemotingException e)
705 { 712 {
706 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + 713 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region using tcp://" +
707 ":" + regInfo.RemotingPort + 714 regInfo.RemotingAddress +
708 "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - Is this neighbor up?"); 715 ":" + regInfo.RemotingPort +
716 "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY +
717 " - Is this neighbor up?");
709 MainLog.Instance.Debug(e.ToString()); 718 MainLog.Instance.Debug(e.ToString());
710 return false; 719 return false;
711 } 720 }
712 catch (SocketException e) 721 catch (SocketException e)
713 { 722 {
714 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + 723 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region using tcp://" +
715 ":" + regInfo.RemotingPort + 724 regInfo.RemotingAddress +
716 "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - Is this neighbor up?"); 725 ":" + regInfo.RemotingPort +
726 "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY +
727 " - Is this neighbor up?");
717 MainLog.Instance.Debug(e.ToString()); 728 MainLog.Instance.Debug(e.ToString());
718 return false; 729 return false;
719 } 730 }
720 catch (InvalidCredentialException e) 731 catch (InvalidCredentialException e)
721 { 732 {
722 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + 733 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region using tcp://" +
723 ":" + regInfo.RemotingPort + 734 regInfo.RemotingAddress +
724 "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 735 ":" + regInfo.RemotingPort +
736 "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
725 MainLog.Instance.Debug(e.ToString()); 737 MainLog.Instance.Debug(e.ToString());
726 return false; 738 return false;
727 } 739 }
728 catch (AuthenticationException e) 740 catch (AuthenticationException e)
729 { 741 {
730 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + 742 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region using tcp://" +
731 ":" + regInfo.RemotingPort + 743 regInfo.RemotingAddress +
732 "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 744 ":" + regInfo.RemotingPort +
745 "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
733 MainLog.Instance.Debug(e.ToString()); 746 MainLog.Instance.Debug(e.ToString());
734 return false; 747 return false;
735 } 748 }
@@ -737,25 +750,25 @@ namespace OpenSim.Region.Communications.OGS1
737 { 750 {
738 // This line errors with a Null Reference Exception.. Why? @.@ 751 // This line errors with a Null Reference Exception.. Why? @.@
739 //MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + 752 //MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress +
740 // ":" + regInfo.RemotingPort + 753 // ":" + regInfo.RemotingPort +
741 //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); 754 //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one");
742 MainLog.Instance.Debug(e.ToString()); 755 MainLog.Instance.Debug(e.ToString());
743 return false; 756 return false;
744 } 757 }
745 } 758 }
759
746 /// <summary> 760 /// <summary>
747 /// 761 ///
748 /// </summary> 762 /// </summary>
749 /// <param name="regionHandle"></param> 763 /// <param name="regionHandle"></param>
750 /// <param name="agentData"></param> 764 /// <param name="agentData"></param>
751 /// <returns></returns> 765 /// <returns></returns>
752
753 public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) 766 public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData)
754 { 767 {
755 RegionInfo regInfo = null; 768 RegionInfo regInfo = null;
756 try 769 try
757 { 770 {
758 if (m_localBackend.InformRegionOfPrimCrossing(regionHandle,primID, objData)) 771 if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData))
759 { 772 {
760 return true; 773 return true;
761 } 774 }
@@ -775,7 +788,7 @@ namespace OpenSim.Region.Communications.OGS1
775 788
776 if (remObject != null) 789 if (remObject != null)
777 { 790 {
778 retValue = remObject.InformRegionOfPrimCrossing(regionHandle,primID.UUID, objData); 791 retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.UUID, objData);
779 } 792 }
780 else 793 else
781 { 794 {
@@ -791,35 +804,41 @@ namespace OpenSim.Region.Communications.OGS1
791 } 804 }
792 catch (RemotingException e) 805 catch (RemotingException e)
793 { 806 {
794 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 807 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName +
808 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
795 MainLog.Instance.Debug(e.ToString()); 809 MainLog.Instance.Debug(e.ToString());
796 return false; 810 return false;
797 } 811 }
798 catch (SocketException e) 812 catch (SocketException e)
799 { 813 {
800 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 814 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " +
815 regInfo.RegionLocX + "," + regInfo.RegionLocY);
801 MainLog.Instance.Debug(e.ToString()); 816 MainLog.Instance.Debug(e.ToString());
802 return false; 817 return false;
803 } 818 }
804 catch (InvalidCredentialException e) 819 catch (InvalidCredentialException e)
805 { 820 {
806 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 821 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName +
822 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
807 MainLog.Instance.Debug(e.ToString()); 823 MainLog.Instance.Debug(e.ToString());
808 return false; 824 return false;
809 } 825 }
810 catch (AuthenticationException e) 826 catch (AuthenticationException e)
811 { 827 {
812 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 828 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " +
829 regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
813 MainLog.Instance.Debug(e.ToString()); 830 MainLog.Instance.Debug(e.ToString());
814 return false; 831 return false;
815 } 832 }
816 catch (Exception e) 833 catch (Exception e)
817 { 834 {
818 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 835 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName +
836 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
819 MainLog.Instance.Debug(e.ToString()); 837 MainLog.Instance.Debug(e.ToString());
820 return false; 838 return false;
821 } 839 }
822 } 840 }
841
823 /// <summary> 842 /// <summary>
824 /// 843 ///
825 /// </summary> 844 /// </summary>
@@ -848,7 +867,9 @@ namespace OpenSim.Region.Communications.OGS1
848 "/InterRegions"); 867 "/InterRegions");
849 if (remObject != null) 868 if (remObject != null)
850 { 869 {
851 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position), isFlying); 870 retValue =
871 remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position),
872 isFlying);
852 } 873 }
853 else 874 else
854 { 875 {
@@ -864,7 +885,8 @@ namespace OpenSim.Region.Communications.OGS1
864 } 885 }
865 catch (RemotingException e) 886 catch (RemotingException e)
866 { 887 {
867 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 888 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName +
889 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
868 MainLog.Instance.Debug(e.ToString()); 890 MainLog.Instance.Debug(e.ToString());
869 return false; 891 return false;
870 } 892 }
@@ -873,6 +895,7 @@ namespace OpenSim.Region.Communications.OGS1
873 return false; 895 return false;
874 } 896 }
875 } 897 }
898
876 public bool ExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical) 899 public bool ExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical)
877 { 900 {
878 RegionInfo regInfo = null; 901 RegionInfo regInfo = null;
@@ -887,14 +910,16 @@ namespace OpenSim.Region.Communications.OGS1
887 if (regInfo != null) 910 if (regInfo != null)
888 { 911 {
889 bool retValue = false; 912 bool retValue = false;
890 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 913 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject(
891 typeof(OGS1InterRegionRemoting), 914 typeof (OGS1InterRegionRemoting),
892 "tcp://" + regInfo.RemotingAddress + 915 "tcp://" + regInfo.RemotingAddress +
893 ":" + regInfo.RemotingPort + 916 ":" + regInfo.RemotingPort +
894 "/InterRegions"); 917 "/InterRegions");
895 if (remObject != null) 918 if (remObject != null)
896 { 919 {
897 retValue = remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position), isPhysical); 920 retValue =
921 remObject.ExpectAvatarCrossing(regionHandle, agentID.UUID, new sLLVector3(position),
922 isPhysical);
898 } 923 }
899 else 924 else
900 { 925 {
@@ -910,7 +935,8 @@ namespace OpenSim.Region.Communications.OGS1
910 } 935 }
911 catch (RemotingException e) 936 catch (RemotingException e)
912 { 937 {
913 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 938 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName +
939 " " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
914 MainLog.Instance.Debug(e.ToString()); 940 MainLog.Instance.Debug(e.ToString());
915 return false; 941 return false;
916 } 942 }
@@ -922,7 +948,6 @@ namespace OpenSim.Region.Communications.OGS1
922 948
923 public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID) 949 public void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID)
924 { 950 {
925
926 } 951 }
927 952
928 public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId) 953 public bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId)
@@ -934,6 +959,7 @@ namespace OpenSim.Region.Communications.OGS1
934 { 959 {
935 return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId); 960 return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId);
936 } 961 }
962
937 #endregion 963 #endregion
938 964
939 #region Methods triggered by calls from external instances 965 #region Methods triggered by calls from external instances
@@ -961,8 +987,9 @@ namespace OpenSim.Region.Communications.OGS1
961 987
962 public bool TriggerRegionUp(SearializableRegionInfo regionData, ulong regionhandle) 988 public bool TriggerRegionUp(SearializableRegionInfo regionData, ulong regionhandle)
963 { 989 {
964 990 MainLog.Instance.Verbose("INTER",
965 MainLog.Instance.Verbose("INTER", gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX + "," + regionData.RegionLocY + ")"); 991 gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.RegionLocX +
992 "," + regionData.RegionLocY + ")");
966 993
967 try 994 try
968 { 995 {
@@ -975,6 +1002,7 @@ namespace OpenSim.Region.Communications.OGS1
975 return false; 1002 return false;
976 } 1003 }
977 } 1004 }
1005
978 public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) 1006 public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
979 { 1007 {
980 MainLog.Instance.Verbose("INTER", "Incoming OGS1 Child Agent Data Update"); 1008 MainLog.Instance.Verbose("INTER", "Incoming OGS1 Child Agent Data Update");
@@ -988,7 +1016,6 @@ namespace OpenSim.Region.Communications.OGS1
988 MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString()); 1016 MainLog.Instance.Error("Remoting Error: Unable to connect to adjacent region.\n" + e.ToString());
989 return false; 1017 return false;
990 } 1018 }
991
992 } 1019 }
993 1020
994 /// <summary> 1021 /// <summary>
@@ -1012,6 +1039,7 @@ namespace OpenSim.Region.Communications.OGS1
1012 return false; 1039 return false;
1013 } 1040 }
1014 } 1041 }
1042
1015 /// <summary> 1043 /// <summary>
1016 /// 1044 ///
1017 /// </summary> 1045 /// </summary>
@@ -1031,6 +1059,7 @@ namespace OpenSim.Region.Communications.OGS1
1031 return false; 1059 return false;
1032 } 1060 }
1033 } 1061 }
1062
1034 public bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical) 1063 public bool TriggerExpectPrimCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isPhysical)
1035 { 1064 {
1036 try 1065 try
@@ -1048,4 +1077,4 @@ namespace OpenSim.Region.Communications.OGS1
1048 1077
1049 #endregion 1078 #endregion
1050 } 1079 }
1051} 1080} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
index 683c471..a0da07e 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Communications.OGS1
41 41
42 public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); 42 public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData);
43 43
44 public delegate bool RegionUp (SearializableRegionInfo region, ulong regionhandle); 44 public delegate bool RegionUp(SearializableRegionInfo region, ulong regionhandle);
45 45
46 public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate); 46 public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate);
47 47
@@ -81,7 +81,6 @@ namespace OpenSim.Region.Communications.OGS1
81 81
82 public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) 82 public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle)
83 { 83 {
84
85 if (OnRegionUp != null) 84 if (OnRegionUp != null)
86 { 85 {
87 return OnRegionUp(sregion, regionhandle); 86 return OnRegionUp(sregion, regionhandle);
@@ -106,6 +105,7 @@ namespace OpenSim.Region.Communications.OGS1
106 } 105 }
107 return false; 106 return false;
108 } 107 }
108
109 public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) 109 public bool InformRegionPrim(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
110 { 110 {
111 if (OnPrimGroupNear != null) 111 if (OnPrimGroupNear != null)
@@ -114,6 +114,7 @@ namespace OpenSim.Region.Communications.OGS1
114 } 114 }
115 return false; 115 return false;
116 } 116 }
117
117 public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData) 118 public bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, string objData)
118 { 119 {
119 if (OnPrimGroupArrival != null) 120 if (OnPrimGroupArrival != null)
@@ -134,7 +135,8 @@ namespace OpenSim.Region.Communications.OGS1
134 { 135 {
135 try 136 try
136 { 137 {
137 return InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData)); 138 return
139 InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData));
138 } 140 }
139 catch (RemotingException e) 141 catch (RemotingException e)
140 { 142 {
@@ -142,7 +144,8 @@ namespace OpenSim.Region.Communications.OGS1
142 return false; 144 return false;
143 } 145 }
144 } 146 }
145 public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) 147
148 public bool RegionUp(SearializableRegionInfo region, ulong regionhandle)
146 { 149 {
147 try 150 try
148 { 151 {
@@ -155,25 +158,27 @@ namespace OpenSim.Region.Communications.OGS1
155 } 158 }
156 } 159 }
157 160
158 public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) 161 public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
159 { 162 {
160 try 163 try
161 { 164 {
162 return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle,cAgentData); 165 return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData);
163 } 166 }
164 catch (RemotingException e) 167 catch (RemotingException e)
165 { 168 {
166 Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString()); 169 Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString());
167 return false; 170 return false;
168 } 171 }
169
170 } 172 }
171 173
172 public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying) 174 public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying)
173 { 175 {
174 try 176 try
175 { 177 {
176 return InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new LLUUID(agentID), new LLVector3(position.x,position.y,position.z), isFlying); 178 return
179 InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new LLUUID(agentID),
180 new LLVector3(position.x, position.y, position.z),
181 isFlying);
177 } 182 }
178 catch (RemotingException e) 183 catch (RemotingException e)
179 { 184 {
@@ -181,20 +186,24 @@ namespace OpenSim.Region.Communications.OGS1
181 return false; 186 return false;
182 } 187 }
183 } 188 }
189
184 public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical) 190 public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical)
185 { 191 {
186 try 192 try
187 { 193 {
188 return InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new LLUUID(SceneObjectGroupID), new LLVector3(position.x,position.y,position.z), isPhysical); 194 return
195 InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new LLUUID(SceneObjectGroupID),
196 new LLVector3(position.x, position.y, position.z),
197 isPhysical);
189 } 198 }
190 catch (RemotingException e) 199 catch (RemotingException e)
191 { 200 {
192 Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); 201 Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString());
193 return false; 202 return false;
194 } 203 }
195
196 } 204 }
197 public bool InformRegionOfPrimCrossing(ulong regionHandle,Guid primID, string objData) 205
206 public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData)
198 { 207 {
199 try 208 try
200 { 209 {
@@ -206,6 +215,5 @@ namespace OpenSim.Region.Communications.OGS1
206 return false; 215 return false;
207 } 216 }
208 } 217 }
209
210 } 218 }
211} \ No newline at end of file 219} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 0fb083a..0d97074 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -29,10 +29,10 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Servers;
33using OpenSim.Framework.Communications; 32using OpenSim.Framework.Communications;
34using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Servers;
36 36
37namespace OpenSim.Region.Communications.OGS1 37namespace OpenSim.Region.Communications.OGS1
38{ 38{
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Communications.OGS1
51 // See IInventoryServices 51 // See IInventoryServices
52 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, 52 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
53 InventoryItemInfo itemCallBack) 53 InventoryItemInfo itemCallBack)
54 { 54 {
55 if (!m_RequestingInventory.ContainsKey(userID)) 55 if (!m_RequestingInventory.ContainsKey(userID))
56 { 56 {
57 InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack); 57 InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack);
@@ -72,10 +72,10 @@ namespace OpenSim.Region.Communications.OGS1
72 try 72 try
73 { 73 {
74 MainLog.Instance.Verbose( 74 MainLog.Instance.Verbose(
75 "INVENTORY", "Requesting inventory from {0}/GetInventory/ for user {1}", 75 "INVENTORY", "Requesting inventory from {0}/GetInventory/ for user {1}",
76 _inventoryServerUrl, userID); 76 _inventoryServerUrl, userID);
77 77
78 RestObjectPosterResponse<InventoryCollection> requester 78 RestObjectPosterResponse<InventoryCollection> requester
79 = new RestObjectPosterResponse<InventoryCollection>(); 79 = new RestObjectPosterResponse<InventoryCollection>();
80 requester.ResponseCallback = InventoryResponse; 80 requester.ResponseCallback = InventoryResponse;
81 81
@@ -96,10 +96,10 @@ namespace OpenSim.Region.Communications.OGS1
96 LLUUID userID = response.UserID; 96 LLUUID userID = response.UserID;
97 if (m_RequestingInventory.ContainsKey(userID)) 97 if (m_RequestingInventory.ContainsKey(userID))
98 { 98 {
99 MainLog.Instance.Verbose("INVENTORY", 99 MainLog.Instance.Verbose("INVENTORY",
100 "Received inventory response for user {0} containing {1} folders and {2} items", 100 "Received inventory response for user {0} containing {1} folders and {2} items",
101 userID, response.Folders.Count, response.AllItems.Count); 101 userID, response.Folders.Count, response.AllItems.Count);
102 102
103 InventoryFolderImpl rootFolder = null; 103 InventoryFolderImpl rootFolder = null;
104 InventoryRequest request = m_RequestingInventory[userID]; 104 InventoryRequest request = m_RequestingInventory[userID];
105 foreach (InventoryFolderBase folder in response.Folders) 105 foreach (InventoryFolderBase folder in response.Folders)
@@ -133,8 +133,8 @@ namespace OpenSim.Region.Communications.OGS1
133 else 133 else
134 { 134 {
135 MainLog.Instance.Warn( 135 MainLog.Instance.Warn(
136 "INVENTORY", 136 "INVENTORY",
137 "Received inventory response for {0} for which we do not have a record of requesting!", 137 "Received inventory response for {0} for which we do not have a record of requesting!",
138 userID); 138 userID);
139 } 139 }
140 } 140 }
@@ -150,7 +150,7 @@ namespace OpenSim.Region.Communications.OGS1
150 SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( 150 SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
151 "POST", _inventoryServerUrl + "/MoveFolder/", folder); 151 "POST", _inventoryServerUrl + "/MoveFolder/", folder);
152 } 152 }
153 153
154 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) 154 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
155 { 155 {
156 SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( 156 SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
@@ -188,4 +188,4 @@ namespace OpenSim.Region.Communications.OGS1
188 } 188 }
189 } 189 }
190 } 190 }
191} 191} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
index c1e6ba6..3a2e138 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs
@@ -30,6 +30,7 @@ using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Net; 32using System.Net;
33using System.Text.RegularExpressions;
33using libsecondlife; 34using libsecondlife;
34using Nwc.XmlRpc; 35using Nwc.XmlRpc;
35using OpenSim.Framework; 36using OpenSim.Framework;
@@ -50,7 +51,9 @@ namespace OpenSim.Region.Communications.OGS1
50 { 51 {
51 if (data.Contains("error_type")) 52 if (data.Contains("error_type"))
52 { 53 {
53 MainLog.Instance.Warn("GRID", "Error sent by user server when trying to get user profile: (" + data["error_type"] + 54 MainLog.Instance.Warn("GRID",
55 "Error sent by user server when trying to get user profile: (" +
56 data["error_type"] +
54 "): " + data["error_desc"]); 57 "): " + data["error_desc"]);
55 return null; 58 return null;
56 } 59 }
@@ -80,19 +83,19 @@ namespace OpenSim.Region.Communications.OGS1
80 return userData; 83 return userData;
81 } 84 }
82 85
83 public List<AvatarPickerAvatar> ConvertXMLRPCDataToAvatarPickerList(LLUUID queryID,Hashtable data) 86 public List<AvatarPickerAvatar> ConvertXMLRPCDataToAvatarPickerList(LLUUID queryID, Hashtable data)
84 { 87 {
85 List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>(); 88 List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
86 int pickercount = Convert.ToInt32((string)data["avcount"]); 89 int pickercount = Convert.ToInt32((string) data["avcount"]);
87 LLUUID respqueryID = new LLUUID((string)data["queryid"]); 90 LLUUID respqueryID = new LLUUID((string) data["queryid"]);
88 if (queryID == respqueryID) 91 if (queryID == respqueryID)
89 { 92 {
90 for (int i = 0; i < pickercount; i++) 93 for (int i = 0; i < pickercount; i++)
91 { 94 {
92 AvatarPickerAvatar apicker = new AvatarPickerAvatar(); 95 AvatarPickerAvatar apicker = new AvatarPickerAvatar();
93 LLUUID avatarID = new LLUUID((string)data["avatarid" + i.ToString()]); 96 LLUUID avatarID = new LLUUID((string) data["avatarid" + i.ToString()]);
94 string firstname = (string)data["firstname" + i.ToString()]; 97 string firstname = (string) data["firstname" + i.ToString()];
95 string lastname = (string)data["lastname" + i.ToString()]; 98 string lastname = (string) data["lastname" + i.ToString()];
96 apicker.AvatarID = avatarID; 99 apicker.AvatarID = avatarID;
97 apicker.firstName = firstname; 100 apicker.firstName = firstname;
98 apicker.lastName = lastname; 101 apicker.lastName = lastname;
@@ -114,18 +117,18 @@ namespace OpenSim.Region.Communications.OGS1
114 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query) 117 public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
115 { 118 {
116 List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>(); 119 List<AvatarPickerAvatar> pickerlist = new List<AvatarPickerAvatar>();
117 System.Text.RegularExpressions.Regex objAlphaNumericPattern = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9 ]"); 120 Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9 ]");
118 try 121 try
119 { 122 {
120 Hashtable param = new Hashtable(); 123 Hashtable param = new Hashtable();
121 param["queryid"] = (string)queryID.ToString(); 124 param["queryid"] = (string) queryID.ToString();
122 param["avquery"] = objAlphaNumericPattern.Replace(query, ""); 125 param["avquery"] = objAlphaNumericPattern.Replace(query, "");
123 IList parameters = new ArrayList(); 126 IList parameters = new ArrayList();
124 parameters.Add(param); 127 parameters.Add(param);
125 XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters); 128 XmlRpcRequest req = new XmlRpcRequest("get_avatar_picker_avatar", parameters);
126 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000); 129 XmlRpcResponse resp = req.Send(m_parent.NetworkServersInfo.UserURL, 3000);
127 Hashtable respData = (Hashtable)resp.Value; 130 Hashtable respData = (Hashtable) resp.Value;
128 pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID,respData); 131 pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData);
129 } 132 }
130 catch (WebException e) 133 catch (WebException e)
131 { 134 {
@@ -196,7 +199,7 @@ namespace OpenSim.Region.Communications.OGS1
196 return profile; 199 return profile;
197 } 200 }
198 201
199 public UserProfileData SetupMasterUser(libsecondlife.LLUUID uuid) 202 public UserProfileData SetupMasterUser(LLUUID uuid)
200 { 203 {
201 UserProfileData data = GetUserProfile(uuid); 204 UserProfileData data = GetUserProfile(uuid);
202 if (data == null) 205 if (data == null)
@@ -211,4 +214,4 @@ namespace OpenSim.Region.Communications.OGS1
211 throw new Exception("The method or operation is not implemented."); 214 throw new Exception("The method or operation is not implemented.");
212 } 215 }
213 } 216 }
214} 217} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs
index 081a8cd..3ca9796 100644
--- a/OpenSim/Region/Environment/EstateManager.cs
+++ b/OpenSim/Region/Environment/EstateManager.cs
@@ -334,6 +334,7 @@ namespace OpenSim.Region.Environment
334 } 334 }
335 } 335 }
336 } 336 }
337
337 private void estateRestartSim(EstateOwnerMessagePacket packet) 338 private void estateRestartSim(EstateOwnerMessagePacket packet)
338 { 339 {
339 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart. 340 // There's only 1 block in the estateResetSim.. and that's the number of seconds till restart.
@@ -341,26 +342,25 @@ namespace OpenSim.Region.Environment
341 { 342 {
342 float timeSeconds = 0; 343 float timeSeconds = 0;
343 timeSeconds = BitConverter.ToInt16(block.Parameter, 1); 344 timeSeconds = BitConverter.ToInt16(block.Parameter, 1);
344 timeSeconds = (int)((timeSeconds / 100) - 3); 345 timeSeconds = (int) ((timeSeconds/100) - 3);
345 m_scene.Restart(timeSeconds); 346 m_scene.Restart(timeSeconds);
346
347 } 347 }
348 } 348 }
349
349 private void EstateChangeCovenant(EstateOwnerMessagePacket packet) 350 private void EstateChangeCovenant(EstateOwnerMessagePacket packet)
350 { 351 {
351 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList) 352 foreach (EstateOwnerMessagePacket.ParamListBlock block in packet.ParamList)
352 { 353 {
353 LLUUID newCovenantID = new LLUUID(Helpers.FieldToUTF8String(block.Parameter)); 354 LLUUID newCovenantID = new LLUUID(Helpers.FieldToUTF8String(block.Parameter));
354 m_regInfo.CovenantID = newCovenantID; 355 m_regInfo.CovenantID = newCovenantID;
355
356 } 356 }
357
358 } 357 }
358
359 public void HandleRegionInfoRequest(IClientAPI client, LLUUID sessionID) 359 public void HandleRegionInfoRequest(IClientAPI client, LLUUID sessionID)
360 { 360 {
361 RegionInfoPacket rinfopack = new RegionInfoPacket(); 361 RegionInfoPacket rinfopack = new RegionInfoPacket();
362 RegionInfoPacket.RegionInfoBlock rinfoblk = new RegionInfoPacket.RegionInfoBlock(); 362 RegionInfoPacket.RegionInfoBlock rinfoblk = new RegionInfoPacket.RegionInfoBlock();
363 363
364 rinfoblk.BillableFactor = 0; 364 rinfoblk.BillableFactor = 0;
365 rinfoblk.EstateID = 02; 365 rinfoblk.EstateID = 02;
366 rinfoblk.MaxAgents = 100; 366 rinfoblk.MaxAgents = 100;
@@ -369,20 +369,20 @@ namespace OpenSim.Region.Environment
369 rinfoblk.PricePerMeter = 0; 369 rinfoblk.PricePerMeter = 0;
370 rinfoblk.RedirectGridX = 0; 370 rinfoblk.RedirectGridX = 0;
371 rinfoblk.RedirectGridY = 0; 371 rinfoblk.RedirectGridY = 0;
372 rinfoblk.RegionFlags = (uint)m_regInfo.EstateSettings.regionFlags; 372 rinfoblk.RegionFlags = (uint) m_regInfo.EstateSettings.regionFlags;
373 rinfoblk.SimAccess = (byte)m_regInfo.EstateSettings.simAccess; 373 rinfoblk.SimAccess = (byte) m_regInfo.EstateSettings.simAccess;
374 rinfoblk.SunHour = m_regInfo.EstateSettings.sunHour; 374 rinfoblk.SunHour = m_regInfo.EstateSettings.sunHour;
375 rinfoblk.TerrainLowerLimit = 20; 375 rinfoblk.TerrainLowerLimit = 20;
376 rinfoblk.TerrainRaiseLimit = 20; 376 rinfoblk.TerrainRaiseLimit = 20;
377 rinfoblk.UseEstateSun = true; 377 rinfoblk.UseEstateSun = true;
378 rinfoblk.WaterHeight = m_regInfo.EstateSettings.waterHeight; 378 rinfoblk.WaterHeight = m_regInfo.EstateSettings.waterHeight;
379 rinfoblk.SimName = Helpers.StringToField(m_regInfo.RegionName); 379 rinfoblk.SimName = Helpers.StringToField(m_regInfo.RegionName);
380 380
381 rinfopack.RegionInfo = rinfoblk; 381 rinfopack.RegionInfo = rinfoblk;
382 382
383 client.OutPacket(rinfopack, ThrottleOutPacketType.Task); 383 client.OutPacket(rinfopack, ThrottleOutPacketType.Task);
384
385 } 384 }
385
386 public void HandleEstateCovenantRequest(IClientAPI client, LLUUID sessionID) 386 public void HandleEstateCovenantRequest(IClientAPI client, LLUUID sessionID)
387 { 387 {
388 EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket(); 388 EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
@@ -390,10 +390,12 @@ namespace OpenSim.Region.Environment
390 edata.CovenantID = m_regInfo.CovenantID; 390 edata.CovenantID = m_regInfo.CovenantID;
391 edata.CovenantTimestamp = 0; 391 edata.CovenantTimestamp = 0;
392 edata.EstateOwnerID = m_regInfo.MasterAvatarAssignedUUID; 392 edata.EstateOwnerID = m_regInfo.MasterAvatarAssignedUUID;
393 edata.EstateName = Helpers.StringToField(m_regInfo.MasterAvatarFirstName + " " + m_regInfo.MasterAvatarLastName); 393 edata.EstateName =
394 Helpers.StringToField(m_regInfo.MasterAvatarFirstName + " " + m_regInfo.MasterAvatarLastName);
394 einfopack.Data = edata; 395 einfopack.Data = edata;
395 client.OutPacket(einfopack, ThrottleOutPacketType.Task); 396 client.OutPacket(einfopack, ThrottleOutPacketType.Task);
396 } 397 }
398
397 #endregion 399 #endregion
398 400
399 #region Outgoing Packets 401 #region Outgoing Packets
@@ -451,4 +453,4 @@ namespace OpenSim.Region.Environment
451 453
452 #endregion 454 #endregion
453 } 455 }
454} 456} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
index ee4d8bc..fb83150 100644
--- a/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
+++ b/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs
@@ -27,7 +27,6 @@
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework;
31using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
32 31
33namespace OpenSim.Region.Environment.Interfaces 32namespace OpenSim.Region.Environment.Interfaces
diff --git a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
index c974616..6aa8f35 100644
--- a/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
+++ b/OpenSim/Region/Environment/Interfaces/IHttpRequests.cs
@@ -26,9 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using System.Collections.Generic;
29using libsecondlife; 30using libsecondlife;
30using OpenSim.Region.Environment.Modules; 31using OpenSim.Region.Environment.Modules;
31using System.Collections.Generic;
32 32
33namespace OpenSim.Region.Environment.Interfaces 33namespace OpenSim.Region.Environment.Interfaces
34{ 34{
diff --git a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
index 91aa5ff..78ad428 100644
--- a/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Environment/Interfaces/IRegionDataStore.cs
@@ -28,6 +28,7 @@
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework;
31using OpenSim.Region.Environment.LandManagement; 32using OpenSim.Region.Environment.LandManagement;
32using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
33 34
@@ -51,10 +52,10 @@ namespace OpenSim.Region.Environment.Interfaces
51 void StoreTerrain(double[,] terrain, LLUUID regionID); 52 void StoreTerrain(double[,] terrain, LLUUID regionID);
52 double[,] LoadTerrain(LLUUID regionID); 53 double[,] LoadTerrain(LLUUID regionID);
53 54
54 void StoreLandObject(Land Parcel,LLUUID regionUUID); 55 void StoreLandObject(Land Parcel, LLUUID regionUUID);
55 void RemoveLandObject(LLUUID globalID); 56 void RemoveLandObject(LLUUID globalID);
56 List<Framework.LandData> LoadLandObjects(LLUUID regionUUID); 57 List<LandData> LoadLandObjects(LLUUID regionUUID);
57 58
58 void Shutdown(); 59 void Shutdown();
59 } 60 }
60} 61} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 7977c78..ff16319 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -32,7 +32,6 @@ using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
35using OpenSim.Region.Environment.Interfaces;
36 35
37namespace OpenSim.Region.Environment.LandManagement 36namespace OpenSim.Region.Environment.LandManagement
38{ 37{
@@ -98,7 +97,6 @@ namespace OpenSim.Region.Environment.LandManagement
98 return newLand; 97 return newLand;
99 } 98 }
100 99
101
102 #endregion 100 #endregion
103 101
104 #region Packet Request Handling 102 #region Packet Request Handling
@@ -202,7 +200,7 @@ namespace OpenSim.Region.Environment.LandManagement
202 //Needs later group support 200 //Needs later group support
203 LandData newData = landData.Copy(); 201 LandData newData = landData.Copy();
204 newData.authBuyerID = packet.ParcelData.AuthBuyerID; 202 newData.authBuyerID = packet.ParcelData.AuthBuyerID;
205 newData.category = (Parcel.ParcelCategory)packet.ParcelData.Category; 203 newData.category = (Parcel.ParcelCategory) packet.ParcelData.Category;
206 newData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc); 204 newData.landDesc = Helpers.FieldToUTF8String(packet.ParcelData.Desc);
207 newData.groupID = packet.ParcelData.GroupID; 205 newData.groupID = packet.ParcelData.GroupID;
208 newData.landingType = packet.ParcelData.LandingType; 206 newData.landingType = packet.ParcelData.LandingType;
@@ -222,8 +220,6 @@ namespace OpenSim.Region.Environment.LandManagement
222 m_scene.LandManager.updateLandObject(landData.localID, newData); 220 m_scene.LandManager.updateLandObject(landData.localID, newData);
223 221
224 sendLandUpdateToAvatarsOverMe(); 222 sendLandUpdateToAvatarsOverMe();
225
226
227 } 223 }
228 } 224 }
229 225
@@ -242,13 +238,13 @@ namespace OpenSim.Region.Environment.LandManagement
242 238
243 public bool isBannedFromLand(LLUUID avatar) 239 public bool isBannedFromLand(LLUUID avatar)
244 { 240 {
245 if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseBanList) > 0) 241 if ((landData.landFlags & (uint) Parcel.ParcelFlags.UseBanList) > 0)
246 { 242 {
247 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 243 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
248 entry.AgentID = avatar; 244 entry.AgentID = avatar;
249 entry.Flags = ParcelManager.AccessList.Ban; 245 entry.Flags = ParcelManager.AccessList.Ban;
250 entry.Time = new DateTime(); 246 entry.Time = new DateTime();
251 if (this.landData.parcelAccessList.Contains(entry)) 247 if (landData.parcelAccessList.Contains(entry))
252 { 248 {
253 //They are banned, so lets send them a notice about this parcel 249 //They are banned, so lets send them a notice about this parcel
254 return true; 250 return true;
@@ -259,13 +255,13 @@ namespace OpenSim.Region.Environment.LandManagement
259 255
260 public bool isRestrictedFromLand(LLUUID avatar) 256 public bool isRestrictedFromLand(LLUUID avatar)
261 { 257 {
262 if ((this.landData.landFlags & (uint)Parcel.ParcelFlags.UseAccessList) > 0) 258 if ((landData.landFlags & (uint) Parcel.ParcelFlags.UseAccessList) > 0)
263 { 259 {
264 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 260 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
265 entry.AgentID = avatar; 261 entry.AgentID = avatar;
266 entry.Flags = ParcelManager.AccessList.Access; 262 entry.Flags = ParcelManager.AccessList.Access;
267 entry.Time = new DateTime(); 263 entry.Time = new DateTime();
268 if (!this.landData.parcelAccessList.Contains(entry)) 264 if (!landData.parcelAccessList.Contains(entry))
269 { 265 {
270 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel 266 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
271 return true; 267 return true;
@@ -310,7 +306,7 @@ namespace OpenSim.Region.Environment.LandManagement
310 { 306 {
311 ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); 307 ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock();
312 308
313 listBlock.Flags = (uint)0; 309 listBlock.Flags = (uint) 0;
314 listBlock.ID = entry.AgentID; 310 listBlock.ID = entry.AgentID;
315 listBlock.Time = 0; 311 listBlock.Time = 0;
316 312
@@ -322,7 +318,7 @@ namespace OpenSim.Region.Environment.LandManagement
322 { 318 {
323 ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); 319 ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock();
324 320
325 listBlock.Flags = (uint)0; 321 listBlock.Flags = (uint) 0;
326 listBlock.ID = LLUUID.Zero; 322 listBlock.ID = LLUUID.Zero;
327 listBlock.Time = 0; 323 listBlock.Time = 0;
328 324
@@ -331,38 +327,37 @@ namespace OpenSim.Region.Environment.LandManagement
331 return list.ToArray(); 327 return list.ToArray();
332 } 328 }
333 329
334 public void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, IClientAPI remote_client) 330 public void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID,
331 IClientAPI remote_client)
335 { 332 {
336
337 ParcelAccessListReplyPacket replyPacket; 333 ParcelAccessListReplyPacket replyPacket;
338 334
339 if (flags == (uint)ParcelManager.AccessList.Access || flags == (uint)ParcelManager.AccessList.Both) 335 if (flags == (uint) ParcelManager.AccessList.Access || flags == (uint) ParcelManager.AccessList.Both)
340 { 336 {
341 replyPacket = new ParcelAccessListReplyPacket(); 337 replyPacket = new ParcelAccessListReplyPacket();
342 replyPacket.Data.AgentID = agentID; 338 replyPacket.Data.AgentID = agentID;
343 replyPacket.Data.Flags = (uint)ParcelManager.AccessList.Access; 339 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Access;
344 replyPacket.Data.LocalID = this.landData.localID; 340 replyPacket.Data.LocalID = landData.localID;
345 replyPacket.Data.SequenceID = 0; 341 replyPacket.Data.SequenceID = 0;
346 342
347 replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access); 343 replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access);
348 remote_client.OutPacket((Packet)replyPacket, ThrottleOutPacketType.Task); 344 remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
349 } 345 }
350 346
351 if (flags == (uint)ParcelManager.AccessList.Ban || flags == (uint)ParcelManager.AccessList.Both) 347 if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both)
352 { 348 {
353 replyPacket = new ParcelAccessListReplyPacket(); 349 replyPacket = new ParcelAccessListReplyPacket();
354 replyPacket.Data.AgentID = agentID; 350 replyPacket.Data.AgentID = agentID;
355 replyPacket.Data.Flags = (uint)ParcelManager.AccessList.Ban; 351 replyPacket.Data.Flags = (uint) ParcelManager.AccessList.Ban;
356 replyPacket.Data.LocalID = this.landData.localID; 352 replyPacket.Data.LocalID = landData.localID;
357 replyPacket.Data.SequenceID = 0; 353 replyPacket.Data.SequenceID = 0;
358 354
359 replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban); 355 replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban);
360 remote_client.OutPacket((Packet)replyPacket, ThrottleOutPacketType.Task); 356 remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
361 } 357 }
362
363 } 358 }
364 359
365 public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 360 public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
366 { 361 {
367 LandData newData = landData.Copy(); 362 LandData newData = landData.Copy();
368 363
@@ -370,11 +365,11 @@ namespace OpenSim.Region.Environment.LandManagement
370 { 365 {
371 entries.Clear(); 366 entries.Clear();
372 } 367 }
373 368
374 List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); 369 List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>();
375 foreach (ParcelManager.ParcelAccessEntry entry in newData.parcelAccessList) 370 foreach (ParcelManager.ParcelAccessEntry entry in newData.parcelAccessList)
376 { 371 {
377 if (entry.Flags == (ParcelManager.AccessList)flags) 372 if (entry.Flags == (ParcelManager.AccessList) flags)
378 { 373 {
379 toRemove.Add(entry); 374 toRemove.Add(entry);
380 } 375 }
@@ -388,8 +383,8 @@ namespace OpenSim.Region.Environment.LandManagement
388 { 383 {
389 ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); 384 ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry();
390 temp.AgentID = entry.AgentID; 385 temp.AgentID = entry.AgentID;
391 temp.Time = new DateTime() ; //Pointless? Yes. 386 temp.Time = new DateTime(); //Pointless? Yes.
392 temp.Flags = (ParcelManager.AccessList)flags; 387 temp.Flags = (ParcelManager.AccessList) flags;
393 388
394 if (!newData.parcelAccessList.Contains(temp)) 389 if (!newData.parcelAccessList.Contains(temp))
395 { 390 {
@@ -398,7 +393,6 @@ namespace OpenSim.Region.Environment.LandManagement
398 } 393 }
399 394
400 m_scene.LandManager.updateLandObject(landData.localID, newData); 395 m_scene.LandManager.updateLandObject(landData.localID, newData);
401
402 } 396 }
403 397
404 #endregion 398 #endregion
@@ -437,7 +431,6 @@ namespace OpenSim.Region.Environment.LandManagement
437 new LLVector3((float) (max_x*4), (float) (max_y*4), 431 new LLVector3((float) (max_x*4), (float) (max_y*4),
438 (float) m_scene.Terrain.GetHeight((max_x*4), (max_y*4))); 432 (float) m_scene.Terrain.GetHeight((max_x*4), (max_y*4)));
439 landData.area = tempArea; 433 landData.area = tempArea;
440
441 } 434 }
442 435
443 public void updateLandBitmapByteArray() 436 public void updateLandBitmapByteArray()
@@ -650,9 +643,9 @@ namespace OpenSim.Region.Environment.LandManagement
650 { 643 {
651 resultLocalIDs.Add(obj.LocalId); 644 resultLocalIDs.Add(obj.LocalId);
652 } 645 }
653 // else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && ...) // TODO: group support 646 // else if (request_type == LandManager.LAND_SELECT_OBJECTS_GROUP && ...) // TODO: group support
654 // { 647 // {
655 // } 648 // }
656 else if (request_type == LandManager.LAND_SELECT_OBJECTS_OTHER && 649 else if (request_type == LandManager.LAND_SELECT_OBJECTS_OTHER &&
657 obj.OwnerID != remote_client.AgentId) 650 obj.OwnerID != remote_client.AgentId)
658 { 651 {
@@ -732,10 +725,8 @@ namespace OpenSim.Region.Environment.LandManagement
732 725
733 num++; 726 num++;
734 } 727 }
735 728
736 pack.Data = dataBlock; 729 pack.Data = dataBlock;
737
738
739 } 730 }
740 remote_client.OutPacket(pack, ThrottleOutPacketType.Task); 731 remote_client.OutPacket(pack, ThrottleOutPacketType.Task);
741 } 732 }
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index ecd458d..772fe2e 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -27,11 +27,13 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Axiom.Math;
30using libsecondlife; 31using libsecondlife;
31using libsecondlife.Packets; 32using libsecondlife.Packets;
32using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Console;
33using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
34using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Physics.Manager;
35 37
36namespace OpenSim.Region.Environment.LandManagement 38namespace OpenSim.Region.Environment.LandManagement
37{ 39{
@@ -93,7 +95,7 @@ namespace OpenSim.Region.Environment.LandManagement
93 private readonly RegionInfo m_regInfo; 95 private readonly RegionInfo m_regInfo;
94 96
95 public bool allowedForcefulBans = true; 97 public bool allowedForcefulBans = true;
96 98
97 #endregion 99 #endregion
98 100
99 #region Constructors 101 #region Constructors
@@ -103,14 +105,13 @@ namespace OpenSim.Region.Environment.LandManagement
103 m_scene = scene; 105 m_scene = scene;
104 m_regInfo = reginfo; 106 m_regInfo = reginfo;
105 landIDList.Initialize(); 107 landIDList.Initialize();
106 scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel); 108 scene.EventManager.OnAvatarEnteringNewParcel +=
107 scene.EventManager.OnClientMovement += new EventManager.ClientMovement(this.handleAnyClientMovement); 109 new EventManager.AvatarEnteringNewParcel(handleAvatarChangingParcel);
110 scene.EventManager.OnClientMovement += new EventManager.ClientMovement(handleAnyClientMovement);
108 } 111 }
109 112
110
111
112 #endregion 113 #endregion
113 114
114 #region Member Functions 115 #region Member Functions
115 116
116 #region Land Object From Storage Functions 117 #region Land Object From Storage Functions
@@ -147,7 +148,6 @@ namespace OpenSim.Region.Environment.LandManagement
147 /// <returns></returns> 148 /// <returns></returns>
148 public Land createBaseLand() 149 public Land createBaseLand()
149 { 150 {
150
151 return new Land(LLUUID.Zero, false, m_scene); 151 return new Land(LLUUID.Zero, false, m_scene);
152 } 152 }
153 153
@@ -175,7 +175,7 @@ namespace OpenSim.Region.Environment.LandManagement
175 } 175 }
176 } 176 }
177 landList[lastLandLocalID].forceUpdateLandInfo(); 177 landList[lastLandLocalID].forceUpdateLandInfo();
178 m_scene.EventManager.TriggerLandObjectAdded(new_land,m_scene.RegionInfo.RegionID); 178 m_scene.EventManager.TriggerLandObjectAdded(new_land, m_scene.RegionInfo.RegionID);
179 return new_land; 179 return new_land;
180 } 180 }
181 181
@@ -207,7 +207,7 @@ namespace OpenSim.Region.Environment.LandManagement
207 if (landList.ContainsKey(local_id)) 207 if (landList.ContainsKey(local_id))
208 { 208 {
209 landList[local_id].landData = newData.Copy(); 209 landList[local_id].landData = newData.Copy();
210 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landList[local_id]); 210 m_scene.EventManager.TriggerLandObjectUpdated((uint) local_id, landList[local_id]);
211 } 211 }
212 else 212 else
213 { 213 {
@@ -335,7 +335,7 @@ namespace OpenSim.Region.Environment.LandManagement
335 335
336 //Now add the new land object 336 //Now add the new land object
337 Land result = addLandObject(newLand); 337 Land result = addLandObject(newLand);
338 updateLandObject(startLandObject.landData.localID,startLandObject.landData); 338 updateLandObject(startLandObject.landData.localID, startLandObject.landData);
339 result.sendLandUpdateToAvatarsOverMe(); 339 result.sendLandUpdateToAvatarsOverMe();
340 340
341 341
@@ -463,11 +463,11 @@ namespace OpenSim.Region.Environment.LandManagement
463 Land southParcel = null; 463 Land southParcel = null;
464 if (x > 0) 464 if (x > 0)
465 { 465 {
466 westParcel = getLandObject((x - 1) * 4, y * 4); 466 westParcel = getLandObject((x - 1)*4, y*4);
467 } 467 }
468 if (y > 0) 468 if (y > 0)
469 { 469 {
470 southParcel = getLandObject(x * 4, (y - 1) * 4); 470 southParcel = getLandObject(x*4, (y - 1)*4);
471 } 471 }
472 472
473 if (x == 0) 473 if (x == 0)
@@ -496,14 +496,15 @@ namespace OpenSim.Region.Environment.LandManagement
496 packet = new ParcelOverlayPacket(); 496 packet = new ParcelOverlayPacket();
497 packet.ParcelData.Data = byteArray; 497 packet.ParcelData.Data = byteArray;
498 packet.ParcelData.SequenceID = sequenceID; 498 packet.ParcelData.SequenceID = sequenceID;
499 remote_client.OutPacket((Packet)packet, ThrottleOutPacketType.Task); 499 remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task);
500 sequenceID++; 500 sequenceID++;
501 byteArray = new byte[LAND_BLOCKS_PER_PACKET]; 501 byteArray = new byte[LAND_BLOCKS_PER_PACKET];
502 } 502 }
503 } 503 }
504 catch (System.Exception e) 504 catch (Exception e)
505 { 505 {
506 OpenSim.Framework.Console.MainLog.Instance.Debug("LAND", "Skipped Land checks because avatar is out of bounds: " + e.Message); 506 MainLog.Instance.Debug("LAND",
507 "Skipped Land checks because avatar is out of bounds: " + e.Message);
507 } 508 }
508 } 509 }
509 } 510 }
@@ -599,7 +600,6 @@ namespace OpenSim.Region.Environment.LandManagement
599 600
600 public List<Land> parcelsNearPoint(LLVector3 position) 601 public List<Land> parcelsNearPoint(LLVector3 position)
601 { 602 {
602
603 List<Land> parcelsNear = new List<Land>(); 603 List<Land> parcelsNear = new List<Land>();
604 int x, y; 604 int x, y;
605 for (x = -4; x <= 4; x += 4) 605 for (x = -4; x <= 4; x += 4)
@@ -617,22 +617,25 @@ namespace OpenSim.Region.Environment.LandManagement
617 } 617 }
618 } 618 }
619 619
620 return parcelsNear; 620 return parcelsNear;
621
622 } 621 }
623 622
624 public void sendYouAreBannedNotice(ScenePresence avatar) 623 public void sendYouAreBannedNotice(ScenePresence avatar)
625 { 624 {
626 if (allowedForcefulBans) 625 if (allowedForcefulBans)
627 { 626 {
628 avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers"); 627 avatar.ControllingClient.SendAlertMessage(
628 "You are not allowed on this parcel because you are banned. Please go away. <3 OpenSim Developers");
629 629
630 avatar.PhysicsActor.Position = new OpenSim.Region.Physics.Manager.PhysicsVector(avatar.lastKnownAllowedPosition.x, avatar.lastKnownAllowedPosition.y, avatar.lastKnownAllowedPosition.z); 630 avatar.PhysicsActor.Position =
631 avatar.PhysicsActor.Velocity = new OpenSim.Region.Physics.Manager.PhysicsVector(0, 0, 0); 631 new PhysicsVector(avatar.lastKnownAllowedPosition.x, avatar.lastKnownAllowedPosition.y,
632 avatar.lastKnownAllowedPosition.z);
633 avatar.PhysicsActor.Velocity = new PhysicsVector(0, 0, 0);
632 } 634 }
633 else 635 else
634 { 636 {
635 avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim! <3 OpenSim Developers"); 637 avatar.ControllingClient.SendAlertMessage(
638 "You are not allowed on this parcel because you are banned; however, the grid administrator has disabled ban lines globally. Please obey the land owner's requests or you can be banned from the entire sim! <3 OpenSim Developers");
636 } 639 }
637 } 640 }
638 641
@@ -651,7 +654,8 @@ namespace OpenSim.Region.Environment.LandManagement
651 } 654 }
652 else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID)) 655 else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID))
653 { 656 {
654 avatar.ControllingClient.SendAlertMessage("You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!). <3 OpenSim Developers"); 657 avatar.ControllingClient.SendAlertMessage(
658 "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!). <3 OpenSim Developers");
655 } 659 }
656 else 660 else
657 { 661 {
@@ -668,7 +672,6 @@ namespace OpenSim.Region.Environment.LandManagement
668 672
669 public void sendOutNearestBanLine(IClientAPI avatar) 673 public void sendOutNearestBanLine(IClientAPI avatar)
670 { 674 {
671
672 List<ScenePresence> avatars = m_scene.GetAvatars(); 675 List<ScenePresence> avatars = m_scene.GetAvatars();
673 foreach (ScenePresence presence in avatars) 676 foreach (ScenePresence presence in avatars)
674 { 677 {
@@ -679,15 +682,14 @@ namespace OpenSim.Region.Environment.LandManagement
679 { 682 {
680 if (checkBan.isBannedFromLand(avatar.AgentId)) 683 if (checkBan.isBannedFromLand(avatar.AgentId))
681 { 684 {
682 checkBan.sendLandProperties(-30000, false, (int)ParcelManager.ParcelResult.Single, avatar); 685 checkBan.sendLandProperties(-30000, false, (int) ParcelManager.ParcelResult.Single, avatar);
683 return; //Only send one 686 return; //Only send one
684 } 687 }
685 else if (checkBan.isRestrictedFromLand(avatar.AgentId)) 688 else if (checkBan.isRestrictedFromLand(avatar.AgentId))
686 { 689 {
687 checkBan.sendLandProperties(-40000, false, (int)ParcelManager.ParcelResult.Single, avatar); 690 checkBan.sendLandProperties(-40000, false, (int) ParcelManager.ParcelResult.Single, avatar);
688 return; //Only send one 691 return; //Only send one
689 } 692 }
690
691 } 693 }
692 return; 694 return;
693 } 695 }
@@ -696,8 +698,8 @@ namespace OpenSim.Region.Environment.LandManagement
696 698
697 public void sendLandUpdate(ScenePresence avatar) 699 public void sendLandUpdate(ScenePresence avatar)
698 { 700 {
699 Land over = getLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), 701 Land over = getLandObject((int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
700 (int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); 702 (int) Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
701 703
702 if (over != null) 704 if (over != null)
703 { 705 {
@@ -705,10 +707,10 @@ namespace OpenSim.Region.Environment.LandManagement
705 if (avatar.currentParcelUUID != over.landData.globalID) 707 if (avatar.currentParcelUUID != over.landData.globalID)
706 { 708 {
707 avatar.currentParcelUUID = over.landData.globalID; 709 avatar.currentParcelUUID = over.landData.globalID;
708 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID, this.m_scene.RegionInfo.RegionID); 710 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.localID,
711 m_scene.RegionInfo.RegionID);
709 } 712 }
710 } 713 }
711
712 } 714 }
713 715
714 public void handleSignificantClientMovement(IClientAPI remote_client) 716 public void handleSignificantClientMovement(IClientAPI remote_client)
@@ -722,16 +724,18 @@ namespace OpenSim.Region.Environment.LandManagement
722 Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y); 724 Land parcel = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);
723 if (parcel != null) 725 if (parcel != null)
724 { 726 {
725 if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) 727 if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT &&
728 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
726 { 729 {
727 730 handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID);
728 handleAvatarChangingParcel(clientAvatar, parcel.landData.localID, m_scene.RegionInfo.RegionID); //They are going below the safety line! 731 //They are going below the safety line!
729 if (!parcel.isBannedFromLand(clientAvatar.UUID)) 732 if (!parcel.isBannedFromLand(clientAvatar.UUID))
730 { 733 {
731 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; 734 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
732 } 735 }
733 } 736 }
734 else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT && parcel.isBannedFromLand(clientAvatar.UUID)) 737 else if (clientAvatar.AbsolutePosition.Z < BAN_LINE_SAFETY_HIEGHT &&
738 parcel.isBannedFromLand(clientAvatar.UUID))
735 { 739 {
736 sendYouAreBannedNotice(clientAvatar); 740 sendYouAreBannedNotice(clientAvatar);
737 } 741 }
@@ -739,30 +743,33 @@ namespace OpenSim.Region.Environment.LandManagement
739 } 743 }
740 } 744 }
741 745
742 public void handleAnyClientMovement(ScenePresence avatar) //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance. 746 public void handleAnyClientMovement(ScenePresence avatar)
747 //Like handleSignificantClientMovement, but called with an AgentUpdate regardless of distance.
743 { 748 {
744 Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 749 Land over = getLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
745 if (over != null) 750 if (over != null)
746 { 751 {
747 if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT) 752 if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= BAN_LINE_SAFETY_HIEGHT)
748 { 753 {
749 avatar.lastKnownAllowedPosition = new Axiom.Math.Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); 754 avatar.lastKnownAllowedPosition =
750 755 new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z);
751
752 } 756 }
753 } 757 }
754 } 758 }
755 759
756 760
757 public void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client) 761 public void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID,
762 int landLocalID, IClientAPI remote_client)
758 { 763 {
759 if (landList.ContainsKey(landLocalID)) 764 if (landList.ContainsKey(landLocalID))
760 { 765 {
761 landList[landLocalID].sendAccessList(agentID, sessionID, flags, sequenceID,remote_client); 766 landList[landLocalID].sendAccessList(agentID, sessionID, flags, sequenceID, remote_client);
762 } 767 }
763 } 768 }
764 769
765 public void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID,uint flags, int landLocalID, List<libsecondlife.ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 770 public void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID, uint flags, int landLocalID,
771 List<ParcelManager.ParcelAccessEntry> entries,
772 IClientAPI remote_client)
766 { 773 {
767 if (landList.ContainsKey(landLocalID)) 774 if (landList.ContainsKey(landLocalID))
768 { 775 {
@@ -849,4 +856,4 @@ namespace OpenSim.Region.Environment.LandManagement
849 } 856 }
850 857
851 #endregion 858 #endregion
852} 859} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index b1ab330..fcf0f72 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -220,7 +220,7 @@ namespace OpenSim.Region.Environment
220 { 220 {
221 if (pluginType.GetInterface("IRegionModule") != null) 221 if (pluginType.GetInterface("IRegionModule") != null)
222 { 222 {
223 modules.Add((IRegionModule)Activator.CreateInstance(pluginType)); 223 modules.Add((IRegionModule) Activator.CreateInstance(pluginType));
224 } 224 }
225 } 225 }
226 } 226 }
diff --git a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
index 0b95aee..c31a79b 100644
--- a/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/AvatarFactoryModule.cs
@@ -27,11 +27,12 @@
27*/ 27*/
28 28
29using System; 29using System;
30using libsecondlife;
31using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console;
35using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
37 38
@@ -59,9 +60,9 @@ namespace OpenSim.Region.Environment.Modules
59 { 60 {
60 m_avatarsAppearance[avatarId] = appearance; 61 m_avatarsAppearance[avatarId] = appearance;
61 } 62 }
62 catch (System.NullReferenceException) 63 catch (NullReferenceException)
63 { 64 {
64 OpenSim.Framework.Console.MainLog.Instance.Error("AVATAR", "Unable to load appearance for uninitialized avatar"); 65 MainLog.Instance.Error("AVATAR", "Unable to load appearance for uninitialized avatar");
65 } 66 }
66 return true; 67 return true;
67 } 68 }
@@ -98,17 +99,17 @@ namespace OpenSim.Region.Environment.Modules
98 99
99 public void NewClient(IClientAPI client) 100 public void NewClient(IClientAPI client)
100 { 101 {
101 client.OnAvatarNowWearing += AvatarIsWearing; 102 client.OnAvatarNowWearing += AvatarIsWearing;
102 } 103 }
103 104
104 public void RemoveClient(IClientAPI client) 105 public void RemoveClient(IClientAPI client)
105 { 106 {
106 // client.OnAvatarNowWearing -= AvatarIsWearing; 107 // client.OnAvatarNowWearing -= AvatarIsWearing;
107 } 108 }
108 109
109 public void AvatarIsWearing(Object sender, AvatarWearingArgs e) 110 public void AvatarIsWearing(Object sender, AvatarWearingArgs e)
110 { 111 {
111 IClientAPI clientView = (IClientAPI)sender; 112 IClientAPI clientView = (IClientAPI) sender;
112 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); 113 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
113 if (profile != null) 114 if (profile != null)
114 { 115 {
@@ -127,7 +128,7 @@ namespace OpenSim.Region.Environment.Modules
127 { 128 {
128 assetId = baseItem.assetID; 129 assetId = baseItem.assetID;
129 //temporary dictionary storage. This should be storing to a database 130 //temporary dictionary storage. This should be storing to a database
130 131
131 if (m_avatarsAppearance.ContainsKey(clientView.AgentId)) 132 if (m_avatarsAppearance.ContainsKey(clientView.AgentId))
132 { 133 {
133 AvatarAppearance avatAppearance = m_avatarsAppearance[clientView.AgentId]; 134 AvatarAppearance avatAppearance = m_avatarsAppearance[clientView.AgentId];
@@ -158,4 +159,4 @@ namespace OpenSim.Region.Environment.Modules
158 return visualParams; 159 return visualParams;
159 } 160 }
160 } 161 }
161} 162} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index 069eb3f..d6df978 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -176,10 +176,10 @@ namespace OpenSim.Region.Environment.Modules
176 foreach (Scene s in m_scenes) 176 foreach (Scene s in m_scenes)
177 { 177 {
178 s.ForEachScenePresence(delegate(ScenePresence presence) 178 s.ForEachScenePresence(delegate(ScenePresence presence)
179 { 179 {
180 TrySendChatMessage(presence, fromPos, regionPos, 180 TrySendChatMessage(presence, fromPos, regionPos,
181 fromAgentID, fromName, e.Type, message); 181 fromAgentID, fromName, e.Type, message);
182 }); 182 });
183 } 183 }
184 } 184 }
185 } 185 }
@@ -373,4 +373,4 @@ namespace OpenSim.Region.Environment.Modules
373 m_tcp.Close(); 373 m_tcp.Close();
374 } 374 }
375 } 375 }
376} 376} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
index d47004b..f8798dc 100644
--- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs
@@ -27,18 +27,15 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
30using System.IO; 31using System.IO;
31using System.Net; 32using System.Net;
32using System.Text; 33using System.Text;
33using OpenSim.Region.Environment.Interfaces;
34using OpenSim.Region.Environment.Scenes;
35using System.Collections;
36using System.Collections.Generic;
37using System.Threading; 34using System.Threading;
38using libsecondlife; 35using libsecondlife;
39using Nini.Config; 36using Nini.Config;
40using Nwc.XmlRpc; 37using OpenSim.Region.Environment.Interfaces;
41using OpenSim.Framework.Servers; 38using OpenSim.Region.Environment.Scenes;
42 39
43/***************************************************** 40/*****************************************************
44 * 41 *
@@ -85,120 +82,120 @@ using OpenSim.Framework.Servers;
85 82
86namespace OpenSim.Region.Environment.Modules 83namespace OpenSim.Region.Environment.Modules
87{ 84{
88 public class ScriptHTTPRequests : IRegionModule, IHttpRequests 85 public class ScriptHTTPRequests : IRegionModule, IHttpRequests
89 { 86 {
90 private Scene m_scene; 87 private Scene m_scene;
91 private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>(); 88 private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
92 private object HttpListLock = new object(); 89 private object HttpListLock = new object();
93 private string m_name = "HttpScriptRequests"; 90 private string m_name = "HttpScriptRequests";
94 private int httpTimeout = 300; 91 private int httpTimeout = 300;
95 92
96 // <request id, HttpRequestClass> 93 // <request id, HttpRequestClass>
97 private Dictionary<LLUUID, HttpRequestClass> m_pendingRequests; 94 private Dictionary<LLUUID, HttpRequestClass> m_pendingRequests;
98 95
99 public ScriptHTTPRequests() 96 public ScriptHTTPRequests()
100 { 97 {
101 } 98 }
102 99
103 public void Initialise(Scene scene, IConfigSource config) 100 public void Initialise(Scene scene, IConfigSource config)
104 { 101 {
105 m_scene = scene; 102 m_scene = scene;
106 103
107 m_scene.RegisterModuleInterface<IHttpRequests>(this); 104 m_scene.RegisterModuleInterface<IHttpRequests>(this);
108 105
109 m_pendingRequests = new Dictionary<LLUUID, HttpRequestClass>(); 106 m_pendingRequests = new Dictionary<LLUUID, HttpRequestClass>();
110 } 107 }
111 108
112 public void PostInitialise() 109 public void PostInitialise()
113 { 110 {
114 } 111 }
115 112
116 public void Close() 113 public void Close()
117 { 114 {
118 } 115 }
119 116
120 public string Name 117 public string Name
121 { 118 {
122 get { return m_name; } 119 get { return m_name; }
123 } 120 }
124 121
125 public bool IsSharedModule 122 public bool IsSharedModule
126 { 123 {
127 get { return true; } 124 get { return true; }
128 } 125 }
129 126
130 public LLUUID MakeHttpRequest(string url, string parameters, string body) { 127 public LLUUID MakeHttpRequest(string url, string parameters, string body)
131 return LLUUID.Zero; 128 {
132 } 129 return LLUUID.Zero;
133 130 }
134 public LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) 131
135 { 132 public LLUUID StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body)
136 LLUUID reqID = LLUUID.Random(); 133 {
137 HttpRequestClass htc = new HttpRequestClass(); 134 LLUUID reqID = LLUUID.Random();
138 135 HttpRequestClass htc = new HttpRequestClass();
139 // Parameters are expected in {key, value, ... , key, value} 136
140 if( parameters != null ) 137 // Parameters are expected in {key, value, ... , key, value}
141 { 138 if (parameters != null)
142 string[] parms = parameters.ToArray(); 139 {
143 for (int i = 0; i < parms.Length / 2; i += 2) 140 string[] parms = parameters.ToArray();
141 for (int i = 0; i < parms.Length/2; i += 2)
144 { 142 {
145 switch( Int32.Parse(parms[i]) ) 143 switch (Int32.Parse(parms[i]))
146 { 144 {
147 case HttpRequestClass.HTTP_METHOD: 145 case HttpRequestClass.HTTP_METHOD:
148 146
149 htc.httpMethod = parms[i + 1]; 147 htc.httpMethod = parms[i + 1];
150 break; 148 break;
151 149
152 case HttpRequestClass.HTTP_MIMETYPE: 150 case HttpRequestClass.HTTP_MIMETYPE:
153 151
154 htc.httpMIMEType = parms[i + 1]; 152 htc.httpMIMEType = parms[i + 1];
155 break; 153 break;
156 154
157 case HttpRequestClass.HTTP_BODY_MAXLENGTH: 155 case HttpRequestClass.HTTP_BODY_MAXLENGTH:
158 156
159 // TODO implement me 157 // TODO implement me
160 break; 158 break;
161 159
162 case HttpRequestClass.HTTP_VERIFY_CERT: 160 case HttpRequestClass.HTTP_VERIFY_CERT:
163 161
164 // TODO implement me 162 // TODO implement me
165 break; 163 break;
166 } 164 }
167 } 165 }
168 } 166 }
169 167
170 htc.localID = localID; 168 htc.localID = localID;
171 htc.itemID = itemID; 169 htc.itemID = itemID;
172 htc.url = url; 170 htc.url = url;
173 htc.reqID = reqID; 171 htc.reqID = reqID;
174 htc.httpTimeout = httpTimeout; 172 htc.httpTimeout = httpTimeout;
175 htc.outbound_body = body; 173 htc.outbound_body = body;
176 174
177 lock (HttpListLock) 175 lock (HttpListLock)
178 { 176 {
179 m_pendingRequests.Add(reqID, htc); 177 m_pendingRequests.Add(reqID, htc);
180 } 178 }
181 179
182 htc.process(); 180 htc.process();
183 181
184 return reqID; 182 return reqID;
185 } 183 }
186 184
187 public void StopHttpRequest(uint m_localID, LLUUID m_itemID) 185 public void StopHttpRequest(uint m_localID, LLUUID m_itemID)
188 { 186 {
189 lock (HttpListLock) 187 lock (HttpListLock)
190 { 188 {
191 189 HttpRequestClass tmpReq;
192 HttpRequestClass tmpReq; 190 if (m_pendingRequests.TryGetValue(m_itemID, out tmpReq))
193 if (m_pendingRequests.TryGetValue(m_itemID, out tmpReq)) 191 {
194 { 192 tmpReq.Stop();
195 tmpReq.Stop(); 193 m_pendingRequests.Remove(m_itemID);
196 m_pendingRequests.Remove(m_itemID); 194 }
197 } 195 }
198 } 196 }
199 } 197
200 198 /*
201 /*
202 * TODO 199 * TODO
203 * Not sure how important ordering is is here - the next first 200 * Not sure how important ordering is is here - the next first
204 * one completed in the list is returned, based soley on its list 201 * one completed in the list is returned, based soley on its list
@@ -206,10 +203,11 @@ namespace OpenSim.Region.Environment.Modules
206 * finsihed. I thought about setting up a queue for this, but 203 * finsihed. I thought about setting up a queue for this, but
207 * it will need some refactoring and this works 'enough' right now 204 * it will need some refactoring and this works 'enough' right now
208 */ 205 */
209 public HttpRequestClass GetNextCompletedRequest() 206
210 { 207 public HttpRequestClass GetNextCompletedRequest()
211 lock (HttpListLock) 208 {
212 { 209 lock (HttpListLock)
210 {
213 foreach (LLUUID luid in m_pendingRequests.Keys) 211 foreach (LLUUID luid in m_pendingRequests.Keys)
214 { 212 {
215 HttpRequestClass tmpReq; 213 HttpRequestClass tmpReq;
@@ -225,18 +223,16 @@ namespace OpenSim.Region.Environment.Modules
225 } 223 }
226 } 224 }
227 return null; 225 return null;
228 } 226 }
229 227 }
230
231 }
232 228
233 // 229 //
234 // HTTP REAQUEST 230 // HTTP REAQUEST
235 // This class was originally in LSLLongCmdHandler 231 // This class was originally in LSLLongCmdHandler
236 // 232 //
237 // TODO: setter/getter methods, maybe pass some in 233 // TODO: setter/getter methods, maybe pass some in
238 // constructor 234 // constructor
239 // 235 //
240 236
241 public class HttpRequestClass 237 public class HttpRequestClass
242 { 238 {
@@ -280,9 +276,9 @@ namespace OpenSim.Region.Environment.Modules
280 * TODO: More work on the response codes. Right now 276 * TODO: More work on the response codes. Right now
281 * returning 200 for success or 499 for exception 277 * returning 200 for success or 499 for exception
282 */ 278 */
279
283 public void SendRequest() 280 public void SendRequest()
284 { 281 {
285
286 HttpWebResponse response = null; 282 HttpWebResponse response = null;
287 StringBuilder sb = new StringBuilder(); 283 StringBuilder sb = new StringBuilder();
288 byte[] buf = new byte[8192]; 284 byte[] buf = new byte[8192];
@@ -292,14 +288,14 @@ namespace OpenSim.Region.Environment.Modules
292 try 288 try
293 { 289 {
294 request = (HttpWebRequest) 290 request = (HttpWebRequest)
295 WebRequest.Create(url); 291 WebRequest.Create(url);
296 request.Method = httpMethod; 292 request.Method = httpMethod;
297 request.ContentType = httpMIMEType; 293 request.ContentType = httpMIMEType;
298 294
299 request.Timeout = httpTimeout; 295 request.Timeout = httpTimeout;
300 // execute the request 296 // execute the request
301 response = (HttpWebResponse) 297 response = (HttpWebResponse)
302 request.GetResponse(); 298 request.GetResponse();
303 299
304 Stream resStream = response.GetResponseStream(); 300 Stream resStream = response.GetResponseStream();
305 301
@@ -317,11 +313,9 @@ namespace OpenSim.Region.Environment.Modules
317 // continue building the string 313 // continue building the string
318 sb.Append(tempString); 314 sb.Append(tempString);
319 } 315 }
320 } 316 } while (count > 0); // any more data to read?
321 while (count > 0); // any more data to read?
322 317
323 response_body = sb.ToString(); 318 response_body = sb.ToString();
324
325 } 319 }
326 catch (Exception e) 320 catch (Exception e)
327 { 321 {
@@ -333,7 +327,6 @@ namespace OpenSim.Region.Environment.Modules
333 327
334 status = 200; 328 status = 200;
335 finished = true; 329 finished = true;
336
337 } 330 }
338 331
339 public void Stop() 332 public void Stop()
@@ -342,8 +335,9 @@ namespace OpenSim.Region.Environment.Modules
342 { 335 {
343 httpThread.Abort(); 336 httpThread.Abort();
344 } 337 }
345 catch (Exception) { } 338 catch (Exception)
339 {
340 }
346 } 341 }
347 } 342 }
348 343} \ No newline at end of file
349 } \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/SunModule.cs b/OpenSim/Region/Environment/Modules/SunModule.cs
index 233c83c..bd6cd63 100644
--- a/OpenSim/Region/Environment/Modules/SunModule.cs
+++ b/OpenSim/Region/Environment/Modules/SunModule.cs
@@ -28,13 +28,12 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using libsecondlife;
31using Nini.Config; 32using Nini.Config;
32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
36using libsecondlife; 35using OpenSim.Region.Environment.Interfaces;
37 36using OpenSim.Region.Environment.Scenes;
38 37
39namespace OpenSim.Region.Environment.Modules 38namespace OpenSim.Region.Environment.Modules
40{ 39{
@@ -55,17 +54,20 @@ namespace OpenSim.Region.Environment.Modules
55 { 54 {
56 m_start = DateTime.Now.Ticks; 55 m_start = DateTime.Now.Ticks;
57 m_frame = 0; 56 m_frame = 0;
58 57
59 // Just in case they don't have the stanzas 58 // Just in case they don't have the stanzas
60 try { 59 try
60 {
61 m_day_length = config.Configs["Sun"].GetDouble("day_length", m_real_day); 61 m_day_length = config.Configs["Sun"].GetDouble("day_length", m_real_day);
62 m_frame_mod = config.Configs["Sun"].GetInt("frame_rate", m_default_frame); 62 m_frame_mod = config.Configs["Sun"].GetInt("frame_rate", m_default_frame);
63 } catch (Exception) { 63 }
64 catch (Exception)
65 {
64 m_day_length = m_real_day; 66 m_day_length = m_real_day;
65 m_frame_mod = m_default_frame; 67 m_frame_mod = m_default_frame;
66 } 68 }
67 69
68 m_dilation = (int)(m_real_day / m_day_length); 70 m_dilation = (int) (m_real_day/m_day_length);
69 m_scene = scene; 71 m_scene = scene;
70 m_log = MainLog.Instance; 72 m_log = MainLog.Instance;
71 scene.EventManager.OnFrame += SunUpdate; 73 scene.EventManager.OnFrame += SunUpdate;
@@ -94,10 +96,11 @@ namespace OpenSim.Region.Environment.Modules
94 { 96 {
95 client.SendSunPos(SunPos(HourOfTheDay()), new LLVector3(0, 0.0f, 10.0f)); 97 client.SendSunPos(SunPos(HourOfTheDay()), new LLVector3(0, 0.0f, 10.0f));
96 } 98 }
97 99
98 public void SunUpdate() 100 public void SunUpdate()
99 { 101 {
100 if (m_frame < m_frame_mod) { 102 if (m_frame < m_frame_mod)
103 {
101 m_frame++; 104 m_frame++;
102 return; 105 return;
103 } 106 }
@@ -115,20 +118,20 @@ namespace OpenSim.Region.Environment.Modules
115 // time when the simulator starts, then run time forward 118 // time when the simulator starts, then run time forward
116 // faster based on time dilation factor. This means that 119 // faster based on time dilation factor. This means that
117 // ticks don't get out of hand 120 // ticks don't get out of hand
118 private double HourOfTheDay() 121 private double HourOfTheDay()
119 { 122 {
120 long m_addticks = (DateTime.Now.Ticks - m_start) * m_dilation; 123 long m_addticks = (DateTime.Now.Ticks - m_start)*m_dilation;
121 DateTime dt = new DateTime(m_start + m_addticks); 124 DateTime dt = new DateTime(m_start + m_addticks);
122 return (double)dt.Hour + ((double)dt.Minute / 60.0); 125 return (double) dt.Hour + ((double) dt.Minute/60.0);
123 } 126 }
124 127
125 private LLVector3 SunPos(double hour) 128 private LLVector3 SunPos(double hour)
126 { 129 {
127 // now we have our radian position 130 // now we have our radian position
128 double rad = (hour / m_real_day) * 2 * Math.PI - (Math.PI / 2.0); 131 double rad = (hour/m_real_day)*2*Math.PI - (Math.PI/2.0);
129 double z = Math.Sin(rad); 132 double z = Math.Sin(rad);
130 double x = Math.Cos(rad); 133 double x = Math.Cos(rad);
131 return new LLVector3((float)x, 0f, (float)z); 134 return new LLVector3((float) x, 0f, (float) z);
132 } 135 }
133 136
134 // TODO: clear this out. This is here so that I remember to 137 // TODO: clear this out. This is here so that I remember to
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
index 0adace1..813be8d 100644
--- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
+++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs
@@ -32,6 +32,7 @@ using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console;
35using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
37 38
@@ -48,7 +49,8 @@ namespace OpenSim.Region.Environment.Modules
48 49
49 private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>(); 50 private BlockingQueue<TextureSender> QueueSenders = new BlockingQueue<TextureSender>();
50 51
51 private Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices = new Dictionary<LLUUID, UserTextureDownloadService>(); 52 private Dictionary<LLUUID, UserTextureDownloadService> m_userTextureServices =
53 new Dictionary<LLUUID, UserTextureDownloadService>();
52 54
53 private Thread m_thread; 55 private Thread m_thread;
54 56
@@ -72,7 +74,6 @@ namespace OpenSim.Region.Environment.Modules
72 m_scene = scene; 74 m_scene = scene;
73 m_scene.EventManager.OnNewClient += NewClient; 75 m_scene.EventManager.OnNewClient += NewClient;
74 } 76 }
75
76 } 77 }
77 78
78 public void PostInitialise() 79 public void PostInitialise()
@@ -115,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules
115 116
116 public void TextureRequest(Object sender, TextureRequestArgs e) 117 public void TextureRequest(Object sender, TextureRequestArgs e)
117 { 118 {
118 IClientAPI client = (IClientAPI)sender; 119 IClientAPI client = (IClientAPI) sender;
119 UserTextureDownloadService textureService; 120 UserTextureDownloadService textureService;
120 if (TryGetUserTextureService(client.AgentId, out textureService)) 121 if (TryGetUserTextureService(client.AgentId, out textureService))
121 { 122 {
@@ -175,7 +176,8 @@ namespace OpenSim.Region.Environment.Modules
175 { 176 {
176 if (!m_textureSenders.ContainsKey(e.RequestedAssetID)) 177 if (!m_textureSenders.ContainsKey(e.RequestedAssetID))
177 { 178 {
178 TextureSender requestHandler = new TextureSender(client, e.RequestedAssetID, e.DiscardLevel, e.PacketNumber); 179 TextureSender requestHandler =
180 new TextureSender(client, e.RequestedAssetID, e.DiscardLevel, e.PacketNumber);
179 m_textureSenders.Add(e.RequestedAssetID, requestHandler); 181 m_textureSenders.Add(e.RequestedAssetID, requestHandler);
180 m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback); 182 m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback);
181 } 183 }
@@ -183,7 +185,8 @@ namespace OpenSim.Region.Environment.Modules
183 { 185 {
184 m_textureSenders[e.RequestedAssetID].UpdateRequest(e.DiscardLevel, e.PacketNumber); 186 m_textureSenders[e.RequestedAssetID].UpdateRequest(e.DiscardLevel, e.PacketNumber);
185 m_textureSenders[e.RequestedAssetID].counter = 0; 187 m_textureSenders[e.RequestedAssetID].counter = 0;
186 if ((m_textureSenders[e.RequestedAssetID].ImageLoaded) && (m_textureSenders[e.RequestedAssetID].Sending ==false)) 188 if ((m_textureSenders[e.RequestedAssetID].ImageLoaded) &&
189 (m_textureSenders[e.RequestedAssetID].Sending == false))
187 { 190 {
188 m_textureSenders[e.RequestedAssetID].Sending = true; 191 m_textureSenders[e.RequestedAssetID].Sending = true;
189 m_sharedSendersQueue.Enqueue(m_textureSenders[e.RequestedAssetID]); 192 m_sharedSendersQueue.Enqueue(m_textureSenders[e.RequestedAssetID]);
@@ -256,7 +259,7 @@ namespace OpenSim.Region.Environment.Modules
256 { 259 {
257 m_asset = asset; 260 m_asset = asset;
258 NumPackets = CalculateNumPackets(asset.Data.Length); 261 NumPackets = CalculateNumPackets(asset.Data.Length);
259 PacketCounter = (int)StartPacketNumber; 262 PacketCounter = (int) StartPacketNumber;
260 ImageLoaded = true; 263 ImageLoaded = true;
261 } 264 }
262 265
@@ -264,14 +267,15 @@ namespace OpenSim.Region.Environment.Modules
264 { 267 {
265 RequestedDiscardLevel = discardLevel; 268 RequestedDiscardLevel = discardLevel;
266 StartPacketNumber = packetNumber; 269 StartPacketNumber = packetNumber;
267 PacketCounter = (int)StartPacketNumber; 270 PacketCounter = (int) StartPacketNumber;
268 } 271 }
269 272
270 public bool SendTexturePacket() 273 public bool SendTexturePacket()
271 { 274 {
272 SendPacket(); 275 SendPacket();
273 counter++; 276 counter++;
274 if ((NumPackets == 0) || (RequestedDiscardLevel == -1) || (PacketCounter > NumPackets) || ((RequestedDiscardLevel > 0) && (counter > 50 + (NumPackets / (RequestedDiscardLevel + 1)))) ) 277 if ((NumPackets == 0) || (RequestedDiscardLevel == -1) || (PacketCounter > NumPackets) ||
278 ((RequestedDiscardLevel > 0) && (counter > 50 + (NumPackets/(RequestedDiscardLevel + 1)))))
275 { 279 {
276 return true; 280 return true;
277 } 281 }
@@ -290,7 +294,7 @@ namespace OpenSim.Region.Environment.Modules
290 im.Header.Reliable = false; 294 im.Header.Reliable = false;
291 im.ImageID.Packets = 1; 295 im.ImageID.Packets = 1;
292 im.ImageID.ID = m_asset.FullID; 296 im.ImageID.ID = m_asset.FullID;
293 im.ImageID.Size = (uint)m_asset.Data.Length; 297 im.ImageID.Size = (uint) m_asset.Data.Length;
294 im.ImageData.Data = m_asset.Data; 298 im.ImageData.Data = m_asset.Data;
295 im.ImageID.Codec = 2; 299 im.ImageID.Codec = 2;
296 RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); 300 RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);
@@ -300,9 +304,9 @@ namespace OpenSim.Region.Environment.Modules
300 { 304 {
301 ImageDataPacket im = new ImageDataPacket(); 305 ImageDataPacket im = new ImageDataPacket();
302 im.Header.Reliable = false; 306 im.Header.Reliable = false;
303 im.ImageID.Packets = (ushort)(NumPackets); 307 im.ImageID.Packets = (ushort) (NumPackets);
304 im.ImageID.ID = m_asset.FullID; 308 im.ImageID.ID = m_asset.FullID;
305 im.ImageID.Size = (uint)m_asset.Data.Length; 309 im.ImageID.Size = (uint) m_asset.Data.Length;
306 im.ImageData.Data = new byte[600]; 310 im.ImageData.Data = new byte[600];
307 Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600); 311 Array.Copy(m_asset.Data, 0, im.ImageData.Data, 0, 600);
308 im.ImageID.Codec = 2; 312 im.ImageID.Codec = 2;
@@ -314,18 +318,20 @@ namespace OpenSim.Region.Environment.Modules
314 { 318 {
315 ImagePacketPacket im = new ImagePacketPacket(); 319 ImagePacketPacket im = new ImagePacketPacket();
316 im.Header.Reliable = false; 320 im.Header.Reliable = false;
317 im.ImageID.Packet = (ushort)(PacketCounter); 321 im.ImageID.Packet = (ushort) (PacketCounter);
318 im.ImageID.ID = m_asset.FullID; 322 im.ImageID.ID = m_asset.FullID;
319 int size = m_asset.Data.Length - 600 - (1000 * (PacketCounter - 1)); 323 int size = m_asset.Data.Length - 600 - (1000*(PacketCounter - 1));
320 if (size > 1000) size = 1000; 324 if (size > 1000) size = 1000;
321 im.ImageData.Data = new byte[size]; 325 im.ImageData.Data = new byte[size];
322 try 326 try
323 { 327 {
324 Array.Copy(m_asset.Data, 600 + (1000 * (PacketCounter - 1)), im.ImageData.Data, 0, size); 328 Array.Copy(m_asset.Data, 600 + (1000*(PacketCounter - 1)), im.ImageData.Data, 0, size);
325 } 329 }
326 catch (System.ArgumentOutOfRangeException) 330 catch (ArgumentOutOfRangeException)
327 { 331 {
328 OpenSim.Framework.Console.MainLog.Instance.Warn("TEXTURE", "Unable to separate texture into multiple packets: Array bounds failure on asset:" + m_asset.FullID.ToString() + "- TextureDownloadModule.cs. line:328"); 332 MainLog.Instance.Warn("TEXTURE",
333 "Unable to separate texture into multiple packets: Array bounds failure on asset:" +
334 m_asset.FullID.ToString() + "- TextureDownloadModule.cs. line:328");
329 return; 335 return;
330 } 336 }
331 RequestUser.OutPacket(im, ThrottleOutPacketType.Texture); 337 RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);
@@ -342,14 +348,12 @@ namespace OpenSim.Region.Environment.Modules
342 { 348 {
343 //over 600 bytes so split up file 349 //over 600 bytes so split up file
344 int restData = (length - 600); 350 int restData = (length - 600);
345 int restPackets = ((restData + 999) / 1000); 351 int restPackets = ((restData + 999)/1000);
346 numPackets = restPackets; 352 numPackets = restPackets;
347 } 353 }
348 354
349 return numPackets; 355 return numPackets;
350 } 356 }
351 } 357 }
352
353
354 } 358 }
355} \ No newline at end of file 359} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
index 0dad998..6b9ae46 100644
--- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
@@ -135,7 +135,7 @@ namespace OpenSim.Region.Environment.Modules
135 { 135 {
136 m_listenerManager.Remove(handle); 136 m_listenerManager.Remove(handle);
137 } 137 }
138 138
139 // This method scans nearby objects and determines if they are listeners, 139 // This method scans nearby objects and determines if they are listeners,
140 // and if so if this message fits the filter. If it does, then 140 // and if so if this message fits the filter. If it does, then
141 // enqueue the message for delivery to the objects listen event handler. 141 // enqueue the message for delivery to the objects listen event handler.
@@ -490,4 +490,4 @@ namespace OpenSim.Region.Environment.Modules
490 return m_id; 490 return m_id;
491 } 491 }
492 } 492 }
493} 493} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
index f13b2bb..481ba3f 100644
--- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
+++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs
@@ -33,10 +33,10 @@ using System.Threading;
33using libsecondlife; 33using libsecondlife;
34using Nini.Config; 34using Nini.Config;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenSim.Framework.Console;
36using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
37using OpenSim.Region.Environment.Interfaces; 38using OpenSim.Region.Environment.Interfaces;
38using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
39using OpenSim.Framework.Console;
40 40
41/***************************************************** 41/*****************************************************
42 * 42 *
@@ -116,15 +116,16 @@ namespace OpenSim.Region.Environment.Modules
116 116
117 public void PostInitialise() 117 public void PostInitialise()
118 { 118 {
119 if ( IsEnabled() ) 119 if (IsEnabled())
120 { 120 {
121 m_openChannels = new Dictionary<LLUUID, RPCChannelInfo>(); 121 m_openChannels = new Dictionary<LLUUID, RPCChannelInfo>();
122 m_pendingResponse = new Dictionary<LLUUID, RPCRequestInfo>(); 122 m_pendingResponse = new Dictionary<LLUUID, RPCRequestInfo>();
123 123
124 // Start http server 124 // Start http server
125 // Attach xmlrpc handlers 125 // Attach xmlrpc handlers
126 m_log.Verbose("REMOTE_DATA", "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); 126 m_log.Verbose("REMOTE_DATA",
127 BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort); 127 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
128 BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort);
128 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); 129 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
129 httpServer.Start(); 130 httpServer.Start();
130 } 131 }
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 53fa08a..76601ec 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -35,13 +35,13 @@ namespace OpenSim.Region.Environment
35 public class PermissionManager 35 public class PermissionManager
36 { 36 {
37 protected Scene m_scene; 37 protected Scene m_scene;
38 38
39 // These are here for testing. They will be taken out 39 // These are here for testing. They will be taken out
40 private uint PERM_ALL = (uint)2147483647; 40 private uint PERM_ALL = (uint) 2147483647;
41 private uint PERM_COPY = (uint)32768; 41 private uint PERM_COPY = (uint) 32768;
42 private uint PERM_MODIFY = (uint)16384; 42 private uint PERM_MODIFY = (uint) 16384;
43 private uint PERM_MOVE = (uint)524288; 43 private uint PERM_MOVE = (uint) 524288;
44 private uint PERM_TRANS = (uint)8192; 44 private uint PERM_TRANS = (uint) 8192;
45 // Bypasses the permissions engine (always returns OK) 45 // Bypasses the permissions engine (always returns OK)
46 // disable in any production environment 46 // disable in any production environment
47 // TODO: Change this to false when permissions are a desired default 47 // TODO: Change this to false when permissions are a desired default
@@ -109,10 +109,11 @@ namespace OpenSim.Region.Environment
109 109
110 string reason = "Insufficient permission"; 110 string reason = "Insufficient permission";
111 111
112 Land land = this.m_scene.LandManager.getLandObject(position.X, position.Y); 112 Land land = m_scene.LandManager.getLandObject(position.X, position.Y);
113 if (land == null) return false; 113 if (land == null) return false;
114 114
115 if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) == (int)Parcel.ParcelFlags.CreateObjects) 115 if ((land.landData.landFlags & ((int) Parcel.ParcelFlags.CreateObjects)) ==
116 (int) Parcel.ParcelFlags.CreateObjects)
116 permission = true; 117 permission = true;
117 118
118 //TODO: check for group rights 119 //TODO: check for group rights
@@ -143,8 +144,6 @@ namespace OpenSim.Region.Environment
143 144
144 #region Object Permissions 145 #region Object Permissions
145 146
146
147
148 public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID) 147 public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
149 { 148 {
150 if (!m_scene.Entities.ContainsKey(objID)) 149 if (!m_scene.Entities.ContainsKey(objID))
@@ -158,7 +157,7 @@ namespace OpenSim.Region.Environment
158 return 0; 157 return 0;
159 } 158 }
160 159
161 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objID]; 160 SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[objID];
162 LLUUID taskOwner = null; 161 LLUUID taskOwner = null;
163 // Added this because at this point in time it wouldn't be wise for 162 // Added this because at this point in time it wouldn't be wise for
164 // the administrator object permissions to take effect. 163 // the administrator object permissions to take effect.
@@ -274,7 +273,7 @@ namespace OpenSim.Region.Environment
274 273
275 public virtual bool CanEditObjectPosition(LLUUID user, LLUUID obj) 274 public virtual bool CanEditObjectPosition(LLUUID user, LLUUID obj)
276 { 275 {
277 bool permission = GenericObjectPermission(user,obj); 276 bool permission = GenericObjectPermission(user, obj);
278 if (!permission) 277 if (!permission)
279 { 278 {
280 if (!m_scene.Entities.ContainsKey(obj)) 279 if (!m_scene.Entities.ContainsKey(obj))
@@ -288,7 +287,7 @@ namespace OpenSim.Region.Environment
288 return false; 287 return false;
289 } 288 }
290 289
291 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj]; 290 SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj];
292 LLUUID taskOwner = null; 291 LLUUID taskOwner = null;
293 // Added this because at this point in time it wouldn't be wise for 292 // Added this because at this point in time it wouldn't be wise for
294 // the administrator object permissions to take effect. 293 // the administrator object permissions to take effect.
@@ -298,6 +297,7 @@ namespace OpenSim.Region.Environment
298 } 297 }
299 return permission; 298 return permission;
300 } 299 }
300
301 public virtual bool CanCopyObject(LLUUID user, LLUUID obj) 301 public virtual bool CanCopyObject(LLUUID user, LLUUID obj)
302 { 302 {
303 bool permission = GenericObjectPermission(user, obj); 303 bool permission = GenericObjectPermission(user, obj);
@@ -314,7 +314,7 @@ namespace OpenSim.Region.Environment
314 return false; 314 return false;
315 } 315 }
316 316
317 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj]; 317 SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj];
318 LLUUID taskOwner = null; 318 LLUUID taskOwner = null;
319 // Added this because at this point in time it wouldn't be wise for 319 // Added this because at this point in time it wouldn't be wise for
320 // the administrator object permissions to take effect. 320 // the administrator object permissions to take effect.
@@ -324,6 +324,7 @@ namespace OpenSim.Region.Environment
324 } 324 }
325 return permission; 325 return permission;
326 } 326 }
327
327 public virtual bool CanReturnObject(LLUUID user, LLUUID obj) 328 public virtual bool CanReturnObject(LLUUID user, LLUUID obj)
328 { 329 {
329 return GenericObjectPermission(user, obj); 330 return GenericObjectPermission(user, obj);
@@ -491,4 +492,4 @@ namespace OpenSim.Region.Environment
491 492
492 #endregion 493 #endregion
493 } 494 }
494} 495} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs b/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs
index cffe846..5466865 100644
--- a/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs
+++ b/OpenSim/Region/Environment/Scenes/AvatarAnimations.cs
@@ -25,11 +25,11 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Xml; 30using System.Xml;
30using libsecondlife; 31using libsecondlife;
31using libsecondlife.Packets; 32using OpenSim.Framework.Console;
32
33 33
34namespace OpenSim.Region.Environment.Scenes 34namespace OpenSim.Region.Environment.Scenes
35{ 35{
@@ -37,11 +37,11 @@ namespace OpenSim.Region.Environment.Scenes
37 { 37 {
38 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>(); 38 public Dictionary<string, LLUUID> AnimsLLUUID = new Dictionary<string, LLUUID>();
39 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>(); 39 public Dictionary<LLUUID, string> AnimsNames = new Dictionary<LLUUID, string>();
40 40
41 public AvatarAnimations() 41 public AvatarAnimations()
42 { 42 {
43 } 43 }
44 44
45 public void LoadAnims() 45 public void LoadAnims()
46 { 46 {
47 //MainLog.Instance.Verbose("CLIENT", "Loading avatar animations"); 47 //MainLog.Instance.Verbose("CLIENT", "Loading avatar animations");
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Environment.Scenes
57 } 57 }
58 } 58 }
59 } 59 }
60 60
61 // MainLog.Instance.Verbose("CLIENT", "Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); 61 // MainLog.Instance.Verbose("CLIENT", "Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)");
62 62
63 try 63 try
@@ -68,11 +68,10 @@ namespace OpenSim.Region.Environment.Scenes
68 AnimsNames.Add(kp.Value, kp.Key); 68 AnimsNames.Add(kp.Value, kp.Key);
69 } 69 }
70 } 70 }
71 catch (System.InvalidOperationException) 71 catch (InvalidOperationException)
72 { 72 {
73 OpenSim.Framework.Console.MainLog.Instance.Warn("AVATAR", "Unable to load animation names for an Avatar"); 73 MainLog.Instance.Warn("AVATAR", "Unable to load animation names for an Avatar");
74 } 74 }
75
76 } 75 }
77 } 76 }
78} 77} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
index 2ec4dbe..1583124 100644
--- a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
+++ b/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -26,15 +26,9 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 29using libsecondlife;
33using libsecondlife.Packets; 30using libsecondlife.Packets;
34using OpenSim.Framework; 31using OpenSim.Framework;
35using OpenSim.Framework.Console;
36using OpenSim.Framework.Communications;
37using OpenSim.Region.Environment.Types;
38 32
39namespace OpenSim.Region.Environment.Scenes 33namespace OpenSim.Region.Environment.Scenes
40{ 34{
@@ -106,8 +100,8 @@ namespace OpenSim.Region.Environment.Scenes
106 // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. 100 // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters.
107 // (float)m_visualParams[25] = Height 101 // (float)m_visualParams[25] = Height
108 // (float)m_visualParams[125] = LegLength 102 // (float)m_visualParams[125] = LegLength
109 m_avatarHeight = (1.50856f + (((float)m_visualParams[25] / 255.0f) * (2.525506f - 1.50856f))) 103 m_avatarHeight = (1.50856f + (((float) m_visualParams[25]/255.0f)*(2.525506f - 1.50856f)))
110 + (((float)m_visualParams[125] / 255.0f) / 1.5f); 104 + (((float) m_visualParams[125]/255.0f)/1.5f);
111 } 105 }
112 106
113 /// <summary> 107 /// <summary>
@@ -144,4 +138,4 @@ namespace OpenSim.Region.Environment.Scenes
144 return textu; 138 return textu;
145 } 139 }
146 } 140 }
147} 141} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 4556c63..18799e4 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -145,7 +145,6 @@ namespace OpenSim.Region.Environment.Scenes
145 return (EntityBase) MemberwiseClone(); 145 return (EntityBase) MemberwiseClone();
146 } 146 }
147 147
148
149 148
150 public abstract void SetText(string text, Vector3 color, double alpha); 149 public abstract void SetText(string text, Vector3 color, double alpha);
151 } 150 }
@@ -161,15 +160,13 @@ namespace OpenSim.Region.Environment.Scenes
161 160
162 public EntityIntersection() 161 public EntityIntersection()
163 { 162 {
164
165
166 } 163 }
164
167 public EntityIntersection(Vector3 _ipoint, float _normal, bool _HitTF) 165 public EntityIntersection(Vector3 _ipoint, float _normal, bool _HitTF)
168 { 166 {
169 ipoint = _ipoint; 167 ipoint = _ipoint;
170 normal = _normal; 168 normal = _normal;
171 HitTF = _HitTF; 169 HitTF = _HitTF;
172 } 170 }
173
174 } 171 }
175} \ No newline at end of file 172} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
index b9d1232..3e87981 100644
--- a/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
+++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs
@@ -27,7 +27,6 @@
27*/ 27*/
28 28
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets;
31using OpenSim.Framework; 30using OpenSim.Framework;
32 31
33namespace OpenSim.Region.Environment.Scenes 32namespace OpenSim.Region.Environment.Scenes
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 0ca3405..4233853 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -28,7 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using Axiom.Math; 31using Axiom.Math;
33using libsecondlife; 32using libsecondlife;
34using libsecondlife.Packets; 33using libsecondlife.Packets;
@@ -44,10 +43,13 @@ namespace OpenSim.Region.Environment.Scenes
44 public class InnerScene 43 public class InnerScene
45 { 44 {
46 #region Events 45 #region Events
46
47 public event PhysicsCrash UnRecoverableError; 47 public event PhysicsCrash UnRecoverableError;
48
48 #endregion 49 #endregion
49 50
50 #region Fields 51 #region Fields
52
51 public Dictionary<LLUUID, ScenePresence> ScenePresences; 53 public Dictionary<LLUUID, ScenePresence> ScenePresences;
52 public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; 54 public Dictionary<LLUUID, SceneObjectGroup> SceneObjects;
53 public Dictionary<LLUUID, EntityBase> Entities; 55 public Dictionary<LLUUID, EntityBase> Entities;
@@ -65,6 +67,7 @@ namespace OpenSim.Region.Environment.Scenes
65 internal object m_syncRoot = new object(); 67 internal object m_syncRoot = new object();
66 68
67 public PhysicsScene _PhyScene; 69 public PhysicsScene _PhyScene;
70
68 #endregion 71 #endregion
69 72
70 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr) 73 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr)
@@ -79,28 +82,27 @@ namespace OpenSim.Region.Environment.Scenes
79 82
80 public PhysicsScene PhysicsScene 83 public PhysicsScene PhysicsScene
81 { 84 {
82 get 85 get { return _PhyScene; }
83 { return _PhyScene; }
84 set 86 set
85 { 87 {
86 // If we're not doing the initial set 88 // If we're not doing the initial set
87 // Then we've got to remove the previous 89 // Then we've got to remove the previous
88 // event handler 90 // event handler
89 try 91 try
90 { 92 {
91 _PhyScene.OnPhysicsCrash -= physicsBasedCrash; 93 _PhyScene.OnPhysicsCrash -= physicsBasedCrash;
92 } 94 }
93 catch (System.NullReferenceException) 95 catch (NullReferenceException)
94 { 96 {
95 // This occurs when storing to _PhyScene the first time. 97 // This occurs when storing to _PhyScene the first time.
96 // Is there a better way to check the event handler before 98 // Is there a better way to check the event handler before
97 // getting here 99 // getting here
98 // This can be safely ignored. We're setting the first inital 100 // This can be safely ignored. We're setting the first inital
99 // there are no event handler's registered. 101 // there are no event handler's registered.
100 } 102 }
101 103
102 _PhyScene = value; 104 _PhyScene = value;
103 105
104 _PhyScene.OnPhysicsCrash += physicsBasedCrash; 106 _PhyScene.OnPhysicsCrash += physicsBasedCrash;
105 } 107 }
106 } 108 }
@@ -113,6 +115,7 @@ namespace OpenSim.Region.Environment.Scenes
113 } 115 }
114 116
115 #region Update Methods 117 #region Update Methods
118
116 internal void UpdatePreparePhysics() 119 internal void UpdatePreparePhysics()
117 { 120 {
118 // If we are using a threaded physics engine 121 // If we are using a threaded physics engine
@@ -141,7 +144,7 @@ namespace OpenSim.Region.Environment.Scenes
141 { 144 {
142 lock (m_syncRoot) 145 lock (m_syncRoot)
143 { 146 {
144 return _PhyScene.Simulate((float)elapsed); 147 return _PhyScene.Simulate((float) elapsed);
145 } 148 }
146 } 149 }
147 150
@@ -151,12 +154,14 @@ namespace OpenSim.Region.Environment.Scenes
151 154
152 foreach (EntityBase entity in moveEntities) 155 foreach (EntityBase entity in moveEntities)
153 { 156 {
154 entity.UpdateMovement(); 157 entity.UpdateMovement();
155 } 158 }
156 } 159 }
160
157 #endregion 161 #endregion
158 162
159 #region Entity Methods 163 #region Entity Methods
164
160 public void AddEntityFromStorage(SceneObjectGroup sceneObject) 165 public void AddEntityFromStorage(SceneObjectGroup sceneObject)
161 { 166 {
162 sceneObject.RegionHandle = m_regInfo.RegionHandle; 167 sceneObject.RegionHandle = m_regInfo.RegionHandle;
@@ -181,14 +186,17 @@ namespace OpenSim.Region.Environment.Scenes
181 m_numPrim++; 186 m_numPrim++;
182 } 187 }
183 } 188 }
189
184 public void AddPhysicalPrim(int number) 190 public void AddPhysicalPrim(int number)
185 { 191 {
186 m_physicalPrim++; 192 m_physicalPrim++;
187 } 193 }
194
188 public void RemovePhysicalPrim(int number) 195 public void RemovePhysicalPrim(int number)
189 { 196 {
190 m_physicalPrim--; 197 m_physicalPrim--;
191 } 198 }
199
192 public void RemovePrim(uint localID, LLUUID avatar_deleter) 200 public void RemovePrim(uint localID, LLUUID avatar_deleter)
193 { 201 {
194 List<EntityBase> EntityList = GetEntities(); 202 List<EntityBase> EntityList = GetEntities();
@@ -197,9 +205,9 @@ namespace OpenSim.Region.Environment.Scenes
197 { 205 {
198 if (obj is SceneObjectGroup) 206 if (obj is SceneObjectGroup)
199 { 207 {
200 if (((SceneObjectGroup)obj).LocalId == localID) 208 if (((SceneObjectGroup) obj).LocalId == localID)
201 { 209 {
202 m_parentScene.RemoveEntity((SceneObjectGroup)obj); 210 m_parentScene.RemoveEntity((SceneObjectGroup) obj);
203 m_numPrim--; 211 m_numPrim--;
204 return; 212 return;
205 } 213 }
@@ -253,7 +261,8 @@ namespace OpenSim.Region.Environment.Scenes
253 261
254 return newAvatar; 262 return newAvatar;
255 } 263 }
256 public void SwapRootChildAgent(bool direction_RC_CR_T_F) 264
265 public void SwapRootChildAgent(bool direction_RC_CR_T_F)
257 { 266 {
258 if (direction_RC_CR_T_F) 267 if (direction_RC_CR_T_F)
259 { 268 {
@@ -266,25 +275,29 @@ namespace OpenSim.Region.Environment.Scenes
266 m_numRootAgents++; 275 m_numRootAgents++;
267 } 276 }
268 } 277 }
278
269 public void removeUserCount(bool TypeRCTF) 279 public void removeUserCount(bool TypeRCTF)
270 { 280 {
271 if (TypeRCTF) 281 if (TypeRCTF)
272 { 282 {
273 m_numRootAgents--; 283 m_numRootAgents--;
274 } 284 }
275 else 285 else
276 { 286 {
277 m_numChildAgents--; 287 m_numChildAgents--;
278 } 288 }
279 } 289 }
290
280 public void RemoveAPrimCount() 291 public void RemoveAPrimCount()
281 { 292 {
282 m_numPrim--; 293 m_numPrim--;
283 } 294 }
295
284 public void AddAPrimCount() 296 public void AddAPrimCount()
285 { 297 {
286 m_numPrim++; 298 m_numPrim++;
287 } 299 }
300
288 public int GetChildAgentCount() 301 public int GetChildAgentCount()
289 { 302 {
290 return m_numChildAgents; 303 return m_numChildAgents;
@@ -375,8 +388,8 @@ namespace OpenSim.Region.Environment.Scenes
375 { 388 {
376 if (ent is SceneObjectGroup) 389 if (ent is SceneObjectGroup)
377 { 390 {
378 if (((SceneObjectGroup)ent).HasChildPrim(localID)) 391 if (((SceneObjectGroup) ent).HasChildPrim(localID))
379 return (SceneObjectGroup)ent; 392 return (SceneObjectGroup) ent;
380 } 393 }
381 } 394 }
382 return null; 395 return null;
@@ -390,8 +403,8 @@ namespace OpenSim.Region.Environment.Scenes
390 { 403 {
391 if (ent is SceneObjectGroup) 404 if (ent is SceneObjectGroup)
392 { 405 {
393 if (((SceneObjectGroup)ent).HasChildPrim(fullID)) 406 if (((SceneObjectGroup) ent).HasChildPrim(fullID))
394 return (SceneObjectGroup)ent; 407 return (SceneObjectGroup) ent;
395 } 408 }
396 } 409 }
397 return null; 410 return null;
@@ -406,7 +419,7 @@ namespace OpenSim.Region.Environment.Scenes
406 { 419 {
407 if (ent is SceneObjectGroup) 420 if (ent is SceneObjectGroup)
408 { 421 {
409 SceneObjectGroup reportingG = (SceneObjectGroup)ent; 422 SceneObjectGroup reportingG = (SceneObjectGroup) ent;
410 EntityIntersection result = reportingG.TestIntersection(hray); 423 EntityIntersection result = reportingG.TestIntersection(hray);
411 if (result.HitTF) 424 if (result.HitTF)
412 { 425 {
@@ -417,7 +430,6 @@ namespace OpenSim.Region.Environment.Scenes
417 } 430 }
418 } 431 }
419 } 432 }
420
421 } 433 }
422 return returnResult; 434 return returnResult;
423 } 435 }
@@ -531,17 +543,16 @@ namespace OpenSim.Region.Environment.Scenes
531 //float distResult = Vector3Distance(avPosition, objPosition); 543 //float distResult = Vector3Distance(avPosition, objPosition);
532 //if (distResult > 512) 544 //if (distResult > 512)
533 //{ 545 //{
534 //int x = 0; 546 //int x = 0;
535 //} 547 //}
536 //if (distResult < presence.DrawDistance) 548 //if (distResult < presence.DrawDistance)
537 //{ 549 //{
538 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); 550 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
539 //} 551 //}
540
541 } 552 }
542 else 553 else
543 { 554 {
544 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); 555 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence);
545 } 556 }
546 } 557 }
547 } 558 }
@@ -554,9 +565,11 @@ namespace OpenSim.Region.Environment.Scenes
554 action(presence.ControllingClient); 565 action(presence.ControllingClient);
555 } 566 }
556 } 567 }
568
557 #endregion 569 #endregion
558 570
559 #region Client Event handlers 571 #region Client Event handlers
572
560 /// <summary> 573 /// <summary>
561 /// 574 ///
562 /// </summary> 575 /// </summary>
@@ -583,13 +596,12 @@ namespace OpenSim.Region.Environment.Scenes
583 /// <param name="AgentID"></param> 596 /// <param name="AgentID"></param>
584 /// <param name="RequestFlags"></param> 597 /// <param name="RequestFlags"></param>
585 /// <param name="ObjectID"></param> 598 /// <param name="ObjectID"></param>
586 public void RequestObjectPropertiesFamily(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags, LLUUID ObjectID) 599 public void RequestObjectPropertiesFamily(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags,
600 LLUUID ObjectID)
587 { 601 {
588 SceneObjectGroup group = GetGroupByPrim(ObjectID); 602 SceneObjectGroup group = GetGroupByPrim(ObjectID);
589 if (group != null) 603 if (group != null)
590 group.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags); 604 group.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags);
591
592
593 } 605 }
594 606
595 /// <summary> 607 /// <summary>
@@ -708,10 +720,9 @@ namespace OpenSim.Region.Environment.Scenes
708 { 720 {
709 if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID)) 721 if (PermissionsMngr.CanEditObject(remoteClient.AgentId, group.UUID))
710 { 722 {
711 group.UpdatePrimFlags(localID, (ushort)packet.Type, true, packet.ToBytes()); 723 group.UpdatePrimFlags(localID, (ushort) packet.Type, true, packet.ToBytes());
712 } 724 }
713 } 725 }
714
715 } 726 }
716 727
717 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 728 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
@@ -763,7 +774,7 @@ namespace OpenSim.Region.Environment.Scenes
763 public void UpdateExtraParam(LLUUID agentID, uint primLocalID, ushort type, bool inUse, byte[] data) 774 public void UpdateExtraParam(LLUUID agentID, uint primLocalID, ushort type, bool inUse, byte[] data)
764 { 775 {
765 SceneObjectGroup group = GetGroupByPrim(primLocalID); 776 SceneObjectGroup group = GetGroupByPrim(primLocalID);
766 777
767 if (group != null) 778 if (group != null)
768 { 779 {
769 if (PermissionsMngr.CanEditObject(agentID, group.UUID)) 780 if (PermissionsMngr.CanEditObject(agentID, group.UUID))
@@ -771,7 +782,6 @@ namespace OpenSim.Region.Environment.Scenes
771 group.UpdateExtraParam(primLocalID, type, inUse, data); 782 group.UpdateExtraParam(primLocalID, type, inUse, data);
772 } 783 }
773 } 784 }
774
775 } 785 }
776 786
777 /// <summary> 787 /// <summary>
@@ -786,7 +796,6 @@ namespace OpenSim.Region.Environment.Scenes
786 { 796 {
787 if (PermissionsMngr.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID))) 797 if (PermissionsMngr.CanEditObjectPosition(agentID, group.GetPartsFullID(primLocalID)))
788 { 798 {
789
790 group.UpdateShape(shapeBlock, primLocalID); 799 group.UpdateShape(shapeBlock, primLocalID);
791 } 800 }
792 } 801 }
@@ -806,9 +815,9 @@ namespace OpenSim.Region.Environment.Scenes
806 { 815 {
807 if (ent is SceneObjectGroup) 816 if (ent is SceneObjectGroup)
808 { 817 {
809 if (((SceneObjectGroup)ent).LocalId == parentPrim) 818 if (((SceneObjectGroup) ent).LocalId == parentPrim)
810 { 819 {
811 parenPrim = (SceneObjectGroup)ent; 820 parenPrim = (SceneObjectGroup) ent;
812 break; 821 break;
813 } 822 }
814 } 823 }
@@ -823,9 +832,9 @@ namespace OpenSim.Region.Environment.Scenes
823 { 832 {
824 if (ent is SceneObjectGroup) 833 if (ent is SceneObjectGroup)
825 { 834 {
826 if (((SceneObjectGroup)ent).LocalId == childPrims[i]) 835 if (((SceneObjectGroup) ent).LocalId == childPrims[i])
827 { 836 {
828 children.Add((SceneObjectGroup)ent); 837 children.Add((SceneObjectGroup) ent);
829 } 838 }
830 } 839 }
831 } 840 }
@@ -857,7 +866,7 @@ namespace OpenSim.Region.Environment.Scenes
857 { 866 {
858 if (ent is SceneObjectGroup) 867 if (ent is SceneObjectGroup)
859 { 868 {
860 SceneObjectGroup obj = (SceneObjectGroup)ent; 869 SceneObjectGroup obj = (SceneObjectGroup) ent;
861 sceneObjects.Add(obj.LocalId, obj); 870 sceneObjects.Add(obj.LocalId, obj);
862 } 871 }
863 } 872 }
@@ -882,9 +891,9 @@ namespace OpenSim.Region.Environment.Scenes
882 } 891 }
883 else 892 else
884 { 893 {
885 MainLog.Instance.Verbose("SCENE", 894 MainLog.Instance.Verbose("SCENE",
886 "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!", 895 "DelinkObjects(): Could not find a root prim out of {0} as given to a delink request!",
887 primIds); 896 primIds);
888 } 897 }
889 } 898 }
890 899
@@ -903,9 +912,9 @@ namespace OpenSim.Region.Environment.Scenes
903 { 912 {
904 if (ent is SceneObjectGroup) 913 if (ent is SceneObjectGroup)
905 { 914 {
906 if (((SceneObjectGroup)ent).LocalId == originalPrim) 915 if (((SceneObjectGroup) ent).LocalId == originalPrim)
907 { 916 {
908 originPrim = (SceneObjectGroup)ent; 917 originPrim = (SceneObjectGroup) ent;
909 break; 918 break;
910 } 919 }
911 } 920 }
@@ -929,7 +938,6 @@ namespace OpenSim.Region.Environment.Scenes
929 { 938 {
930 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim"); 939 MainLog.Instance.Warn("client", "Attempted to duplicate nonexistant prim");
931 } 940 }
932
933 } 941 }
934 942
935 /// <summary> 943 /// <summary>
@@ -943,8 +951,11 @@ namespace OpenSim.Region.Environment.Scenes
943 // We don't really need the double floating point precision... 951 // We don't really need the double floating point precision...
944 // so casting it to a single 952 // so casting it to a single
945 953
946 return (float)Math.Sqrt((v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y) + (v1.z - v2.z) * (v1.z - v2.z)); 954 return
955 (float)
956 Math.Sqrt((v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y) + (v1.z - v2.z)*(v1.z - v2.z));
947 } 957 }
958
948 #endregion 959 #endregion
949 } 960 }
950} 961} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 0689177..4c6e1c8 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -26,14 +26,12 @@
26* 26*
27*/ 27*/
28 28
29using Axiom.Math; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Region.Physics.Manager;
36using System.Collections.Generic;
37 35
38namespace OpenSim.Region.Environment.Scenes 36namespace OpenSim.Region.Environment.Scenes
39{ 37{
@@ -41,7 +39,7 @@ namespace OpenSim.Region.Environment.Scenes
41 { 39 {
42 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete 40 //split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
43 // or at least some of they can be moved somewhere else 41 // or at least some of they can be moved somewhere else
44 42
45 /// <summary> 43 /// <summary>
46 /// Add an inventory item to an avatar's inventory. 44 /// Add an inventory item to an avatar's inventory.
47 /// </summary> 45 /// </summary>
@@ -57,7 +55,7 @@ namespace OpenSim.Region.Environment.Scenes
57 remoteClient.SendInventoryItemCreateUpdate(item); 55 remoteClient.SendInventoryItemCreateUpdate(item);
58 } 56 }
59 } 57 }
60 58
61 /// <summary> 59 /// <summary>
62 /// <see>AddInventoryItem(LLUUID, InventoryItemBase)</see> 60 /// <see>AddInventoryItem(LLUUID, InventoryItemBase)</see>
63 /// </summary> 61 /// </summary>
@@ -71,10 +69,10 @@ namespace OpenSim.Region.Environment.Scenes
71 if (!TryGetAvatar(avatarId, out avatar)) 69 if (!TryGetAvatar(avatarId, out avatar))
72 { 70 {
73 MainLog.Instance.Error( 71 MainLog.Instance.Error(
74 "AGENTINVENTORY", "Could not find avatar {0} to add inventory item", avatarId); 72 "AGENTINVENTORY", "Could not find avatar {0} to add inventory item", avatarId);
75 return; 73 return;
76 } 74 }
77 75
78 AddInventoryItem(avatar.ControllingClient, item); 76 AddInventoryItem(avatar.ControllingClient, item);
79 } 77 }
80 78
@@ -95,7 +93,9 @@ namespace OpenSim.Region.Environment.Scenes
95 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 93 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
96 if (item != null) 94 if (item != null)
97 { 95 {
98 AssetBase asset = CreateAsset(item.inventoryName, item.inventoryDescription, (sbyte) item.invType, (sbyte) item.assetType, data); 96 AssetBase asset =
97 CreateAsset(item.inventoryName, item.inventoryDescription, (sbyte) item.invType,
98 (sbyte) item.assetType, data);
99 AssetCache.AddAsset(asset); 99 AssetCache.AddAsset(asset);
100 100
101 item.assetID = asset.FullID; 101 item.assetID = asset.FullID;
@@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment.Scenes
117 } 117 }
118 return LLUUID.Zero; 118 return LLUUID.Zero;
119 } 119 }
120 120
121 /// <summary> 121 /// <summary>
122 /// <see>CapsUpdatedInventoryItemAsset(IClientAPI, LLUUID, byte[])</see> 122 /// <see>CapsUpdatedInventoryItemAsset(IClientAPI, LLUUID, byte[])</see>
123 /// </summary> 123 /// </summary>
@@ -132,14 +132,14 @@ namespace OpenSim.Region.Environment.Scenes
132 else 132 else
133 { 133 {
134 MainLog.Instance.Error( 134 MainLog.Instance.Error(
135 "AGENTINVENTORY", 135 "AGENTINVENTORY",
136 "Avatar {0} cannot be found to update its inventory item asset", 136 "Avatar {0} cannot be found to update its inventory item asset",
137 avatarId); 137 avatarId);
138 } 138 }
139 139
140 return LLUUID.Zero; 140 return LLUUID.Zero;
141 } 141 }
142 142
143 /// <summary> 143 /// <summary>
144 /// Capability originating call to update the asset of a script in a prim's (task's) inventory 144 /// Capability originating call to update the asset of a script in a prim's (task's) inventory
145 /// </summary> 145 /// </summary>
@@ -149,17 +149,17 @@ namespace OpenSim.Region.Environment.Scenes
149 /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param> 149 /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param>
150 /// <param name="data"></param> 150 /// <param name="data"></param>
151 /// <returns>Asset LLUID created</returns> 151 /// <returns>Asset LLUID created</returns>
152 public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, LLUUID itemId, 152 public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, LLUUID itemId,
153 LLUUID primId, bool isScriptRunning, byte[] data) 153 LLUUID primId, bool isScriptRunning, byte[] data)
154 { 154 {
155 // TODO Not currently doing anything with the isScriptRunning bool 155 // TODO Not currently doing anything with the isScriptRunning bool
156 156
157 MainLog.Instance.Verbose( 157 MainLog.Instance.Verbose(
158 "PRIMINVENTORY", 158 "PRIMINVENTORY",
159 "Prim inventory script save functionality not yet implemented." 159 "Prim inventory script save functionality not yet implemented."
160 + " remoteClient: {0}, itemID: {1}, primID: {2}, isScriptRunning: {3}", 160 + " remoteClient: {0}, itemID: {1}, primID: {2}, isScriptRunning: {3}",
161 remoteClient, itemId, primId, isScriptRunning); 161 remoteClient, itemId, primId, isScriptRunning);
162 162
163 // TODO 163 // TODO
164 // Retrieve client LLUID 164 // Retrieve client LLUID
165 // Retrieve sog containing primID 165 // Retrieve sog containing primID
@@ -170,13 +170,13 @@ namespace OpenSim.Region.Environment.Scenes
170 // Trigger rerunning of script (use TriggerRezScript event, see RezScript) 170 // Trigger rerunning of script (use TriggerRezScript event, see RezScript)
171 // return new asset id 171 // return new asset id
172 } 172 }
173 173
174 /// <summary> 174 /// <summary>
175 /// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, LLUUID, LLUUID, bool, byte[])</see> 175 /// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, LLUUID, LLUUID, bool, byte[])</see>
176 /// </summary> 176 /// </summary>
177 private void CapsUpdateTaskInventoryScriptAsset(LLUUID avatarId, LLUUID itemId, 177 private void CapsUpdateTaskInventoryScriptAsset(LLUUID avatarId, LLUUID itemId,
178 LLUUID primId, bool isScriptRunning, byte[] data) 178 LLUUID primId, bool isScriptRunning, byte[] data)
179 { 179 {
180 ScenePresence avatar; 180 ScenePresence avatar;
181 181
182 if (TryGetAvatar(avatarId, out avatar)) 182 if (TryGetAvatar(avatarId, out avatar))
@@ -187,10 +187,10 @@ namespace OpenSim.Region.Environment.Scenes
187 else 187 else
188 { 188 {
189 MainLog.Instance.Error( 189 MainLog.Instance.Error(
190 "PRIMINVENTORY", 190 "PRIMINVENTORY",
191 "Avatar {0} cannot be found to update its prim item asset", 191 "Avatar {0} cannot be found to update its prim item asset",
192 avatarId); 192 avatarId);
193 } 193 }
194 } 194 }
195 195
196 /// <summary> 196 /// <summary>
@@ -204,74 +204,75 @@ namespace OpenSim.Region.Environment.Scenes
204 /// <param name="name">The name of the updated item</param> 204 /// <param name="name">The name of the updated item</param>
205 /// <param name="description">The description of the updated item</param> 205 /// <param name="description">The description of the updated item</param>
206 /// <param name="nextOwnerMask">The permissions of the updated item</param> 206 /// <param name="nextOwnerMask">The permissions of the updated item</param>
207 public void UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, 207 public void UpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID,
208 LLUUID itemID, string name, string description, 208 LLUUID itemID, string name, string description,
209 uint nextOwnerMask) 209 uint nextOwnerMask)
210 { 210 {
211 CachedUserInfo userInfo 211 CachedUserInfo userInfo
212 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 212 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
213 213
214 if (userInfo != null && userInfo.RootFolder != null) 214 if (userInfo != null && userInfo.RootFolder != null)
215 { 215 {
216 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); 216 InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
217 if (item != null) 217 if (item != null)
218 { 218 {
219 if (LLUUID.Zero == transactionID) 219 if (LLUUID.Zero == transactionID)
220 { 220 {
221 item.inventoryName = name; 221 item.inventoryName = name;
222 item.inventoryDescription = description; 222 item.inventoryDescription = description;
223 item.inventoryNextPermissions = nextOwnerMask; 223 item.inventoryNextPermissions = nextOwnerMask;
224 224
225 userInfo.UpdateItem(remoteClient.AgentId, item); 225 userInfo.UpdateItem(remoteClient.AgentId, item);
226 } 226 }
227 else 227 else
228 { 228 {
229 AgentAssetTransactions transactions 229 AgentAssetTransactions transactions
230 = CommsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId); 230 = CommsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
231 231
232 if (transactions != null) 232 if (transactions != null)
233 { 233 {
234 LLUUID assetID = libsecondlife.LLUUID.Combine(transactionID, remoteClient.SecureSessionId); 234 LLUUID assetID = LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
235 AssetBase asset 235 AssetBase asset
236 = AssetCache.GetAsset( 236 = AssetCache.GetAsset(
237 assetID, (item.assetType == (int)AssetType.Texture ? true : false)); 237 assetID, (item.assetType == (int) AssetType.Texture ? true : false));
238 238
239 if (asset == null) 239 if (asset == null)
240 { 240 {
241 asset = transactions.GetTransactionAsset(transactionID); 241 asset = transactions.GetTransactionAsset(transactionID);
242 } 242 }
243 243
244 if (asset != null && asset.FullID == assetID) 244 if (asset != null && asset.FullID == assetID)
245 { 245 {
246 asset.Name = item.inventoryName; 246 asset.Name = item.inventoryName;
247 asset.Description = item.inventoryDescription; 247 asset.Description = item.inventoryDescription;
248 asset.InvType = (sbyte) item.invType; 248 asset.InvType = (sbyte) item.invType;
249 asset.Type = (sbyte) item.assetType; 249 asset.Type = (sbyte) item.assetType;
250 item.assetID = asset.FullID; 250 item.assetID = asset.FullID;
251 251
252 AssetCache.AddAsset(asset); 252 AssetCache.AddAsset(asset);
253 } 253 }
254 254
255 userInfo.UpdateItem(remoteClient.AgentId, item); 255 userInfo.UpdateItem(remoteClient.AgentId, item);
256 } 256 }
257 } 257 }
258 } 258 }
259 else 259 else
260 { 260 {
261 MainLog.Instance.Warn( 261 MainLog.Instance.Warn(
262 "AGENTINVENTORY", 262 "AGENTINVENTORY",
263 "Item ID " + itemID + " not found for an inventory item update."); 263 "Item ID " + itemID + " not found for an inventory item update.");
264 } 264 }
265 } 265 }
266 else 266 else
267 { 267 {
268 MainLog.Instance.Warn( 268 MainLog.Instance.Warn(
269 "AGENTINVENTORY", 269 "AGENTINVENTORY",
270 "Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); 270 "Agent ID " + remoteClient.AgentId + " not found for an inventory item update.");
271 } 271 }
272 } 272 }
273 273
274 public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, LLUUID newFolderID, string newName) 274 public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID,
275 LLUUID newFolderID, string newName)
275 { 276 {
276 InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(oldItemID); 277 InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(oldItemID);
277 if (item == null) 278 if (item == null)
@@ -308,7 +309,7 @@ namespace OpenSim.Region.Environment.Scenes
308 } 309 }
309 310
310 asset.Name = (newName.Length == 0) ? item.inventoryName : newName; 311 asset.Name = (newName.Length == 0) ? item.inventoryName : newName;
311 312
312 // TODO: preserve current permissions? 313 // TODO: preserve current permissions?
313 CreateNewInventoryItem(remoteClient, newFolderID, callbackID, asset, item.inventoryNextPermissions); 314 CreateNewInventoryItem(remoteClient, newFolderID, callbackID, asset, item.inventoryNextPermissions);
314 } 315 }
@@ -325,12 +326,13 @@ namespace OpenSim.Region.Environment.Scenes
325 return asset; 326 return asset;
326 } 327 }
327 328
328 public void MoveInventoryItem(IClientAPI remoteClient,LLUUID folderID, LLUUID itemID, int length, string newName) 329 public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length,
330 string newName)
329 { 331 {
330 MainLog.Instance.Verbose( 332 MainLog.Instance.Verbose(
331 "AGENTINVENTORY", 333 "AGENTINVENTORY",
332 "Moving item for " + remoteClient.AgentId.ToString()); 334 "Moving item for " + remoteClient.AgentId.ToString());
333 335
334 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 336 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
335 if (userInfo == null) 337 if (userInfo == null)
336 { 338 {
@@ -364,8 +366,6 @@ namespace OpenSim.Region.Environment.Scenes
364 MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + itemID.ToString() + ", no root folder"); 366 MainLog.Instance.Warn("AGENTINVENTORY", "Failed to find item " + itemID.ToString() + ", no root folder");
365 return; 367 return;
366 } 368 }
367
368
369 } 369 }
370 370
371 private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID, 371 private void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID folderID, uint callbackID,
@@ -406,7 +406,8 @@ namespace OpenSim.Region.Environment.Scenes
406 /// <param name="wearableType"></param> 406 /// <param name="wearableType"></param>
407 /// <param name="nextOwnerMask"></param> 407 /// <param name="nextOwnerMask"></param>
408 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, 408 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID,
409 uint callbackID, string description, string name, sbyte invType, sbyte assetType, 409 uint callbackID, string description, string name, sbyte invType,
410 sbyte assetType,
410 byte wearableType, uint nextOwnerMask) 411 byte wearableType, uint nextOwnerMask)
411 { 412 {
412 if (transActionID == LLUUID.Zero) 413 if (transActionID == LLUUID.Zero)
@@ -437,8 +438,8 @@ namespace OpenSim.Region.Environment.Scenes
437 { 438 {
438 if (ent is SceneObjectGroup) 439 if (ent is SceneObjectGroup)
439 { 440 {
440 if (((SceneObjectGroup)ent).HasChildPrim(localID)) 441 if (((SceneObjectGroup) ent).HasChildPrim(localID))
441 return (SceneObjectGroup)ent; 442 return (SceneObjectGroup) ent;
442 } 443 }
443 } 444 }
444 return null; 445 return null;
@@ -491,13 +492,13 @@ namespace OpenSim.Region.Environment.Scenes
491 else 492 else
492 { 493 {
493 MainLog.Instance.Warn( 494 MainLog.Instance.Warn(
494 "PRIMINVENTORY", 495 "PRIMINVENTORY",
495 "Removal of item {0} requested of prim {1} but this prim does not exist", 496 "Removal of item {0} requested of prim {1} but this prim does not exist",
496 itemID, 497 itemID,
497 localID); 498 localID);
498 } 499 }
499 } 500 }
500 501
501 /// <summary> 502 /// <summary>
502 /// Update an item in a prim (task) inventory. 503 /// Update an item in a prim (task) inventory.
503 /// This method does not handle scripts, <see>RezScript(IClientAPI, LLUUID, unit)</see> 504 /// This method does not handle scripts, <see>RezScript(IClientAPI, LLUUID, unit)</see>
@@ -506,7 +507,7 @@ namespace OpenSim.Region.Environment.Scenes
506 /// <param name="itemID"></param> 507 /// <param name="itemID"></param>
507 /// <param name="folderID"></param> 508 /// <param name="folderID"></param>
508 /// <param name="primLocalID"></param> 509 /// <param name="primLocalID"></param>
509 public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, 510 public void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID,
510 uint primLocalID) 511 uint primLocalID)
511 { 512 {
512 SceneObjectGroup group = GetGroupByPrim(primLocalID); 513 SceneObjectGroup group = GetGroupByPrim(primLocalID);
@@ -515,17 +516,17 @@ namespace OpenSim.Region.Environment.Scenes
515 // TODO Retrieve itemID from client's inventory to pass on 516 // TODO Retrieve itemID from client's inventory to pass on
516 //group.AddInventoryItem(rmoteClient, primLocalID, null); 517 //group.AddInventoryItem(rmoteClient, primLocalID, null);
517 MainLog.Instance.Verbose( 518 MainLog.Instance.Verbose(
518 "PRIMINVENTORY", 519 "PRIMINVENTORY",
519 "UpdateTaskInventory called with script {0}, folder {1}, primLocalID {2}, user {3}", 520 "UpdateTaskInventory called with script {0}, folder {1}, primLocalID {2}, user {3}",
520 itemID, folderID, primLocalID, remoteClient.Name); 521 itemID, folderID, primLocalID, remoteClient.Name);
521 } 522 }
522 else 523 else
523 { 524 {
524 MainLog.Instance.Warn( 525 MainLog.Instance.Warn(
525 "PRIMINVENTORY", 526 "PRIMINVENTORY",
526 "Update with script {0} requested of prim {1} for {2} but this prim does not exist", 527 "Update with script {0} requested of prim {1} for {2} but this prim does not exist",
527 itemID, primLocalID, remoteClient.Name); 528 itemID, primLocalID, remoteClient.Name);
528 } 529 }
529 } 530 }
530 531
531 /// <summary> 532 /// <summary>
@@ -551,7 +552,7 @@ namespace OpenSim.Region.Environment.Scenes
551 { 552 {
552 isTexture = true; 553 isTexture = true;
553 } 554 }
554 555
555 AssetBase rezAsset = AssetCache.GetAsset(item.assetID, isTexture); 556 AssetBase rezAsset = AssetCache.GetAsset(item.assetID, isTexture);
556 557
557 if (rezAsset != null) 558 if (rezAsset != null)
@@ -569,18 +570,18 @@ namespace OpenSim.Region.Environment.Scenes
569 // TODO: do we care about the value of this bool? 570 // TODO: do we care about the value of this bool?
570 group.AddInventoryItem(remoteClient, localID, item, copyID); 571 group.AddInventoryItem(remoteClient, localID, item, copyID);
571 group.GetProperites(remoteClient); 572 group.GetProperites(remoteClient);
572 573
573 MainLog.Instance.Verbose( 574 MainLog.Instance.Verbose(
574 "PRIMINVENTORY", 575 "PRIMINVENTORY",
575 "Rezzed script {0} (asset {1}) into prim {2} for user {3}", 576 "Rezzed script {0} (asset {1}) into prim {2} for user {3}",
576 item.inventoryName, rezAsset.FullID, localID, remoteClient.Name); 577 item.inventoryName, rezAsset.FullID, localID, remoteClient.Name);
577 } 578 }
578 else 579 else
579 { 580 {
580 MainLog.Instance.Warn( 581 MainLog.Instance.Warn(
581 "PRIMINVENTORY", 582 "PRIMINVENTORY",
582 "Could not rez script {0} into prim {1} for user {2}" 583 "Could not rez script {0} into prim {1} for user {2}"
583 + " because the prim could not be found in the region!", 584 + " because the prim could not be found in the region!",
584 item.inventoryName, localID, remoteClient.Name); 585 item.inventoryName, localID, remoteClient.Name);
585 } 586 }
586 } 587 }
@@ -589,7 +590,7 @@ namespace OpenSim.Region.Environment.Scenes
589 MainLog.Instance.Warn( 590 MainLog.Instance.Warn(
590 "PRIMINVENTORY", 591 "PRIMINVENTORY",
591 "Could not rez script {0} into prim {1} for user {2}" 592 "Could not rez script {0} into prim {1} for user {2}"
592 + " because the item asset {3} could not be found!", 593 + " because the item asset {3} could not be found!",
593 item.inventoryName, localID, item.assetID, remoteClient.Name); 594 item.inventoryName, localID, item.assetID, remoteClient.Name);
594 } 595 }
595 } 596 }
@@ -638,7 +639,8 @@ namespace OpenSim.Region.Environment.Scenes
638 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID)) 639 if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
639 { 640 {
640 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString(); 641 string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
641 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 642 CachedUserInfo userInfo =
643 CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
642 if (userInfo != null) 644 if (userInfo != null)
643 { 645 {
644 AssetBase asset = CreateAsset( 646 AssetBase asset = CreateAsset(
@@ -661,9 +663,10 @@ namespace OpenSim.Region.Environment.Scenes
661 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; 663 item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
662 item.inventoryCurrentPermissions = 2147483647; 664 item.inventoryCurrentPermissions = 2147483647;
663 item.inventoryNextPermissions = 2147483647; 665 item.inventoryNextPermissions = 2147483647;
664 item.inventoryEveryOnePermissions = ((SceneObjectGroup)selectedEnt).RootPart.EveryoneMask; 666 item.inventoryEveryOnePermissions =
665 item.inventoryBasePermissions = ((SceneObjectGroup)selectedEnt).RootPart.BaseMask; 667 ((SceneObjectGroup) selectedEnt).RootPart.EveryoneMask;
666 item.inventoryCurrentPermissions = ((SceneObjectGroup)selectedEnt).RootPart.OwnerMask; 668 item.inventoryBasePermissions = ((SceneObjectGroup) selectedEnt).RootPart.BaseMask;
669 item.inventoryCurrentPermissions = ((SceneObjectGroup) selectedEnt).RootPart.OwnerMask;
667 670
668 userInfo.AddItem(remoteClient.AgentId, item); 671 userInfo.AddItem(remoteClient.AgentId, item);
669 remoteClient.SendInventoryItemCreateUpdate(item); 672 remoteClient.SendInventoryItemCreateUpdate(item);
@@ -730,20 +733,20 @@ namespace OpenSim.Region.Environment.Scenes
730 //bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim); 733 //bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0)&& m_physicalPrim);
731 //if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 734 //if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
732 //{ 735 //{
733 //PrimitiveBaseShape pbs = rootPart.Shape; 736 //PrimitiveBaseShape pbs = rootPart.Shape;
734 //rootPart.PhysActor = PhysicsScene.AddPrimShape( 737 //rootPart.PhysActor = PhysicsScene.AddPrimShape(
735 //rootPart.Name, 738 //rootPart.Name,
736 //pbs, 739 //pbs,
737 //new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, 740 //new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
738 // rootPart.AbsolutePosition.Z), 741 // rootPart.AbsolutePosition.Z),
739 //new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 742 //new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
740 //new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 743 //new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
741 // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); 744 // rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
742 745
743 // rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); 746 // rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
744 747
745 // } 748 // }
746 rootPart.ScheduleFullUpdate(); 749 rootPart.ScheduleFullUpdate();
747 } 750 }
748 } 751 }
749} 752} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 6a7c266..999b70f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -29,8 +29,6 @@ using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.UserManagement;
33using OpenSim.Framework.Console;
34 32
35namespace OpenSim.Region.Environment.Scenes 33namespace OpenSim.Region.Environment.Scenes
36{ 34{
@@ -45,7 +43,8 @@ namespace OpenSim.Region.Environment.Scenes
45 /// <param name="action">The action to be performed</param> 43 /// <param name="action">The action to be performed</param>
46 /// <param name="north">Distance from the north border where the cursor is located</param> 44 /// <param name="north">Distance from the north border where the cursor is located</param>
47 /// <param name="west">Distance from the west border where the cursor is located</param> 45 /// <param name="west">Distance from the west border where the cursor is located</param>
48 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, float south, float east, 46 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
47 float south, float east,
49 IClientAPI remoteUser) 48 IClientAPI remoteUser)
50 { 49 {
51 // Do a permissions check before allowing terraforming. 50 // Do a permissions check before allowing terraforming.
@@ -157,7 +156,7 @@ namespace OpenSim.Region.Environment.Scenes
157 } 156 }
158 } 157 }
159 } 158 }
160 159
161 public void ProcessAvatarPickerRequest(IClientAPI client, LLUUID avatarID, LLUUID RequestID, string query) 160 public void ProcessAvatarPickerRequest(IClientAPI client, LLUUID avatarID, LLUUID RequestID, string query)
162 { 161 {
163 //EventManager.TriggerAvatarPickerRequest(); 162 //EventManager.TriggerAvatarPickerRequest();
@@ -166,13 +165,14 @@ namespace OpenSim.Region.Environment.Scenes
166 AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); 165 AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query);
167 166
168 AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket(); 167 AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket();
169 AvatarPickerReplyPacket.DataBlock[] searchData = new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count]; 168 AvatarPickerReplyPacket.DataBlock[] searchData =
169 new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count];
170 AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); 170 AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock();
171 171
172 agentData.AgentID = avatarID; 172 agentData.AgentID = avatarID;
173 agentData.QueryID = RequestID; 173 agentData.QueryID = RequestID;
174 replyPacket.AgentData = agentData; 174 replyPacket.AgentData = agentData;
175 byte[] bytes = new byte[AvatarResponses.Count * 32]; 175 byte[] bytes = new byte[AvatarResponses.Count*32];
176 176
177 int i = 0; 177 int i = 0;
178 foreach (AvatarPickerAvatar item in AvatarResponses) 178 foreach (AvatarPickerAvatar item in AvatarResponses)
@@ -180,10 +180,9 @@ namespace OpenSim.Region.Environment.Scenes
180 LLUUID translatedIDtem = item.AvatarID; 180 LLUUID translatedIDtem = item.AvatarID;
181 searchData[i] = new AvatarPickerReplyPacket.DataBlock(); 181 searchData[i] = new AvatarPickerReplyPacket.DataBlock();
182 searchData[i].AvatarID = translatedIDtem; 182 searchData[i].AvatarID = translatedIDtem;
183 searchData[i].FirstName = Helpers.StringToField((string)item.firstName); 183 searchData[i].FirstName = Helpers.StringToField((string) item.firstName);
184 searchData[i].LastName = Helpers.StringToField((string)item.lastName); 184 searchData[i].LastName = Helpers.StringToField((string) item.lastName);
185 i++; 185 i++;
186
187 } 186 }
188 if (AvatarResponses.Count == 0) 187 if (AvatarResponses.Count == 0)
189 { 188 {
@@ -193,4 +192,4 @@ namespace OpenSim.Region.Environment.Scenes
193 client.SendAvatarPickerReply(replyPacket); 192 client.SendAvatarPickerReply(replyPacket);
194 } 193 }
195 } 194 }
196} 195} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 0144c4c..c0fda61 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -27,27 +27,28 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.Drawing;
31using System.Net; 31using System.Drawing.Imaging;
32using System.Threading; 32using System.Threading;
33using System.Timers; 33using System.Timers;
34using System.Xml;
35using Axiom.Math; 34using Axiom.Math;
36using libsecondlife; 35using libsecondlife;
36using libsecondlife.Packets;
37using OpenJPEGNet;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache; 40using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Console; 41using OpenSim.Framework.Console;
41using OpenSim.Region.Environment.LandManagement;
42using OpenSim.Framework.Servers; 42using OpenSim.Framework.Servers;
43using OpenSim.Region.Capabilities;
44using OpenSim.Region.Environment.Interfaces; 43using OpenSim.Region.Environment.Interfaces;
44using OpenSim.Region.Environment.LandManagement;
45using OpenSim.Region.Environment.Modules; 45using OpenSim.Region.Environment.Modules;
46using OpenSim.Region.Environment.Scenes.Scripting; 46using OpenSim.Region.Environment.Scenes.Scripting;
47using OpenSim.Region.Environment.Types;
48using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.Physics.Manager;
49using OpenSim.Region.Terrain; 48using OpenSim.Region.Terrain;
50using Timer = System.Timers.Timer; 49using Caps=OpenSim.Region.Capabilities.Caps;
50using Image=System.Drawing.Image;
51using Timer=System.Timers.Timer;
51 52
52namespace OpenSim.Region.Environment.Scenes 53namespace OpenSim.Region.Environment.Scenes
53{ 54{
@@ -56,6 +57,7 @@ namespace OpenSim.Region.Environment.Scenes
56 public partial class Scene : SceneBase 57 public partial class Scene : SceneBase
57 { 58 {
58 #region Fields 59 #region Fields
60
59 protected Timer m_heartbeatTimer = new Timer(); 61 protected Timer m_heartbeatTimer = new Timer();
60 protected Timer m_restartWaitTimer = new Timer(); 62 protected Timer m_restartWaitTimer = new Timer();
61 63
@@ -88,7 +90,7 @@ namespace OpenSim.Region.Environment.Scenes
88 protected SceneCommunicationService m_sceneGridService; 90 protected SceneCommunicationService m_sceneGridService;
89 protected SceneXmlLoader m_sceneXmlLoader; 91 protected SceneXmlLoader m_sceneXmlLoader;
90 92
91 protected Dictionary<LLUUID, OpenSim.Region.Capabilities.Caps> m_capsHandlers = new Dictionary<LLUUID, OpenSim.Region.Capabilities.Caps>(); 93 protected Dictionary<LLUUID, Caps> m_capsHandlers = new Dictionary<LLUUID, Caps>();
92 protected BaseHttpServer httpListener; 94 protected BaseHttpServer httpListener;
93 95
94 protected Dictionary<string, IRegionModule> Modules = new Dictionary<string, IRegionModule>(); 96 protected Dictionary<string, IRegionModule> Modules = new Dictionary<string, IRegionModule>();
@@ -122,6 +124,7 @@ namespace OpenSim.Region.Environment.Scenes
122 private int m_update_terrain = 50; 124 private int m_update_terrain = 50;
123 private int m_update_land = 1; 125 private int m_update_land = 1;
124 private int m_update_avatars = 1; 126 private int m_update_avatars = 1;
127
125 #endregion 128 #endregion
126 129
127 #region Properties 130 #region Properties
@@ -145,6 +148,7 @@ namespace OpenSim.Region.Environment.Scenes
145 set { m_innerScene.PhysicsScene = value; } 148 set { m_innerScene.PhysicsScene = value; }
146 get { return (m_innerScene.PhysicsScene); } 149 get { return (m_innerScene.PhysicsScene); }
147 } 150 }
151
148 // This gets locked so things stay thread safe. 152 // This gets locked so things stay thread safe.
149 public object SyncRoot 153 public object SyncRoot
150 { 154 {
@@ -204,7 +208,8 @@ namespace OpenSim.Region.Environment.Scenes
204 208
205 #region Constructors 209 #region Constructors
206 210
207 public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, 211 public Scene(RegionInfo regInfo, AgentCircuitManager authen, PermissionManager permissionManager,
212 CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
208 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, 213 AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
209 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SendTasksToChild) 214 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SendTasksToChild)
210 { 215 {
@@ -230,9 +235,11 @@ namespace OpenSim.Region.Environment.Scenes
230 m_LandManager = new LandManager(this, m_regInfo); 235 m_LandManager = new LandManager(this, m_regInfo);
231 236
232 //Bind Storage Manager functions to some land manager functions for this scene 237 //Bind Storage Manager functions to some land manager functions for this scene
233 EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); 238 EventManager.OnLandObjectAdded +=
234 EventManager.OnLandObjectRemoved += new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); 239 new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
235 240 EventManager.OnLandObjectRemoved +=
241 new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
242
236 m_estateManager = new EstateManager(this, m_regInfo); 243 m_estateManager = new EstateManager(this, m_regInfo);
237 244
238 m_permissionManager = permissionManager; 245 m_permissionManager = permissionManager;
@@ -258,7 +265,7 @@ namespace OpenSim.Region.Environment.Scenes
258 m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); 265 m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>();
259 266
260 MainLog.Instance.Verbose("SCENE", "Creating LandMap"); 267 MainLog.Instance.Verbose("SCENE", "Creating LandMap");
261 Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); 268 Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY);
262 269
263 ScenePresence.LoadAnims(); 270 ScenePresence.LoadAnims();
264 271
@@ -276,7 +283,7 @@ namespace OpenSim.Region.Environment.Scenes
276 protected virtual void RegisterDefaultSceneEvents() 283 protected virtual void RegisterDefaultSceneEvents()
277 { 284 {
278 m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts; 285 m_eventManager.OnParcelPrimCountAdd += m_LandManager.addPrimToLandPrimCounts;
279 m_eventManager.OnParcelPrimCountUpdate += this.addPrimsToParcelCounts; 286 m_eventManager.OnParcelPrimCountUpdate += addPrimsToParcelCounts;
280 m_eventManager.OnPermissionError += SendPermissionAlert; 287 m_eventManager.OnPermissionError += SendPermissionAlert;
281 } 288 }
282 289
@@ -295,68 +302,65 @@ namespace OpenSim.Region.Environment.Scenes
295 302
296 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 303 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
297 { 304 {
298 for (int i = 0; i < m_neighbours.Count; i++) 305 for (int i = 0; i < m_neighbours.Count; i++)
306 {
307 // The purpose of this loop is to re-update the known neighbors
308 // when another region comes up on top of another one.
309 // The latest region in that location ends up in the
310 // 'known neighbors list'
311 // Additionally, the commFailTF property gets reset to false.
312 if (m_neighbours[i].RegionHandle == otherRegion.RegionHandle)
299 { 313 {
300 // The purpose of this loop is to re-update the known neighbors 314 lock (m_neighbours)
301 // when another region comes up on top of another one.
302 // The latest region in that location ends up in the
303 // 'known neighbors list'
304 // Additionally, the commFailTF property gets reset to false.
305 if (m_neighbours[i].RegionHandle == otherRegion.RegionHandle)
306 { 315 {
307 lock (m_neighbours) 316 m_neighbours[i] = otherRegion;
308 {
309 m_neighbours[i] = otherRegion;
310 }
311 } 317 }
312 } 318 }
319 }
313 320
314 // If the value isn't in the neighbours, add it. 321 // If the value isn't in the neighbours, add it.
315 // If the RegionInfo isn't exact but is for the same XY World location, 322 // If the RegionInfo isn't exact but is for the same XY World location,
316 // then the above loop will fix that. 323 // then the above loop will fix that.
317 324
318 if (!(m_neighbours.Contains(otherRegion))) 325 if (!(m_neighbours.Contains(otherRegion)))
326 {
327 lock (m_neighbours)
319 { 328 {
320 lock (m_neighbours) 329 m_neighbours.Add(otherRegion);
321 {
322 m_neighbours.Add(otherRegion);
323 }
324 } 330 }
325 if ((Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1) && (Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1)) 331 }
332 if ((Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1) &&
333 (Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1))
326 { 334 {
327 try 335 try
328 { 336 {
329
330 ForEachScenePresence(delegate(ScenePresence agent) 337 ForEachScenePresence(delegate(ScenePresence agent)
331 { 338 {
332 // If agent is a root agent. 339 // If agent is a root agent.
333 if (!agent.IsChildAgent) 340 if (!agent.IsChildAgent)
334 { 341 {
335 342 //agent.ControllingClient.new
336 //agent.ControllingClient.new 343 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
337 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); 344 InformClientOfNeighbor(agent, otherRegion);
338 InformClientOfNeighbor(agent, otherRegion); 345 }
339 } 346 }
340 } 347 );
341
342 );
343 } 348 }
344 catch (System.NullReferenceException) 349 catch (NullReferenceException)
345 { 350 {
346 // This means that we're not booted up completely yet. 351 // This means that we're not booted up completely yet.
347 // This shouldn't happen too often anymore. 352 // This shouldn't happen too often anymore.
348 MainLog.Instance.Error("SCENE", "Couldn't inform client of regionup because we got a null reference exception"); 353 MainLog.Instance.Error("SCENE",
354 "Couldn't inform client of regionup because we got a null reference exception");
349 } 355 }
350 } 356 }
351 else 357 else
352 { 358 {
353 MainLog.Instance.Verbose("INTERGRID", "Got notice about far away Region: " + otherRegion.RegionName.ToString() + 359 MainLog.Instance.Verbose("INTERGRID",
354 " at (" + otherRegion.RegionLocX.ToString() + ", " + otherRegion.RegionLocY.ToString() + ")" ); 360 "Got notice about far away Region: " + otherRegion.RegionName.ToString() +
361 " at (" + otherRegion.RegionLocX.ToString() + ", " +
362 otherRegion.RegionLocY.ToString() + ")");
355 } 363 }
356
357
358
359
360 } 364 }
361 return true; 365 return true;
362 } 366 }
@@ -379,11 +383,11 @@ namespace OpenSim.Region.Environment.Scenes
379 { 383 {
380 // Now we figure out what to set the timer to that does the notifications and calls, RestartNow() 384 // Now we figure out what to set the timer to that does the notifications and calls, RestartNow()
381 m_restartTimer.Interval = 15000; 385 m_restartTimer.Interval = 15000;
382 m_incrementsof15seconds = (int)seconds / 15; 386 m_incrementsof15seconds = (int) seconds/15;
383 m_RestartTimerCounter = 0; 387 m_RestartTimerCounter = 0;
384 m_restartTimer.AutoReset = true; 388 m_restartTimer.AutoReset = true;
385 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); 389 m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
386 MainLog.Instance.Error("REGION", "Restarting Region in " + (seconds / 60) + " minutes"); 390 MainLog.Instance.Error("REGION", "Restarting Region in " + (seconds/60) + " minutes");
387 m_restartTimer.Start(); 391 m_restartTimer.Start();
388 SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes"); 392 SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes");
389 } 393 }
@@ -399,7 +403,8 @@ namespace OpenSim.Region.Environment.Scenes
399 if (m_RestartTimerCounter <= m_incrementsof15seconds) 403 if (m_RestartTimerCounter <= m_incrementsof15seconds)
400 { 404 {
401 if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7) 405 if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7)
402 SendGeneralAlert(RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds"); 406 SendGeneralAlert(RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter)*15) +
407 " seconds");
403 } 408 }
404 else 409 else
405 { 410 {
@@ -432,21 +437,19 @@ namespace OpenSim.Region.Environment.Scenes
432 { 437 {
433 try 438 try
434 { 439 {
435
436 ForEachScenePresence(delegate(ScenePresence agent) 440 ForEachScenePresence(delegate(ScenePresence agent)
437 { 441 {
438 // If agent is a root agent. 442 // If agent is a root agent.
439 if (!agent.IsChildAgent) 443 if (!agent.IsChildAgent)
440 { 444 {
441 //agent.ControllingClient.new 445 //agent.ControllingClient.new
442 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); 446 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
443 InformClientOfNeighbor(agent, region); 447 InformClientOfNeighbor(agent, region);
444 } 448 }
445 } 449 }
446 450 );
447 );
448 } 451 }
449 catch (System.NullReferenceException) 452 catch (NullReferenceException)
450 { 453 {
451 // This means that we're not booted up completely yet. 454 // This means that we're not booted up completely yet.
452 // This shouldn't happen too often anymore. 455 // This shouldn't happen too often anymore.
@@ -464,24 +467,22 @@ namespace OpenSim.Region.Environment.Scenes
464 MainLog.Instance.Warn("SCENE", "Closing down the single simulator: " + RegionInfo.RegionName); 467 MainLog.Instance.Warn("SCENE", "Closing down the single simulator: " + RegionInfo.RegionName);
465 // Kick all ROOT agents with the message, 'The simulator is going down' 468 // Kick all ROOT agents with the message, 'The simulator is going down'
466 ForEachScenePresence(delegate(ScenePresence avatar) 469 ForEachScenePresence(delegate(ScenePresence avatar)
467 { 470 {
468 if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) 471 if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle))
469 avatar.KnownChildRegions.Remove(RegionInfo.RegionHandle); 472 avatar.KnownChildRegions.Remove(RegionInfo.RegionHandle);
470 473
471 if (!avatar.IsChildAgent) 474 if (!avatar.IsChildAgent)
472 avatar.ControllingClient.Kick("The simulator is going down."); 475 avatar.ControllingClient.Kick("The simulator is going down.");
473 476
474 avatar.ControllingClient.OutPacket(new libsecondlife.Packets.DisableSimulatorPacket(), ThrottleOutPacketType.Task); 477 avatar.ControllingClient.OutPacket(new DisableSimulatorPacket(),
475 }); 478 ThrottleOutPacketType.Task);
479 });
476 480
477 // Wait here, or the kick messages won't actually get to the agents before the scene terminates. 481 // Wait here, or the kick messages won't actually get to the agents before the scene terminates.
478 Thread.Sleep(500); 482 Thread.Sleep(500);
479 483
480 // Stop all client threads. 484 // Stop all client threads.
481 ForEachScenePresence(delegate(ScenePresence avatar) 485 ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(true); });
482 {
483 avatar.ControllingClient.Close(true);
484 });
485 // Stop updating the scene objects and agents. 486 // Stop updating the scene objects and agents.
486 m_heartbeatTimer.Close(); 487 m_heartbeatTimer.Close();
487 // close the inner scene 488 // close the inner scene
@@ -509,7 +510,7 @@ namespace OpenSim.Region.Environment.Scenes
509 public void StartTimer() 510 public void StartTimer()
510 { 511 {
511 m_heartbeatTimer.Enabled = true; 512 m_heartbeatTimer.Enabled = true;
512 m_heartbeatTimer.Interval = (int)(m_timespan * 1000); 513 m_heartbeatTimer.Interval = (int) (m_timespan*1000);
513 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); 514 m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
514 } 515 }
515 516
@@ -555,30 +556,30 @@ namespace OpenSim.Region.Environment.Scenes
555 if (m_frame == Int32.MaxValue) 556 if (m_frame == Int32.MaxValue)
556 m_frame = 0; 557 m_frame = 0;
557 558
558 if (m_frame % m_update_physics == 0) 559 if (m_frame%m_update_physics == 0)
559 m_innerScene.UpdatePreparePhysics(); 560 m_innerScene.UpdatePreparePhysics();
560 561
561 if (m_frame % m_update_entitymovement == 0) 562 if (m_frame%m_update_entitymovement == 0)
562 m_innerScene.UpdateEntityMovement(); 563 m_innerScene.UpdateEntityMovement();
563 564
564 if (m_frame % m_update_physics == 0) 565 if (m_frame%m_update_physics == 0)
565 physicsFPS = m_innerScene.UpdatePhysics( 566 physicsFPS = m_innerScene.UpdatePhysics(
566 Math.Max(SinceLastFrame.TotalSeconds, m_timespan) 567 Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
567 ); 568 );
568 569
569 if (m_frame % m_update_entities == 0) 570 if (m_frame%m_update_entities == 0)
570 m_innerScene.UpdateEntities(); 571 m_innerScene.UpdateEntities();
571 572
572 if (m_frame % m_update_events == 0) 573 if (m_frame%m_update_events == 0)
573 UpdateEvents(); 574 UpdateEvents();
574 575
575 if (m_frame % m_update_backup == 0) 576 if (m_frame%m_update_backup == 0)
576 UpdateStorageBackup(); 577 UpdateStorageBackup();
577 578
578 if (m_frame % m_update_terrain == 0) 579 if (m_frame%m_update_terrain == 0)
579 UpdateTerrain(); 580 UpdateTerrain();
580 581
581 if (m_frame % m_update_land == 0) 582 if (m_frame%m_update_land == 0)
582 UpdateLand(); 583 UpdateLand();
583 584
584 // if (m_frame%m_update_avatars == 0) 585 // if (m_frame%m_update_avatars == 0)
@@ -592,7 +593,6 @@ namespace OpenSim.Region.Environment.Scenes
592 m_statsReporter.SetChildAgents(m_innerScene.GetChildAgentCount()); 593 m_statsReporter.SetChildAgents(m_innerScene.GetChildAgentCount());
593 m_statsReporter.SetObjects(m_innerScene.GetTotalObjects()); 594 m_statsReporter.SetObjects(m_innerScene.GetTotalObjects());
594 m_statsReporter.SetActiveObjects(m_innerScene.GetActiveObjects()); 595 m_statsReporter.SetActiveObjects(m_innerScene.GetActiveObjects());
595
596 } 596 }
597 catch (NotImplementedException) 597 catch (NotImplementedException)
598 { 598 {
@@ -606,10 +606,11 @@ namespace OpenSim.Region.Environment.Scenes
606 { 606 {
607 updateLock.ReleaseMutex(); 607 updateLock.ReleaseMutex();
608 608
609 m_timedilation = m_timespan / (float)SinceLastFrame.TotalSeconds; 609 m_timedilation = m_timespan/(float) SinceLastFrame.TotalSeconds;
610 m_lastupdate = DateTime.Now; 610 m_lastupdate = DateTime.Now;
611 } 611 }
612 } 612 }
613
613 //Updates the time in the viewer. 614 //Updates the time in the viewer.
614 private void UpdateInWorldTime() 615 private void UpdateInWorldTime()
615 { 616 {
@@ -631,7 +632,7 @@ namespace OpenSim.Region.Environment.Scenes
631 } 632 }
632 } 633 }
633 634
634 private void SendSimStatsPackets(libsecondlife.Packets.SimStatsPacket pack) 635 private void SendSimStatsPackets(SimStatsPacket pack)
635 { 636 {
636 List<ScenePresence> StatSendAgents = GetScenePresences(); 637 List<ScenePresence> StatSendAgents = GetScenePresences();
637 foreach (ScenePresence agent in StatSendAgents) 638 foreach (ScenePresence agent in StatSendAgents)
@@ -639,11 +640,10 @@ namespace OpenSim.Region.Environment.Scenes
639 if (!agent.IsChildAgent) 640 if (!agent.IsChildAgent)
640 { 641 {
641 agent.ControllingClient.OutPacket(pack, ThrottleOutPacketType.Task); 642 agent.ControllingClient.OutPacket(pack, ThrottleOutPacketType.Task);
642
643 } 643 }
644 } 644 }
645
646 } 645 }
646
647 private void UpdateLand() 647 private void UpdateLand()
648 { 648 {
649 if (m_LandManager.landPrimCountTainted) 649 if (m_LandManager.landPrimCountTainted)
@@ -676,7 +676,7 @@ namespace OpenSim.Region.Environment.Scenes
676 { 676 {
677 for (int y = 0; y < 16; y++) 677 for (int y = 0; y < 16; y++)
678 { 678 {
679 if (Terrain.Tainted(x * 16, y * 16)) 679 if (Terrain.Tainted(x*16, y*16))
680 { 680 {
681 client.SendLayerData(x, y, terData); 681 client.SendLayerData(x, y, terData);
682 } 682 }
@@ -724,13 +724,17 @@ namespace OpenSim.Region.Environment.Scenes
724 724
725 public void ExportWorldMap(string fileName) 725 public void ExportWorldMap(string fileName)
726 { 726 {
727 List<MapBlockData> mapBlocks = this.CommsManager.GridService.RequestNeighbourMapBlocks((int)(this.RegionInfo.RegionLocX - 9), (int)(this.RegionInfo.RegionLocY - 9), (int)(this.RegionInfo.RegionLocX + 9), (int)(this.RegionInfo.RegionLocY + 9)); 727 List<MapBlockData> mapBlocks =
728 CommsManager.GridService.RequestNeighbourMapBlocks((int) (RegionInfo.RegionLocX - 9),
729 (int) (RegionInfo.RegionLocY - 9),
730 (int) (RegionInfo.RegionLocX + 9),
731 (int) (RegionInfo.RegionLocY + 9));
728 List<AssetBase> textures = new List<AssetBase>(); 732 List<AssetBase> textures = new List<AssetBase>();
729 List<System.Drawing.Image> bitImages = new List<System.Drawing.Image>(); 733 List<Image> bitImages = new List<Image>();
730 734
731 foreach (MapBlockData mapBlock in mapBlocks) 735 foreach (MapBlockData mapBlock in mapBlocks)
732 { 736 {
733 AssetBase texAsset = this.AssetCache.GetAsset(mapBlock.MapImageId, true); 737 AssetBase texAsset = AssetCache.GetAsset(mapBlock.MapImageId, true);
734 738
735 if (texAsset != null) 739 if (texAsset != null)
736 { 740 {
@@ -738,7 +742,7 @@ namespace OpenSim.Region.Environment.Scenes
738 } 742 }
739 else 743 else
740 { 744 {
741 texAsset = this.AssetCache.GetAsset(mapBlock.MapImageId, true); 745 texAsset = AssetCache.GetAsset(mapBlock.MapImageId, true);
742 if (texAsset != null) 746 if (texAsset != null)
743 { 747 {
744 textures.Add(texAsset); 748 textures.Add(texAsset);
@@ -748,22 +752,22 @@ namespace OpenSim.Region.Environment.Scenes
748 752
749 foreach (AssetBase asset in textures) 753 foreach (AssetBase asset in textures)
750 { 754 {
751 System.Drawing.Image image = OpenJPEGNet.OpenJPEG.DecodeToImage(asset.Data); 755 Image image = OpenJPEG.DecodeToImage(asset.Data);
752 bitImages.Add(image); 756 bitImages.Add(image);
753 } 757 }
754 758
755 System.Drawing.Bitmap mapTexture = new System.Drawing.Bitmap(2560, 2560); 759 Bitmap mapTexture = new Bitmap(2560, 2560);
756 System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(mapTexture); 760 Graphics g = Graphics.FromImage(mapTexture);
757 System.Drawing.SolidBrush sea = new System.Drawing.SolidBrush(System.Drawing.Color.DarkBlue); 761 SolidBrush sea = new SolidBrush(Color.DarkBlue);
758 g.FillRectangle(sea, 0, 0, 2560, 2560); 762 g.FillRectangle(sea, 0, 0, 2560, 2560);
759 763
760 for (int i = 0; i < mapBlocks.Count; i++) 764 for (int i = 0; i < mapBlocks.Count; i++)
761 { 765 {
762 ushort x = (ushort)((mapBlocks[i].X - this.RegionInfo.RegionLocX) + 10); 766 ushort x = (ushort) ((mapBlocks[i].X - RegionInfo.RegionLocX) + 10);
763 ushort y = (ushort)((mapBlocks[i].Y - this.RegionInfo.RegionLocY) + 10); 767 ushort y = (ushort) ((mapBlocks[i].Y - RegionInfo.RegionLocY) + 10);
764 g.DrawImage(bitImages[i], (x * 128), (y * 128), 128, 128); 768 g.DrawImage(bitImages[i], (x*128), (y*128), 128, 128);
765 } 769 }
766 mapTexture.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg); 770 mapTexture.Save(fileName, ImageFormat.Jpeg);
767 } 771 }
768 772
769 /// <summary> 773 /// <summary>
@@ -861,7 +865,7 @@ namespace OpenSim.Region.Environment.Scenes
861 public void loadAllLandObjectsFromStorage() 865 public void loadAllLandObjectsFromStorage()
862 { 866 {
863 MainLog.Instance.Verbose("SCENE", "Loading land objects from storage"); 867 MainLog.Instance.Verbose("SCENE", "Loading land objects from storage");
864 List<Framework.LandData> landData = m_storageManager.DataStore.LoadLandObjects(RegionInfo.RegionID); 868 List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(RegionInfo.RegionID);
865 if (landData.Count == 0) 869 if (landData.Count == 0)
866 { 870 {
867 m_LandManager.NoLandDataFromStorage(); 871 m_LandManager.NoLandDataFromStorage();
@@ -871,7 +875,7 @@ namespace OpenSim.Region.Environment.Scenes
871 m_LandManager.IncomingLandObjectsFromStorage(landData); 875 m_LandManager.IncomingLandObjectsFromStorage(landData);
872 } 876 }
873 } 877 }
874 878
875 #endregion 879 #endregion
876 880
877 #region Primitives Methods 881 #region Primitives Methods
@@ -889,8 +893,8 @@ namespace OpenSim.Region.Environment.Scenes
889 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); 893 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
890 rootPart.ApplySanePermissions(); 894 rootPart.ApplySanePermissions();
891 895
892 bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); 896 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
893 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 897 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
894 rootPart.PhysActor = PhysicsScene.AddPrimShape( 898 rootPart.PhysActor = PhysicsScene.AddPrimShape(
895 rootPart.Name, 899 rootPart.Name,
896 rootPart.Shape, 900 rootPart.Shape,
@@ -931,9 +935,8 @@ namespace OpenSim.Region.Environment.Scenes
931 935
932 if (PermissionsMngr.CanRezObject(ownerID, pos)) 936 if (PermissionsMngr.CanRezObject(ownerID, pos))
933 { 937 {
934
935 EntityIntersection rayTracing = null; 938 EntityIntersection rayTracing = null;
936 ScenePresence presence = ((ScenePresence)GetScenePresence(ownerID)); 939 ScenePresence presence = ((ScenePresence) GetScenePresence(ownerID));
937 if (presence != null) 940 if (presence != null)
938 { 941 {
939 Vector3 CameraPosition = presence.CameraPosition; 942 Vector3 CameraPosition = presence.CameraPosition;
@@ -941,14 +944,13 @@ namespace OpenSim.Region.Environment.Scenes
941 944
942 float raydistance = m_innerScene.Vector3Distance(CameraPosition, rayEnd); 945 float raydistance = m_innerScene.Vector3Distance(CameraPosition, rayEnd);
943 946
944 Vector3 rayDirection = new Vector3(rayEnd.x / raydistance, rayEnd.y / raydistance, rayEnd.z / raydistance); 947 Vector3 rayDirection = new Vector3(rayEnd.x/raydistance, rayEnd.y/raydistance, rayEnd.z/raydistance);
945 948
946 Ray rezRay = new Ray(CameraPosition, rayDirection); 949 Ray rezRay = new Ray(CameraPosition, rayDirection);
947 950
948 Vector3 RezDirectionFromCamera = rezRay.Direction; 951 Vector3 RezDirectionFromCamera = rezRay.Direction;
949 952
950 rayTracing = m_innerScene.GetClosestIntersectingPrim(rezRay); 953 rayTracing = m_innerScene.GetClosestIntersectingPrim(rezRay);
951
952 } 954 }
953 955
954 if ((rayTracing != null) && (rayTracing.HitTF)) 956 if ((rayTracing != null) && (rayTracing.HitTF))
@@ -957,7 +959,8 @@ namespace OpenSim.Region.Environment.Scenes
957 // We will rez the object somewhere close to the prim. Better math needed. This is a Stub 959 // We will rez the object somewhere close to the prim. Better math needed. This is a Stub
958 //Vector3 Newpos = new Vector3(rayTracing.obj.AbsolutePosition.X,rayTracing.obj.AbsolutePosition.Y,rayTracing.obj.AbsolutePosition.Z); 960 //Vector3 Newpos = new Vector3(rayTracing.obj.AbsolutePosition.X,rayTracing.obj.AbsolutePosition.Y,rayTracing.obj.AbsolutePosition.Z);
959 Vector3 Newpos = rayTracing.ipoint; 961 Vector3 Newpos = rayTracing.ipoint;
960 Vector3 NewScale = new Vector3(rayTracing.obj.Scale.X, rayTracing.obj.Scale.Y, rayTracing.obj.Scale.Z); 962 Vector3 NewScale =
963 new Vector3(rayTracing.obj.Scale.X, rayTracing.obj.Scale.Y, rayTracing.obj.Scale.Z);
961 964
962 Quaternion ParentRot = rayTracing.obj.ParentGroup.Rotation; 965 Quaternion ParentRot = rayTracing.obj.ParentGroup.Rotation;
963 //Quaternion ParentRot = new Quaternion(primParentRot.W,primParentRot.X,primParentRot.Y,primParentRot.Z); 966 //Quaternion ParentRot = new Quaternion(primParentRot.W,primParentRot.X,primParentRot.Y,primParentRot.Z);
@@ -965,7 +968,7 @@ namespace OpenSim.Region.Environment.Scenes
965 LLQuaternion primLocalRot = rayTracing.obj.RotationOffset; 968 LLQuaternion primLocalRot = rayTracing.obj.RotationOffset;
966 Quaternion LocalRot = new Quaternion(primLocalRot.W, primLocalRot.X, primLocalRot.Y, primLocalRot.Z); 969 Quaternion LocalRot = new Quaternion(primLocalRot.W, primLocalRot.X, primLocalRot.Y, primLocalRot.Z);
967 970
968 Quaternion NewRot = LocalRot * ParentRot; 971 Quaternion NewRot = LocalRot*ParentRot;
969 972
970 Vector3 RezPoint = Newpos; 973 Vector3 RezPoint = Newpos;
971 974
@@ -990,8 +993,8 @@ namespace OpenSim.Region.Environment.Scenes
990 //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; 993 //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
991 } 994 }
992 // if not phantom, add to physics 995 // if not phantom, add to physics
993 bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); 996 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim);
994 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 997 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
995 { 998 {
996 rootPart.PhysActor = 999 rootPart.PhysActor =
997 PhysicsScene.AddPrimShape( 1000 PhysicsScene.AddPrimShape(
@@ -1007,14 +1010,14 @@ namespace OpenSim.Region.Environment.Scenes
1007 } 1010 }
1008 1011
1009 public void AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position, 1012 public void AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position,
1010 Tree treeType, bool newTree) 1013 Tree treeType, bool newTree)
1011 { 1014 {
1012 PrimitiveBaseShape treeShape = new PrimitiveBaseShape(); 1015 PrimitiveBaseShape treeShape = new PrimitiveBaseShape();
1013 treeShape.PathCurve = 16; 1016 treeShape.PathCurve = 16;
1014 treeShape.PathEnd = 49900; 1017 treeShape.PathEnd = 49900;
1015 treeShape.PCode = newTree ? (byte)PCode.NewTree : (byte)PCode.Tree; 1018 treeShape.PCode = newTree ? (byte) PCode.NewTree : (byte) PCode.Tree;
1016 treeShape.Scale = scale; 1019 treeShape.Scale = scale;
1017 treeShape.State = (byte)treeType; 1020 treeShape.State = (byte) treeType;
1018 AddNewPrim(LLUUID.Random(), position, rotation, treeShape); 1021 AddNewPrim(LLUUID.Random(), position, rotation, treeShape);
1019 } 1022 }
1020 1023
@@ -1135,7 +1138,8 @@ namespace OpenSim.Region.Environment.Scenes
1135 client.OnParcelObjectOwnerRequest += 1138 client.OnParcelObjectOwnerRequest +=
1136 new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest); 1139 new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
1137 client.OnParcelAccessListRequest += new ParcelAccessListRequest(m_LandManager.handleParcelAccessRequest); 1140 client.OnParcelAccessListRequest += new ParcelAccessListRequest(m_LandManager.handleParcelAccessRequest);
1138 client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(m_LandManager.handleParcelAccessUpdateRequest); 1141 client.OnParcelAccessListUpdateRequest +=
1142 new ParcelAccessListUpdateRequest(m_LandManager.handleParcelAccessUpdateRequest);
1139 1143
1140 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage); 1144 client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
1141 client.OnRegionInfoRequest += m_estateManager.HandleRegionInfoRequest; 1145 client.OnRegionInfoRequest += m_estateManager.HandleRegionInfoRequest;
@@ -1157,8 +1161,8 @@ namespace OpenSim.Region.Environment.Scenes
1157 client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest; 1161 client.OnAssetUploadRequest += CommsManager.TransactionsManager.HandleUDPUploadRequest;
1158 client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer; 1162 client.OnXferReceive += CommsManager.TransactionsManager.HandleXfer;
1159 client.OnRezScript += RezScript; 1163 client.OnRezScript += RezScript;
1160 1164
1161 client.OnRequestTaskInventory += RequestTaskInventory; 1165 client.OnRequestTaskInventory += RequestTaskInventory;
1162 client.OnRemoveTaskItem += RemoveTaskInventory; 1166 client.OnRemoveTaskItem += RemoveTaskInventory;
1163 client.OnUpdateTaskInventory += UpdateTaskInventory; 1167 client.OnUpdateTaskInventory += UpdateTaskInventory;
1164 1168
@@ -1216,23 +1220,23 @@ namespace OpenSim.Region.Environment.Scenes
1216 m_innerScene.removeUserCount(true); 1220 m_innerScene.removeUserCount(true);
1217 } 1221 }
1218 } 1222 }
1219 catch (System.NullReferenceException) 1223 catch (NullReferenceException)
1220 { 1224 {
1221 // We don't know which count to remove it from 1225 // We don't know which count to remove it from
1222 // Avatar is already disposed :/ 1226 // Avatar is already disposed :/
1223 } 1227 }
1224 m_eventManager.TriggerOnRemovePresence(agentID); 1228 m_eventManager.TriggerOnRemovePresence(agentID);
1225 Broadcast(delegate(IClientAPI client) 1229 Broadcast(delegate(IClientAPI client)
1226 {
1227 try
1228 {
1229 client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
1230 }
1231 catch (System.NullReferenceException)
1232 { 1230 {
1233 //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. 1231 try
1234 } 1232 {
1235 }); 1233 client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
1234 }
1235 catch (NullReferenceException)
1236 {
1237 //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway.
1238 }
1239 });
1236 1240
1237 ForEachScenePresence( 1241 ForEachScenePresence(
1238 delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); 1242 delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
@@ -1251,7 +1255,7 @@ namespace OpenSim.Region.Environment.Scenes
1251 { 1255 {
1252 avatar.Close(); 1256 avatar.Close();
1253 } 1257 }
1254 catch (System.NullReferenceException) 1258 catch (NullReferenceException)
1255 { 1259 {
1256 //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway. 1260 //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway.
1257 } 1261 }
@@ -1263,19 +1267,22 @@ namespace OpenSim.Region.Environment.Scenes
1263 // Remove client agent from profile, so new logins will work 1267 // Remove client agent from profile, so new logins will work
1264 CommsManager.UserService.clearUserAgent(agentID); 1268 CommsManager.UserService.clearUserAgent(agentID);
1265 } 1269 }
1266 public override void CloseAllAgents(uint circuitcode) 1270
1271 public override void CloseAllAgents(uint circuitcode)
1267 { 1272 {
1268 // Called by ClientView to kill all circuit codes 1273 // Called by ClientView to kill all circuit codes
1269 ClientManager.CloseAllAgents(circuitcode); 1274 ClientManager.CloseAllAgents(circuitcode);
1270
1271 } 1275 }
1276
1272 public void NotifyMyCoarseLocationChange() 1277 public void NotifyMyCoarseLocationChange()
1273 { 1278 {
1274 ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); 1279 ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
1275 } 1280 }
1281
1276 #endregion 1282 #endregion
1277 1283
1278 #region Entities 1284 #region Entities
1285
1279 /// <summary> 1286 /// <summary>
1280 /// 1287 ///
1281 /// </summary> 1288 /// </summary>
@@ -1312,7 +1319,7 @@ namespace OpenSim.Region.Environment.Scenes
1312 m_sceneGridService.OnCloseAgentConnection += CloseConnection; 1319 m_sceneGridService.OnCloseAgentConnection += CloseConnection;
1313 m_sceneGridService.OnRegionUp += OtherRegionUp; 1320 m_sceneGridService.OnRegionUp += OtherRegionUp;
1314 m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; 1321 m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
1315 1322
1316 1323
1317 m_sceneGridService.KillObject = SendKillObject; 1324 m_sceneGridService.KillObject = SendKillObject;
1318 } 1325 }
@@ -1321,17 +1328,16 @@ namespace OpenSim.Region.Environment.Scenes
1321 /// 1328 ///
1322 /// </summary> 1329 /// </summary>
1323 public void UnRegisterReginWithComms() 1330 public void UnRegisterReginWithComms()
1324 { 1331 {
1325
1326 m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 1332 m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
1327 m_sceneGridService.OnRegionUp -= OtherRegionUp; 1333 m_sceneGridService.OnRegionUp -= OtherRegionUp;
1328 m_sceneGridService.OnExpectUser -= NewUserConnection; 1334 m_sceneGridService.OnExpectUser -= NewUserConnection;
1329 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; 1335 m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
1330 m_sceneGridService.OnCloseAgentConnection -= CloseConnection; 1336 m_sceneGridService.OnCloseAgentConnection -= CloseConnection;
1331 1337
1332 m_sceneGridService.Close(); 1338 m_sceneGridService.Close();
1333 } 1339 }
1334 1340
1335 1341
1336 /// <summary> 1342 /// <summary>
1337 /// 1343 ///
@@ -1344,18 +1350,19 @@ namespace OpenSim.Region.Environment.Scenes
1344 { 1350 {
1345 if (agent.CapsPath != "") 1351 if (agent.CapsPath != "")
1346 { 1352 {
1347 OpenSim.Region.Capabilities.Caps cap = 1353 Caps cap =
1348 new OpenSim.Region.Capabilities.Caps(AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port, 1354 new Caps(AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port,
1349 agent.CapsPath, agent.AgentID, m_dumpAssetsToFile); 1355 agent.CapsPath, agent.AgentID, m_dumpAssetsToFile);
1350 1356
1351 Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + 1357 Util.SetCapsURL(agent.AgentID,
1352 "/CAPS/" + agent.CapsPath + "0000/"); 1358 "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() +
1359 "/CAPS/" + agent.CapsPath + "0000/");
1353 cap.RegisterHandlers(); 1360 cap.RegisterHandlers();
1354 1361
1355 cap.AddNewInventoryItem = AddInventoryItem; 1362 cap.AddNewInventoryItem = AddInventoryItem;
1356 cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset; 1363 cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
1357 cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset; 1364 cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset;
1358 1365
1359 if (m_capsHandlers.ContainsKey(agent.AgentID)) 1366 if (m_capsHandlers.ContainsKey(agent.AgentID))
1360 { 1367 {
1361 //MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " + 1368 //MainLog.Instance.Warn("client", "Adding duplicate CAPS entry for user " +
@@ -1364,7 +1371,7 @@ namespace OpenSim.Region.Environment.Scenes
1364 { 1371 {
1365 m_capsHandlers[agent.AgentID] = cap; 1372 m_capsHandlers[agent.AgentID] = cap;
1366 } 1373 }
1367 catch (System.Collections.Generic.KeyNotFoundException) 1374 catch (KeyNotFoundException)
1368 { 1375 {
1369 // Fix for a potential race condition. 1376 // Fix for a potential race condition.
1370 m_capsHandlers.Add(agent.AgentID, cap); 1377 m_capsHandlers.Add(agent.AgentID, cap);
@@ -1396,10 +1403,10 @@ namespace OpenSim.Region.Environment.Scenes
1396 { 1403 {
1397 m_scenePresences[agentID].MakeRootAgent(position, isFlying); 1404 m_scenePresences[agentID].MakeRootAgent(position, isFlying);
1398 } 1405 }
1399 catch (System.Exception e) 1406 catch (Exception e)
1400 { 1407 {
1401 MainLog.Instance.Verbose("SCENE", "Unable to do Agent Crossing."); 1408 MainLog.Instance.Verbose("SCENE", "Unable to do Agent Crossing.");
1402 MainLog.Instance.Debug("SCENE",e.ToString()); 1409 MainLog.Instance.Debug("SCENE", e.ToString());
1403 } 1410 }
1404 //m_innerScene.SwapRootChildAgent(false); 1411 //m_innerScene.SwapRootChildAgent(false);
1405 } 1412 }
@@ -1419,11 +1426,11 @@ namespace OpenSim.Region.Environment.Scenes
1419 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 1426 childAgentUpdate.ChildAgentDataUpdate(cAgentData);
1420 // Not Implemented: 1427 // Not Implemented:
1421 //TODO: Do we need to pass the message on to one of our neighbors? 1428 //TODO: Do we need to pass the message on to one of our neighbors?
1422
1423 } 1429 }
1424 } 1430 }
1425 return true; 1431 return true;
1426 } 1432 }
1433
1427 /// <summary> 1434 /// <summary>
1428 /// Tell a single agent to disconnect from the region. 1435 /// Tell a single agent to disconnect from the region.
1429 /// </summary> 1436 /// </summary>
@@ -1445,7 +1452,7 @@ namespace OpenSim.Region.Environment.Scenes
1445 m_innerScene.removeUserCount(true); 1452 m_innerScene.removeUserCount(true);
1446 } 1453 }
1447 // Tell a single agent to disconnect from the region. 1454 // Tell a single agent to disconnect from the region.
1448 libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket(); 1455 DisableSimulatorPacket disable = new DisableSimulatorPacket();
1449 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); 1456 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task);
1450 } 1457 }
1451 } 1458 }
@@ -1511,7 +1518,8 @@ namespace OpenSim.Region.Environment.Scenes
1511 { 1518 {
1512 if (m_scenePresences.ContainsKey(remoteClient.AgentId)) 1519 if (m_scenePresences.ContainsKey(remoteClient.AgentId))
1513 { 1520 {
1514 m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle, position, lookAt, flags); 1521 m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle,
1522 position, lookAt, flags);
1515 } 1523 }
1516 } 1524 }
1517 1525
@@ -1551,9 +1559,9 @@ namespace OpenSim.Region.Environment.Scenes
1551 /// <param name="mod"></param> 1559 /// <param name="mod"></param>
1552 public void RegisterModuleInterface<M>(M mod) 1560 public void RegisterModuleInterface<M>(M mod)
1553 { 1561 {
1554 if (!ModuleInterfaces.ContainsKey(typeof(M))) 1562 if (!ModuleInterfaces.ContainsKey(typeof (M)))
1555 { 1563 {
1556 ModuleInterfaces.Add(typeof(M), mod); 1564 ModuleInterfaces.Add(typeof (M), mod);
1557 } 1565 }
1558 } 1566 }
1559 1567
@@ -1563,9 +1571,9 @@ namespace OpenSim.Region.Environment.Scenes
1563 /// <returns></returns> 1571 /// <returns></returns>
1564 public T RequestModuleInterface<T>() 1572 public T RequestModuleInterface<T>()
1565 { 1573 {
1566 if (ModuleInterfaces.ContainsKey(typeof(T))) 1574 if (ModuleInterfaces.ContainsKey(typeof (T)))
1567 { 1575 {
1568 return (T)ModuleInterfaces[typeof(T)]; 1576 return (T) ModuleInterfaces[typeof (T)];
1569 } 1577 }
1570 else 1578 else
1571 { 1579 {
@@ -1642,7 +1650,7 @@ namespace OpenSim.Region.Environment.Scenes
1642 { 1650 {
1643 if (obj is SceneObjectGroup) 1651 if (obj is SceneObjectGroup)
1644 { 1652 {
1645 m_eventManager.TriggerParcelPrimCountAdd((SceneObjectGroup)obj); 1653 m_eventManager.TriggerParcelPrimCountAdd((SceneObjectGroup) obj);
1646 } 1654 }
1647 } 1655 }
1648 } 1656 }
@@ -1650,6 +1658,7 @@ namespace OpenSim.Region.Environment.Scenes
1650 #endregion 1658 #endregion
1651 1659
1652 #region Console Commands 1660 #region Console Commands
1661
1653 #region Alert Methods 1662 #region Alert Methods
1654 1663
1655 private void SendPermissionAlert(LLUUID user, string reason) 1664 private void SendPermissionAlert(LLUUID user, string reason)
@@ -1692,7 +1701,8 @@ namespace OpenSim.Region.Environment.Scenes
1692 /// <param name="sessionID"></param> 1701 /// <param name="sessionID"></param>
1693 /// <param name="token"></param> 1702 /// <param name="token"></param>
1694 /// <param name="controllingClient"></param> 1703 /// <param name="controllingClient"></param>
1695 public void handleRequestGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token, IClientAPI controllingClient) 1704 public void handleRequestGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token,
1705 IClientAPI controllingClient)
1696 { 1706 {
1697 // First check that this is the sim owner 1707 // First check that this is the sim owner
1698 if (agentID == RegionInfo.MasterAvatarAssignedUUID) 1708 if (agentID == RegionInfo.MasterAvatarAssignedUUID)
@@ -1736,37 +1746,38 @@ namespace OpenSim.Region.Environment.Scenes
1736 if (agentID == kickUserID) 1746 if (agentID == kickUserID)
1737 { 1747 {
1738 ClientManager.ForEachClient(delegate(IClientAPI controller) 1748 ClientManager.ForEachClient(delegate(IClientAPI controller)
1739 {
1740 ScenePresence p = GetScenePresence(controller.AgentId);
1741 bool childagent = !p.Equals(null) && p.IsChildAgent;
1742 if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness?
1743 { 1749 {
1744 controller.Kick(Helpers.FieldToUTF8String(reason)); 1750 ScenePresence p = GetScenePresence(controller.AgentId);
1745 1751 bool childagent = !p.Equals(null) && p.IsChildAgent;
1746 if (childagent) 1752 if (controller.AgentId != godID && !childagent)
1753 // Do we really want to kick the initiator of this madness?
1747 { 1754 {
1748 m_innerScene.removeUserCount(false); 1755 controller.Kick(Helpers.FieldToUTF8String(reason));
1756
1757 if (childagent)
1758 {
1759 m_innerScene.removeUserCount(false);
1760 }
1761 else
1762 {
1763 m_innerScene.removeUserCount(true);
1764 }
1749 } 1765 }
1750 else
1751 {
1752 m_innerScene.removeUserCount(true);
1753 }
1754
1755 } 1766 }
1756 }
1757 ); 1767 );
1758 // This is a bit crude. It seems the client will be null before it actually stops the thread 1768 // This is a bit crude. It seems the client will be null before it actually stops the thread
1759 // The thread will kill itself eventually :/ 1769 // The thread will kill itself eventually :/
1760 // Is there another way to make sure *all* clients get this 'inter region' message? 1770 // Is there another way to make sure *all* clients get this 'inter region' message?
1761 ClientManager.ForEachClient(delegate(IClientAPI controller) 1771 ClientManager.ForEachClient(delegate(IClientAPI controller)
1762 {
1763 ScenePresence p = GetScenePresence(controller.AgentId);
1764 bool childagent = !p.Equals(null) && p.IsChildAgent;
1765 if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness?
1766 { 1772 {
1767 controller.Close(true); 1773 ScenePresence p = GetScenePresence(controller.AgentId);
1774 bool childagent = !p.Equals(null) && p.IsChildAgent;
1775 if (controller.AgentId != godID && !childagent)
1776 // Do we really want to kick the initiator of this madness?
1777 {
1778 controller.Close(true);
1779 }
1768 } 1780 }
1769 }
1770 ); 1781 );
1771 } 1782 }
1772 else 1783 else
@@ -1799,7 +1810,8 @@ namespace OpenSim.Region.Environment.Scenes
1799 /// <param name="agentID"></param> 1810 /// <param name="agentID"></param>
1800 /// <param name="sessionID"></param> 1811 /// <param name="sessionID"></param>
1801 /// <param name="permChanges"></param> 1812 /// <param name="permChanges"></param>
1802 public void HandleObjectPermissionsUpdate(IClientAPI controller, LLUUID agentID, LLUUID sessionID, List<libsecondlife.Packets.ObjectPermissionsPacket.ObjectDataBlock> permChanges) 1813 public void HandleObjectPermissionsUpdate(IClientAPI controller, LLUUID agentID, LLUUID sessionID,
1814 List<ObjectPermissionsPacket.ObjectDataBlock> permChanges)
1803 { 1815 {
1804 // Check for spoofing.. since this is permissions we're talking about here! 1816 // Check for spoofing.. since this is permissions we're talking about here!
1805 if ((controller.SessionId == sessionID) && (controller.AgentId == agentID)) 1817 if ((controller.SessionId == sessionID) && (controller.AgentId == agentID))
@@ -1879,7 +1891,7 @@ namespace OpenSim.Region.Environment.Scenes
1879 { 1891 {
1880 if (ent is SceneObjectGroup) 1892 if (ent is SceneObjectGroup)
1881 { 1893 {
1882 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); 1894 ((SceneObjectGroup) ent).ScheduleGroupForFullUpdate();
1883 } 1895 }
1884 } 1896 }
1885 } 1897 }
@@ -1899,7 +1911,7 @@ namespace OpenSim.Region.Environment.Scenes
1899 { 1911 {
1900 if (ent is SceneObjectGroup) 1912 if (ent is SceneObjectGroup)
1901 { 1913 {
1902 SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID); 1914 SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID);
1903 if (part != null) 1915 if (part != null)
1904 { 1916 {
1905 if (part.Name == cmdparams[0]) 1917 if (part.Name == cmdparams[0])
@@ -1967,10 +1979,12 @@ namespace OpenSim.Region.Environment.Scenes
1967 { 1979 {
1968 m_eventManager.TriggerOnPluginConsole(args); 1980 m_eventManager.TriggerOnPluginConsole(args);
1969 } 1981 }
1982
1970 public double GetLandHeight(int x, int y) 1983 public double GetLandHeight(int x, int y)
1971 { 1984 {
1972 return Terrain.GetHeight(x, y); 1985 return Terrain.GetHeight(x, y);
1973 } 1986 }
1987
1974 public LLUUID GetLandOwner(float x, float y) 1988 public LLUUID GetLandOwner(float x, float y)
1975 { 1989 {
1976 Land land = LandManager.getLandObject(x, y); 1990 Land land = LandManager.getLandObject(x, y);
@@ -1983,7 +1997,7 @@ namespace OpenSim.Region.Environment.Scenes
1983 return land.landData.ownerID; 1997 return land.landData.ownerID;
1984 } 1998 }
1985 } 1999 }
1986 2000
1987 public LandData GetLandData(float x, float y) 2001 public LandData GetLandData(float x, float y)
1988 { 2002 {
1989 return LandManager.getLandObject(x, y).landData; 2003 return LandManager.getLandObject(x, y).landData;
@@ -2034,6 +2048,7 @@ namespace OpenSim.Region.Environment.Scenes
2034 { 2048 {
2035 return m_innerScene.ConvertLocalIDToFullID(localID); 2049 return m_innerScene.ConvertLocalIDToFullID(localID);
2036 } 2050 }
2051
2037 public void SwapRootAgentCount(bool rootChildChildRootTF) 2052 public void SwapRootAgentCount(bool rootChildChildRootTF)
2038 { 2053 {
2039 m_innerScene.SwapRootChildAgent(rootChildChildRootTF); 2054 m_innerScene.SwapRootChildAgent(rootChildChildRootTF);
@@ -2108,13 +2123,16 @@ namespace OpenSim.Region.Environment.Scenes
2108 // We don't want to try to send messages if there are no avatar. 2123 // We don't want to try to send messages if there are no avatar.
2109 if (!(m_scenePresences.Equals(null))) 2124 if (!(m_scenePresences.Equals(null)))
2110 { 2125 {
2111 try { 2126 try
2112 List<ScenePresence> presenceList = GetScenePresences(); 2127 {
2128 List<ScenePresence> presenceList = GetScenePresences();
2113 foreach (ScenePresence presence in presenceList) 2129 foreach (ScenePresence presence in presenceList)
2114 { 2130 {
2115 action(presence); 2131 action(presence);
2116 } 2132 }
2117 } catch (Exception e) { 2133 }
2134 catch (Exception e)
2135 {
2118 MainLog.Instance.Verbose("BUG", e.ToString()); 2136 MainLog.Instance.Verbose("BUG", e.ToString());
2119 } 2137 }
2120 } 2138 }
@@ -2181,4 +2199,4 @@ namespace OpenSim.Region.Environment.Scenes
2181 2199
2182 #endregion 2200 #endregion
2183 } 2201 }
2184} 2202} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 35d88eb..fe8f8da 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -26,8 +26,6 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic;
30using System.Timers;
31using libsecondlife; 29using libsecondlife;
32using OpenSim.Framework; 30using OpenSim.Framework;
33using OpenSim.Framework.Communications.Cache; 31using OpenSim.Framework.Communications.Cache;
@@ -43,8 +41,9 @@ namespace OpenSim.Region.Environment.Scenes
43 public event restart OnRestart; 41 public event restart OnRestart;
44 42
45 #endregion 43 #endregion
46 44
47 #region Fields 45 #region Fields
46
48 private readonly ClientManager m_clientManager = new ClientManager(); 47 private readonly ClientManager m_clientManager = new ClientManager();
49 48
50 public ClientManager ClientManager 49 public ClientManager ClientManager
@@ -92,8 +91,6 @@ namespace OpenSim.Region.Environment.Scenes
92 /// </summary> 91 /// </summary>
93 public abstract void Update(); 92 public abstract void Update();
94 93
95
96
97 #endregion 94 #endregion
98 95
99 #region Terrain Methods 96 #region Terrain Methods
@@ -163,8 +160,8 @@ namespace OpenSim.Region.Environment.Scenes
163 160
164 public abstract bool OtherRegionUp(RegionInfo thisRegion); 161 public abstract bool OtherRegionUp(RegionInfo thisRegion);
165 162
166
167 #endregion 163 #endregion
164
168 #region Shutdown 165 #region Shutdown
169 166
170 /// <summary> 167 /// <summary>
@@ -184,4 +181,4 @@ namespace OpenSim.Region.Environment.Scenes
184 181
185 #endregion 182 #endregion
186 } 183 }
187} 184} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index b184af2..3942397 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -29,11 +29,10 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Text;
33using libsecondlife; 32using libsecondlife;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Console;
36using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
35using OpenSim.Framework.Console;
37 36
38namespace OpenSim.Region.Environment.Scenes 37namespace OpenSim.Region.Environment.Scenes
39{ 38{
@@ -52,7 +51,7 @@ namespace OpenSim.Region.Environment.Scenes
52 public event PrimCrossing OnPrimCrossingIntoRegion; 51 public event PrimCrossing OnPrimCrossingIntoRegion;
53 public event RegionUp OnRegionUp; 52 public event RegionUp OnRegionUp;
54 public event ChildAgentUpdate OnChildAgentUpdate; 53 public event ChildAgentUpdate OnChildAgentUpdate;
55 54
56 55
57 public KillObjectDelegate KillObject; 56 public KillObjectDelegate KillObject;
58 public string _debugRegionName = ""; 57 public string _debugRegionName = "";
@@ -60,10 +59,7 @@ namespace OpenSim.Region.Environment.Scenes
60 public string debugRegionName 59 public string debugRegionName
61 { 60 {
62 get { return _debugRegionName; } 61 get { return _debugRegionName; }
63 set 62 set { _debugRegionName = value; }
64 {
65 _debugRegionName = value;
66 }
67 } 63 }
68 64
69 public SceneCommunicationService(CommunicationsManager commsMan) 65 public SceneCommunicationService(CommunicationsManager commsMan)
@@ -90,7 +86,6 @@ namespace OpenSim.Region.Environment.Scenes
90 regionCommsHost.OnCloseAgentConnection += CloseConnection; 86 regionCommsHost.OnCloseAgentConnection += CloseConnection;
91 regionCommsHost.OnRegionUp += newRegionUp; 87 regionCommsHost.OnRegionUp += newRegionUp;
92 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; 88 regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
93
94 } 89 }
95 else 90 else
96 { 91 {
@@ -102,7 +97,6 @@ namespace OpenSim.Region.Environment.Scenes
102 { 97 {
103 if (regionCommsHost != null) 98 if (regionCommsHost != null)
104 { 99 {
105
106 regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; 100 regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
107 regionCommsHost.OnRegionUp -= newRegionUp; 101 regionCommsHost.OnRegionUp -= newRegionUp;
108 regionCommsHost.OnExpectUser -= NewUserConnection; 102 regionCommsHost.OnExpectUser -= NewUserConnection;
@@ -115,6 +109,7 @@ namespace OpenSim.Region.Environment.Scenes
115 } 109 }
116 110
117 #region CommsManager Event handlers 111 #region CommsManager Event handlers
112
118 /// <summary> 113 /// <summary>
119 /// 114 ///
120 /// </summary> 115 /// </summary>
@@ -139,6 +134,7 @@ namespace OpenSim.Region.Environment.Scenes
139 } 134 }
140 return true; 135 return true;
141 } 136 }
137
142 protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) 138 protected bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
143 { 139 {
144 if (OnChildAgentUpdate != null) 140 if (OnChildAgentUpdate != null)
@@ -155,6 +151,7 @@ namespace OpenSim.Region.Environment.Scenes
155 OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying); 151 OnAvatarCrossingIntoRegion(regionHandle, agentID, position, isFlying);
156 } 152 }
157 } 153 }
154
158 protected void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical) 155 protected void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical)
159 { 156 {
160 if (OnPrimCrossingIntoRegion != null) 157 if (OnPrimCrossingIntoRegion != null)
@@ -174,12 +171,13 @@ namespace OpenSim.Region.Environment.Scenes
174 #endregion 171 #endregion
175 172
176 #region Inform Client of Neighbours 173 #region Inform Client of Neighbours
174
177 private delegate void InformClientOfNeighbourDelegate( 175 private delegate void InformClientOfNeighbourDelegate(
178 ScenePresence avatar, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint); 176 ScenePresence avatar, AgentCircuitData a, ulong regionHandle, IPEndPoint endPoint);
179 177
180 private void InformClientOfNeighbourCompleted(IAsyncResult iar) 178 private void InformClientOfNeighbourCompleted(IAsyncResult iar)
181 { 179 {
182 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState; 180 InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate) iar.AsyncState;
183 icon.EndInvoke(iar); 181 icon.EndInvoke(iar);
184 } 182 }
185 183
@@ -215,8 +213,6 @@ namespace OpenSim.Region.Environment.Scenes
215 213
216 //blah.Address = region.RemotingAddress; 214 //blah.Address = region.RemotingAddress;
217 //blah.Port = region.RemotingPort; 215 //blah.Port = region.RemotingPort;
218
219
220 } 216 }
221 217
222 /// <summary> 218 /// <summary>
@@ -227,7 +223,7 @@ namespace OpenSim.Region.Environment.Scenes
227 { 223 {
228 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); 224 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
229 225
230 //m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 226 //m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
231 for (int i = 0; i < lstneighbours.Count; i++) 227 for (int i = 0; i < lstneighbours.Count; i++)
232 { 228 {
233 // We don't want to keep sending to regions that consistently fail on comms. 229 // We don't want to keep sending to regions that consistently fail on comms.
@@ -245,7 +241,6 @@ namespace OpenSim.Region.Environment.Scenes
245 { 241 {
246 for (int i = 0; i < neighbours.Count; i++) 242 for (int i = 0; i < neighbours.Count; i++)
247 { 243 {
248
249 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); 244 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
250 agent.BaseFolder = LLUUID.Zero; 245 agent.BaseFolder = LLUUID.Zero;
251 agent.InventoryFolder = LLUUID.Zero; 246 agent.InventoryFolder = LLUUID.Zero;
@@ -259,6 +254,7 @@ namespace OpenSim.Region.Environment.Scenes
259 } 254 }
260 } 255 }
261 } 256 }
257
262 /// <summary> 258 /// <summary>
263 /// This informs a single neighboring region about agent "avatar". 259 /// This informs a single neighboring region about agent "avatar".
264 /// Calls an asynchronous method to do so.. so it doesn't lag the sim. 260 /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
@@ -278,11 +274,12 @@ namespace OpenSim.Region.Environment.Scenes
278 } 274 }
279 275
280 #endregion 276 #endregion
277
281 public delegate void InformNeighbourThatRegionUpDelegate(RegionInfo region, ulong regionhandle); 278 public delegate void InformNeighbourThatRegionUpDelegate(RegionInfo region, ulong regionhandle);
282 279
283 private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar) 280 private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar)
284 { 281 {
285 InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate)iar.AsyncState; 282 InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate) iar.AsyncState;
286 icon.EndInvoke(iar); 283 icon.EndInvoke(iar);
287 } 284 }
288 285
@@ -290,7 +287,8 @@ namespace OpenSim.Region.Environment.Scenes
290 private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle) 287 private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle)
291 { 288 {
292 MainLog.Instance.Notice("INTERGRID", "Starting to inform neighbors that I'm here"); 289 MainLog.Instance.Notice("INTERGRID", "Starting to inform neighbors that I'm here");
293 bool regionAccepted = m_commsProvider.InterRegion.RegionUp((new SearializableRegionInfo(region)), regionhandle); 290 bool regionAccepted =
291 m_commsProvider.InterRegion.RegionUp((new SearializableRegionInfo(region)), regionhandle);
294 292
295 if (regionAccepted) 293 if (regionAccepted)
296 { 294 {
@@ -301,6 +299,7 @@ namespace OpenSim.Region.Environment.Scenes
301 MainLog.Instance.Notice("INTERGRID", "Failed to inform neighbors that I'm here"); 299 MainLog.Instance.Notice("INTERGRID", "Failed to inform neighbors that I'm here");
302 } 300 }
303 } 301 }
302
304 /// <summary> 303 /// <summary>
305 /// Called by scene when region is initialized (not always when it's listening for agents) 304 /// Called by scene when region is initialized (not always when it's listening for agents)
306 /// This is an inter-region message that informs the surrounding neighbors that the sim is up. 305 /// This is an inter-region message that informs the surrounding neighbors that the sim is up.
@@ -317,7 +316,6 @@ namespace OpenSim.Region.Environment.Scenes
317 { 316 {
318 for (int i = 0; i < neighbours.Count; i++) 317 for (int i = 0; i < neighbours.Count; i++)
319 { 318 {
320
321 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; 319 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
322 320
323 d.BeginInvoke(region, neighbours[i].RegionHandle, 321 d.BeginInvoke(region, neighbours[i].RegionHandle,
@@ -325,9 +323,10 @@ namespace OpenSim.Region.Environment.Scenes
325 d); 323 d);
326 } 324 }
327 } 325 }
328 326
329 //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region)); 327 //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
330 } 328 }
329
331 public delegate void SendChildAgentDataUpdateDelegate(ulong regionHandle, ChildAgentDataUpdate cAgentData); 330 public delegate void SendChildAgentDataUpdateDelegate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
332 331
333 /// <summary> 332 /// <summary>
@@ -340,7 +339,7 @@ namespace OpenSim.Region.Environment.Scenes
340 private void SendChildAgentDataUpdateAsync(ulong regionHandle, ChildAgentDataUpdate cAgentData) 339 private void SendChildAgentDataUpdateAsync(ulong regionHandle, ChildAgentDataUpdate cAgentData)
341 { 340 {
342 MainLog.Instance.Notice("INTERGRID", "Informing a neighbor about my agent."); 341 MainLog.Instance.Notice("INTERGRID", "Informing a neighbor about my agent.");
343 bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle,cAgentData); 342 bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData);
344 343
345 if (regionAccepted) 344 if (regionAccepted)
346 { 345 {
@@ -351,11 +350,13 @@ namespace OpenSim.Region.Environment.Scenes
351 MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent"); 350 MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent");
352 } 351 }
353 } 352 }
353
354 private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) 354 private void SendChildAgentDataUpdateCompleted(IAsyncResult iar)
355 { 355 {
356 SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate)iar.AsyncState; 356 SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate) iar.AsyncState;
357 icon.EndInvoke(iar); 357 icon.EndInvoke(iar);
358 } 358 }
359
359 public void SendChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) 360 public void SendChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData)
360 { 361 {
361 // This assumes that we know what our neighbors are. 362 // This assumes that we know what our neighbors are.
@@ -363,9 +364,8 @@ namespace OpenSim.Region.Environment.Scenes
363 d.BeginInvoke(regionHandle, cAgentData, 364 d.BeginInvoke(regionHandle, cAgentData,
364 SendChildAgentDataUpdateCompleted, 365 SendChildAgentDataUpdateCompleted,
365 d); 366 d);
366
367 } 367 }
368 368
369 369
370 /// <summary> 370 /// <summary>
371 /// Helper function to request neighbors from grid-comms 371 /// Helper function to request neighbors from grid-comms
@@ -401,15 +401,13 @@ namespace OpenSim.Region.Environment.Scenes
401 /// <param name="lookAt"></param> 401 /// <param name="lookAt"></param>
402 /// <param name="flags"></param> 402 /// <param name="flags"></param>
403 public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position, 403 public virtual void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, LLVector3 position,
404 LLVector3 lookAt, uint flags) 404 LLVector3 lookAt, uint flags)
405 { 405 {
406 if (regionHandle == m_regionInfo.RegionHandle) 406 if (regionHandle == m_regionInfo.RegionHandle)
407 { 407 {
408
409 avatar.ControllingClient.SendTeleportLocationStart(); 408 avatar.ControllingClient.SendTeleportLocationStart();
410 avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags); 409 avatar.ControllingClient.SendLocalTeleport(position, lookAt, flags);
411 avatar.Teleport(position); 410 avatar.Teleport(position);
412
413 } 411 }
414 else 412 else
415 { 413 {
@@ -424,20 +422,22 @@ namespace OpenSim.Region.Environment.Scenes
424 agent.child = true; 422 agent.child = true;
425 avatar.Close(); 423 avatar.Close();
426 m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent); 424 m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
427 m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId, position, false); 425 m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
426 position, false);
428 AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo(); 427 AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
429 string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId); 428 string capsPath = Util.GetCapsURL(avatar.ControllingClient.AgentId);
430 avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4), capsPath); 429 avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
430 capsPath);
431 avatar.MakeChildAgent(); 431 avatar.MakeChildAgent();
432 if (KillObject != null) 432 if (KillObject != null)
433 { 433 {
434 KillObject(avatar.LocalId); 434 KillObject(avatar.LocalId);
435 } 435 }
436 uint newRegionX = (uint)(regionHandle >> 40); 436 uint newRegionX = (uint) (regionHandle >> 40);
437 uint newRegionY = (((uint)(regionHandle)) >> 8); 437 uint newRegionY = (((uint) (regionHandle)) >> 8);
438 uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40); 438 uint oldRegionX = (uint) (m_regionInfo.RegionHandle >> 40);
439 uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8); 439 uint oldRegionY = (((uint) (m_regionInfo.RegionHandle)) >> 8);
440 if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3) 440 if (Util.fast_distance2d((int) (newRegionX - oldRegionX), (int) (newRegionY - oldRegionY)) > 3)
441 { 441 {
442 CloseChildAgentConnections(avatar); 442 CloseChildAgentConnections(avatar);
443 } 443 }
@@ -465,7 +465,8 @@ namespace OpenSim.Region.Environment.Scenes
465 { 465 {
466 foreach (ulong regionHandle in presence.KnownChildRegions) 466 foreach (ulong regionHandle in presence.KnownChildRegions)
467 { 467 {
468 m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle, presence.ControllingClient.AgentId); 468 m_commsProvider.InterRegion.TellRegionToCloseChildConnection(regionHandle,
469 presence.ControllingClient.AgentId);
469 presence.RemoveNeighbourRegion(regionHandle); 470 presence.RemoveNeighbourRegion(regionHandle);
470 } 471 }
471 } 472 }
@@ -474,6 +475,5 @@ namespace OpenSim.Region.Environment.Scenes
474 { 475 {
475 return m_commsProvider.GridService.GetGridSettings(); 476 return m_commsProvider.GridService.GetGridSettings();
476 } 477 }
477
478 } 478 }
479} 479} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
index 9c8c62b..a6a8fb6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneEvents.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.Environment.Scenes
105 public delegate void LandObjectAdded(Land newParcel, LLUUID regionUUID); 105 public delegate void LandObjectAdded(Land newParcel, LLUUID regionUUID);
106 106
107 public event LandObjectAdded OnLandObjectAdded; 107 public event LandObjectAdded OnLandObjectAdded;
108 108
109 public delegate void LandObjectRemoved(LLUUID globalID); 109 public delegate void LandObjectRemoved(LLUUID globalID);
110 110
111 public event LandObjectRemoved OnLandObjectRemoved; 111 public event LandObjectRemoved OnLandObjectRemoved;
@@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment.Scenes
117 117
118 public void TriggerOnClientMovement(ScenePresence avatar) 118 public void TriggerOnClientMovement(ScenePresence avatar)
119 { 119 {
120 if(OnClientMovement != null) 120 if (OnClientMovement != null)
121 OnClientMovement(avatar); 121 OnClientMovement(avatar);
122 } 122 }
123 123
@@ -223,7 +223,7 @@ namespace OpenSim.Region.Environment.Scenes
223 { 223 {
224 if (OnSceneGroupMove != null) 224 if (OnSceneGroupMove != null)
225 { 225 {
226 return OnSceneGroupMove(groupID, delta); 226 return OnSceneGroupMove(groupID, delta);
227 } 227 }
228 return true; 228 return true;
229 } 229 }
@@ -236,13 +236,14 @@ namespace OpenSim.Region.Environment.Scenes
236 } 236 }
237 } 237 }
238 238
239 public void TriggerLandObjectAdded(Land newParcel,LLUUID regionID) 239 public void TriggerLandObjectAdded(Land newParcel, LLUUID regionID)
240 { 240 {
241 if (OnLandObjectAdded != null) 241 if (OnLandObjectAdded != null)
242 { 242 {
243 OnLandObjectAdded(newParcel, regionID); 243 OnLandObjectAdded(newParcel, regionID);
244 } 244 }
245 } 245 }
246
246 public void TriggerLandObjectRemoved(LLUUID globalID) 247 public void TriggerLandObjectRemoved(LLUUID globalID)
247 { 248 {
248 if (OnLandObjectRemoved != null) 249 if (OnLandObjectRemoved != null)
@@ -250,10 +251,11 @@ namespace OpenSim.Region.Environment.Scenes
250 OnLandObjectRemoved(globalID); 251 OnLandObjectRemoved(globalID);
251 } 252 }
252 } 253 }
254
253 public void TriggerLandObjectUpdated(uint localParcelID, Land newParcel) 255 public void TriggerLandObjectUpdated(uint localParcelID, Land newParcel)
254 { 256 {
255 //triggerLandObjectRemoved(localParcelID); 257 //triggerLandObjectRemoved(localParcelID);
256 TriggerLandObjectAdded(newParcel,newParcel.m_scene.RegionInfo.RegionID); 258 TriggerLandObjectAdded(newParcel, newParcel.m_scene.RegionInfo.RegionID);
257 } 259 }
258 260
259 public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID) 261 public void TriggerAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index e822874..1eac61b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -84,7 +84,6 @@ namespace OpenSim.Region.Environment.Scenes
84 { 84 {
85 if (m_localScenes[i].Equals(cscene)) 85 if (m_localScenes[i].Equals(cscene))
86 { 86 {
87
88 m_localScenes[i].Close(); 87 m_localScenes[i].Close();
89 } 88 }
90 } 89 }
@@ -99,7 +98,8 @@ namespace OpenSim.Region.Environment.Scenes
99 98
100 public void HandleRestart(RegionInfo rdata) 99 public void HandleRestart(RegionInfo rdata)
101 { 100 {
102 MainLog.Instance.Error("SCENEMANAGER", "Got Restart message for region:" + rdata.RegionName +" Sending up to main"); 101 MainLog.Instance.Error("SCENEMANAGER",
102 "Got Restart message for region:" + rdata.RegionName + " Sending up to main");
103 int RegionSceneElement = -1; 103 int RegionSceneElement = -1;
104 for (int i = 0; i < m_localScenes.Count; i++) 104 for (int i = 0; i < m_localScenes.Count; i++)
105 { 105 {
@@ -127,7 +127,6 @@ namespace OpenSim.Region.Environment.Scenes
127 127
128 for (int i = 0; i < m_localScenes.Count; i++) 128 for (int i = 0; i < m_localScenes.Count; i++)
129 { 129 {
130
131 if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle) 130 if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle)
132 { 131 {
133 // Inform other regions to tell their avatar about me 132 // Inform other regions to tell their avatar about me
@@ -223,7 +222,7 @@ namespace OpenSim.Region.Environment.Scenes
223 { 222 {
224 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); }); 223 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); });
225 } 224 }
226 225
227 public void HandleAlertCommandOnCurrentScene(string[] cmdparams) 226 public void HandleAlertCommandOnCurrentScene(string[] cmdparams)
228 { 227 {
229 ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); }); 228 ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
@@ -423,4 +422,4 @@ namespace OpenSim.Region.Environment.Scenes
423 m_localScenes.ForEach(action); 422 m_localScenes.ForEach(action);
424 } 423 }
425 } 424 }
426} 425} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 20d596a..5b74c9b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -28,6 +28,7 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Drawing;
31using System.IO; 32using System.IO;
32using System.Text; 33using System.Text;
33using System.Xml; 34using System.Xml;
@@ -38,7 +39,6 @@ using OpenSim.Framework;
38using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
39using OpenSim.Region.Environment.Interfaces; 40using OpenSim.Region.Environment.Interfaces;
40using OpenSim.Region.Physics.Manager; 41using OpenSim.Region.Physics.Manager;
41using System.Drawing;
42 42
43namespace OpenSim.Region.Environment.Scenes 43namespace OpenSim.Region.Environment.Scenes
44{ 44{
@@ -74,11 +74,13 @@ namespace OpenSim.Region.Environment.Scenes
74 { 74 {
75 get { return m_rootPart.RotationOffset; } 75 get { return m_rootPart.RotationOffset; }
76 } 76 }
77
77 public LLUUID GroupID 78 public LLUUID GroupID
78 { 79 {
79 get { return m_rootPart.GroupID; } 80 get { return m_rootPart.GroupID; }
80 set { m_rootPart.GroupID = value; } 81 set { m_rootPart.GroupID = value; }
81 } 82 }
83
82 /// <summary> 84 /// <summary>
83 /// 85 ///
84 /// </summary> 86 /// </summary>
@@ -242,7 +244,7 @@ namespace OpenSim.Region.Environment.Scenes
242 part.ParentID = 0; 244 part.ParentID = 0;
243 part.LinkNum = 0; 245 part.LinkNum = 0;
244 m_parts.Add(part.UUID, part); 246 m_parts.Add(part.UUID, part);
245 247
246 SetPartAsRoot(part); 248 SetPartAsRoot(part);
247 249
248 RegionHandle = regionHandle; 250 RegionHandle = regionHandle;
@@ -295,7 +297,6 @@ namespace OpenSim.Region.Environment.Scenes
295 sr.Close(); 297 sr.Close();
296 298
297 299
298
299 m_rootPart.LocalID = m_scene.PrimIDAllocate(); 300 m_rootPart.LocalID = m_scene.PrimIDAllocate();
300 m_rootPart.ParentID = 0; 301 m_rootPart.ParentID = 0;
301 m_rootPart.RegionHandle = m_regionHandle; 302 m_rootPart.RegionHandle = m_regionHandle;
@@ -376,9 +377,10 @@ namespace OpenSim.Region.Environment.Scenes
376 377
377 foreach (SceneObjectPart part in m_parts.Values) 378 foreach (SceneObjectPart part in m_parts.Values)
378 { 379 {
379 380 Vector3 partPosition =
380 Vector3 partPosition = new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z); 381 new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z);
381 Quaternion parentrotation = new Quaternion(GroupRotation.W, GroupRotation.X, GroupRotation.Y, GroupRotation.Z); 382 Quaternion parentrotation =
383 new Quaternion(GroupRotation.W, GroupRotation.X, GroupRotation.Y, GroupRotation.Z);
382 384
383 // Telling the prim to raytrace. 385 // Telling the prim to raytrace.
384 EntityIntersection inter = part.TestIntersection(hRay, parentrotation); 386 EntityIntersection inter = part.TestIntersection(hRay, parentrotation);
@@ -389,14 +391,11 @@ namespace OpenSim.Region.Environment.Scenes
389 float idist = 256f; 391 float idist = 256f;
390 392
391 393
392
393
394 if (inter.HitTF) 394 if (inter.HitTF)
395 { 395 {
396 // We need to find the closest prim to return to the testcaller along the ray 396 // We need to find the closest prim to return to the testcaller along the ray
397 if (inter.distance < idist) 397 if (inter.distance < idist)
398 { 398 {
399
400 idist = inter.distance; 399 idist = inter.distance;
401 returnresult.HitTF = true; 400 returnresult.HitTF = true;
402 returnresult.ipoint = inter.ipoint; 401 returnresult.ipoint = inter.ipoint;
@@ -405,15 +404,11 @@ namespace OpenSim.Region.Environment.Scenes
405 returnresult.distance = inter.distance; 404 returnresult.distance = inter.distance;
406 } 405 }
407 } 406 }
408
409
410 } 407 }
411 return returnresult; 408 return returnresult;
412
413 } 409 }
414 410
415 411
416
417 /// <summary> 412 /// <summary>
418 /// 413 ///
419 /// </summary> 414 /// </summary>
@@ -524,7 +519,7 @@ namespace OpenSim.Region.Environment.Scenes
524 /// <returns></returns> 519 /// <returns></returns>
525 public SceneObjectGroup Copy(LLUUID cAgentID, LLUUID cGroupID) 520 public SceneObjectGroup Copy(LLUUID cAgentID, LLUUID cGroupID)
526 { 521 {
527 SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone(); 522 SceneObjectGroup dupe = (SceneObjectGroup) MemberwiseClone();
528 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>(); 523 dupe.m_parts = new Dictionary<LLUUID, SceneObjectPart>();
529 dupe.m_parts.Clear(); 524 dupe.m_parts.Clear();
530 //dupe.OwnerID = AgentID; 525 //dupe.OwnerID = AgentID;
@@ -549,9 +544,8 @@ namespace OpenSim.Region.Environment.Scenes
549 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z), 544 new PhysicsVector(dupe.RootPart.Scale.X, dupe.RootPart.Scale.Y, dupe.RootPart.Scale.Z),
550 new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, 545 new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
551 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z), 546 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z),
552 dupe.RootPart.PhysActor.IsPhysical); 547 dupe.RootPart.PhysActor.IsPhysical);
553 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true); 548 dupe.RootPart.DoPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
554
555 } 549 }
556 // Now we've made a copy that replaces this one, we need to 550 // Now we've made a copy that replaces this one, we need to
557 // switch the owner to the person who did the copying 551 // switch the owner to the person who did the copying
@@ -559,8 +553,8 @@ namespace OpenSim.Region.Environment.Scenes
559 // So, we have to make a copy of this one, set it in it's place then set the owner on this one 553 // So, we have to make a copy of this one, set it in it's place then set the owner on this one
560 554
561 SetRootPartOwner(m_rootPart, cAgentID, cGroupID); 555 SetRootPartOwner(m_rootPart, cAgentID, cGroupID);
562 556
563 557
564 m_rootPart.ScheduleFullUpdate(); 558 m_rootPart.ScheduleFullUpdate();
565 559
566 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values); 560 List<SceneObjectPart> partList = new List<SceneObjectPart>(m_parts.Values);
@@ -571,7 +565,6 @@ namespace OpenSim.Region.Environment.Scenes
571 dupe.CopyPart(part, OwnerID, GroupID); 565 dupe.CopyPart(part, OwnerID, GroupID);
572 SetPartOwner(part, cAgentID, cGroupID); 566 SetPartOwner(part, cAgentID, cGroupID);
573 part.ScheduleFullUpdate(); 567 part.ScheduleFullUpdate();
574
575 } 568 }
576 } 569 }
577 dupe.UpdateParentIDs(); 570 dupe.UpdateParentIDs();
@@ -601,7 +594,7 @@ namespace OpenSim.Region.Environment.Scenes
601 part.OwnerID = cAgentID; 594 part.OwnerID = cAgentID;
602 part.GroupID = cGroupID; 595 part.GroupID = cGroupID;
603 596
604 597
605 if (part.OwnerID != cAgentID) 598 if (part.OwnerID != cAgentID)
606 { 599 {
607 // Apply Next Owner Permissions if we're not bypassing permissions 600 // Apply Next Owner Permissions if we're not bypassing permissions
@@ -637,6 +630,7 @@ namespace OpenSim.Region.Environment.Scenes
637 m_parts.Add(part.UUID, part); 630 m_parts.Add(part.UUID, part);
638 } 631 }
639 } 632 }
633
640 /// <summary> 634 /// <summary>
641 /// 635 ///
642 /// </summary> 636 /// </summary>
@@ -666,8 +660,8 @@ namespace OpenSim.Region.Environment.Scenes
666 objPropDB.Description = Helpers.StringToField(RootPart.Description); 660 objPropDB.Description = Helpers.StringToField(RootPart.Description);
667 objPropFamilyPack.ObjectData = objPropDB; 661 objPropFamilyPack.ObjectData = objPropDB;
668 remoteClient.OutPacket(objPropFamilyPack, ThrottleOutPacketType.Task); 662 remoteClient.OutPacket(objPropFamilyPack, ThrottleOutPacketType.Task);
669
670 } 663 }
664
671 public void SetPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID) 665 public void SetPartOwner(SceneObjectPart part, LLUUID cAgentID, LLUUID cGroupID)
672 { 666 {
673 part.OwnerID = cAgentID; 667 part.OwnerID = cAgentID;
@@ -884,12 +878,12 @@ namespace OpenSim.Region.Environment.Scenes
884 Quaternion parentRot = 878 Quaternion parentRot =
885 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, 879 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
886 m_rootPart.RotationOffset.Z); 880 m_rootPart.RotationOffset.Z);
887 axPos = parentRot.Inverse() * axPos; 881 axPos = parentRot.Inverse()*axPos;
888 linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); 882 linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
889 Quaternion oldRot = 883 Quaternion oldRot =
890 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, 884 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y,
891 linkPart.RotationOffset.Z); 885 linkPart.RotationOffset.Z);
892 Quaternion newRot = parentRot.Inverse() * oldRot; 886 Quaternion newRot = parentRot.Inverse()*oldRot;
893 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 887 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
894 linkPart.ParentID = m_rootPart.LocalID; 888 linkPart.ParentID = m_rootPart.LocalID;
895 linkPart.LinkNum = m_parts.Count; 889 linkPart.LinkNum = m_parts.Count;
@@ -949,7 +943,7 @@ namespace OpenSim.Region.Environment.Scenes
949 linkPart.OffsetPosition.Y, 943 linkPart.OffsetPosition.Y,
950 linkPart.OffsetPosition.Z); 944 linkPart.OffsetPosition.Z);
951 945
952 axPos = parentRot * axPos; 946 axPos = parentRot*axPos;
953 linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); 947 linkPart.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
954 linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition; 948 linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition;
955 linkPart.OffsetPosition = new LLVector3(0, 0, 0); 949 linkPart.OffsetPosition = new LLVector3(0, 0, 0);
@@ -960,7 +954,7 @@ namespace OpenSim.Region.Environment.Scenes
960 linkPart.RotationOffset.X, 954 linkPart.RotationOffset.X,
961 linkPart.RotationOffset.Y, 955 linkPart.RotationOffset.Y,
962 linkPart.RotationOffset.Z); 956 linkPart.RotationOffset.Z);
963 Quaternion newRot = parentRot * oldRot; 957 Quaternion newRot = parentRot*oldRot;
964 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 958 linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
965 959
966 // Add physics information back to delinked part if appropriate 960 // Add physics information back to delinked part if appropriate
@@ -978,7 +972,6 @@ namespace OpenSim.Region.Environment.Scenes
978 linkPart.RotationOffset.Y, linkPart.RotationOffset.Z), 972 linkPart.RotationOffset.Y, linkPart.RotationOffset.Z),
979 m_rootPart.PhysActor.IsPhysical); 973 m_rootPart.PhysActor.IsPhysical);
980 m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true); 974 m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true);
981
982 } 975 }
983 976
984 SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart); 977 SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart);
@@ -990,8 +983,8 @@ namespace OpenSim.Region.Environment.Scenes
990 else 983 else
991 { 984 {
992 MainLog.Instance.Verbose("SCENE", 985 MainLog.Instance.Verbose("SCENE",
993 "DelinkFromGroup(): Child prim local id {0} not found in object with root prim id {1}", 986 "DelinkFromGroup(): Child prim local id {0} not found in object with root prim id {1}",
994 partID, LocalId); 987 partID, LocalId);
995 } 988 }
996 } 989 }
997 990
@@ -1008,7 +1001,7 @@ namespace OpenSim.Region.Environment.Scenes
1008 m_parts.Add(part.UUID, part); 1001 m_parts.Add(part.UUID, part);
1009 1002
1010 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); 1003 Vector3 axiomOldPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
1011 axiomOldPos = oldGroupRotation * axiomOldPos; 1004 axiomOldPos = oldGroupRotation*axiomOldPos;
1012 axiomOldPos += oldGroupPosition; 1005 axiomOldPos += oldGroupPosition;
1013 LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z); 1006 LLVector3 oldAbsolutePosition = new LLVector3(axiomOldPos.x, axiomOldPos.y, axiomOldPos.z);
1014 part.OffsetPosition = oldAbsolutePosition - AbsolutePosition; 1007 part.OffsetPosition = oldAbsolutePosition - AbsolutePosition;
@@ -1018,15 +1011,15 @@ namespace OpenSim.Region.Environment.Scenes
1018 m_rootPart.RotationOffset.Z); 1011 m_rootPart.RotationOffset.Z);
1019 1012
1020 Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z); 1013 Vector3 axiomPos = new Vector3(part.OffsetPosition.X, part.OffsetPosition.Y, part.OffsetPosition.Z);
1021 axiomPos = axiomRootRotation.Inverse() * axiomPos; 1014 axiomPos = axiomRootRotation.Inverse()*axiomPos;
1022 part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z); 1015 part.OffsetPosition = new LLVector3(axiomPos.x, axiomPos.y, axiomPos.z);
1023 1016
1024 Quaternion axiomPartRotation = 1017 Quaternion axiomPartRotation =
1025 new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y, 1018 new Quaternion(part.RotationOffset.W, part.RotationOffset.X, part.RotationOffset.Y,
1026 part.RotationOffset.Z); 1019 part.RotationOffset.Z);
1027 1020
1028 axiomPartRotation = oldGroupRotation * axiomPartRotation; 1021 axiomPartRotation = oldGroupRotation*axiomPartRotation;
1029 axiomPartRotation = axiomRootRotation.Inverse() * axiomPartRotation; 1022 axiomPartRotation = axiomRootRotation.Inverse()*axiomPartRotation;
1030 part.RotationOffset = 1023 part.RotationOffset =
1031 new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w); 1024 new LLQuaternion(axiomPartRotation.x, axiomPartRotation.y, axiomPartRotation.z, axiomPartRotation.w);
1032 } 1025 }
@@ -1056,12 +1049,12 @@ namespace OpenSim.Region.Environment.Scenes
1056 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; 1049 proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
1057 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); 1050 proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
1058 proper.ObjectData[0].ItemID = LLUUID.Zero; 1051 proper.ObjectData[0].ItemID = LLUUID.Zero;
1059 proper.ObjectData[0].CreationDate = (ulong)m_rootPart.CreationDate; 1052 proper.ObjectData[0].CreationDate = (ulong) m_rootPart.CreationDate;
1060 proper.ObjectData[0].CreatorID = m_rootPart.CreatorID; 1053 proper.ObjectData[0].CreatorID = m_rootPart.CreatorID;
1061 proper.ObjectData[0].FolderID = LLUUID.Zero; 1054 proper.ObjectData[0].FolderID = LLUUID.Zero;
1062 proper.ObjectData[0].FromTaskID = LLUUID.Zero; 1055 proper.ObjectData[0].FromTaskID = LLUUID.Zero;
1063 proper.ObjectData[0].GroupID = LLUUID.Zero; 1056 proper.ObjectData[0].GroupID = LLUUID.Zero;
1064 proper.ObjectData[0].InventorySerial = (short)m_rootPart.InventorySerial; 1057 proper.ObjectData[0].InventorySerial = (short) m_rootPart.InventorySerial;
1065 proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID; 1058 proper.ObjectData[0].LastOwnerID = m_rootPart.LastOwnerID;
1066 proper.ObjectData[0].ObjectID = UUID; 1059 proper.ObjectData[0].ObjectID = UUID;
1067 proper.ObjectData[0].OwnerID = m_rootPart.OwnerID; 1060 proper.ObjectData[0].OwnerID = m_rootPart.OwnerID;
@@ -1155,7 +1148,7 @@ namespace OpenSim.Region.Environment.Scenes
1155 else 1148 else
1156 { 1149 {
1157 MainLog.Instance.Warn( 1150 MainLog.Instance.Warn(
1158 "SCENE", 1151 "SCENE",
1159 "Couldn't find part {0} in object group {1} ({2}) to retreive prim inventory", 1152 "Couldn't find part {0} in object group {1} ({2}) to retreive prim inventory",
1160 localID, LocalId, UUID); 1153 localID, LocalId, UUID);
1161 } 1154 }
@@ -1272,10 +1265,8 @@ namespace OpenSim.Region.Environment.Scenes
1272 public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF) 1265 public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF)
1273 { 1266 {
1274 SceneObjectPart updatePart = GetChildPart(localID); 1267 SceneObjectPart updatePart = GetChildPart(localID);
1275 updatePart.UpdatePermissions(AgentID,field,localID,mask,addRemTF); 1268 updatePart.UpdatePermissions(AgentID, field, localID, mask, addRemTF);
1276 } 1269 }
1277
1278
1279 1270
1280 #endregion 1271 #endregion
1281 1272
@@ -1304,9 +1295,8 @@ namespace OpenSim.Region.Environment.Scenes
1304 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, 1295 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X,
1305 m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z), 1296 m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z),
1306 m_rootPart.PhysActor.IsPhysical); 1297 m_rootPart.PhysActor.IsPhysical);
1307 bool UsePhysics = ((m_rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 1298 bool UsePhysics = ((m_rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
1308 m_rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); 1299 m_rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
1309
1310 } 1300 }
1311 } 1301 }
1312 1302
@@ -1350,11 +1340,10 @@ namespace OpenSim.Region.Environment.Scenes
1350 if (m_scene.EventManager.TriggerGroupMove(UUID, pos)) 1340 if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
1351 { 1341 {
1352 AbsolutePosition = pos; 1342 AbsolutePosition = pos;
1353
1354 } 1343 }
1355 //we need to do a terse update even if the move wasn't allowed 1344 //we need to do a terse update even if the move wasn't allowed
1356 // so that the position is reset in the client (the object snaps back) 1345 // so that the position is reset in the client (the object snaps back)
1357 ScheduleGroupForTerseUpdate(); 1346 ScheduleGroupForTerseUpdate();
1358 } 1347 }
1359 1348
1360 /// <summary> 1349 /// <summary>
@@ -1394,7 +1383,7 @@ namespace OpenSim.Region.Environment.Scenes
1394 Quaternion partRotation = 1383 Quaternion partRotation =
1395 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, 1384 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
1396 m_rootPart.RotationOffset.Z); 1385 m_rootPart.RotationOffset.Z);
1397 axDiff = partRotation.Inverse() * axDiff; 1386 axDiff = partRotation.Inverse()*axDiff;
1398 diff.X = axDiff.x; 1387 diff.X = axDiff.x;
1399 diff.Y = axDiff.y; 1388 diff.Y = axDiff.y;
1400 diff.Z = axDiff.z; 1389 diff.Z = axDiff.z;
@@ -1496,14 +1485,14 @@ namespace OpenSim.Region.Environment.Scenes
1496 if (prim.UUID != m_rootPart.UUID) 1485 if (prim.UUID != m_rootPart.UUID)
1497 { 1486 {
1498 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z); 1487 Vector3 axPos = new Vector3(prim.OffsetPosition.X, prim.OffsetPosition.Y, prim.OffsetPosition.Z);
1499 axPos = oldParentRot * axPos; 1488 axPos = oldParentRot*axPos;
1500 axPos = axRot.Inverse() * axPos; 1489 axPos = axRot.Inverse()*axPos;
1501 prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z); 1490 prim.OffsetPosition = new LLVector3(axPos.x, axPos.y, axPos.z);
1502 Quaternion primsRot = 1491 Quaternion primsRot =
1503 new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y, 1492 new Quaternion(prim.RotationOffset.W, prim.RotationOffset.X, prim.RotationOffset.Y,
1504 prim.RotationOffset.Z); 1493 prim.RotationOffset.Z);
1505 Quaternion newRot = oldParentRot * primsRot; 1494 Quaternion newRot = oldParentRot*primsRot;
1506 newRot = axRot.Inverse() * newRot; 1495 newRot = axRot.Inverse()*newRot;
1507 prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w); 1496 prim.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
1508 prim.ScheduleTerseUpdate(); 1497 prim.ScheduleTerseUpdate();
1509 } 1498 }
@@ -1736,10 +1725,10 @@ namespace OpenSim.Region.Environment.Scenes
1736 1725
1737 public override void SetText(string text, Vector3 color, double alpha) 1726 public override void SetText(string text, Vector3 color, double alpha)
1738 { 1727 {
1739 Color = Color.FromArgb(0xff - (int)(alpha * 0xff), 1728 Color = Color.FromArgb(0xff - (int) (alpha*0xff),
1740 (int)(color.x * 0xff), 1729 (int) (color.x*0xff),
1741 (int)(color.y * 0xff), 1730 (int) (color.y*0xff),
1742 (int)(color.z * 0xff)); 1731 (int) (color.z*0xff));
1743 Text = text; 1732 Text = text;
1744 } 1733 }
1745 1734
@@ -1748,4 +1737,4 @@ namespace OpenSim.Region.Environment.Scenes
1748 m_rootPart.ApplyPhysics(); 1737 m_rootPart.ApplyPhysics();
1749 } 1738 }
1750 } 1739 }
1751} 1740} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index f226150..90a975c 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -28,6 +28,7 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Drawing;
31using System.Xml; 32using System.Xml;
32using System.Xml.Serialization; 33using System.Xml.Serialization;
33using Axiom.Math; 34using Axiom.Math;
@@ -38,23 +39,26 @@ using OpenSim.Framework.Console;
38using OpenSim.Region.Environment.Interfaces; 39using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Environment.Scenes.Scripting; 40using OpenSim.Region.Environment.Scenes.Scripting;
40using OpenSim.Region.Physics.Manager; 41using OpenSim.Region.Physics.Manager;
41using System.Drawing;
42 42
43namespace OpenSim.Region.Environment.Scenes 43namespace OpenSim.Region.Environment.Scenes
44{ 44{
45 public class SceneObjectPart : IScriptHost 45 public class SceneObjectPart : IScriptHost
46 { 46 {
47 private const LLObject.ObjectFlags OBJFULL_MASK_GENERAL = LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectTransfer; 47 private const LLObject.ObjectFlags OBJFULL_MASK_GENERAL =
48 private const LLObject.ObjectFlags OBJFULL_MASK_OWNER = LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectOwnerModify | LLObject.ObjectFlags.ObjectTransfer | LLObject.ObjectFlags.ObjectYouOwner; 48 LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectTransfer;
49
50 private const LLObject.ObjectFlags OBJFULL_MASK_OWNER =
51 LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectOwnerModify |
52 LLObject.ObjectFlags.ObjectTransfer | LLObject.ObjectFlags.ObjectYouOwner;
53
49 private const uint OBJNEXT_OWNER = 2147483647; 54 private const uint OBJNEXT_OWNER = 2147483647;
50 55
51 private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647; 56 private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647;
52 private const uint FULL_MASK_PERMISSIONS_OWNER = 2147483647; 57 private const uint FULL_MASK_PERMISSIONS_OWNER = 2147483647;
53 private string m_inventoryFileName = ""; 58 private string m_inventoryFileName = "";
54 private LLUUID m_folderID = LLUUID.Zero; 59 private LLUUID m_folderID = LLUUID.Zero;
55 60
56 [XmlIgnore] 61 [XmlIgnore] public PhysicsActor PhysActor = null;
57 public PhysicsActor PhysActor = null;
58 62
59 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>(); 63 protected Dictionary<LLUUID, TaskInventoryItem> TaskInventory = new Dictionary<LLUUID, TaskInventoryItem>();
60 public LLUUID LastOwnerID; 64 public LLUUID LastOwnerID;
@@ -72,25 +76,20 @@ namespace OpenSim.Region.Environment.Scenes
72 private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1); 76 private Quaternion m_sitTargetOrientation = new Quaternion(0, 0, 0, 1);
73 private LLUUID m_SitTargetAvatar = LLUUID.Zero; 77 private LLUUID m_SitTargetAvatar = LLUUID.Zero;
74 78
75
76
77 79
78 // Main grid has default permissions as follows 80 // Main grid has default permissions as follows
79 // 81 //
80 public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER; 82 public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER;
81 public uint NextOwnerMask = OBJNEXT_OWNER; 83 public uint NextOwnerMask = OBJNEXT_OWNER;
82 public uint GroupMask = (uint) LLObject.ObjectFlags.None; 84 public uint GroupMask = (uint) LLObject.ObjectFlags.None;
83 public uint EveryoneMask = (uint) LLObject.ObjectFlags.None; 85 public uint EveryoneMask = (uint) LLObject.ObjectFlags.None;
84 public uint BaseMask = FULL_MASK_PERMISSIONS_OWNER; 86 public uint BaseMask = FULL_MASK_PERMISSIONS_OWNER;
85 87
86 protected byte[] m_particleSystem = new byte[0]; 88 protected byte[] m_particleSystem = new byte[0];
87 89
88 [XmlIgnore] 90 [XmlIgnore] public uint TimeStampFull = 0;
89 public uint TimeStampFull = 0; 91 [XmlIgnore] public uint TimeStampTerse = 0;
90 [XmlIgnore] 92 [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn
91 public uint TimeStampTerse = 0;
92 [XmlIgnore]
93 public uint TimeStampLastActivity = 0; // Will be used for AutoReturn
94 93
95 /// <summary> 94 /// <summary>
96 /// Only used internally to schedule client updates 95 /// Only used internally to schedule client updates
@@ -145,16 +144,16 @@ namespace OpenSim.Region.Environment.Scenes
145 144
146 public uint ObjectFlags 145 public uint ObjectFlags
147 { 146 {
148 get { return (uint)m_flags; } 147 get { return (uint) m_flags; }
149 set { m_flags = (LLObject.ObjectFlags)value; } 148 set { m_flags = (LLObject.ObjectFlags) value; }
150 } 149 }
151 150
152 protected LLObject.MaterialType m_material = 0; 151 protected LLObject.MaterialType m_material = 0;
153 152
154 public byte Material 153 public byte Material
155 { 154 {
156 get { return (byte)m_material; } 155 get { return (byte) m_material; }
157 set { m_material = (LLObject.MaterialType)value; } 156 set { m_material = (LLObject.MaterialType) value; }
158 } 157 }
159 158
160 protected ulong m_regionHandle; 159 protected ulong m_regionHandle;
@@ -168,7 +167,6 @@ namespace OpenSim.Region.Environment.Scenes
168 //unkown if this will be kept, added as a way of removing the group position from the group class 167 //unkown if this will be kept, added as a way of removing the group position from the group class
169 protected LLVector3 m_groupPosition; 168 protected LLVector3 m_groupPosition;
170 169
171
172 170
173 public LLVector3 GroupPosition 171 public LLVector3 GroupPosition
174 { 172 {
@@ -225,7 +223,7 @@ namespace OpenSim.Region.Environment.Scenes
225 if (PhysActor != null) 223 if (PhysActor != null)
226 { 224 {
227 if (PhysActor.Orientation.x != 0 || PhysActor.Orientation.y != 0 225 if (PhysActor.Orientation.x != 0 || PhysActor.Orientation.y != 0
228 || PhysActor.Orientation.z != 0 || PhysActor.Orientation.w != 0) 226 || PhysActor.Orientation.z != 0 || PhysActor.Orientation.w != 0)
229 { 227 {
230 m_rotationOffset.X = PhysActor.Orientation.x; 228 m_rotationOffset.X = PhysActor.Orientation.x;
231 m_rotationOffset.Y = PhysActor.Orientation.y; 229 m_rotationOffset.Y = PhysActor.Orientation.y;
@@ -281,6 +279,7 @@ namespace OpenSim.Region.Environment.Scenes
281 } 279 }
282 set { m_velocity = value; } 280 set { m_velocity = value; }
283 } 281 }
282
284 public LLVector3 RotationalVelocity 283 public LLVector3 RotationalVelocity
285 { 284 {
286 get 285 get
@@ -351,6 +350,7 @@ namespace OpenSim.Region.Environment.Scenes
351 { 350 {
352 get { return m_sitTargetPosition; } 351 get { return m_sitTargetPosition; }
353 } 352 }
353
354 public Quaternion SitTargetOrientation 354 public Quaternion SitTargetOrientation
355 { 355 {
356 get { return m_sitTargetOrientation; } 356 get { return m_sitTargetOrientation; }
@@ -383,6 +383,7 @@ namespace OpenSim.Region.Environment.Scenes
383 } 383 }
384 384
385 private int m_linkNum = 0; 385 private int m_linkNum = 0;
386
386 public int LinkNum 387 public int LinkNum
387 { 388 {
388 get { return m_linkNum; } 389 get { return m_linkNum; }
@@ -390,13 +391,14 @@ namespace OpenSim.Region.Environment.Scenes
390 } 391 }
391 392
392 private byte m_clickAction = 0; 393 private byte m_clickAction = 0;
394
393 public byte ClickAction 395 public byte ClickAction
394 { 396 {
395 get { return m_clickAction; } 397 get { return m_clickAction; }
396 set 398 set
397 { 399 {
398 m_clickAction = value; 400 m_clickAction = value;
399 this.ScheduleFullUpdate(); 401 ScheduleFullUpdate();
400 } 402 }
401 } 403 }
402 404
@@ -423,6 +425,7 @@ namespace OpenSim.Region.Environment.Scenes
423 425
424 // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out. 426 // FIXME, TODO, ERROR: 'ParentGroup' can't be in here, move it out.
425 protected SceneObjectGroup m_parentGroup; 427 protected SceneObjectGroup m_parentGroup;
428
426 public SceneObjectGroup ParentGroup 429 public SceneObjectGroup ParentGroup
427 { 430 {
428 get { return m_parentGroup; } 431 get { return m_parentGroup; }
@@ -434,7 +437,6 @@ namespace OpenSim.Region.Environment.Scenes
434 set { m_updateFlag = value; } 437 set { m_updateFlag = value; }
435 } 438 }
436 439
437
438 #region Constructors 440 #region Constructors
439 441
440 /// <summary> 442 /// <summary>
@@ -469,18 +471,18 @@ namespace OpenSim.Region.Environment.Scenes
469 m_regionHandle = regionHandle; 471 m_regionHandle = regionHandle;
470 m_parentGroup = parent; 472 m_parentGroup = parent;
471 473
472 CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 474 CreationDate = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
473 OwnerID = ownerID; 475 OwnerID = ownerID;
474 CreatorID = OwnerID; 476 CreatorID = OwnerID;
475 LastOwnerID = LLUUID.Zero; 477 LastOwnerID = LLUUID.Zero;
476 UUID = LLUUID.Random(); 478 UUID = LLUUID.Random();
477 LocalID = (uint)(localID); 479 LocalID = (uint) (localID);
478 Shape = shape; 480 Shape = shape;
479 // Todo: Add More Object Parameter from above! 481 // Todo: Add More Object Parameter from above!
480 OwnershipCost = 0; 482 OwnershipCost = 0;
481 ObjectSaleType = (byte)0; 483 ObjectSaleType = (byte) 0;
482 SalePrice = 0; 484 SalePrice = 0;
483 Category = (uint)0; 485 Category = (uint) 0;
484 LastOwnerID = CreatorID; 486 LastOwnerID = CreatorID;
485 // End Todo: /// 487 // End Todo: ///
486 GroupPosition = groupPosition; 488 GroupPosition = groupPosition;
@@ -495,9 +497,9 @@ namespace OpenSim.Region.Environment.Scenes
495 m_folderID = LLUUID.Random(); 497 m_folderID = LLUUID.Random();
496 498
497 m_flags = 0; 499 m_flags = 0;
498 m_flags |= LLObject.ObjectFlags.Touch | 500 m_flags |= LLObject.ObjectFlags.Touch |
499 LLObject.ObjectFlags.AllowInventoryDrop | 501 LLObject.ObjectFlags.AllowInventoryDrop |
500 LLObject.ObjectFlags.CreateSelected; 502 LLObject.ObjectFlags.CreateSelected;
501 503
502 ApplySanePermissions(); 504 ApplySanePermissions();
503 505
@@ -520,18 +522,18 @@ namespace OpenSim.Region.Environment.Scenes
520 { 522 {
521 m_regionHandle = regionHandle; 523 m_regionHandle = regionHandle;
522 m_parentGroup = parent; 524 m_parentGroup = parent;
523 TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); 525 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
524 CreationDate = creationDate; 526 CreationDate = creationDate;
525 OwnerID = ownerID; 527 OwnerID = ownerID;
526 CreatorID = creatorID; 528 CreatorID = creatorID;
527 LastOwnerID = lastOwnerID; 529 LastOwnerID = lastOwnerID;
528 UUID = LLUUID.Random(); 530 UUID = LLUUID.Random();
529 LocalID = (uint)(localID); 531 LocalID = (uint) (localID);
530 Shape = shape; 532 Shape = shape;
531 OwnershipCost = 0; 533 OwnershipCost = 0;
532 ObjectSaleType = (byte)0; 534 ObjectSaleType = (byte) 0;
533 SalePrice = 0; 535 SalePrice = 0;
534 Category = (uint)0; 536 Category = (uint) 0;
535 LastOwnerID = CreatorID; 537 LastOwnerID = CreatorID;
536 OffsetPosition = position; 538 OffsetPosition = position;
537 RotationOffset = rotation; 539 RotationOffset = rotation;
@@ -552,18 +554,18 @@ namespace OpenSim.Region.Environment.Scenes
552 /// <returns></returns> 554 /// <returns></returns>
553 public static SceneObjectPart FromXml(XmlReader xmlReader) 555 public static SceneObjectPart FromXml(XmlReader xmlReader)
554 { 556 {
555 XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); 557 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
556 SceneObjectPart newobject = (SceneObjectPart)serializer.Deserialize(xmlReader); 558 SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
557 return newobject; 559 return newobject;
558 } 560 }
559 561
560 public void ApplyPhysics() 562 public void ApplyPhysics()
561 { 563 {
562 bool isPhysical = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 564 bool isPhysical = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
563 bool isPhantom = ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0); 565 bool isPhantom = ((ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0);
564 566
565 bool usePhysics = isPhysical && !isPhantom; 567 bool usePhysics = isPhysical && !isPhantom;
566 568
567 if (usePhysics) 569 if (usePhysics)
568 { 570 {
569 PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape( 571 PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape(
@@ -576,101 +578,102 @@ namespace OpenSim.Region.Environment.Scenes
576 RotationOffset.Y, RotationOffset.Z), usePhysics); 578 RotationOffset.Y, RotationOffset.Z), usePhysics);
577 } 579 }
578 580
579 DoPhysicsPropertyUpdate(usePhysics, true); 581 DoPhysicsPropertyUpdate(usePhysics, true);
580 } 582 }
583
581 public void ApplyNextOwnerPermissions() 584 public void ApplyNextOwnerPermissions()
582 { 585 {
583 BaseMask = NextOwnerMask; 586 BaseMask = NextOwnerMask;
584 OwnerMask = NextOwnerMask; 587 OwnerMask = NextOwnerMask;
585 } 588 }
589
586 public void ApplySanePermissions() 590 public void ApplySanePermissions()
587 { 591 {
588 // These are some flags that The OwnerMask should never have 592 // These are some flags that The OwnerMask should never have
589 OwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; 593 OwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectGroupOwned;
590 OwnerMask &= ~(uint)LLObject.ObjectFlags.Physics; 594 OwnerMask &= ~(uint) LLObject.ObjectFlags.Physics;
591 OwnerMask &= ~(uint)LLObject.ObjectFlags.Phantom; 595 OwnerMask &= ~(uint) LLObject.ObjectFlags.Phantom;
592 OwnerMask &= ~(uint)LLObject.ObjectFlags.Scripted; 596 OwnerMask &= ~(uint) LLObject.ObjectFlags.Scripted;
593 OwnerMask &= ~(uint)LLObject.ObjectFlags.Touch; 597 OwnerMask &= ~(uint) LLObject.ObjectFlags.Touch;
594 OwnerMask &= ~(uint)LLObject.ObjectFlags.Temporary; 598 OwnerMask &= ~(uint) LLObject.ObjectFlags.Temporary;
595 OwnerMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; 599 OwnerMask &= ~(uint) LLObject.ObjectFlags.TemporaryOnRez;
596 OwnerMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; 600 OwnerMask &= ~(uint) LLObject.ObjectFlags.ZlibCompressed;
597 OwnerMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; 601 OwnerMask &= ~(uint) LLObject.ObjectFlags.AllowInventoryDrop;
598 OwnerMask &= ~(uint)LLObject.ObjectFlags.AnimSource; 602 OwnerMask &= ~(uint) LLObject.ObjectFlags.AnimSource;
599 OwnerMask &= ~(uint)LLObject.ObjectFlags.Money; 603 OwnerMask &= ~(uint) LLObject.ObjectFlags.Money;
600 OwnerMask &= ~(uint)LLObject.ObjectFlags.CastShadows; 604 OwnerMask &= ~(uint) LLObject.ObjectFlags.CastShadows;
601 OwnerMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; 605 OwnerMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty;
602 OwnerMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; 606 OwnerMask &= ~(uint) LLObject.ObjectFlags.CreateSelected;
603 607
604 608
605 // These are some flags that the next owner mask should never have 609 // These are some flags that the next owner mask should never have
606 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; 610 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner;
607 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; 611 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectTransfer;
608 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify; 612 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectOwnerModify;
609 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; 613 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ObjectGroupOwned;
610 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Physics; 614 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Physics;
611 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Phantom; 615 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Phantom;
612 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Scripted; 616 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Scripted;
613 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Touch; 617 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Touch;
614 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Temporary; 618 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Temporary;
615 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; 619 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.TemporaryOnRez;
616 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; 620 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.ZlibCompressed;
617 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; 621 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.AllowInventoryDrop;
618 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.AnimSource; 622 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.AnimSource;
619 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.Money; 623 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.Money;
620 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.CastShadows; 624 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.CastShadows;
621 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; 625 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty;
622 NextOwnerMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; 626 NextOwnerMask &= ~(uint) LLObject.ObjectFlags.CreateSelected;
623 627
624 628
625 // These are some flags that the GroupMask should never have 629 // These are some flags that the GroupMask should never have
626 GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; 630 GroupMask &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner;
627 GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; 631 GroupMask &= ~(uint) LLObject.ObjectFlags.ObjectTransfer;
628 GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify; 632 GroupMask &= ~(uint) LLObject.ObjectFlags.ObjectOwnerModify;
629 GroupMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; 633 GroupMask &= ~(uint) LLObject.ObjectFlags.ObjectGroupOwned;
630 GroupMask &= ~(uint)LLObject.ObjectFlags.Physics; 634 GroupMask &= ~(uint) LLObject.ObjectFlags.Physics;
631 GroupMask &= ~(uint)LLObject.ObjectFlags.Phantom; 635 GroupMask &= ~(uint) LLObject.ObjectFlags.Phantom;
632 GroupMask &= ~(uint)LLObject.ObjectFlags.Scripted; 636 GroupMask &= ~(uint) LLObject.ObjectFlags.Scripted;
633 GroupMask &= ~(uint)LLObject.ObjectFlags.Touch; 637 GroupMask &= ~(uint) LLObject.ObjectFlags.Touch;
634 GroupMask &= ~(uint)LLObject.ObjectFlags.Temporary; 638 GroupMask &= ~(uint) LLObject.ObjectFlags.Temporary;
635 GroupMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; 639 GroupMask &= ~(uint) LLObject.ObjectFlags.TemporaryOnRez;
636 GroupMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; 640 GroupMask &= ~(uint) LLObject.ObjectFlags.ZlibCompressed;
637 GroupMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; 641 GroupMask &= ~(uint) LLObject.ObjectFlags.AllowInventoryDrop;
638 GroupMask &= ~(uint)LLObject.ObjectFlags.AnimSource; 642 GroupMask &= ~(uint) LLObject.ObjectFlags.AnimSource;
639 GroupMask &= ~(uint)LLObject.ObjectFlags.Money; 643 GroupMask &= ~(uint) LLObject.ObjectFlags.Money;
640 GroupMask &= ~(uint)LLObject.ObjectFlags.CastShadows; 644 GroupMask &= ~(uint) LLObject.ObjectFlags.CastShadows;
641 GroupMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; 645 GroupMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty;
642 GroupMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; 646 GroupMask &= ~(uint) LLObject.ObjectFlags.CreateSelected;
643 647
644 648
645 // These are some flags that EveryoneMask should never have 649 // These are some flags that EveryoneMask should never have
646 EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; 650 EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner;
647 EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; 651 EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectTransfer;
648 EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify; 652 EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectOwnerModify;
649 EveryoneMask &= ~(uint)LLObject.ObjectFlags.ObjectGroupOwned; 653 EveryoneMask &= ~(uint) LLObject.ObjectFlags.ObjectGroupOwned;
650 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Physics; 654 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Physics;
651 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Phantom; 655 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Phantom;
652 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Scripted; 656 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Scripted;
653 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Touch; 657 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Touch;
654 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Temporary; 658 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Temporary;
655 EveryoneMask &= ~(uint)LLObject.ObjectFlags.TemporaryOnRez; 659 EveryoneMask &= ~(uint) LLObject.ObjectFlags.TemporaryOnRez;
656 EveryoneMask &= ~(uint)LLObject.ObjectFlags.ZlibCompressed; 660 EveryoneMask &= ~(uint) LLObject.ObjectFlags.ZlibCompressed;
657 EveryoneMask &= ~(uint)LLObject.ObjectFlags.AllowInventoryDrop; 661 EveryoneMask &= ~(uint) LLObject.ObjectFlags.AllowInventoryDrop;
658 EveryoneMask &= ~(uint)LLObject.ObjectFlags.AnimSource; 662 EveryoneMask &= ~(uint) LLObject.ObjectFlags.AnimSource;
659 EveryoneMask &= ~(uint)LLObject.ObjectFlags.Money; 663 EveryoneMask &= ~(uint) LLObject.ObjectFlags.Money;
660 EveryoneMask &= ~(uint)LLObject.ObjectFlags.CastShadows; 664 EveryoneMask &= ~(uint) LLObject.ObjectFlags.CastShadows;
661 EveryoneMask &= ~(uint)LLObject.ObjectFlags.InventoryEmpty; 665 EveryoneMask &= ~(uint) LLObject.ObjectFlags.InventoryEmpty;
662 EveryoneMask &= ~(uint)LLObject.ObjectFlags.CreateSelected; 666 EveryoneMask &= ~(uint) LLObject.ObjectFlags.CreateSelected;
663
664 667
665 // These are some flags that ObjectFlags (m_flags) should never have
666 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner;
667 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer;
668 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectOwnerModify;
669 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer;
670 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectCopy;
671 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectModify;
672 ObjectFlags &= ~(uint)LLObject.ObjectFlags.ObjectMove;
673 668
669 // These are some flags that ObjectFlags (m_flags) should never have
670 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectYouOwner;
671 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectTransfer;
672 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectOwnerModify;
673 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectYouOfficer;
674 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectCopy;
675 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectModify;
676 ObjectFlags &= ~(uint) LLObject.ObjectFlags.ObjectMove;
674 } 677 }
675 678
676 /// <summary> 679 /// <summary>
@@ -679,13 +682,12 @@ namespace OpenSim.Region.Environment.Scenes
679 /// <param name="xmlWriter"></param> 682 /// <param name="xmlWriter"></param>
680 public void ToXml(XmlWriter xmlWriter) 683 public void ToXml(XmlWriter xmlWriter)
681 { 684 {
682 XmlSerializer serializer = new XmlSerializer(typeof(SceneObjectPart)); 685 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
683 serializer.Serialize(xmlWriter, this); 686 serializer.Serialize(xmlWriter, this);
684 } 687 }
685 688
686 public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) 689 public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot)
687 { 690 {
688
689 // In this case we're using a sphere with a radius of the largest dimention of the prim 691 // In this case we're using a sphere with a radius of the largest dimention of the prim
690 // TODO: Change to take shape into account 692 // TODO: Change to take shape into account
691 693
@@ -693,35 +695,34 @@ namespace OpenSim.Region.Environment.Scenes
693 EntityIntersection returnresult = new EntityIntersection(); 695 EntityIntersection returnresult = new EntityIntersection();
694 Vector3 vAbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z); 696 Vector3 vAbsolutePosition = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
695 Vector3 vScale = new Vector3(Scale.X, Scale.Y, Scale.Z); 697 Vector3 vScale = new Vector3(Scale.X, Scale.Y, Scale.Z);
696 Quaternion qRotation = new Quaternion(RotationOffset.W, RotationOffset.X, RotationOffset.Y, RotationOffset.Z); 698 Quaternion qRotation =
697 699 new Quaternion(RotationOffset.W, RotationOffset.X, RotationOffset.Y, RotationOffset.Z);
698 700
699 701
700 Quaternion worldRotation = (qRotation * parentrot); 702 Quaternion worldRotation = (qRotation*parentrot);
701 Matrix3 worldRotM = worldRotation.ToRotationMatrix(); 703 Matrix3 worldRotM = worldRotation.ToRotationMatrix();
702 704
703 705
704
705 Vector3 rOrigin = iray.Origin; 706 Vector3 rOrigin = iray.Origin;
706 Vector3 rDirection = iray.Direction; 707 Vector3 rDirection = iray.Direction;
707 708
708 709
709 // Buidling the first part of the Quadratic equation 710 // Buidling the first part of the Quadratic equation
710 Vector3 r2ndDirection = rDirection * rDirection; 711 Vector3 r2ndDirection = rDirection*rDirection;
711 float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z; 712 float itestPart1 = r2ndDirection.x + r2ndDirection.y + r2ndDirection.z;
712 713
713 // Buidling the second part of the Quadratic equation 714 // Buidling the second part of the Quadratic equation
714 Vector3 tmVal2 = rOrigin - vAbsolutePosition; 715 Vector3 tmVal2 = rOrigin - vAbsolutePosition;
715 Vector3 r2Direction = rDirection * 2.0f; 716 Vector3 r2Direction = rDirection*2.0f;
716 Vector3 tmVal3 = r2Direction * tmVal2; 717 Vector3 tmVal3 = r2Direction*tmVal2;
717 718
718 float itestPart2 = tmVal3.x + tmVal3.y + tmVal3.z; 719 float itestPart2 = tmVal3.x + tmVal3.y + tmVal3.z;
719 720
720 // Buidling the third part of the Quadratic equation 721 // Buidling the third part of the Quadratic equation
721 Vector3 tmVal4 = rOrigin * rOrigin; 722 Vector3 tmVal4 = rOrigin*rOrigin;
722 Vector3 tmVal5 = vAbsolutePosition * vAbsolutePosition; 723 Vector3 tmVal5 = vAbsolutePosition*vAbsolutePosition;
723 724
724 Vector3 tmVal6 = vAbsolutePosition * rOrigin; 725 Vector3 tmVal6 = vAbsolutePosition*rOrigin;
725 726
726 727
727 // Set Radius to the largest dimention of the prim 728 // Set Radius to the largest dimention of the prim
@@ -735,21 +736,22 @@ namespace OpenSim.Region.Environment.Scenes
735 736
736 //radius = radius; 737 //radius = radius;
737 738
738 float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z - (2.0f * (tmVal6.x + tmVal6.y + tmVal6.z + (radius * radius))); 739 float itestPart3 = tmVal4.x + tmVal4.y + tmVal4.z + tmVal5.x + tmVal5.y + tmVal5.z -
740 (2.0f*(tmVal6.x + tmVal6.y + tmVal6.z + (radius*radius)));
739 741
740 // Yuk Quadradrics.. Solve first 742 // Yuk Quadradrics.. Solve first
741 float rootsqr = (itestPart2 * itestPart2) - (4.0f * itestPart1 * itestPart3); 743 float rootsqr = (itestPart2*itestPart2) - (4.0f*itestPart1*itestPart3);
742 if (rootsqr < 0.0f) 744 if (rootsqr < 0.0f)
743 { 745 {
744 // No intersection 746 // No intersection
745 return returnresult; 747 return returnresult;
746 } 748 }
747 float root = ((-itestPart2) - (float)Math.Sqrt((double)rootsqr)) / (itestPart1 * 2.0f); 749 float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f);
748 750
749 if (root < 0.0f) 751 if (root < 0.0f)
750 { 752 {
751 // perform second quadratic root solution 753 // perform second quadratic root solution
752 root = ((-itestPart2) + (float)Math.Sqrt((double)rootsqr)) / (itestPart1 * 2.0f); 754 root = ((-itestPart2) + (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f);
753 755
754 // is there any intersection? 756 // is there any intersection?
755 if (root < 0.0f) 757 if (root < 0.0f)
@@ -761,7 +763,9 @@ namespace OpenSim.Region.Environment.Scenes
761 763
762 // We got an intersection. putting together an EntityIntersection object with the 764 // We got an intersection. putting together an EntityIntersection object with the
763 // intersection information 765 // intersection information
764 Vector3 ipoint = new Vector3(iray.Origin.x + (iray.Direction.x * root), iray.Origin.y + (iray.Direction.y * root), iray.Origin.z + (iray.Direction.z * root)); 766 Vector3 ipoint =
767 new Vector3(iray.Origin.x + (iray.Direction.x*root), iray.Origin.y + (iray.Direction.y*root),
768 iray.Origin.z + (iray.Direction.z*root));
765 769
766 returnresult.HitTF = true; 770 returnresult.HitTF = true;
767 returnresult.ipoint = ipoint; 771 returnresult.ipoint = ipoint;
@@ -775,7 +779,7 @@ namespace OpenSim.Region.Environment.Scenes
775 779
776 LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z); 780 LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z);
777 LLVector3 distanceConvert2 = new LLVector3(ipoint.x, ipoint.y, ipoint.z); 781 LLVector3 distanceConvert2 = new LLVector3(ipoint.x, ipoint.y, ipoint.z);
778 float distance = (float)Util.GetDistanceTo(distanceConvert1, distanceConvert2); 782 float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2);
779 783
780 returnresult.distance = distance; 784 returnresult.distance = distance;
781 785
@@ -783,7 +787,6 @@ namespace OpenSim.Region.Environment.Scenes
783 } 787 }
784 788
785 789
786
787 /// <summary> 790 /// <summary>
788 /// 791 ///
789 /// </summary> 792 /// </summary>
@@ -797,6 +800,7 @@ namespace OpenSim.Region.Environment.Scenes
797 m_sitTargetPosition = offset; 800 m_sitTargetPosition = offset;
798 m_sitTargetOrientation = orientation; 801 m_sitTargetOrientation = orientation;
799 } 802 }
803
800 public LLVector3 GetSitTargetPositionLL() 804 public LLVector3 GetSitTargetPositionLL()
801 { 805 {
802 return new LLVector3(m_sitTargetPosition.x, m_sitTargetPosition.y, m_sitTargetPosition.z); 806 return new LLVector3(m_sitTargetPosition.x, m_sitTargetPosition.y, m_sitTargetPosition.z);
@@ -804,13 +808,17 @@ namespace OpenSim.Region.Environment.Scenes
804 808
805 public LLQuaternion GetSitTargetOrientationLL() 809 public LLQuaternion GetSitTargetOrientationLL()
806 { 810 {
807 return new LLQuaternion( m_sitTargetOrientation.x, m_sitTargetOrientation.y, m_sitTargetOrientation.z,m_sitTargetOrientation.w); 811 return
812 new LLQuaternion(m_sitTargetOrientation.x, m_sitTargetOrientation.y, m_sitTargetOrientation.z,
813 m_sitTargetOrientation.w);
808 } 814 }
809 815
810 // Utility function so the databases don't have to reference axiom.math 816 // Utility function so the databases don't have to reference axiom.math
811 public void SetSitTargetLL(LLVector3 offset, LLQuaternion orientation) 817 public void SetSitTargetLL(LLVector3 offset, LLQuaternion orientation)
812 { 818 {
813 if (!(offset.X == 0 && offset.Y == 0 && offset.Z == 0 && (orientation.W == 0 || orientation.W == 1) && orientation.X == 0 && orientation.Y == 0 && orientation.Z == 0)) 819 if (
820 !(offset.X == 0 && offset.Y == 0 && offset.Z == 0 && (orientation.W == 0 || orientation.W == 1) &&
821 orientation.X == 0 && orientation.Y == 0 && orientation.Z == 0))
814 { 822 {
815 m_sitTargetPosition = new Vector3(offset.X, offset.Y, offset.Z); 823 m_sitTargetPosition = new Vector3(offset.X, offset.Y, offset.Z);
816 m_sitTargetOrientation = new Quaternion(orientation.W, orientation.X, orientation.Y, orientation.Z); 824 m_sitTargetOrientation = new Quaternion(orientation.W, orientation.X, orientation.Y, orientation.Z);
@@ -869,7 +877,7 @@ namespace OpenSim.Region.Environment.Scenes
869 /// <returns></returns> 877 /// <returns></returns>
870 public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID) 878 public SceneObjectPart Copy(uint localID, LLUUID AgentID, LLUUID GroupID)
871 { 879 {
872 SceneObjectPart dupe = (SceneObjectPart)MemberwiseClone(); 880 SceneObjectPart dupe = (SceneObjectPart) MemberwiseClone();
873 dupe.m_shape = m_shape.Copy(); 881 dupe.m_shape = m_shape.Copy();
874 dupe.m_regionHandle = m_regionHandle; 882 dupe.m_regionHandle = m_regionHandle;
875 dupe.UUID = LLUUID.Random(); 883 dupe.UUID = LLUUID.Random();
@@ -896,7 +904,7 @@ namespace OpenSim.Region.Environment.Scenes
896 byte[] extraP = new byte[Shape.ExtraParams.Length]; 904 byte[] extraP = new byte[Shape.ExtraParams.Length];
897 Array.Copy(Shape.ExtraParams, extraP, extraP.Length); 905 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
898 dupe.Shape.ExtraParams = extraP; 906 dupe.Shape.ExtraParams = extraP;
899 bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 907 bool UsePhysics = ((dupe.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
900 dupe.DoPhysicsPropertyUpdate(UsePhysics, true); 908 dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
901 909
902 return dupe; 910 return dupe;
@@ -923,7 +931,7 @@ namespace OpenSim.Region.Environment.Scenes
923 { 931 {
924 m_parentGroup.HasChanged = true; 932 m_parentGroup.HasChanged = true;
925 } 933 }
926 TimeStampFull = (uint)Util.UnixTimeSinceEpoch(); 934 TimeStampFull = (uint) Util.UnixTimeSinceEpoch();
927 m_updateFlag = 2; 935 m_updateFlag = 2;
928 } 936 }
929 937
@@ -931,11 +939,10 @@ namespace OpenSim.Region.Environment.Scenes
931 { 939 {
932 LLObject.ObjectFlags prevflag = m_flags; 940 LLObject.ObjectFlags prevflag = m_flags;
933 //uint objflags = m_flags; 941 //uint objflags = m_flags;
934 if ((ObjectFlags & (uint)flag) == 0) 942 if ((ObjectFlags & (uint) flag) == 0)
935 { 943 {
936 //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString()); 944 //Console.WriteLine("Adding flag: " + ((LLObject.ObjectFlags) flag).ToString());
937 m_flags |= flag; 945 m_flags |= flag;
938
939 } 946 }
940 //uint currflag = (uint)m_flags; 947 //uint currflag = (uint)m_flags;
941 //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); 948 //System.Console.WriteLine("Aprev: " + prevflag.ToString() + " curr: " + m_flags.ToString());
@@ -945,11 +952,10 @@ namespace OpenSim.Region.Environment.Scenes
945 public void RemFlag(LLObject.ObjectFlags flag) 952 public void RemFlag(LLObject.ObjectFlags flag)
946 { 953 {
947 LLObject.ObjectFlags prevflag = m_flags; 954 LLObject.ObjectFlags prevflag = m_flags;
948 if ((ObjectFlags & (uint)flag) != 0) 955 if ((ObjectFlags & (uint) flag) != 0)
949 { 956 {
950 //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString()); 957 //Console.WriteLine("Removing flag: " + ((LLObject.ObjectFlags)flag).ToString());
951 m_flags &= ~flag; 958 m_flags &= ~flag;
952
953 } 959 }
954 //System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + m_flags.ToString()); 960 //System.Console.WriteLine("prev: " + prevflag.ToString() + " curr: " + m_flags.ToString());
955 //ScheduleFullUpdate(); 961 //ScheduleFullUpdate();
@@ -966,7 +972,7 @@ namespace OpenSim.Region.Environment.Scenes
966 { 972 {
967 m_parentGroup.HasChanged = true; 973 m_parentGroup.HasChanged = true;
968 } 974 }
969 TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); 975 TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
970 m_updateFlag = 1; 976 m_updateFlag = 1;
971 } 977 }
972 } 978 }
@@ -1074,7 +1080,7 @@ namespace OpenSim.Region.Environment.Scenes
1074 { 1080 {
1075 if (m_inventorySerial > 0) 1081 if (m_inventorySerial > 0)
1076 { 1082 {
1077 client.SendTaskInventory(m_uuid, (short)m_inventorySerial, 1083 client.SendTaskInventory(m_uuid, (short) m_inventorySerial,
1078 Helpers.StringToField(m_inventoryFileName)); 1084 Helpers.StringToField(m_inventoryFileName));
1079 return true; 1085 return true;
1080 } 1086 }
@@ -1134,7 +1140,7 @@ namespace OpenSim.Region.Environment.Scenes
1134 bool IsTemporary = false; 1140 bool IsTemporary = false;
1135 bool IsPhantom = false; 1141 bool IsPhantom = false;
1136 bool castsShadows = false; 1142 bool castsShadows = false;
1137 bool wasUsingPhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 1143 bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
1138 //bool IsLocked = false; 1144 //bool IsLocked = false;
1139 int i = 0; 1145 int i = 0;
1140 1146
@@ -1162,7 +1168,6 @@ namespace OpenSim.Region.Environment.Scenes
1162 { 1168 {
1163 DoPhysicsPropertyUpdate(usePhysics, false); 1169 DoPhysicsPropertyUpdate(usePhysics, false);
1164 } 1170 }
1165
1166 } 1171 }
1167 else 1172 else
1168 { 1173 {
@@ -1174,9 +1179,6 @@ namespace OpenSim.Region.Environment.Scenes
1174 } 1179 }
1175 1180
1176 1181
1177
1178
1179
1180 if (IsPhantom) 1182 if (IsPhantom)
1181 { 1183 {
1182 AddFlag(LLObject.ObjectFlags.Phantom); 1184 AddFlag(LLObject.ObjectFlags.Phantom);
@@ -1220,19 +1222,18 @@ namespace OpenSim.Region.Environment.Scenes
1220 // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); 1222 // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
1221 ScheduleFullUpdate(); 1223 ScheduleFullUpdate();
1222 } 1224 }
1225
1223 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) 1226 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
1224 { 1227 {
1225
1226 if (PhysActor != null) 1228 if (PhysActor != null)
1227 { 1229 {
1228 if (UsePhysics != PhysActor.IsPhysical || isNew) 1230 if (UsePhysics != PhysActor.IsPhysical || isNew)
1229 { 1231 {
1230
1231 if (PhysActor.IsPhysical) 1232 if (PhysActor.IsPhysical)
1232 { 1233 {
1233 if (!isNew) 1234 if (!isNew)
1234 this.ParentGroup.m_scene.RemovePhysicalPrim(1); 1235 ParentGroup.m_scene.RemovePhysicalPrim(1);
1235 1236
1236 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; 1237 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
1237 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; 1238 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
1238 } 1239 }
@@ -1244,7 +1245,7 @@ namespace OpenSim.Region.Environment.Scenes
1244 //PhysActor = null; 1245 //PhysActor = null;
1245 1246
1246 1247
1247 if ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 1248 if ((ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
1248 { 1249 {
1249 //PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape( 1250 //PhysActor = m_parentGroup.m_scene.PhysicsScene.AddPrimShape(
1250 //Name, 1251 //Name,
@@ -1256,8 +1257,8 @@ namespace OpenSim.Region.Environment.Scenes
1256 //RotationOffset.Y, RotationOffset.Z), UsePhysics); 1257 //RotationOffset.Y, RotationOffset.Z), UsePhysics);
1257 if (UsePhysics) 1258 if (UsePhysics)
1258 { 1259 {
1259 this.ParentGroup.m_scene.AddPhysicalPrim(1); 1260 ParentGroup.m_scene.AddPhysicalPrim(1);
1260 1261
1261 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 1262 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
1262 PhysActor.OnOutOfBounds += PhysicsOutOfBounds; 1263 PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
1263 } 1264 }
@@ -1271,15 +1272,15 @@ namespace OpenSim.Region.Environment.Scenes
1271 { 1272 {
1272 m_shape.ExtraParams = new byte[data.Length + 7]; 1273 m_shape.ExtraParams = new byte[data.Length + 7];
1273 int i = 0; 1274 int i = 0;
1274 uint length = (uint)data.Length; 1275 uint length = (uint) data.Length;
1275 m_shape.ExtraParams[i++] = 1; 1276 m_shape.ExtraParams[i++] = 1;
1276 m_shape.ExtraParams[i++] = (byte)(type % 256); 1277 m_shape.ExtraParams[i++] = (byte) (type%256);
1277 m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256); 1278 m_shape.ExtraParams[i++] = (byte) ((type >> 8)%256);
1278 1279
1279 m_shape.ExtraParams[i++] = (byte)(length % 256); 1280 m_shape.ExtraParams[i++] = (byte) (length%256);
1280 m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256); 1281 m_shape.ExtraParams[i++] = (byte) ((length >> 8)%256);
1281 m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256); 1282 m_shape.ExtraParams[i++] = (byte) ((length >> 16)%256);
1282 m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256); 1283 m_shape.ExtraParams[i++] = (byte) ((length >> 24)%256);
1283 Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length); 1284 Array.Copy(data, 0, m_shape.ExtraParams, i, data.Length);
1284 1285
1285 ScheduleFullUpdate(); 1286 ScheduleFullUpdate();
@@ -1305,7 +1306,7 @@ namespace OpenSim.Region.Environment.Scenes
1305 { 1306 {
1306 if (PhysActor != null) 1307 if (PhysActor != null)
1307 { 1308 {
1308 return new LLVector3(PhysActor.CenterOfMass.X,PhysActor.CenterOfMass.Y,PhysActor.CenterOfMass.Z); 1309 return new LLVector3(PhysActor.CenterOfMass.X, PhysActor.CenterOfMass.Y, PhysActor.CenterOfMass.Z);
1309 } 1310 }
1310 else 1311 else
1311 { 1312 {
@@ -1323,7 +1324,7 @@ namespace OpenSim.Region.Environment.Scenes
1323 /// <param name="textureEntry"></param> 1324 /// <param name="textureEntry"></param>
1324 public void UpdateTextureEntry(byte[] textureEntry) 1325 public void UpdateTextureEntry(byte[] textureEntry)
1325 { 1326 {
1326 m_shape.Textures = new LLObject.TextureEntry( textureEntry, 0, textureEntry.Length ); 1327 m_shape.Textures = new LLObject.TextureEntry(textureEntry, 0, textureEntry.Length);
1327 ScheduleFullUpdate(); 1328 ScheduleFullUpdate();
1328 } 1329 }
1329 1330
@@ -1337,20 +1338,20 @@ namespace OpenSim.Region.Environment.Scenes
1337 { 1338 {
1338 if (tex.FaceTextures[i] != null) 1339 if (tex.FaceTextures[i] != null)
1339 { 1340 {
1340 tmpcolor = tex.GetFace((uint)i).RGBA; 1341 tmpcolor = tex.GetFace((uint) i).RGBA;
1341 tmpcolor.A = tmpcolor.A * 255; 1342 tmpcolor.A = tmpcolor.A*255;
1342 tmpcolor.R = tmpcolor.R * 255; 1343 tmpcolor.R = tmpcolor.R*255;
1343 tmpcolor.G = tmpcolor.G * 255; 1344 tmpcolor.G = tmpcolor.G*255;
1344 tmpcolor.B = tmpcolor.B * 255; 1345 tmpcolor.B = tmpcolor.B*255;
1345 tex.FaceTextures[i].RGBA = tmpcolor; 1346 tex.FaceTextures[i].RGBA = tmpcolor;
1346 } 1347 }
1347 } 1348 }
1348 tmpcolor = tex.DefaultTexture.RGBA; 1349 tmpcolor = tex.DefaultTexture.RGBA;
1349 tmpcolor.A = tmpcolor.A * 255; 1350 tmpcolor.A = tmpcolor.A*255;
1350 tmpcolor.R = tmpcolor.R * 255; 1351 tmpcolor.R = tmpcolor.R*255;
1351 tmpcolor.G = tmpcolor.G * 255; 1352 tmpcolor.G = tmpcolor.G*255;
1352 tmpcolor.B = tmpcolor.B * 255; 1353 tmpcolor.B = tmpcolor.B*255;
1353 tex.DefaultTexture.RGBA = tmpcolor; 1354 tex.DefaultTexture.RGBA = tmpcolor;
1354 UpdateTextureEntry(tex.ToBytes()); 1355 UpdateTextureEntry(tex.ToBytes());
1355 } 1356 }
1356 1357
@@ -1416,34 +1417,33 @@ namespace OpenSim.Region.Environment.Scenes
1416 // Are we the owner? 1417 // Are we the owner?
1417 if (AgentID == OwnerID) 1418 if (AgentID == OwnerID)
1418 { 1419 {
1419 MainLog.Instance.Verbose("PERMISSIONS", "field: " + field.ToString() + ", mask: " + mask.ToString() + " addRemTF: " + addRemTF.ToString()); 1420 MainLog.Instance.Verbose("PERMISSIONS",
1420 1421 "field: " + field.ToString() + ", mask: " + mask.ToString() + " addRemTF: " +
1422 addRemTF.ToString());
1423
1421 //Field 8 = EveryoneMask 1424 //Field 8 = EveryoneMask
1422 if (field == (byte)8) 1425 if (field == (byte) 8)
1423 { 1426 {
1424 MainLog.Instance.Verbose("PERMISSIONS", "Left over: " + (OwnerMask - EveryoneMask)); 1427 MainLog.Instance.Verbose("PERMISSIONS", "Left over: " + (OwnerMask - EveryoneMask));
1425 if (addRemTF == (byte)0) 1428 if (addRemTF == (byte) 0)
1426 { 1429 {
1427 //EveryoneMask = (uint)0; 1430 //EveryoneMask = (uint)0;
1428 EveryoneMask &= ~mask; 1431 EveryoneMask &= ~mask;
1429 //EveryoneMask &= ~(uint)57344; 1432 //EveryoneMask &= ~(uint)57344;
1430
1431
1432 } 1433 }
1433 else 1434 else
1434 { 1435 {
1435 //EveryoneMask = (uint)0; 1436 //EveryoneMask = (uint)0;
1436 EveryoneMask |= mask; 1437 EveryoneMask |= mask;
1437 //EveryoneMask |= (uint)57344; 1438 //EveryoneMask |= (uint)57344;
1438
1439 } 1439 }
1440 //ScheduleFullUpdate(); 1440 //ScheduleFullUpdate();
1441 SendFullUpdateToAllClients(); 1441 SendFullUpdateToAllClients();
1442 } 1442 }
1443 //Field 16 = NextownerMask 1443 //Field 16 = NextownerMask
1444 if (field == (byte)16) 1444 if (field == (byte) 16)
1445 { 1445 {
1446 if (addRemTF == (byte)0) 1446 if (addRemTF == (byte) 0)
1447 { 1447 {
1448 NextOwnerMask &= ~mask; 1448 NextOwnerMask &= ~mask;
1449 } 1449 }
@@ -1453,7 +1453,6 @@ namespace OpenSim.Region.Environment.Scenes
1453 } 1453 }
1454 SendFullUpdateToAllClients(); 1454 SendFullUpdateToAllClients();
1455 } 1455 }
1456
1457 } 1456 }
1458 } 1457 }
1459 1458
@@ -1482,7 +1481,8 @@ namespace OpenSim.Region.Environment.Scenes
1482 for (int i = 0; i < avatars.Count; i++) 1481 for (int i = 0; i < avatars.Count; i++)
1483 { 1482 {
1484 // Ugly reference :( 1483 // Ugly reference :(
1485 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, avatars[i].GenerateClientFlags(this.UUID)); 1484 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
1485 avatars[i].GenerateClientFlags(UUID));
1486 } 1486 }
1487 } 1487 }
1488 1488
@@ -1515,19 +1515,19 @@ namespace OpenSim.Region.Environment.Scenes
1515 { 1515 {
1516 LLQuaternion lRot; 1516 LLQuaternion lRot;
1517 lRot = RotationOffset; 1517 lRot = RotationOffset;
1518 clientFlags &= ~(uint)LLObject.ObjectFlags.CreateSelected; 1518 clientFlags &= ~(uint) LLObject.ObjectFlags.CreateSelected;
1519 1519
1520 if (remoteClient.AgentId == OwnerID) 1520 if (remoteClient.AgentId == OwnerID)
1521 { 1521 {
1522 if ((uint)(m_flags & LLObject.ObjectFlags.CreateSelected) != 0) 1522 if ((uint) (m_flags & LLObject.ObjectFlags.CreateSelected) != 0)
1523 { 1523 {
1524 clientFlags |= (uint)LLObject.ObjectFlags.CreateSelected; 1524 clientFlags |= (uint) LLObject.ObjectFlags.CreateSelected;
1525 m_flags &= ~LLObject.ObjectFlags.CreateSelected; 1525 m_flags &= ~LLObject.ObjectFlags.CreateSelected;
1526 } 1526 }
1527 } 1527 }
1528 1528
1529 1529
1530 byte[] color = new byte[] { m_color.R, m_color.G, m_color.B, m_color.A }; 1530 byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A};
1531 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, 1531 remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid,
1532 OwnerID, 1532 OwnerID,
1533 m_text, color, ParentID, m_particleSystem, lRot, m_clickAction); 1533 m_text, color, ParentID, m_particleSystem, lRot, m_clickAction);
@@ -1574,26 +1574,28 @@ namespace OpenSim.Region.Environment.Scenes
1574 LLVector3 lPos; 1574 LLVector3 lPos;
1575 lPos = OffsetPosition; 1575 lPos = OffsetPosition;
1576 LLQuaternion mRot = RotationOffset; 1576 LLQuaternion mRot = RotationOffset;
1577 if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) 1577 if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0)
1578 { 1578 {
1579 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); 1579 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
1580 } 1580 }
1581 else 1581 else
1582 { 1582 {
1583 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, RotationalVelocity); 1583 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity,
1584 RotationalVelocity);
1584 } 1585 }
1585 } 1586 }
1586 1587
1587 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos) 1588 public void SendTerseUpdateToClient(IClientAPI remoteClient, LLVector3 lPos)
1588 { 1589 {
1589 LLQuaternion mRot = RotationOffset; 1590 LLQuaternion mRot = RotationOffset;
1590 if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) 1591 if ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0)
1591 { 1592 {
1592 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); 1593 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot);
1593 } 1594 }
1594 else 1595 else
1595 { 1596 {
1596 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity, RotationalVelocity); 1597 remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot, Velocity,
1598 RotationalVelocity);
1597 //System.Console.WriteLine("RVel:" + RotationalVelocity); 1599 //System.Console.WriteLine("RVel:" + RotationalVelocity);
1598 } 1600 }
1599 } 1601 }
@@ -1603,13 +1605,16 @@ namespace OpenSim.Region.Environment.Scenes
1603 public virtual void UpdateMovement() 1605 public virtual void UpdateMovement()
1604 { 1606 {
1605 } 1607 }
1608
1606 #region Events 1609 #region Events
1610
1607 public void PhysicsRequestingTerseUpdate() 1611 public void PhysicsRequestingTerseUpdate()
1608 { 1612 {
1609 ScheduleTerseUpdate(); 1613 ScheduleTerseUpdate();
1610 1614
1611 //SendTerseUpdateToAllClients(); 1615 //SendTerseUpdateToAllClients();
1612 } 1616 }
1617
1613 #endregion 1618 #endregion
1614 1619
1615 public void PhysicsOutOfBounds(PhysicsVector pos) 1620 public void PhysicsOutOfBounds(PhysicsVector pos)
@@ -1626,10 +1631,10 @@ namespace OpenSim.Region.Environment.Scenes
1626 1631
1627 public void SetText(string text, Vector3 color, double alpha) 1632 public void SetText(string text, Vector3 color, double alpha)
1628 { 1633 {
1629 Color = Color.FromArgb(0xff - (int)(alpha * 0xff), 1634 Color = Color.FromArgb(0xff - (int) (alpha*0xff),
1630 (int)(color.x * 0xff), 1635 (int) (color.x*0xff),
1631 (int)(color.y * 0xff), 1636 (int) (color.y*0xff),
1632 (int)(color.z * 0xff)); 1637 (int) (color.z*0xff));
1633 Text = text; 1638 Text = text;
1634 } 1639 }
1635 1640
@@ -1725,7 +1730,6 @@ namespace OpenSim.Region.Environment.Scenes
1725 public TaskInventoryItem() 1730 public TaskInventoryItem()
1726 { 1731 {
1727 } 1732 }
1728
1729 } 1733 }
1730 } 1734 }
1731} 1735} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 9a937a2..9454de0 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -32,7 +32,6 @@ using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Communications;
36using OpenSim.Region.Environment.Types; 35using OpenSim.Region.Environment.Types;
37using OpenSim.Region.Physics.Manager; 36using OpenSim.Region.Physics.Manager;
38 37
@@ -60,14 +59,14 @@ namespace OpenSim.Region.Environment.Scenes
60 private bool m_setAlwaysRun = false; 59 private bool m_setAlwaysRun = false;
61 60
62 private Quaternion m_bodyRot; 61 private Quaternion m_bodyRot;
63 62
64 public bool IsRestrictedToRegion = false; 63 public bool IsRestrictedToRegion = false;
65 64
66 // Agent moves with a PID controller causing a force to be exerted. 65 // Agent moves with a PID controller causing a force to be exerted.
67 private bool m_newForce = false; 66 private bool m_newForce = false;
68 private bool m_newCoarseLocations = true; 67 private bool m_newCoarseLocations = true;
69 private bool m_gotAllObjectsInScene = false; 68 private bool m_gotAllObjectsInScene = false;
70 69
71 // Default AV Height 70 // Default AV Height
72 private float m_avHeight = 127.0f; 71 private float m_avHeight = 127.0f;
73 72
@@ -76,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes
76 75
77 private readonly Vector3[] Dir_Vectors = new Vector3[6]; 76 private readonly Vector3[] Dir_Vectors = new Vector3[6];
78 private LLVector3 lastPhysPos = new LLVector3(); 77 private LLVector3 lastPhysPos = new LLVector3();
79 78
80 // Position of agent's camera in world (region cordinates) 79 // Position of agent's camera in world (region cordinates)
81 protected Vector3 m_CameraCenter = new Vector3(0, 0, 0); 80 protected Vector3 m_CameraCenter = new Vector3(0, 0, 0);
82 81
@@ -85,17 +84,18 @@ namespace OpenSim.Region.Environment.Scenes
85 protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0); 84 protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0);
86 protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0); 85 protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0);
87 protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0); 86 protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0);
88 private uint m_AgentControlFlags = (uint)0; 87 private uint m_AgentControlFlags = (uint) 0;
89 private LLQuaternion m_headrotation = new LLQuaternion(); 88 private LLQuaternion m_headrotation = new LLQuaternion();
90 private byte m_state = (byte)0; 89 private byte m_state = (byte) 0;
91 90
92 // Agent's Draw distance. 91 // Agent's Draw distance.
93 protected float m_DrawDistance = 0f; 92 protected float m_DrawDistance = 0f;
94 93
95 protected AvatarAppearance m_appearance; 94 protected AvatarAppearance m_appearance;
96 95
97 private readonly List<ulong> m_knownChildRegions = new List<ulong>(); //neighbouring regions we have enabled a child agent in 96 private readonly List<ulong> m_knownChildRegions = new List<ulong>();
98 97 //neighbouring regions we have enabled a child agent in
98
99 99
100 /// <summary> 100 /// <summary>
101 /// Implemented Control Flags 101 /// Implemented Control Flags
@@ -172,6 +172,7 @@ namespace OpenSim.Region.Environment.Scenes
172 } 172 }
173 173
174 protected bool m_allowMovement = true; 174 protected bool m_allowMovement = true;
175
175 public bool AllowMovement 176 public bool AllowMovement
176 { 177 {
177 get { return m_allowMovement; } 178 get { return m_allowMovement; }
@@ -181,8 +182,8 @@ namespace OpenSim.Region.Environment.Scenes
181 /// <summary> 182 /// <summary>
182 /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager 183 /// This works out to be the ClientView object associated with this avatar, or it's UDP connection manager
183 /// </summary> 184 /// </summary>
184
185 private readonly IClientAPI m_controllingClient; 185 private readonly IClientAPI m_controllingClient;
186
186 protected PhysicsActor m_physicsActor; 187 protected PhysicsActor m_physicsActor;
187 188
188 public IClientAPI ControllingClient 189 public IClientAPI ControllingClient
@@ -228,6 +229,7 @@ namespace OpenSim.Region.Environment.Scenes
228 m_pos = value; 229 m_pos = value;
229 } 230 }
230 } 231 }
232
231 /// <summary> 233 /// <summary>
232 /// Current Velocity of the avatar. 234 /// Current Velocity of the avatar.
233 /// </summary> 235 /// </summary>
@@ -294,6 +296,7 @@ namespace OpenSim.Region.Environment.Scenes
294 { 296 {
295 get { return m_knownChildRegions; } 297 get { return m_knownChildRegions; }
296 } 298 }
299
297 #endregion 300 #endregion
298 301
299 #region Constructor(s) 302 #region Constructor(s)
@@ -336,7 +339,7 @@ namespace OpenSim.Region.Environment.Scenes
336 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) 339 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance)
337 : this(client, world, reginfo) 340 : this(client, world, reginfo)
338 { 341 {
339 m_appearance = appearance; 342 m_appearance = appearance;
340 } 343 }
341 344
342 private void RegisterToEvents() 345 private void RegisterToEvents()
@@ -366,6 +369,7 @@ namespace OpenSim.Region.Environment.Scenes
366 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN 369 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN
367 Dir_Vectors[5] = new Vector3(0, 0, -0.5f); //DOWN_Nudge 370 Dir_Vectors[5] = new Vector3(0, 0, -0.5f); //DOWN_Nudge
368 } 371 }
372
369 #endregion 373 #endregion
370 374
371 public void QueuePartForUpdate(SceneObjectPart part) 375 public void QueuePartForUpdate(SceneObjectPart part)
@@ -381,7 +385,7 @@ namespace OpenSim.Region.Environment.Scenes
381 385
382 public uint GenerateClientFlags(LLUUID ObjectID) 386 public uint GenerateClientFlags(LLUUID ObjectID)
383 { 387 {
384 return m_scene.PermissionsMngr.GenerateClientFlags(this.m_uuid, ObjectID); 388 return m_scene.PermissionsMngr.GenerateClientFlags(m_uuid, ObjectID);
385 } 389 }
386 390
387 public void SendPrimUpdates() 391 public void SendPrimUpdates()
@@ -461,6 +465,7 @@ namespace OpenSim.Region.Environment.Scenes
461 } 465 }
462 466
463 #region Status Methods 467 #region Status Methods
468
464 /// <summary> 469 /// <summary>
465 /// This turns a child agent, into a root agent 470 /// This turns a child agent, into a root agent
466 /// This is called when an agent teleports into a region, or if an 471 /// This is called when an agent teleports into a region, or if an
@@ -531,6 +536,7 @@ namespace OpenSim.Region.Environment.Scenes
531 public void StopMovement() 536 public void StopMovement()
532 { 537 {
533 } 538 }
539
534 public void StopFlying() 540 public void StopFlying()
535 { 541 {
536 // It turns out to get the agent to stop flying, you have to feed it stop flying velocities 542 // It turns out to get the agent to stop flying, you have to feed it stop flying velocities
@@ -560,9 +566,11 @@ namespace OpenSim.Region.Environment.Scenes
560 m_knownChildRegions.Remove(regionHandle); 566 m_knownChildRegions.Remove(regionHandle);
561 } 567 }
562 } 568 }
569
563 #endregion 570 #endregion
564 571
565 #region Event Handlers 572 #region Event Handlers
573
566 /// <summary> 574 /// <summary>
567 /// Sets avatar height in the phyiscs plugin 575 /// Sets avatar height in the phyiscs plugin
568 /// </summary> 576 /// </summary>
@@ -603,7 +611,6 @@ namespace OpenSim.Region.Environment.Scenes
603 /// </summary> 611 /// </summary>
604 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdatePacket agentData) 612 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdatePacket agentData)
605 { 613 {
606
607 //if (m_isChildAgent) 614 //if (m_isChildAgent)
608 //{ 615 //{
609 // // Console.WriteLine("DEBUG: HandleAgentUpdate: child agent"); 616 // // Console.WriteLine("DEBUG: HandleAgentUpdate: child agent");
@@ -639,7 +646,7 @@ namespace OpenSim.Region.Environment.Scenes
639 // The Agent's Draw distance setting 646 // The Agent's Draw distance setting
640 m_DrawDistance = agentData.AgentData.Far; 647 m_DrawDistance = agentData.AgentData.Far;
641 648
642 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) 649 if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
643 { 650 {
644 StandUp(); 651 StandUp();
645 } 652 }
@@ -649,7 +656,7 @@ namespace OpenSim.Region.Environment.Scenes
649 return; 656 return;
650 } 657 }
651 658
652 if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) 659 if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
653 { 660 {
654 // TODO: This doesn't quite work yet -- probably a parent ID problem 661 // TODO: This doesn't quite work yet -- probably a parent ID problem
655 // m_parentID = (what should this be?) 662 // m_parentID = (what should this be?)
@@ -672,7 +679,7 @@ namespace OpenSim.Region.Environment.Scenes
672 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 679 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
673 bool oldflying = PhysicsActor.Flying; 680 bool oldflying = PhysicsActor.Flying;
674 681
675 PhysicsActor.Flying = ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 682 PhysicsActor.Flying = ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
676 if (PhysicsActor.Flying != oldflying) 683 if (PhysicsActor.Flying != oldflying)
677 { 684 {
678 update_movementflag = true; 685 update_movementflag = true;
@@ -686,23 +693,23 @@ namespace OpenSim.Region.Environment.Scenes
686 693
687 if (m_parentID == 0) 694 if (m_parentID == 0)
688 { 695 {
689 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags))) 696 foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags)))
690 { 697 {
691 if ((flags & (uint)DCF) != 0) 698 if ((flags & (uint) DCF) != 0)
692 { 699 {
693 DCFlagKeyPressed = true; 700 DCFlagKeyPressed = true;
694 agent_control_v3 += Dir_Vectors[i]; 701 agent_control_v3 += Dir_Vectors[i];
695 if ((m_movementflag & (uint)DCF) == 0) 702 if ((m_movementflag & (uint) DCF) == 0)
696 { 703 {
697 m_movementflag += (byte)(uint)DCF; 704 m_movementflag += (byte) (uint) DCF;
698 update_movementflag = true; 705 update_movementflag = true;
699 } 706 }
700 } 707 }
701 else 708 else
702 { 709 {
703 if ((m_movementflag & (uint)DCF) != 0) 710 if ((m_movementflag & (uint) DCF) != 0)
704 { 711 {
705 m_movementflag -= (byte)(uint)DCF; 712 m_movementflag -= (byte) (uint) DCF;
706 update_movementflag = true; 713 update_movementflag = true;
707 } 714 }
708 } 715 }
@@ -719,8 +726,9 @@ namespace OpenSim.Region.Environment.Scenes
719 if (m_physicsActor.Flying) 726 if (m_physicsActor.Flying)
720 { 727 {
721 // Are the landing controls requirements filled? 728 // Are the landing controls requirements filled?
722 bool controlland = (((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 729 bool controlland = (((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
723 730 ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
731
724 // Are the collision requirements fulfilled? 732 // Are the collision requirements fulfilled?
725 bool colliding = (m_physicsActor.IsColliding == true); 733 bool colliding = (m_physicsActor.IsColliding == true);
726 734
@@ -748,7 +756,6 @@ namespace OpenSim.Region.Environment.Scenes
748 { 756 {
749 if (m_parentID != 0) 757 if (m_parentID != 0)
750 { 758 {
751
752 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); 759 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
753 if (part != null) 760 if (part != null)
754 { 761 {
@@ -757,7 +764,7 @@ namespace OpenSim.Region.Environment.Scenes
757 part.SetAvatarOnSitTarget(LLUUID.Zero); 764 part.SetAvatarOnSitTarget(LLUUID.Zero);
758 } 765 }
759 766
760 m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); 767 m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight);
761 m_parentPosition = new LLVector3(); 768 m_parentPosition = new LLVector3();
762 769
763 if (m_physicsActor == null) 770 if (m_physicsActor == null)
@@ -778,14 +785,14 @@ namespace OpenSim.Region.Environment.Scenes
778 785
779 bool autopilot = true; 786 bool autopilot = true;
780 LLVector3 pos = new LLVector3(); 787 LLVector3 pos = new LLVector3();
781 LLQuaternion sitOrientation = new LLQuaternion(0,0,0,1); 788 LLQuaternion sitOrientation = new LLQuaternion(0, 0, 0, 1);
782 789
783 SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); 790 SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
784 if (part != null) 791 if (part != null)
785 { 792 {
786 // TODO: determine position to sit at based on scene geometry; don't trust offset from client 793 // TODO: determine position to sit at based on scene geometry; don't trust offset from client
787 // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it 794 // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
788 795
789 796
790 // Is a sit target available? 797 // Is a sit target available?
791 Vector3 avSitOffSet = part.GetSitTargetPosition(); 798 Vector3 avSitOffSet = part.GetSitTargetPosition();
@@ -793,15 +800,17 @@ namespace OpenSim.Region.Environment.Scenes
793 LLUUID avOnTargetAlready = part.GetAvatarOnSitTarget(); 800 LLUUID avOnTargetAlready = part.GetAvatarOnSitTarget();
794 801
795 bool SitTargetUnOccupied = (!(avOnTargetAlready != LLUUID.Zero)); 802 bool SitTargetUnOccupied = (!(avOnTargetAlready != LLUUID.Zero));
796 bool SitTargetisSet = (!(avSitOffSet.x == 0 && avSitOffSet.y == 0 && avSitOffSet.z == 0 && avSitOrientation.w == 0 && avSitOrientation.x == 0 && avSitOrientation.y == 0 && avSitOrientation.z == 1)); 803 bool SitTargetisSet =
804 (!(avSitOffSet.x == 0 && avSitOffSet.y == 0 && avSitOffSet.z == 0 && avSitOrientation.w == 0 &&
805 avSitOrientation.x == 0 && avSitOrientation.y == 0 && avSitOrientation.z == 1));
797 806
798 if (SitTargetisSet && SitTargetUnOccupied) 807 if (SitTargetisSet && SitTargetUnOccupied)
799 { 808 {
800 part.SetAvatarOnSitTarget(UUID); 809 part.SetAvatarOnSitTarget(UUID);
801 offset = new LLVector3(avSitOffSet.x,avSitOffSet.y,avSitOffSet.z); 810 offset = new LLVector3(avSitOffSet.x, avSitOffSet.y, avSitOffSet.z);
802 sitOrientation = new LLQuaternion(avSitOrientation.w,avSitOrientation.x,avSitOrientation.y,avSitOrientation.z); 811 sitOrientation =
812 new LLQuaternion(avSitOrientation.w, avSitOrientation.x, avSitOrientation.y, avSitOrientation.z);
803 autopilot = false; 813 autopilot = false;
804
805 } 814 }
806 815
807 816
@@ -817,43 +826,37 @@ namespace OpenSim.Region.Environment.Scenes
817 826
818 if (autopilot) 827 if (autopilot)
819 { 828 {
820
821 if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5) 829 if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5)
822 { 830 {
823 autopilot = false; 831 autopilot = false;
824 832
825 RemoveFromPhysicalScene(); 833 RemoveFromPhysicalScene();
826 AbsolutePosition = pos + new LLVector3(0.0f, 0.0f, m_sitAvatarHeight); 834 AbsolutePosition = pos + new LLVector3(0.0f, 0.0f, m_sitAvatarHeight);
827
828 } 835 }
829 else 836 else
830 { 837 {
831
832 } 838 }
833 } 839 }
834 else 840 else
835 { 841 {
836 RemoveFromPhysicalScene(); 842 RemoveFromPhysicalScene();
837
838
839 } 843 }
840 } // Physactor != null 844 } // Physactor != null
841 } // part != null 845 } // part != null
842 846
843 847
844 avatarSitResponse.SitTransform.AutoPilot = autopilot; 848 avatarSitResponse.SitTransform.AutoPilot = autopilot;
845 avatarSitResponse.SitTransform.SitPosition = offset; 849 avatarSitResponse.SitTransform.SitPosition = offset;
846 avatarSitResponse.SitTransform.SitRotation = sitOrientation; 850 avatarSitResponse.SitTransform.SitRotation = sitOrientation;
847 851
848 remoteClient.OutPacket(avatarSitResponse, ThrottleOutPacketType.Task); 852 remoteClient.OutPacket(avatarSitResponse, ThrottleOutPacketType.Task);
849 853
850 // This calls HandleAgentSit twice, once from here, and the client calls 854 // This calls HandleAgentSit twice, once from here, and the client calls
851 // HandleAgentSit itself after it gets to the location 855 // HandleAgentSit itself after it gets to the location
852 // It doesn't get to the location until we've moved them there though 856 // It doesn't get to the location until we've moved them there though
853 // which happens in HandleAgentSit :P 857 // which happens in HandleAgentSit :P
854 if (!autopilot) 858 if (!autopilot)
855 HandleAgentSit(remoteClient, UUID); 859 HandleAgentSit(remoteClient, UUID);
856
857 } 860 }
858 861
859 public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset) 862 public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset)
@@ -863,7 +866,6 @@ namespace OpenSim.Region.Environment.Scenes
863 StandUp(); 866 StandUp();
864 } 867 }
865 868
866
867 869
868 SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); 870 SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
869 871
@@ -919,7 +921,6 @@ namespace OpenSim.Region.Environment.Scenes
919 // This may seem stupid, but Our Full updates don't send avatar rotation :P 921 // This may seem stupid, but Our Full updates don't send avatar rotation :P
920 // So we're also sending a terse update (which has avatar rotation) 922 // So we're also sending a terse update (which has avatar rotation)
921 SendTerseUpdateToAllClients(); 923 SendTerseUpdateToAllClients();
922
923 } 924 }
924 925
925 /// <summary> 926 /// <summary>
@@ -1003,7 +1004,7 @@ namespace OpenSim.Region.Environment.Scenes
1003 // We are flying 1004 // We are flying
1004 SetMovementAnimation(Animations.AnimsLLUUID["FLY"], 1); 1005 SetMovementAnimation(Animations.AnimsLLUUID["FLY"], 1);
1005 } 1006 }
1006 else if (((m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && 1007 else if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
1007 PhysicsActor.IsColliding) 1008 PhysicsActor.IsColliding)
1008 { 1009 {
1009 // Client is pressing the page down button and moving and is colliding with something 1010 // Client is pressing the page down button and moving and is colliding with something
@@ -1014,7 +1015,8 @@ namespace OpenSim.Region.Environment.Scenes
1014 // Client is moving and falling at a velocity greater then 6 meters per unit 1015 // Client is moving and falling at a velocity greater then 6 meters per unit
1015 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"], 1); 1016 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"], 1);
1016 } 1017 }
1017 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && (m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) 1018 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 &&
1019 (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
1018 { 1020 {
1019 // Client is moving, and colliding and pressing the page up button but isn't flying 1021 // Client is moving, and colliding and pressing the page up button but isn't flying
1020 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1); 1022 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1);
@@ -1034,7 +1036,7 @@ namespace OpenSim.Region.Environment.Scenes
1034 { 1036 {
1035 // Not moving 1037 // Not moving
1036 1038
1037 if (((m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && 1039 if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
1038 PhysicsActor.IsColliding) 1040 PhysicsActor.IsColliding)
1039 { 1041 {
1040 // Client pressing the page down button 1042 // Client pressing the page down button
@@ -1045,7 +1047,8 @@ namespace OpenSim.Region.Environment.Scenes
1045 // Not colliding and not flying, and we're falling at high speed 1047 // Not colliding and not flying, and we're falling at high speed
1046 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"], 1); 1048 SetMovementAnimation(Animations.AnimsLLUUID["FALLDOWN"], 1);
1047 } 1049 }
1048 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && (m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) 1050 else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying &&
1051 (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
1049 { 1052 {
1050 // This is the standing jump 1053 // This is the standing jump
1051 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1); 1054 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1);
@@ -1063,6 +1066,7 @@ namespace OpenSim.Region.Environment.Scenes
1063 } 1066 }
1064 } 1067 }
1065 } 1068 }
1069
1066 /// <summary> 1070 /// <summary>
1067 /// Adds a new movement 1071 /// Adds a new movement
1068 /// </summary> 1072 /// </summary>
@@ -1075,10 +1079,10 @@ namespace OpenSim.Region.Environment.Scenes
1075 } 1079 }
1076 m_rotation = rotation; 1080 m_rotation = rotation;
1077 NewForce newVelocity = new NewForce(); 1081 NewForce newVelocity = new NewForce();
1078 Vector3 direc = rotation * vec; 1082 Vector3 direc = rotation*vec;
1079 direc.Normalize(); 1083 direc.Normalize();
1080 1084
1081 direc *= 0.03f * 128f; 1085 direc *= 0.03f*128f;
1082 if (m_physicsActor.Flying) 1086 if (m_physicsActor.Flying)
1083 { 1087 {
1084 direc *= 4; 1088 direc *= 4;
@@ -1108,7 +1112,6 @@ namespace OpenSim.Region.Environment.Scenes
1108 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1); 1112 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1);
1109 } 1113 }
1110 } 1114 }
1111
1112 } 1115 }
1113 1116
1114 newVelocity.X = direc.x; 1117 newVelocity.X = direc.x;
@@ -1173,7 +1176,7 @@ namespace OpenSim.Region.Environment.Scenes
1173 { 1176 {
1174 LLVector3 pos = m_pos; 1177 LLVector3 pos = m_pos;
1175 LLVector3 vel = Velocity; 1178 LLVector3 vel = Velocity;
1176 LLQuaternion rot=new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); 1179 LLQuaternion rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w);
1177 remoteClient.SendAvatarTerseUpdate(m_regionHandle, 64096, LocalId, new LLVector3(pos.X, pos.Y, pos.Z), 1180 remoteClient.SendAvatarTerseUpdate(m_regionHandle, 64096, LocalId, new LLVector3(pos.X, pos.Y, pos.Z),
1178 new LLVector3(vel.X, vel.Y, vel.Z), rot); 1181 new LLVector3(vel.X, vel.Y, vel.Z), rot);
1179 } 1182 }
@@ -1213,7 +1216,8 @@ namespace OpenSim.Region.Environment.Scenes
1213 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) 1216 public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
1214 { 1217 {
1215 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, 1218 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
1216 LocalId, m_pos, m_appearance.TextureEntry.ToBytes(), m_parentID); 1219 LocalId, m_pos, m_appearance.TextureEntry.ToBytes(),
1220 m_parentID);
1217 } 1221 }
1218 1222
1219 /// <summary> 1223 /// <summary>
@@ -1303,10 +1307,8 @@ namespace OpenSim.Region.Environment.Scenes
1303 /// <param name="seqs"></param> 1307 /// <param name="seqs"></param>
1304 public void SendAnimPack(LLUUID[] animations, int[] seqs) 1308 public void SendAnimPack(LLUUID[] animations, int[] seqs)
1305 { 1309 {
1306 m_scene.Broadcast(delegate(IClientAPI client) 1310 m_scene.Broadcast(
1307 { 1311 delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId); });
1308 client.SendAnimations(animations, seqs, m_controllingClient.AgentId);
1309 });
1310 } 1312 }
1311 1313
1312 /// <summary> 1314 /// <summary>
@@ -1320,6 +1322,7 @@ namespace OpenSim.Region.Environment.Scenes
1320 #endregion 1322 #endregion
1321 1323
1322 #region Significant Movement Method 1324 #region Significant Movement Method
1325
1323 /// <summary> 1326 /// <summary>
1324 /// This checks for a significant movement and sends a courselocationchange update 1327 /// This checks for a significant movement and sends a courselocationchange update
1325 /// </summary> 1328 /// </summary>
@@ -1349,9 +1352,9 @@ namespace OpenSim.Region.Environment.Scenes
1349 LLVector3 vel = Velocity; 1352 LLVector3 vel = Velocity;
1350 1353
1351 float timeStep = 0.1f; 1354 float timeStep = 0.1f;
1352 pos2.X = pos2.X + (vel.X * timeStep); 1355 pos2.X = pos2.X + (vel.X*timeStep);
1353 pos2.Y = pos2.Y + (vel.Y * timeStep); 1356 pos2.Y = pos2.Y + (vel.Y*timeStep);
1354 pos2.Z = pos2.Z + (vel.Z * timeStep); 1357 pos2.Z = pos2.Z + (vel.Z*timeStep);
1355 1358
1356 if ((pos2.X < 0) || (pos2.X > 256)) 1359 if ((pos2.X < 0) || (pos2.X > 256))
1357 { 1360 {
@@ -1411,7 +1414,7 @@ namespace OpenSim.Region.Environment.Scenes
1411 } 1414 }
1412 1415
1413 LLVector3 vel = m_velocity; 1416 LLVector3 vel = m_velocity;
1414 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); 1417 ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256));
1415 SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); 1418 SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
1416 if (neighbourRegion != null) 1419 if (neighbourRegion != null)
1417 { 1420 {
@@ -1432,6 +1435,7 @@ namespace OpenSim.Region.Environment.Scenes
1432 } 1435 }
1433 1436
1434 #endregion 1437 #endregion
1438
1435 /// <summary> 1439 /// <summary>
1436 /// This allows the Sim owner the abiility to kick users from their sim currently. 1440 /// This allows the Sim owner the abiility to kick users from their sim currently.
1437 /// It tells the client that the agent has permission to do so. 1441 /// It tells the client that the agent has permission to do so.
@@ -1445,7 +1449,7 @@ namespace OpenSim.Region.Environment.Scenes
1445 adb.AgentID = agentID; 1449 adb.AgentID = agentID;
1446 adb.SessionID = sessionID; // More security 1450 adb.SessionID = sessionID; // More security
1447 1451
1448 gdb.GodLevel = (byte)100; 1452 gdb.GodLevel = (byte) 100;
1449 gdb.Token = token; 1453 gdb.Token = token;
1450 //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock; 1454 //respondPacket.AgentData = (GrantGodlikePowersPacket.AgentDataBlock)ablock;
1451 respondPacket.GrantData = gdb; 1455 respondPacket.GrantData = gdb;
@@ -1462,7 +1466,8 @@ namespace OpenSim.Region.Environment.Scenes
1462 // 1466 //
1463 m_DrawDistance = cAgentData.drawdistance; 1467 m_DrawDistance = cAgentData.drawdistance;
1464 m_pos = new LLVector3(cAgentData.Position.x, cAgentData.Position.y, cAgentData.Position.z); 1468 m_pos = new LLVector3(cAgentData.Position.x, cAgentData.Position.y, cAgentData.Position.z);
1465 m_CameraCenter = new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); 1469 m_CameraCenter =
1470 new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
1466 m_godlevel = cAgentData.godlevel; 1471 m_godlevel = cAgentData.godlevel;
1467 ControllingClient.SetChildAgentThrottle(cAgentData.throttles); 1472 ControllingClient.SetChildAgentThrottle(cAgentData.throttles);
1468 //cAgentData.AVHeight; 1473 //cAgentData.AVHeight;
@@ -1555,6 +1560,7 @@ namespace OpenSim.Region.Environment.Scenes
1555 m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 1560 m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
1556 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 1561 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
1557 } 1562 }
1563
1558 // Event called by the physics plugin to tell the avatar about a collision. 1564 // Event called by the physics plugin to tell the avatar about a collision.
1559 private void PhysicsCollisionUpdate(EventArgs e) 1565 private void PhysicsCollisionUpdate(EventArgs e)
1560 { 1566 {
@@ -1567,4 +1573,4 @@ namespace OpenSim.Region.Environment.Scenes
1567 RemoveFromPhysicalScene(); 1573 RemoveFromPhysicalScene();
1568 } 1574 }
1569 } 1575 }
1570} 1576} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
index aeb9c61..8c4a951 100644
--- a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
@@ -28,17 +28,16 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using System.Xml;
33using System.IO; 31using System.IO;
34using libsecondlife; 32using System.Xml;
35using Axiom.Math; 33using Axiom.Math;
34using libsecondlife;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.Physics.Manager; 36using OpenSim.Region.Physics.Manager;
38 37
39namespace OpenSim.Region.Environment.Scenes 38namespace OpenSim.Region.Environment.Scenes
40{ 39{
41 public class SceneXmlLoader // can move to a module? 40 public class SceneXmlLoader // can move to a module?
42 { 41 {
43 protected InnerScene m_innerScene; 42 protected InnerScene m_innerScene;
44 protected RegionInfo m_regInfo; 43 protected RegionInfo m_regInfo;
@@ -78,8 +77,9 @@ namespace OpenSim.Region.Environment.Scenes
78 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 77 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
79 // Apply loadOffsets for load/import and move combinations 78 // Apply loadOffsets for load/import and move combinations
80 rootPart.GroupPosition = rootPart.AbsolutePosition + loadOffset; 79 rootPart.GroupPosition = rootPart.AbsolutePosition + loadOffset;
81 bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_parentScene.m_physicalPrim); 80 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) &&
82 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 81 m_parentScene.m_physicalPrim);
82 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
83 { 83 {
84 rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape( 84 rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape(
85 rootPart.Name, 85 rootPart.Name,
@@ -91,7 +91,6 @@ namespace OpenSim.Region.Environment.Scenes
91 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 91 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
92 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); 92 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
93 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); 93 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
94
95 } 94 }
96 primCount++; 95 primCount++;
97 } 96 }
@@ -115,7 +114,7 @@ namespace OpenSim.Region.Environment.Scenes
115 { 114 {
116 if (ent is SceneObjectGroup) 115 if (ent is SceneObjectGroup)
117 { 116 {
118 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString()); 117 stream.WriteLine(((SceneObjectGroup) ent).ToXmlString());
119 primCount++; 118 primCount++;
120 } 119 }
121 } 120 }
@@ -152,8 +151,9 @@ namespace OpenSim.Region.Environment.Scenes
152 m_innerScene.AddEntityFromStorage(obj); 151 m_innerScene.AddEntityFromStorage(obj);
153 152
154 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 153 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
155 bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_parentScene.m_physicalPrim); 154 bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) &&
156 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 155 m_parentScene.m_physicalPrim);
156 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
157 { 157 {
158 rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape( 158 rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape(
159 rootPart.Name, 159 rootPart.Name,
@@ -180,7 +180,7 @@ namespace OpenSim.Region.Environment.Scenes
180 { 180 {
181 if (ent is SceneObjectGroup) 181 if (ent is SceneObjectGroup)
182 { 182 {
183 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString2()); 183 stream.WriteLine(((SceneObjectGroup) ent).ToXmlString2());
184 primCount++; 184 primCount++;
185 } 185 }
186 } 186 }
@@ -188,6 +188,5 @@ namespace OpenSim.Region.Environment.Scenes
188 stream.Close(); 188 stream.Close();
189 file.Close(); 189 file.Close();
190 } 190 }
191
192 } 191 }
193} 192} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
index 294a6c9..d781806 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs
@@ -37,4 +37,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
37 void Shutdown(); 37 void Shutdown();
38// void StartScript(string ScriptID, IScriptHost ObjectID); 38// void StartScript(string ScriptID, IScriptHost ObjectID);
39 } 39 }
40} 40} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
index d3fdad6..5dbe500 100644
--- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
+++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineLoader.cs
@@ -121,4 +121,4 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
121 return ret; 121 return ret;
122 } 122 }
123 } 123 }
124} 124} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index bfdacfe..b183c04 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -27,22 +27,19 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Timers; 30using System.Timers;
33using libsecondlife.Packets; 31using libsecondlife.Packets;
34using OpenSim.Framework; 32using OpenSim.Framework;
35using Timer = System.Timers.Timer;
36 33
37namespace OpenSim.Region.Environment.Scenes 34namespace OpenSim.Region.Environment.Scenes
38{ 35{
39 public class SimStatsReporter 36 public class SimStatsReporter
40 { 37 {
41 public delegate void SendStatResult(SimStatsPacket pack); 38 public delegate void SendStatResult(SimStatsPacket pack);
42 39
43 public event SendStatResult OnSendStatsResult; 40 public event SendStatResult OnSendStatsResult;
44 41
45 private enum Stats : uint 42 private enum Stats : uint
46 { 43 {
47 TimeDilation = 0, 44 TimeDilation = 0,
48 SimFPS = 1, 45 SimFPS = 1,
@@ -72,7 +69,7 @@ namespace OpenSim.Region.Environment.Scenes
72 private RegionInfo ReportingRegion; 69 private RegionInfo ReportingRegion;
73 70
74 private Timer m_report = new Timer(); 71 private Timer m_report = new Timer();
75 72
76 73
77 public SimStatsReporter(RegionInfo regionData) 74 public SimStatsReporter(RegionInfo regionData)
78 { 75 {
@@ -93,23 +90,24 @@ namespace OpenSim.Region.Environment.Scenes
93 statpack.Region.RegionY = ReportingRegion.RegionLocY; 90 statpack.Region.RegionY = ReportingRegion.RegionLocY;
94 try 91 try
95 { 92 {
96 statpack.Region.RegionFlags = (uint)ReportingRegion.EstateSettings.regionFlags; 93 statpack.Region.RegionFlags = (uint) ReportingRegion.EstateSettings.regionFlags;
97 } 94 }
98 catch(System.Exception) 95 catch (Exception)
99 { 96 {
100 statpack.Region.RegionFlags = (uint)0; 97 statpack.Region.RegionFlags = (uint) 0;
101 } 98 }
102 statpack.Region.ObjectCapacity = (uint)15000; 99 statpack.Region.ObjectCapacity = (uint) 15000;
103 100
104 #region various statistic googly moogly 101 #region various statistic googly moogly
105 float simfps = (int)(m_fps * 5); 102
103 float simfps = (int) (m_fps*5);
106 104
107 if (simfps > 45) 105 if (simfps > 45)
108 simfps = simfps - (simfps - 45); 106 simfps = simfps - (simfps - 45);
109 if (simfps < 0) 107 if (simfps < 0)
110 simfps = 0; 108 simfps = 0;
111 109
112 float physfps = (m_pfps / statsUpdatesEveryMS); 110 float physfps = (m_pfps/statsUpdatesEveryMS);
113 111
114 if (physfps > 50) 112 if (physfps > 50)
115 physfps = physfps - (physfps - 50); 113 physfps = physfps - (physfps - 50);
@@ -120,49 +118,49 @@ namespace OpenSim.Region.Environment.Scenes
120 #endregion 118 #endregion
121 119
122 sb[0] = new SimStatsPacket.StatBlock(); 120 sb[0] = new SimStatsPacket.StatBlock();
123 sb[0].StatID = (uint)Stats.TimeDilation; 121 sb[0].StatID = (uint) Stats.TimeDilation;
124 sb[0].StatValue = (m_timeDilation); 122 sb[0].StatValue = (m_timeDilation);
125 123
126 sb[1] = new SimStatsPacket.StatBlock(); 124 sb[1] = new SimStatsPacket.StatBlock();
127 sb[1].StatID = (uint)Stats.SimFPS; 125 sb[1].StatID = (uint) Stats.SimFPS;
128 sb[1].StatValue = simfps; 126 sb[1].StatValue = simfps;
129 127
130 sb[2] = new SimStatsPacket.StatBlock(); 128 sb[2] = new SimStatsPacket.StatBlock();
131 sb[2].StatID = (uint)Stats.PhysicsFPS; 129 sb[2].StatID = (uint) Stats.PhysicsFPS;
132 sb[2].StatValue = physfps; 130 sb[2].StatValue = physfps;
133 131
134 sb[3] = new SimStatsPacket.StatBlock(); 132 sb[3] = new SimStatsPacket.StatBlock();
135 sb[3].StatID = (uint)Stats.AgentUpdates; 133 sb[3].StatID = (uint) Stats.AgentUpdates;
136 sb[3].StatValue = (m_agentUpdates / statsUpdatesEveryMS); 134 sb[3].StatValue = (m_agentUpdates/statsUpdatesEveryMS);
137 135
138 sb[4] = new SimStatsPacket.StatBlock(); 136 sb[4] = new SimStatsPacket.StatBlock();
139 sb[4].StatID = (uint)Stats.Agents; 137 sb[4].StatID = (uint) Stats.Agents;
140 sb[4].StatValue = m_rootAgents; 138 sb[4].StatValue = m_rootAgents;
141 139
142 sb[5] = new SimStatsPacket.StatBlock(); 140 sb[5] = new SimStatsPacket.StatBlock();
143 sb[5].StatID = (uint)Stats.ChildAgents; 141 sb[5].StatID = (uint) Stats.ChildAgents;
144 sb[5].StatValue = m_childAgents; 142 sb[5].StatValue = m_childAgents;
145 143
146 sb[6] = new SimStatsPacket.StatBlock(); 144 sb[6] = new SimStatsPacket.StatBlock();
147 sb[6].StatID = (uint)Stats.TotalPrim; 145 sb[6].StatID = (uint) Stats.TotalPrim;
148 sb[6].StatValue = m_numPrim; 146 sb[6].StatValue = m_numPrim;
149 147
150 sb[7] = new SimStatsPacket.StatBlock(); 148 sb[7] = new SimStatsPacket.StatBlock();
151 sb[7].StatID = (uint)Stats.ActivePrim; 149 sb[7].StatID = (uint) Stats.ActivePrim;
152 sb[7].StatValue = m_activePrim; 150 sb[7].StatValue = m_activePrim;
153 151
154 sb[8] = new SimStatsPacket.StatBlock(); 152 sb[8] = new SimStatsPacket.StatBlock();
155 sb[8].StatID = (uint)Stats.InPacketsPerSecond; 153 sb[8].StatID = (uint) Stats.InPacketsPerSecond;
156 sb[8].StatValue = (int)(m_inPacketsPerSecond / statsUpdatesEveryMS); 154 sb[8].StatValue = (int) (m_inPacketsPerSecond/statsUpdatesEveryMS);
157 155
158 sb[9] = new SimStatsPacket.StatBlock(); 156 sb[9] = new SimStatsPacket.StatBlock();
159 sb[9].StatID = (uint)Stats.OutPacketsPerSecond; 157 sb[9].StatID = (uint) Stats.OutPacketsPerSecond;
160 sb[9].StatValue = (int)(m_outPacketsPerSecond / statsUpdatesEveryMS); 158 sb[9].StatValue = (int) (m_outPacketsPerSecond/statsUpdatesEveryMS);
161 159
162 sb[10] = new SimStatsPacket.StatBlock(); 160 sb[10] = new SimStatsPacket.StatBlock();
163 sb[10].StatID = (uint)Stats.UnAckedBytes; 161 sb[10].StatID = (uint) Stats.UnAckedBytes;
164 sb[10].StatValue = (int) (m_unAckedBytes / statsUpdatesEveryMS); 162 sb[10].StatValue = (int) (m_unAckedBytes/statsUpdatesEveryMS);
165 163
166 statpack.Stat = sb; 164 statpack.Stat = sb;
167 165
168 if (OnSendStatsResult != null) 166 if (OnSendStatsResult != null)
@@ -181,8 +179,8 @@ namespace OpenSim.Region.Environment.Scenes
181 m_inPacketsPerSecond = 0; 179 m_inPacketsPerSecond = 0;
182 m_outPacketsPerSecond = 0; 180 m_outPacketsPerSecond = 0;
183 m_unAckedBytes = 0; 181 m_unAckedBytes = 0;
184
185 } 182 }
183
186 public void SetTimeDilation(float td) 184 public void SetTimeDilation(float td)
187 { 185 {
188 m_timeDilation = td; 186 m_timeDilation = td;
@@ -191,47 +189,56 @@ namespace OpenSim.Region.Environment.Scenes
191 189
192 if (m_timeDilation < 0) 190 if (m_timeDilation < 0)
193 m_timeDilation = 0.0f; 191 m_timeDilation = 0.0f;
194
195 } 192 }
193
196 public void SetRootAgents(int rootAgents) 194 public void SetRootAgents(int rootAgents)
197 { 195 {
198 m_rootAgents = rootAgents; 196 m_rootAgents = rootAgents;
199 } 197 }
198
200 public void SetChildAgents(int childAgents) 199 public void SetChildAgents(int childAgents)
201 { 200 {
202 m_childAgents = childAgents; 201 m_childAgents = childAgents;
203 } 202 }
203
204 public void SetObjects(int objects) 204 public void SetObjects(int objects)
205 { 205 {
206 m_numPrim = objects; 206 m_numPrim = objects;
207 } 207 }
208
208 public void SetActiveObjects(int objects) 209 public void SetActiveObjects(int objects)
209 { 210 {
210 m_activePrim = objects; 211 m_activePrim = objects;
211 } 212 }
213
212 public void AddFPS(int frames) 214 public void AddFPS(int frames)
213 { 215 {
214 m_fps += frames; 216 m_fps += frames;
215 } 217 }
218
216 public void AddPhysicsFPS(float frames) 219 public void AddPhysicsFPS(float frames)
217 { 220 {
218 m_pfps += frames; 221 m_pfps += frames;
219 } 222 }
223
220 public void AddAgentUpdates(float numUpdates) 224 public void AddAgentUpdates(float numUpdates)
221 { 225 {
222 m_agentUpdates += numUpdates; 226 m_agentUpdates += numUpdates;
223 } 227 }
228
224 public void AddInPackets(int numPackets) 229 public void AddInPackets(int numPackets)
225 { 230 {
226 m_inPacketsPerSecond += numPackets; 231 m_inPacketsPerSecond += numPackets;
227 } 232 }
233
228 public void AddOutPackets(int numPackets) 234 public void AddOutPackets(int numPackets)
229 { 235 {
230 m_outPacketsPerSecond += numPackets; 236 m_outPacketsPerSecond += numPackets;
231 } 237 }
238
232 public void AddunAckedBytes(int numBytes) 239 public void AddunAckedBytes(int numBytes)
233 { 240 {
234 m_unAckedBytes += numBytes; 241 m_unAckedBytes += numBytes;
235 } 242 }
236 } 243 }
237} 244} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
index b3084a2..2d8441e 100644
--- a/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
+++ b/OpenSim/Region/Examples/SimpleApp/FileSystemObject.cs
@@ -26,7 +26,6 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.IO; 29using System.IO;
31using libsecondlife; 30using libsecondlife;
32using OpenSim.Framework; 31using OpenSim.Framework;
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index ec93362..3e191b4 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -29,7 +29,6 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Text;
33using libsecondlife; 32using libsecondlife;
34using libsecondlife.Packets; 33using libsecondlife.Packets;
35using OpenSim.Framework; 34using OpenSim.Framework;
@@ -62,7 +61,7 @@ namespace SimpleApp
62 public event LinkObjects OnLinkObjects; 61 public event LinkObjects OnLinkObjects;
63 public event DelinkObjects OnDelinkObjects; 62 public event DelinkObjects OnDelinkObjects;
64 public event RequestMapBlocks OnRequestMapBlocks; 63 public event RequestMapBlocks OnRequestMapBlocks;
65 public event RequestMapName OnMapNameRequest; 64 public event RequestMapName OnMapNameRequest;
66 public event TeleportLocationRequest OnTeleportLocationRequest; 65 public event TeleportLocationRequest OnTeleportLocationRequest;
67 public event DisconnectUser OnDisconnectUser; 66 public event DisconnectUser OnDisconnectUser;
68 public event RequestAvatarProperties OnRequestAvatarProperties; 67 public event RequestAvatarProperties OnRequestAvatarProperties;
@@ -139,7 +138,7 @@ namespace SimpleApp
139 public event EstateOwnerMessageRequest OnEstateOwnerMessage; 138 public event EstateOwnerMessageRequest OnEstateOwnerMessage;
140 public event RegionInfoRequest OnRegionInfoRequest; 139 public event RegionInfoRequest OnRegionInfoRequest;
141 public event EstateCovenantRequest OnEstateCovenantRequest; 140 public event EstateCovenantRequest OnEstateCovenantRequest;
142 141
143 142
144#pragma warning restore 67 143#pragma warning restore 67
145 144
@@ -168,7 +167,7 @@ namespace SimpleApp
168 { 167 {
169 get { return LLUUID.Zero; } 168 get { return LLUUID.Zero; }
170 } 169 }
171 170
172 public LLUUID SecureSessionId 171 public LLUUID SecureSessionId
173 { 172 {
174 get { return LLUUID.Zero; } 173 get { return LLUUID.Zero; }
@@ -185,7 +184,7 @@ namespace SimpleApp
185 { 184 {
186 get { return lastName; } 185 get { return lastName; }
187 } 186 }
188 187
189 public virtual String Name 188 public virtual String Name
190 { 189 {
191 get { return FirstName + LastName; } 190 get { return FirstName + LastName; }
@@ -314,7 +313,8 @@ namespace SimpleApp
314 313
315 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, 314 public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
316 PrimitiveBaseShape primShape, LLVector3 pos, uint flags, 315 PrimitiveBaseShape primShape, LLVector3 pos, uint flags,
317 LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, 316 LLUUID objectID, LLUUID ownerID, string text, byte[] color,
317 uint parentID,
318 byte[] particleSystem, LLQuaternion rotation, byte clickAction) 318 byte[] particleSystem, LLQuaternion rotation, byte clickAction)
319 { 319 {
320 } 320 }
@@ -323,14 +323,16 @@ namespace SimpleApp
323 LLVector3 position, LLQuaternion rotation) 323 LLVector3 position, LLQuaternion rotation)
324 { 324 {
325 } 325 }
326
326 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, 327 public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
327 LLVector3 position, LLQuaternion rotation,LLVector3 velocity, LLVector3 rotationalvelocity) 328 LLVector3 position, LLQuaternion rotation, LLVector3 velocity,
329 LLVector3 rotationalvelocity)
328 { 330 {
329 } 331 }
330 332
331 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, 333 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID,
332 List<InventoryItemBase> items, 334 List<InventoryItemBase> items,
333 List<InventoryFolderBase> folders, 335 List<InventoryFolderBase> folders,
334 bool fetchFolders, 336 bool fetchFolders,
335 bool fetchItems) 337 bool fetchItems)
336 { 338 {
@@ -376,9 +378,11 @@ namespace SimpleApp
376 public void SendAgentAlertMessage(string message, bool modal) 378 public void SendAgentAlertMessage(string message, bool modal)
377 { 379 {
378 } 380 }
381
379 public void SendSystemAlertMessage(string message) 382 public void SendSystemAlertMessage(string message)
380 { 383 {
381 } 384 }
385
382 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, 386 public void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message,
383 string url) 387 string url)
384 { 388 {
@@ -477,7 +481,6 @@ namespace SimpleApp
477 481
478 public void Stop() 482 public void Stop()
479 { 483 {
480
481 } 484 }
482 485
483 private uint m_circuitCode; 486 private uint m_circuitCode;
@@ -492,4 +495,4 @@ namespace SimpleApp
492 { 495 {
493 } 496 }
494 } 497 }
495} 498} \ No newline at end of file
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
index d5f702d..4c12b3f 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
@@ -41,10 +41,13 @@ namespace SimpleApp
41 { 41 {
42 private List<ScenePresence> m_avatars; 42 private List<ScenePresence> m_avatars;
43 43
44 public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, PermissionManager permissionManager, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, 44 public MyWorld(RegionInfo regionInfo, AgentCircuitManager authen, PermissionManager permissionManager,
45 CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
45 AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer, 46 AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer,
46 ModuleLoader moduleLoader, bool physicalPrim, bool ChildGetTasks) 47 ModuleLoader moduleLoader, bool physicalPrim, bool ChildGetTasks)
47 : base(regionInfo, authen, permissionManager, commsMan, sceneGridService, assetCach, storeMan, httpServer, moduleLoader, false, true, false) 48 : base(
49 regionInfo, authen, permissionManager, commsMan, sceneGridService, assetCach, storeMan, httpServer,
50 moduleLoader, false, true, false)
48 { 51 {
49 m_avatars = new List<ScenePresence>(); 52 m_avatars = new List<ScenePresence>();
50 } 53 }
@@ -73,7 +76,7 @@ namespace SimpleApp
73 76
74 client.OnCompleteMovementToRegion += 77 client.OnCompleteMovementToRegion +=
75 delegate() { client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero); }; 78 delegate() { client.SendChatMessage("Welcome to My World.", 1, pos, "System", LLUUID.Zero); };
76 79
77 client.SendRegionHandshake(m_regInfo); 80 client.SendRegionHandshake(m_regInfo);
78 } 81 }
79 } 82 }
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index 02108d0..d872bf6 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -179,7 +179,8 @@ namespace SimpleApp
179 PermissionManager permissionManager = new PermissionManager(); 179 PermissionManager permissionManager = new PermissionManager();
180 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); 180 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
181 return 181 return
182 new MyWorld(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService, m_assetCache, storageManager, m_httpServer, 182 new MyWorld(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService,
183 m_assetCache, storageManager, m_httpServer,
183 new ModuleLoader(m_log, m_config), true, false); 184 new ModuleLoader(m_log, m_config), true, false);
184 } 185 }
185 186
@@ -214,4 +215,4 @@ namespace SimpleApp
214 app.Run(); 215 app.Run();
215 } 216 }
216 } 217 }
217} 218} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
index 89c3743..b625f43 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/CSharpScriptEngine.cs
@@ -101,4 +101,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp
101 return LoadDotNetScript(csharpProvider, filename); 101 return LoadDotNetScript(csharpProvider, filename);
102 } 102 }
103 } 103 }
104} 104} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs
index 09b7f48..a25d027 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/CSharp/Examples/ExportRegionToLSL.cs
@@ -91,4 +91,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
91 return ""; 91 return "";
92 } 92 }
93 } 93 }
94} 94} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
index 425c3a4..bc5c413 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JScript/JScriptEngine.cs
@@ -101,4 +101,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JScript
101 return LoadDotNetScript(jscriptProvider, filename); 101 return LoadDotNetScript(jscriptProvider, filename);
102 } 102 }
103 } 103 }
104} 104} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs
index 7a2a96b..c12fda5 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassInstance.cs
@@ -40,4 +40,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
40 { 40 {
41 } 41 }
42 } 42 }
43} 43} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs
index adf7d66..b152df2 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/ClassRecord.cs
@@ -645,4 +645,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
645 645
646 #endregion 646 #endregion
647 } 647 }
648} 648} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs
index 500c991..4308a19 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Heap.cs
@@ -37,4 +37,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
37 { 37 {
38 } 38 }
39 } 39 }
40} 40} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
index 03e0756..d9f5ce1 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Logic.cs
@@ -616,4 +616,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
616 } 616 }
617 } 617 }
618 } 618 }
619} 619} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs
index 25bc2a8..fb8a16e 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Methods.cs
@@ -99,4 +99,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
99 } 99 }
100 } 100 }
101 } 101 }
102} 102} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs
index 9580159..60cf8d4 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.Return.cs
@@ -33,4 +33,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
33 { 33 {
34 } 34 }
35 } 35 }
36} 36} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
index 3634c24..64e9275 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Interpreter.cs
@@ -129,4 +129,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
129 } 129 }
130 } 130 }
131 } 131 }
132} 132} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs
index 9a06cad..6e62d5a 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MainMemory.cs
@@ -38,4 +38,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
38 HeapArea = new Heap(); 38 HeapArea = new Heap();
39 } 39 }
40 } 40 }
41} 41} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs
index d73fec6..2d3fc47 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/MethodMemory.cs
@@ -41,4 +41,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
41 MethodBuffer = new byte[20000]; 41 MethodBuffer = new byte[20000];
42 } 42 }
43 } 43 }
44} 44} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs
index bad71c9..f17bf43 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Object.cs
@@ -30,4 +30,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
30 public class Object 30 public class Object
31 { 31 {
32 } 32 }
33} 33} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs
index 88d5af0..ff01307 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Stack.cs
@@ -37,4 +37,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
37 { 37 {
38 } 38 }
39 } 39 }
40} 40} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs
index a73ebd0..40bec4c 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/StackFrame.cs
@@ -43,4 +43,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
43 LocalVariables = new BaseType[20]; 43 LocalVariables = new BaseType[20];
44 } 44 }
45 } 45 }
46} 46} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs
index 50c9c09..7f3af0e 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/JVM/Thread.cs
@@ -108,4 +108,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
108 return m_Interpreter.Excute(); 108 return m_Interpreter.Excute();
109 } 109 }
110 } 110 }
111} 111} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs
index 00c2d1c..449f715 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Engines/JVMEngine/OpenSimJVM.cs
@@ -163,4 +163,4 @@ namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
163 } 163 }
164 } 164 }
165 } 165 }
166} 166} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/Script.cs b/OpenSim/Region/ExtensionsScriptModule/Script.cs
index 3a9edfe..0555277 100644
--- a/OpenSim/Region/ExtensionsScriptModule/Script.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/Script.cs
@@ -61,4 +61,4 @@ namespace OpenSim.Region.ExtensionsScriptModule
61 //script.logger.Verbose("TESTSCRIPT", "Hello World!"); 61 //script.logger.Verbose("TESTSCRIPT", "Hello World!");
62 } 62 }
63 } 63 }
64} 64} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
index 4fccef1..af54a4e 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptInfo.cs
@@ -61,4 +61,4 @@ namespace OpenSim.Region.ExtensionsScriptModule
61 api = new ScriptAPI(world, task); 61 api = new ScriptAPI(world, task);
62 } 62 }
63 } 63 }
64} 64} \ No newline at end of file
diff --git a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
index 1f26d22..d080ab8 100644
--- a/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
+++ b/OpenSim/Region/ExtensionsScriptModule/ScriptManager.cs
@@ -146,4 +146,4 @@ namespace OpenSim.Region.ExtensionsScriptModule
146 Dictionary<string, IScript> compile(string filename); 146 Dictionary<string, IScript> compile(string filename);
147 string FileExt(); 147 string FileExt();
148 } 148 }
149} 149} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
index 919910c..b76fbbf 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("1.0.*")] 58[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 5ac651f..636cf1a 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -106,18 +106,19 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
106 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 106 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
107 PhysicsVector size, Quaternion rotation) 107 PhysicsVector size, Quaternion rotation)
108 { 108 {
109 return this.AddPrimShape(primName, pbs, position, size, rotation, false); 109 return AddPrimShape(primName, pbs, position, size, rotation, false);
110 } 110 }
111 111
112 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 112 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
113 PhysicsVector size, Quaternion rotation, bool isPhysical) 113 PhysicsVector size, Quaternion rotation, bool isPhysical)
114 { 114 {
115 return null; 115 return null;
116 } 116 }
117
117 public override void AddPhysicsActorTaint(PhysicsActor prim) 118 public override void AddPhysicsActorTaint(PhysicsActor prim)
118 { 119 {
119
120 } 120 }
121
121 public override float Simulate(float timeStep) 122 public override float Simulate(float timeStep)
122 { 123 {
123 float fps = 0; 124 float fps = 0;
@@ -125,8 +126,8 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
125 { 126 {
126 BasicActor actor = _actors[i]; 127 BasicActor actor = _actors[i];
127 128
128 actor.Position.X += actor.Velocity.X * timeStep; 129 actor.Position.X += actor.Velocity.X*timeStep;
129 actor.Position.Y += actor.Velocity.Y * timeStep; 130 actor.Position.Y += actor.Velocity.Y*timeStep;
130 131
131 if (actor.Position.Y < 0) 132 if (actor.Position.Y < 0)
132 { 133 {
@@ -146,18 +147,18 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
146 actor.Position.X = 255.9F; 147 actor.Position.X = 255.9F;
147 } 148 }
148 149
149 float height = _heightMap[(int) actor.Position.Y * 256 + (int) actor.Position.X] + 1.0f; 150 float height = _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 1.0f;
150 if (actor.Flying) 151 if (actor.Flying)
151 { 152 {
152 if (actor.Position.Z + (actor.Velocity.Z * timeStep) < 153 if (actor.Position.Z + (actor.Velocity.Z*timeStep) <
153 _heightMap[(int) actor.Position.Y * 256 + (int) actor.Position.X] + 2) 154 _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 2)
154 { 155 {
155 actor.Position.Z = height; 156 actor.Position.Z = height;
156 actor.Velocity.Z = 0; 157 actor.Velocity.Z = 0;
157 } 158 }
158 else 159 else
159 { 160 {
160 actor.Position.Z += actor.Velocity.Z * timeStep; 161 actor.Position.Z += actor.Velocity.Z*timeStep;
161 } 162 }
162 } 163 }
163 else 164 else
@@ -204,31 +205,37 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
204 _position = new PhysicsVector(); 205 _position = new PhysicsVector();
205 _acceleration = new PhysicsVector(); 206 _acceleration = new PhysicsVector();
206 } 207 }
208
207 public override int PhysicsActorType 209 public override int PhysicsActorType
208 { 210 {
209 get { return (int)ActorTypes.Agent; } 211 get { return (int) ActorTypes.Agent; }
210 set { return; } 212 set { return; }
211 } 213 }
214
212 public override PhysicsVector RotationalVelocity 215 public override PhysicsVector RotationalVelocity
213 { 216 {
214 get { return m_rotationalVelocity; } 217 get { return m_rotationalVelocity; }
215 set { m_rotationalVelocity = value; } 218 set { m_rotationalVelocity = value; }
216 } 219 }
220
217 public override bool SetAlwaysRun 221 public override bool SetAlwaysRun
218 { 222 {
219 get { return false; } 223 get { return false; }
220 set { return; } 224 set { return; }
221 } 225 }
226
222 public override bool IsPhysical 227 public override bool IsPhysical
223 { 228 {
224 get { return false; } 229 get { return false; }
225 set { return; } 230 set { return; }
226 } 231 }
232
227 public override bool ThrottleUpdates 233 public override bool ThrottleUpdates
228 { 234 {
229 get { return false; } 235 get { return false; }
230 set { return; } 236 set { return; }
231 } 237 }
238
232 public override bool Flying 239 public override bool Flying
233 { 240 {
234 get { return flying; } 241 get { return flying; }
@@ -240,16 +247,19 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
240 get { return iscolliding; } 247 get { return iscolliding; }
241 set { iscolliding = value; } 248 set { iscolliding = value; }
242 } 249 }
250
243 public override bool CollidingGround 251 public override bool CollidingGround
244 { 252 {
245 get { return false; } 253 get { return false; }
246 set { return; } 254 set { return; }
247 } 255 }
256
248 public override bool CollidingObj 257 public override bool CollidingObj
249 { 258 {
250 get { return false; } 259 get { return false; }
251 set { return; } 260 set { return; }
252 } 261 }
262
253 public override PhysicsVector Position 263 public override PhysicsVector Position
254 { 264 {
255 get { return _position; } 265 get { return _position; }
@@ -264,27 +274,29 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
264 274
265 public override PrimitiveBaseShape Shape 275 public override PrimitiveBaseShape Shape
266 { 276 {
267 set 277 set { return; }
268 {
269 return;
270 }
271 } 278 }
279
272 public override float Mass 280 public override float Mass
273 { 281 {
274 get { return 0f; } 282 get { return 0f; }
275 } 283 }
284
276 public override PhysicsVector Force 285 public override PhysicsVector Force
277 { 286 {
278 get { return PhysicsVector.Zero; } 287 get { return PhysicsVector.Zero; }
279 } 288 }
289
280 public override PhysicsVector CenterOfMass 290 public override PhysicsVector CenterOfMass
281 { 291 {
282 get { return PhysicsVector.Zero; } 292 get { return PhysicsVector.Zero; }
283 } 293 }
294
284 public override PhysicsVector GeometricCenter 295 public override PhysicsVector GeometricCenter
285 { 296 {
286 get { return PhysicsVector.Zero; } 297 get { return PhysicsVector.Zero; }
287 } 298 }
299
288 public override PhysicsVector Velocity 300 public override PhysicsVector Velocity
289 { 301 {
290 get { return _velocity; } 302 get { return _velocity; }
@@ -321,4 +333,4 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
321 { 333 {
322 } 334 }
323 } 335 }
324} 336} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
index 06d4fe3..6b7ce82 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("1.0.0.0")] 58[assembly : AssemblyVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 5602301..a88299e 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -70,12 +70,11 @@ using XnaDevRu.BulletX;
70using XnaDevRu.BulletX.Dynamics; 70using XnaDevRu.BulletX.Dynamics;
71using AxiomQuaternion = Axiom.Math.Quaternion; 71using AxiomQuaternion = Axiom.Math.Quaternion;
72using BoxShape=XnaDevRu.BulletX.BoxShape; 72using BoxShape=XnaDevRu.BulletX.BoxShape;
73#endregion
74 73
74#endregion
75 75
76namespace OpenSim.Region.Physics.BulletXPlugin 76namespace OpenSim.Region.Physics.BulletXPlugin
77{ 77{
78
79 /// <summary> 78 /// <summary>
80 /// BulletXConversions are called now BulletXMaths 79 /// BulletXConversions are called now BulletXMaths
81 /// This Class converts objects and types for BulletX and give some operations 80 /// This Class converts objects and types for BulletX and give some operations
@@ -263,25 +262,25 @@ namespace OpenSim.Region.Physics.BulletXPlugin
263 262
264 // Class to detect and debug collisions 263 // Class to detect and debug collisions
265 // Mainly used for debugging purposes 264 // Mainly used for debugging purposes
266 class CollisionDispatcherLocal : CollisionDispatcher 265 internal class CollisionDispatcherLocal : CollisionDispatcher
267 { 266 {
268 267 private BulletXScene relatedScene;
269 BulletXScene relatedScene;
270 268
271 public CollisionDispatcherLocal(BulletXScene s) 269 public CollisionDispatcherLocal(BulletXScene s)
272 : base() 270 : base()
273 { 271 {
274 relatedScene=s; 272 relatedScene = s;
275 } 273 }
276 274
277 public override bool NeedsCollision(CollisionObject bodyA, CollisionObject bodyB) 275 public override bool NeedsCollision(CollisionObject bodyA, CollisionObject bodyB)
278 { 276 {
279 RigidBody rb; 277 RigidBody rb;
280 BulletXCharacter bxcA=null; 278 BulletXCharacter bxcA = null;
281 BulletXPrim bxpA = null; 279 BulletXPrim bxpA = null;
282 Type t = bodyA.GetType(); 280 Type t = bodyA.GetType();
283 if (t==typeof(RigidBody)) { 281 if (t == typeof (RigidBody))
284 rb = (RigidBody)bodyA; 282 {
283 rb = (RigidBody) bodyA;
285 relatedScene._characters.TryGetValue(rb, out bxcA); 284 relatedScene._characters.TryGetValue(rb, out bxcA);
286 relatedScene._prims.TryGetValue(rb, out bxpA); 285 relatedScene._prims.TryGetValue(rb, out bxpA);
287 } 286 }
@@ -296,9 +295,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
296 BulletXCharacter bxcB = null; 295 BulletXCharacter bxcB = null;
297 BulletXPrim bxpB = null; 296 BulletXPrim bxpB = null;
298 t = bodyB.GetType(); 297 t = bodyB.GetType();
299 if (t == typeof(RigidBody)) 298 if (t == typeof (RigidBody))
300 { 299 {
301 rb = (RigidBody)bodyB; 300 rb = (RigidBody) bodyB;
302 relatedScene._characters.TryGetValue(rb, out bxcB); 301 relatedScene._characters.TryGetValue(rb, out bxcB);
303 relatedScene._prims.TryGetValue(rb, out bxpB); 302 relatedScene._prims.TryGetValue(rb, out bxpB);
304 } 303 }
@@ -310,15 +309,16 @@ namespace OpenSim.Region.Physics.BulletXPlugin
310 else 309 else
311 nameB = "null"; 310 nameB = "null";
312 311
313 bool needsCollision=base.NeedsCollision(bodyA, bodyB); 312 bool needsCollision = base.NeedsCollision(bodyA, bodyB);
314 313
315 MainLog.Instance.Debug("BulletX", "A collision was detected between {0} and {1} --> {2}", nameA, nameB, needsCollision); 314 MainLog.Instance.Debug("BulletX", "A collision was detected between {0} and {1} --> {2}", nameA, nameB,
315 needsCollision);
316 316
317 317
318 return needsCollision; 318 return needsCollision;
319 } 319 }
320 } 320 }
321 321
322 /// <summary> 322 /// <summary>
323 /// PhysicsScene Class for BulletX 323 /// PhysicsScene Class for BulletX
324 /// </summary> 324 /// </summary>
@@ -439,7 +439,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
439 ((BulletXCharacter) actor).RigidBody.ActivationState = ActivationState.DisableSimulation; 439 ((BulletXCharacter) actor).RigidBody.ActivationState = ActivationState.DisableSimulation;
440 AddForgottenRigidBody(((BulletXCharacter) actor).RigidBody); 440 AddForgottenRigidBody(((BulletXCharacter) actor).RigidBody);
441 } 441 }
442 _characters.Remove(((BulletXCharacter)actor).RigidBody); 442 _characters.Remove(((BulletXCharacter) actor).RigidBody);
443 } 443 }
444 GC.Collect(); 444 GC.Collect();
445 } 445 }
@@ -448,8 +448,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
448 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 448 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
449 PhysicsVector size, AxiomQuaternion rotation) 449 PhysicsVector size, AxiomQuaternion rotation)
450 { 450 {
451 return this.AddPrimShape(primName, pbs, position, size, rotation, false); 451 return AddPrimShape(primName, pbs, position, size, rotation, false);
452 } 452 }
453
453 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 454 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
454 PhysicsVector size, AxiomQuaternion rotation, bool isPhysical) 455 PhysicsVector size, AxiomQuaternion rotation, bool isPhysical)
455 { 456 {
@@ -514,7 +515,6 @@ namespace OpenSim.Region.Physics.BulletXPlugin
514 515
515 public override void AddPhysicsActorTaint(PhysicsActor prim) 516 public override void AddPhysicsActorTaint(PhysicsActor prim)
516 { 517 {
517
518 } 518 }
519 519
520 public override float Simulate(float timeStep) 520 public override float Simulate(float timeStep)
@@ -526,10 +526,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
526 RemoveForgottenRigidBodies(); 526 RemoveForgottenRigidBodies();
527 //End of remove 527 //End of remove
528 MoveAllObjects(timeStep); 528 MoveAllObjects(timeStep);
529 529
530 530
531 fps = (timeStep * simulationSubSteps); 531 fps = (timeStep*simulationSubSteps);
532 532
533 ddWorld.StepSimulation(timeStep, simulationSubSteps, timeStep); 533 ddWorld.StepSimulation(timeStep, simulationSubSteps, timeStep);
534 //Extra Heightmap Validation: BulletX's HeightFieldTerrain somestimes doesn't work so fine. 534 //Extra Heightmap Validation: BulletX's HeightFieldTerrain somestimes doesn't work so fine.
535 ValidateHeightForAll(); 535 ValidateHeightForAll();
@@ -768,7 +768,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin
768 public override PhysicsVector Size 768 public override PhysicsVector Size
769 { 769 {
770 get { return _size; } 770 get { return _size; }
771 set { lock (BulletXScene.BulletXLock) { _size = value; } } 771 set
772 {
773 lock (BulletXScene.BulletXLock)
774 {
775 _size = value;
776 }
777 }
772 } 778 }
773 779
774 public override PhysicsVector Force 780 public override PhysicsVector Force
@@ -788,10 +794,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
788 794
789 public override PrimitiveBaseShape Shape 795 public override PrimitiveBaseShape Shape
790 { 796 {
791 set 797 set { return; }
792 {
793 return;
794 }
795 } 798 }
796 799
797 public override bool SetAlwaysRun 800 public override bool SetAlwaysRun
@@ -818,9 +821,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
818 } 821 }
819 } 822 }
820 823
821 public override float Mass 824 public override float Mass
822 { 825 {
823 get { return ActorMass; } 826 get { return ActorMass; }
824 } 827 }
825 828
826 public virtual float ActorMass 829 public virtual float ActorMass
@@ -841,7 +844,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
841 844
842 public Vector3 RigidBodyPosition 845 public Vector3 RigidBodyPosition
843 { 846 {
844 get { return this.rigidBody.CenterOfMassPosition; } 847 get { return rigidBody.CenterOfMassPosition; }
845 } 848 }
846 849
847 public override bool IsPhysical 850 public override bool IsPhysical
@@ -855,6 +858,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
855 get { return flying; } 858 get { return flying; }
856 set { flying = value; } 859 set { flying = value; }
857 } 860 }
861
858 public override bool ThrottleUpdates 862 public override bool ThrottleUpdates
859 { 863 {
860 get { return false; } 864 get { return false; }
@@ -889,19 +893,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
889 893
890 public override bool Kinematic 894 public override bool Kinematic
891 { 895 {
892 get 896 get { return false; }
893 { 897 set { }
894 return false;
895 }
896 set
897 {
898
899 }
900 } 898 }
901 899
902 public override void AddForce(PhysicsVector force) 900 public override void AddForce(PhysicsVector force)
903 { 901 {
904
905 } 902 }
906 903
907 public override void SetMomentum(PhysicsVector momentum) 904 public override void SetMomentum(PhysicsVector momentum)
@@ -917,31 +914,37 @@ namespace OpenSim.Region.Physics.BulletXPlugin
917 } 914 }
918 915
919 #region Methods for updating values of RigidBody 916 #region Methods for updating values of RigidBody
920 internal protected void Translate() 917
918 protected internal void Translate()
921 { 919 {
922 Translate(this._position); 920 Translate(_position);
923 } 921 }
924 internal protected void Translate(PhysicsVector _newPos) 922
923 protected internal void Translate(PhysicsVector _newPos)
925 { 924 {
926 Vector3 _translation; 925 Vector3 _translation;
927 _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition; 926 _translation = BulletXMaths.PhysicsVectorToXnaVector3(_newPos) - rigidBody.CenterOfMassPosition;
928 rigidBody.Translate(_translation); 927 rigidBody.Translate(_translation);
929 } 928 }
930 internal protected void Speed() 929
930 protected internal void Speed()
931 { 931 {
932 Speed(this._velocity); 932 Speed(_velocity);
933 } 933 }
934 internal protected void Speed(PhysicsVector _newSpeed) 934
935 protected internal void Speed(PhysicsVector _newSpeed)
935 { 936 {
936 Vector3 _speed; 937 Vector3 _speed;
937 _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed); 938 _speed = BulletXMaths.PhysicsVectorToXnaVector3(_newSpeed);
938 rigidBody.LinearVelocity = _speed; 939 rigidBody.LinearVelocity = _speed;
939 } 940 }
940 internal protected void ReOrient() 941
942 protected internal void ReOrient()
941 { 943 {
942 ReOrient(this._orientation); 944 ReOrient(_orientation);
943 } 945 }
944 internal protected void ReOrient(AxiomQuaternion _newOrient) 946
947 protected internal void ReOrient(AxiomQuaternion _newOrient)
945 { 948 {
946 Quaternion _newOrientation; 949 Quaternion _newOrientation;
947 _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient); 950 _newOrientation = BulletXMaths.AxiomQuaternionToXnaQuaternion(_newOrient);
@@ -949,17 +952,21 @@ namespace OpenSim.Region.Physics.BulletXPlugin
949 BulletXMaths.SetRotation(ref _comTransform, _newOrientation); 952 BulletXMaths.SetRotation(ref _comTransform, _newOrientation);
950 rigidBody.CenterOfMassTransform = _comTransform; 953 rigidBody.CenterOfMassTransform = _comTransform;
951 } 954 }
952 internal protected void ReSize() 955
956 protected internal void ReSize()
953 { 957 {
954 ReSize(this._size); 958 ReSize(_size);
955 } 959 }
956 internal protected virtual void ReSize(PhysicsVector _newSize) 960
961 protected internal virtual void ReSize(PhysicsVector _newSize)
957 { 962 {
958 } 963 }
964
959 public virtual void ScheduleTerseUpdate() 965 public virtual void ScheduleTerseUpdate()
960 { 966 {
961 base.RequestPhysicsterseUpdate(); 967 base.RequestPhysicsterseUpdate();
962 } 968 }
969
963 #endregion 970 #endregion
964 } 971 }
965 972
@@ -972,11 +979,13 @@ namespace OpenSim.Region.Physics.BulletXPlugin
972 : this("", parent_scene, pos) 979 : this("", parent_scene, pos)
973 { 980 {
974 } 981 }
982
975 public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos) 983 public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos)
976 : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(), 984 : this(avName, parent_scene, pos, new PhysicsVector(), new PhysicsVector(), new PhysicsVector(),
977 AxiomQuaternion.Identity) 985 AxiomQuaternion.Identity)
978 { 986 {
979 } 987 }
988
980 public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, 989 public BulletXCharacter(String avName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity,
981 PhysicsVector size, PhysicsVector acceleration, AxiomQuaternion orientation) 990 PhysicsVector size, PhysicsVector acceleration, AxiomQuaternion orientation)
982 : base(avName) 991 : base(avName)
@@ -1026,45 +1035,54 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1026 parent_scene.ddWorld.AddRigidBody(rigidBody); 1035 parent_scene.ddWorld.AddRigidBody(rigidBody);
1027 } 1036 }
1028 } 1037 }
1038
1029 public override int PhysicsActorType 1039 public override int PhysicsActorType
1030 { 1040 {
1031 get { return (int)ActorTypes.Agent; } 1041 get { return (int) ActorTypes.Agent; }
1032 set { return; } 1042 set { return; }
1033 } 1043 }
1044
1034 public override PhysicsVector Position 1045 public override PhysicsVector Position
1035 { 1046 {
1036 get { return base.Position; } 1047 get { return base.Position; }
1037 set { base.Position = value; } 1048 set { base.Position = value; }
1038 } 1049 }
1050
1039 public override PhysicsVector Velocity 1051 public override PhysicsVector Velocity
1040 { 1052 {
1041 get { return base.Velocity; } 1053 get { return base.Velocity; }
1042 set { base.Velocity = value; } 1054 set { base.Velocity = value; }
1043 } 1055 }
1056
1044 public override PhysicsVector Size 1057 public override PhysicsVector Size
1045 { 1058 {
1046 get { return base.Size; } 1059 get { return base.Size; }
1047 set { base.Size = value; } 1060 set { base.Size = value; }
1048 } 1061 }
1062
1049 public override PhysicsVector Acceleration 1063 public override PhysicsVector Acceleration
1050 { 1064 {
1051 get { return base.Acceleration; } 1065 get { return base.Acceleration; }
1052 } 1066 }
1067
1053 public override AxiomQuaternion Orientation 1068 public override AxiomQuaternion Orientation
1054 { 1069 {
1055 get { return base.Orientation; } 1070 get { return base.Orientation; }
1056 set { base.Orientation = value; } 1071 set { base.Orientation = value; }
1057 } 1072 }
1073
1058 public override bool Flying 1074 public override bool Flying
1059 { 1075 {
1060 get { return base.Flying; } 1076 get { return base.Flying; }
1061 set { base.Flying = value; } 1077 set { base.Flying = value; }
1062 } 1078 }
1079
1063 public override bool IsColliding 1080 public override bool IsColliding
1064 { 1081 {
1065 get { return base.IsColliding; } 1082 get { return base.IsColliding; }
1066 set { base.IsColliding = value; } 1083 set { base.IsColliding = value; }
1067 } 1084 }
1085
1068 public override bool Kinematic 1086 public override bool Kinematic
1069 { 1087 {
1070 get { return base.Kinematic; } 1088 get { return base.Kinematic; }
@@ -1075,10 +1093,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1075 { 1093 {
1076 base.SetAcceleration(accel); 1094 base.SetAcceleration(accel);
1077 } 1095 }
1096
1078 public override void AddForce(PhysicsVector force) 1097 public override void AddForce(PhysicsVector force)
1079 { 1098 {
1080 base.AddForce(force); 1099 base.AddForce(force);
1081 } 1100 }
1101
1082 public override void SetMomentum(PhysicsVector momentum) 1102 public override void SetMomentum(PhysicsVector momentum)
1083 { 1103 {
1084 base.SetMomentum(momentum); 1104 base.SetMomentum(momentum);
@@ -1117,6 +1137,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1117 } 1137 }
1118 rigidBody.LinearVelocity = vec; 1138 rigidBody.LinearVelocity = vec;
1119 } 1139 }
1140
1120 //This validation is very basic 1141 //This validation is very basic
1121 internal override void ValidateHeight(float heighmapPositionValue) 1142 internal override void ValidateHeight(float heighmapPositionValue)
1122 { 1143 {
@@ -1131,6 +1152,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1131 Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); 1152 Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
1132 } 1153 }
1133 } 1154 }
1155
1134 internal override void UpdateKinetics() 1156 internal override void UpdateKinetics()
1135 { 1157 {
1136 _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); 1158 _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition);
@@ -1154,12 +1176,15 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1154 1176
1155 public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, 1177 public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size,
1156 AxiomQuaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical) 1178 AxiomQuaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
1157 : this(primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs, isPhysical) 1179 : this(
1180 primName, parent_scene, pos, new PhysicsVector(), size, new PhysicsVector(), rotation, mesh, pbs,
1181 isPhysical)
1158 { 1182 {
1159 } 1183 }
1184
1160 public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity, 1185 public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector velocity,
1161 PhysicsVector size, 1186 PhysicsVector size,
1162 PhysicsVector acceleration, AxiomQuaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, 1187 PhysicsVector acceleration, AxiomQuaternion rotation, IMesh mesh, PrimitiveBaseShape pbs,
1163 bool isPhysical) 1188 bool isPhysical)
1164 : base(primName) 1189 : base(primName)
1165 { 1190 {
@@ -1177,27 +1202,28 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1177 1202
1178 CreateRigidBody(parent_scene, mesh, pos, size); 1203 CreateRigidBody(parent_scene, mesh, pos, size);
1179 } 1204 }
1205
1180 public override int PhysicsActorType 1206 public override int PhysicsActorType
1181 { 1207 {
1182 get { return (int)ActorTypes.Prim; } 1208 get { return (int) ActorTypes.Prim; }
1183 set { return; } 1209 set { return; }
1184 } 1210 }
1211
1185 public override PhysicsVector Position 1212 public override PhysicsVector Position
1186 { 1213 {
1187 get { return base.Position; } 1214 get { return base.Position; }
1188 set { base.Position = value; } 1215 set { base.Position = value; }
1189 } 1216 }
1217
1190 public override PhysicsVector Velocity 1218 public override PhysicsVector Velocity
1191 { 1219 {
1192 get { return base.Velocity; } 1220 get { return base.Velocity; }
1193 set { base.Velocity = value; } 1221 set { base.Velocity = value; }
1194 } 1222 }
1223
1195 public override PhysicsVector Size 1224 public override PhysicsVector Size
1196 { 1225 {
1197 get 1226 get { return _size; }
1198 {
1199 return _size;
1200 }
1201 set 1227 set
1202 { 1228 {
1203 lock (BulletXScene.BulletXLock) 1229 lock (BulletXScene.BulletXLock)
@@ -1207,29 +1233,30 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1207 } 1233 }
1208 } 1234 }
1209 } 1235 }
1236
1210 public override PhysicsVector Acceleration 1237 public override PhysicsVector Acceleration
1211 { 1238 {
1212 get { return base.Acceleration; } 1239 get { return base.Acceleration; }
1213 } 1240 }
1241
1214 public override AxiomQuaternion Orientation 1242 public override AxiomQuaternion Orientation
1215 { 1243 {
1216 get { return base.Orientation; } 1244 get { return base.Orientation; }
1217 set { base.Orientation = value; } 1245 set { base.Orientation = value; }
1218 } 1246 }
1247
1219 public override float ActorMass 1248 public override float ActorMass
1220 { 1249 {
1221 get 1250 get
1222 { 1251 {
1223 //For now all prims are boxes 1252 //For now all prims are boxes
1224 return (_physical ? 1 : 0) * _density * _size.X * _size.Y * _size.Z; 1253 return (_physical ? 1 : 0)*_density*_size.X*_size.Y*_size.Z;
1225 } 1254 }
1226 } 1255 }
1256
1227 public override bool IsPhysical 1257 public override bool IsPhysical
1228 { 1258 {
1229 get 1259 get { return base.IsPhysical; }
1230 {
1231 return base.IsPhysical;
1232 }
1233 set 1260 set
1234 { 1261 {
1235 base.IsPhysical = value; 1262 base.IsPhysical = value;
@@ -1238,27 +1265,30 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1238 //--- 1265 //---
1239 PhysicsPluginManager.PhysicsPluginMessage("Physical - Recreate", true); 1266 PhysicsPluginManager.PhysicsPluginMessage("Physical - Recreate", true);
1240 //--- 1267 //---
1241 ReCreateRigidBody(this._size); 1268 ReCreateRigidBody(_size);
1242 } 1269 }
1243 else 1270 else
1244 { 1271 {
1245 //--- 1272 //---
1246 PhysicsPluginManager.PhysicsPluginMessage("Physical - SetMassProps", true); 1273 PhysicsPluginManager.PhysicsPluginMessage("Physical - SetMassProps", true);
1247 //--- 1274 //---
1248 this.rigidBody.SetMassProps(Mass, new Vector3()); 1275 rigidBody.SetMassProps(Mass, new Vector3());
1249 } 1276 }
1250 } 1277 }
1251 } 1278 }
1279
1252 public override bool Flying 1280 public override bool Flying
1253 { 1281 {
1254 get { return base.Flying; } 1282 get { return base.Flying; }
1255 set { base.Flying = value; } 1283 set { base.Flying = value; }
1256 } 1284 }
1285
1257 public override bool IsColliding 1286 public override bool IsColliding
1258 { 1287 {
1259 get { return base.IsColliding; } 1288 get { return base.IsColliding; }
1260 set { base.IsColliding = value; } 1289 set { base.IsColliding = value; }
1261 } 1290 }
1291
1262 public override bool Kinematic 1292 public override bool Kinematic
1263 { 1293 {
1264 get { return base.Kinematic; } 1294 get { return base.Kinematic; }
@@ -1272,10 +1302,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1272 _acceleration = accel; 1302 _acceleration = accel;
1273 } 1303 }
1274 } 1304 }
1305
1275 public override void AddForce(PhysicsVector force) 1306 public override void AddForce(PhysicsVector force)
1276 { 1307 {
1277 base.AddForce(force); 1308 base.AddForce(force);
1278 } 1309 }
1310
1279 public override void SetMomentum(PhysicsVector momentum) 1311 public override void SetMomentum(PhysicsVector momentum)
1280 { 1312 {
1281 base.SetMomentum(momentum); 1313 base.SetMomentum(momentum);
@@ -1296,6 +1328,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1296 Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f)); 1328 Speed(new PhysicsVector(rigidBody.LinearVelocity.X, rigidBody.LinearVelocity.Y, 0.0f));
1297 } 1329 }
1298 } 1330 }
1331
1299 internal override void UpdateKinetics() 1332 internal override void UpdateKinetics()
1300 { 1333 {
1301 if (_physical) //Updates properties. Prim updates its properties physically 1334 if (_physical) //Updates properties. Prim updates its properties physically
@@ -1320,7 +1353,6 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1320 { 1353 {
1321 m_lastUpdateSent = false; 1354 m_lastUpdateSent = false;
1322 base.ScheduleTerseUpdate(); 1355 base.ScheduleTerseUpdate();
1323
1324 } 1356 }
1325 m_prev_position = _position; 1357 m_prev_position = _position;
1326 } 1358 }
@@ -1333,7 +1365,9 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1333 } 1365 }
1334 1366
1335 #region Methods for updating values of RigidBody 1367 #region Methods for updating values of RigidBody
1336 internal protected void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, PhysicsVector pos, PhysicsVector size) 1368
1369 protected internal void CreateRigidBody(BulletXScene parent_scene, IMesh mesh, PhysicsVector pos,
1370 PhysicsVector size)
1337 { 1371 {
1338 //For RigidBody Constructor. The next values might change 1372 //For RigidBody Constructor. The next values might change
1339 float _linearDamping = 0.0f; 1373 float _linearDamping = 0.0f;
@@ -1349,27 +1383,31 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1349 CollisionShape _collisionShape; 1383 CollisionShape _collisionShape;
1350 if (mesh == null) 1384 if (mesh == null)
1351 { 1385 {
1352 _collisionShape = new XnaDevRu.BulletX.BoxShape(BulletXMaths.PhysicsVectorToXnaVector3(size) / 2.0f); 1386 _collisionShape = new BoxShape(BulletXMaths.PhysicsVectorToXnaVector3(size)/2.0f);
1353 } else { 1387 }
1388 else
1389 {
1354 int iVertexCount = mesh.getVertexList().Count; 1390 int iVertexCount = mesh.getVertexList().Count;
1355 int[] indices = mesh.getIndexListAsInt(); 1391 int[] indices = mesh.getIndexListAsInt();
1356 Vector3[] v3Vertices = new Vector3[iVertexCount]; 1392 Vector3[] v3Vertices = new Vector3[iVertexCount];
1357 for (int i = 0; i < iVertexCount; i++) 1393 for (int i = 0; i < iVertexCount; i++)
1358 { 1394 {
1359 PhysicsVector v=mesh.getVertexList()[i]; 1395 PhysicsVector v = mesh.getVertexList()[i];
1360 if (v != null) // Note, null has special meaning. See meshing code for details 1396 if (v != null) // Note, null has special meaning. See meshing code for details
1361 v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v); 1397 v3Vertices[i] = BulletXMaths.PhysicsVectorToXnaVector3(v);
1362 else 1398 else
1363 v3Vertices[i] = MonoXnaCompactMaths.Vector3.Zero; 1399 v3Vertices[i] = Vector3.Zero;
1364 } 1400 }
1365 TriangleIndexVertexArray triMesh = new TriangleIndexVertexArray(indices, v3Vertices); 1401 TriangleIndexVertexArray triMesh = new TriangleIndexVertexArray(indices, v3Vertices);
1366 1402
1367 _collisionShape = new XnaDevRu.BulletX.TriangleMeshShape(triMesh); 1403 _collisionShape = new TriangleMeshShape(triMesh);
1368 } 1404 }
1369 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset); 1405 DefaultMotionState _motionState = new DefaultMotionState(_startTransform, _centerOfMassOffset);
1370 Vector3 _localInertia = new Vector3(); 1406 Vector3 _localInertia = new Vector3();
1371 if (_physical) _collisionShape.CalculateLocalInertia(Mass, out _localInertia); //Always when mass > 0 1407 if (_physical) _collisionShape.CalculateLocalInertia(Mass, out _localInertia); //Always when mass > 0
1372 rigidBody = new RigidBody(Mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping, _friction, _restitution); 1408 rigidBody =
1409 new RigidBody(Mass, _motionState, _collisionShape, _localInertia, _linearDamping, _angularDamping,
1410 _friction, _restitution);
1373 //rigidBody.ActivationState = ActivationState.DisableDeactivation; 1411 //rigidBody.ActivationState = ActivationState.DisableDeactivation;
1374 //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition 1412 //It's seems that there are a bug with rigidBody constructor and its CenterOfMassPosition
1375 Vector3 _vDebugTranslation; 1413 Vector3 _vDebugTranslation;
@@ -1379,30 +1417,34 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1379 parent_scene.ddWorld.AddRigidBody(rigidBody); 1417 parent_scene.ddWorld.AddRigidBody(rigidBody);
1380 } 1418 }
1381 } 1419 }
1382 internal protected void ReCreateRigidBody(PhysicsVector size) 1420
1421 protected internal void ReCreateRigidBody(PhysicsVector size)
1383 { 1422 {
1384 //There is a bug when trying to remove a rigidBody that is colliding with something.. 1423 //There is a bug when trying to remove a rigidBody that is colliding with something..
1385 try 1424 try
1386 { 1425 {
1387 this._parent_scene.ddWorld.RemoveRigidBody(rigidBody); 1426 _parent_scene.ddWorld.RemoveRigidBody(rigidBody);
1388 } 1427 }
1389 catch (Exception ex) 1428 catch (Exception ex)
1390 { 1429 {
1391 this._parent_scene.BulletXMessage(this._parent_scene.is_ex_message + ex.Message, true); 1430 _parent_scene.BulletXMessage(_parent_scene.is_ex_message + ex.Message, true);
1392 rigidBody.ActivationState = ActivationState.DisableSimulation; 1431 rigidBody.ActivationState = ActivationState.DisableSimulation;
1393 this._parent_scene.AddForgottenRigidBody(rigidBody); 1432 _parent_scene.AddForgottenRigidBody(rigidBody);
1394 } 1433 }
1395 CreateRigidBody(this._parent_scene, null, this._position, size); // Note, null for the meshing definitely is wrong. It's here for the moment to apease the compiler 1434 CreateRigidBody(_parent_scene, null, _position, size);
1396 if (_physical) Speed();//Static objects don't have linear velocity 1435 // Note, null for the meshing definitely is wrong. It's here for the moment to apease the compiler
1436 if (_physical) Speed(); //Static objects don't have linear velocity
1397 ReOrient(); 1437 ReOrient();
1398 GC.Collect(); 1438 GC.Collect();
1399 } 1439 }
1400 internal protected override void ReSize(PhysicsVector _newSize) 1440
1441 protected internal override void ReSize(PhysicsVector _newSize)
1401 { 1442 {
1402 //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't 1443 //I wonder to know how to resize with a simple instruction in BulletX. It seems that for now there isn't
1403 //so i have to do it manually. That's recreating rigidbody 1444 //so i have to do it manually. That's recreating rigidbody
1404 ReCreateRigidBody(_newSize); 1445 ReCreateRigidBody(_newSize);
1405 } 1446 }
1447
1406 #endregion 1448 #endregion
1407 } 1449 }
1408 1450
@@ -1486,4 +1528,4 @@ namespace OpenSim.Region.Physics.BulletXPlugin
1486 return height; 1528 return height;
1487 } 1529 }
1488 } 1530 }
1489} 1531} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs b/OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs
index 4f63687..e73c953 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/TriangleIndexVertexArray.cs
@@ -34,8 +34,8 @@
34 */ 34 */
35using System; 35using System;
36using System.Collections.Generic; 36using System.Collections.Generic;
37using System.Text;
38using MonoXnaCompactMaths; 37using MonoXnaCompactMaths;
38using XnaDevRu.BulletX;
39 39
40namespace OpenSim.Region.Physics.BulletXPlugin 40namespace OpenSim.Region.Physics.BulletXPlugin
41{ 41{
@@ -52,7 +52,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
52 private Vector3[] _vertexBase; 52 private Vector3[] _vertexBase;
53 private int _vertexStride; 53 private int _vertexStride;
54 54
55 public IndexedMesh(int numTriangleIndices, int[] triangleIndexBase, int triangleIndexStride, int numVertices, Vector3[] vertexBase, int vertexStride) 55 public IndexedMesh(int numTriangleIndices, int[] triangleIndexBase, int triangleIndexStride, int numVertices,
56 Vector3[] vertexBase, int vertexStride)
56 { 57 {
57 _numTriangles = numTriangleIndices; 58 _numTriangles = numTriangleIndices;
58 _triangleIndexBase = triangleIndexBase; 59 _triangleIndexBase = triangleIndexBase;
@@ -72,25 +73,57 @@ namespace OpenSim.Region.Physics.BulletXPlugin
72 _vertexStride = 24; 73 _vertexStride = 24;
73 } 74 }
74 75
75 public int TriangleCount { get { return _numTriangles; } set { _numTriangles = value; } } 76 public int TriangleCount
76 public int[] TriangleIndexBase { get { return _triangleIndexBase; } set { _triangleIndexBase = value; } } 77 {
77 public int TriangleIndexStride { get { return _triangleIndexStride; } set { _triangleIndexStride = value; } } 78 get { return _numTriangles; }
78 public int VertexCount { get { return _numVertices; } set { _numVertices = value; } } 79 set { _numTriangles = value; }
79 public Vector3[] VertexBase { get { return _vertexBase; } set { _vertexBase = value; } } 80 }
80 public int VertexStride { get { return _vertexStride; } set { _vertexStride = value; } } 81
82 public int[] TriangleIndexBase
83 {
84 get { return _triangleIndexBase; }
85 set { _triangleIndexBase = value; }
86 }
87
88 public int TriangleIndexStride
89 {
90 get { return _triangleIndexStride; }
91 set { _triangleIndexStride = value; }
92 }
93
94 public int VertexCount
95 {
96 get { return _numVertices; }
97 set { _numVertices = value; }
98 }
99
100 public Vector3[] VertexBase
101 {
102 get { return _vertexBase; }
103 set { _vertexBase = value; }
104 }
105
106 public int VertexStride
107 {
108 get { return _vertexStride; }
109 set { _vertexStride = value; }
110 }
81 } 111 }
82 112
83 /// <summary> 113 /// <summary>
84 /// TriangleIndexVertexArray allows to use multiple meshes, by indexing into existing triangle/index arrays. 114 /// TriangleIndexVertexArray allows to use multiple meshes, by indexing into existing triangle/index arrays.
85 /// Additional meshes can be added using addIndexedMesh 115 /// Additional meshes can be added using addIndexedMesh
86 /// </summary> 116 /// </summary>
87 public class TriangleIndexVertexArray : XnaDevRu.BulletX.StridingMeshInterface 117 public class TriangleIndexVertexArray : StridingMeshInterface
88 { 118 {
89 List<IndexedMesh> _indexedMeshes = new List<IndexedMesh>(); 119 private List<IndexedMesh> _indexedMeshes = new List<IndexedMesh>();
90 120
91 public TriangleIndexVertexArray() { } 121 public TriangleIndexVertexArray()
122 {
123 }
92 124
93 public TriangleIndexVertexArray(int numTriangleIndices, int[] triangleIndexBase, int triangleIndexStride, int numVertices, Vector3[] vertexBase, int vertexStride) 125 public TriangleIndexVertexArray(int numTriangleIndices, int[] triangleIndexBase, int triangleIndexStride,
126 int numVertices, Vector3[] vertexBase, int vertexStride)
94 { 127 {
95 IndexedMesh mesh = new IndexedMesh(); 128 IndexedMesh mesh = new IndexedMesh();
96 mesh.TriangleCount = numTriangleIndices; 129 mesh.TriangleCount = numTriangleIndices;
@@ -104,19 +137,23 @@ namespace OpenSim.Region.Physics.BulletXPlugin
104 } 137 }
105 138
106 public TriangleIndexVertexArray(int[] triangleIndexBase, Vector3[] vertexBase) 139 public TriangleIndexVertexArray(int[] triangleIndexBase, Vector3[] vertexBase)
107 : this(triangleIndexBase.Length, triangleIndexBase, 32, vertexBase.Length, vertexBase, 24) { } 140 : this(triangleIndexBase.Length, triangleIndexBase, 32, vertexBase.Length, vertexBase, 24)
141 {
142 }
108 143
109 public void AddIndexedMesh(IndexedMesh indexedMesh) 144 public void AddIndexedMesh(IndexedMesh indexedMesh)
110 { 145 {
111 _indexedMeshes.Add(indexedMesh); 146 _indexedMeshes.Add(indexedMesh);
112 } 147 }
113 148
114 public override void GetLockedVertexIndexBase(out List<Vector3> verts, out List<int> indicies, out int numfaces, int subpart) 149 public override void GetLockedVertexIndexBase(out List<Vector3> verts, out List<int> indicies, out int numfaces,
150 int subpart)
115 { 151 {
116 throw new Exception("The method or operation is not implemented."); 152 throw new Exception("The method or operation is not implemented.");
117 } 153 }
118 154
119 public override void GetLockedReadOnlyVertexIndexBase(out List<Vector3> verts, out List<int> indicies, out int numfaces, int subpart) 155 public override void GetLockedReadOnlyVertexIndexBase(out List<Vector3> verts, out List<int> indicies,
156 out int numfaces, int subpart)
120 { 157 {
121 IndexedMesh m = _indexedMeshes[0]; 158 IndexedMesh m = _indexedMeshes[0];
122 Vector3[] vertexBase = m.VertexBase; 159 Vector3[] vertexBase = m.VertexBase;
@@ -158,4 +195,4 @@ namespace OpenSim.Region.Physics.BulletXPlugin
158 throw new Exception("The method or operation is not implemented."); 195 throw new Exception("The method or operation is not implemented.");
159 } 196 }
160 } 197 }
161} 198} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
index 3d95d6d..983a2b9 100644
--- a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/Manager/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("1.0.*")] 58[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs
index 1648a98..80b3320 100644
--- a/OpenSim/Region/Physics/Manager/IMesher.cs
+++ b/OpenSim/Region/Physics/Manager/IMesher.cs
@@ -28,8 +28,6 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32
33using OpenSim.Framework; 31using OpenSim.Framework;
34 32
35namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.Physics.Manager
@@ -39,7 +37,8 @@ namespace OpenSim.Region.Physics.Manager
39 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size); 37 IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size);
40 } 38 }
41 39
42 public interface IVertex { 40 public interface IVertex
41 {
43 } 42 }
44 43
45 public interface IMesh 44 public interface IMesh
@@ -48,7 +47,5 @@ namespace OpenSim.Region.Physics.Manager
48 int[] getIndexListAsInt(); 47 int[] getIndexListAsInt();
49 int[] getIndexListAsIntLocked(); 48 int[] getIndexListAsIntLocked();
50 float[] getVertexListAsFloatLocked(); 49 float[] getVertexListAsFloatLocked();
51
52
53 } 50 }
54} 51} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index 5894ab0..d393b62 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -25,10 +25,10 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using Axiom.Math;
29using OpenSim.Framework;
30using System; 28using System;
31using System.Collections.Generic; 29using System.Collections.Generic;
30using Axiom.Math;
31using OpenSim.Framework;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.Physics.Manager
34{ 34{
@@ -37,14 +37,16 @@ namespace OpenSim.Region.Physics.Manager
37 public delegate void VelocityUpdate(PhysicsVector velocity); 37 public delegate void VelocityUpdate(PhysicsVector velocity);
38 38
39 public delegate void OrientationUpdate(Quaternion orientation); 39 public delegate void OrientationUpdate(Quaternion orientation);
40
40 public enum ActorTypes : int 41 public enum ActorTypes : int
41 { 42 {
42 Unknown = 0, 43 Unknown = 0,
43 Agent = 1, 44 Agent = 1,
44 Prim = 2, 45 Prim = 2,
45 Ground = 3 46 Ground = 3
46 } 47 }
47 public class CollisionEventUpdate : EventArgs 48
49 public class CollisionEventUpdate : EventArgs
48 { 50 {
49 // Raising the event on the object, so don't need to provide location.. further up the tree knows that info. 51 // Raising the event on the object, so don't need to provide location.. further up the tree knows that info.
50 52
@@ -53,52 +55,53 @@ namespace OpenSim.Region.Physics.Manager
53 public bool m_startOrEnd; 55 public bool m_startOrEnd;
54 //public uint m_LocalID; 56 //public uint m_LocalID;
55 public List<uint> m_objCollisionList; 57 public List<uint> m_objCollisionList;
58
56 public CollisionEventUpdate(uint localID, int colliderType, bool startOrEnd, List<uint> objCollisionList) 59 public CollisionEventUpdate(uint localID, int colliderType, bool startOrEnd, List<uint> objCollisionList)
57 { 60 {
58 m_colliderType = colliderType; 61 m_colliderType = colliderType;
59 m_startOrEnd = startOrEnd; 62 m_startOrEnd = startOrEnd;
60 m_objCollisionList = objCollisionList; 63 m_objCollisionList = objCollisionList;
61
62 } 64 }
63 public CollisionEventUpdate(bool startOrEnd){ 65
64 m_colliderType = (int)ActorTypes.Unknown; 66 public CollisionEventUpdate(bool startOrEnd)
67 {
68 m_colliderType = (int) ActorTypes.Unknown;
65 m_startOrEnd = startOrEnd; 69 m_startOrEnd = startOrEnd;
66 m_objCollisionList = null; 70 m_objCollisionList = null;
67 } 71 }
68 public CollisionEventUpdate() { 72
69 m_colliderType = (int)ActorTypes.Unknown; 73 public CollisionEventUpdate()
74 {
75 m_colliderType = (int) ActorTypes.Unknown;
70 m_startOrEnd = false; 76 m_startOrEnd = false;
71 m_objCollisionList = null; 77 m_objCollisionList = null;
72 } 78 }
73 public int collidertype{ 79
74 get { 80 public int collidertype
75 return m_colliderType; 81 {
76 } 82 get { return m_colliderType; }
77 set { 83 set { m_colliderType = value; }
78 m_colliderType = value;
79 }
80 } 84 }
81 public bool startOrEnd { 85
82 get { 86 public bool startOrEnd
83 return m_startOrEnd; 87 {
84 } 88 get { return m_startOrEnd; }
85 set { 89 set { m_startOrEnd = value; }
86 m_startOrEnd = value;
87 }
88 } 90 }
89 public void addCollider(uint localID) { 91
92 public void addCollider(uint localID)
93 {
90 m_objCollisionList.Add(localID); 94 m_objCollisionList.Add(localID);
91 } 95 }
92 } 96 }
93
94
95 97
96
97 98
98 public abstract class PhysicsActor 99 public abstract class PhysicsActor
99 { 100 {
100 public delegate void RequestTerseUpdate(); 101 public delegate void RequestTerseUpdate();
102
101 public delegate void CollisionUpdate(EventArgs e); 103 public delegate void CollisionUpdate(EventArgs e);
104
102 public delegate void OutOfBounds(PhysicsVector pos); 105 public delegate void OutOfBounds(PhysicsVector pos);
103 106
104#pragma warning disable 67 107#pragma warning disable 67
@@ -117,10 +120,8 @@ namespace OpenSim.Region.Physics.Manager
117 120
118 public abstract PhysicsVector Size { get; set; } 121 public abstract PhysicsVector Size { get; set; }
119 122
120 public abstract PrimitiveBaseShape Shape 123 public abstract PrimitiveBaseShape Shape { set; }
121 { 124
122 set;
123 }
124 public virtual void RequestPhysicsterseUpdate() 125 public virtual void RequestPhysicsterseUpdate()
125 { 126 {
126 // Make a temporary copy of the event to avoid possibility of 127 // Make a temporary copy of the event to avoid possibility of
@@ -131,8 +132,8 @@ namespace OpenSim.Region.Physics.Manager
131 { 132 {
132 OnRequestTerseUpdate(); 133 OnRequestTerseUpdate();
133 } 134 }
134
135 } 135 }
136
136 public virtual void RaiseOutOfBounds(PhysicsVector pos) 137 public virtual void RaiseOutOfBounds(PhysicsVector pos)
137 { 138 {
138 // Make a temporary copy of the event to avoid possibility of 139 // Make a temporary copy of the event to avoid possibility of
@@ -143,8 +144,8 @@ namespace OpenSim.Region.Physics.Manager
143 { 144 {
144 OnOutOfBounds(pos); 145 OnOutOfBounds(pos);
145 } 146 }
146
147 } 147 }
148
148 public virtual void SendCollisionUpdate(EventArgs e) 149 public virtual void SendCollisionUpdate(EventArgs e)
149 { 150 {
150 CollisionUpdate handler = OnCollisionUpdate; 151 CollisionUpdate handler = OnCollisionUpdate;
@@ -159,7 +160,7 @@ namespace OpenSim.Region.Physics.Manager
159 160
160 public abstract float Mass { get; } 161 public abstract float Mass { get; }
161 162
162 public abstract PhysicsVector Force { get;} 163 public abstract PhysicsVector Force { get; }
163 164
164 public abstract PhysicsVector GeometricCenter { get; } 165 public abstract PhysicsVector GeometricCenter { get; }
165 166
@@ -172,7 +173,7 @@ namespace OpenSim.Region.Physics.Manager
172 public abstract Quaternion Orientation { get; set; } 173 public abstract Quaternion Orientation { get; set; }
173 public abstract int PhysicsActorType { get; set; } 174 public abstract int PhysicsActorType { get; set; }
174 175
175 public abstract bool IsPhysical {get; set;} 176 public abstract bool IsPhysical { get; set; }
176 177
177 public abstract bool Flying { get; set; } 178 public abstract bool Flying { get; set; }
178 public abstract bool SetAlwaysRun { get; set; } 179 public abstract bool SetAlwaysRun { get; set; }
@@ -198,48 +199,54 @@ namespace OpenSim.Region.Physics.Manager
198 get { return PhysicsVector.Zero; } 199 get { return PhysicsVector.Zero; }
199 set { return; } 200 set { return; }
200 } 201 }
202
201 public override bool SetAlwaysRun 203 public override bool SetAlwaysRun
202 { 204 {
203 get { return false; } 205 get { return false; }
204 set { return; } 206 set { return; }
205 } 207 }
208
206 public override bool CollidingGround 209 public override bool CollidingGround
207 { 210 {
208 get {return false;} 211 get { return false; }
209 set {return;} 212 set { return; }
210 } 213 }
211 public override bool CollidingObj 214
215 public override bool CollidingObj
212 { 216 {
213 get { return false; } 217 get { return false; }
214 set { return; } 218 set { return; }
215 } 219 }
220
216 public override PhysicsVector Size 221 public override PhysicsVector Size
217 { 222 {
218 get { return PhysicsVector.Zero; } 223 get { return PhysicsVector.Zero; }
219 set { return; } 224 set { return; }
220 } 225 }
226
221 public override float Mass 227 public override float Mass
222 { 228 {
223 get { return 0f; } 229 get { return 0f; }
224 } 230 }
231
225 public override PhysicsVector Force 232 public override PhysicsVector Force
226 { 233 {
227 get { return PhysicsVector.Zero; } 234 get { return PhysicsVector.Zero; }
228 } 235 }
236
229 public override PhysicsVector CenterOfMass 237 public override PhysicsVector CenterOfMass
230 { 238 {
231 get { return PhysicsVector.Zero; } 239 get { return PhysicsVector.Zero; }
232 } 240 }
241
233 public override PhysicsVector GeometricCenter 242 public override PhysicsVector GeometricCenter
234 { 243 {
235 get { return PhysicsVector.Zero; } 244 get { return PhysicsVector.Zero; }
236 } 245 }
246
237 public override PrimitiveBaseShape Shape 247 public override PrimitiveBaseShape Shape
238 { 248 {
239 set 249 set { return; }
240 {
241 return;
242 }
243 } 250 }
244 251
245 public override PhysicsVector Velocity 252 public override PhysicsVector Velocity
@@ -270,6 +277,7 @@ namespace OpenSim.Region.Physics.Manager
270 get { return false; } 277 get { return false; }
271 set { return; } 278 set { return; }
272 } 279 }
280
273 public override bool ThrottleUpdates 281 public override bool ThrottleUpdates
274 { 282 {
275 get { return false; } 283 get { return false; }
@@ -281,9 +289,10 @@ namespace OpenSim.Region.Physics.Manager
281 get { return false; } 289 get { return false; }
282 set { return; } 290 set { return; }
283 } 291 }
292
284 public override int PhysicsActorType 293 public override int PhysicsActorType
285 { 294 {
286 get { return (int)ActorTypes.Unknown; } 295 get { return (int) ActorTypes.Unknown; }
287 set { return; } 296 set { return; }
288 } 297 }
289 298
@@ -297,14 +306,16 @@ namespace OpenSim.Region.Physics.Manager
297 { 306 {
298 return; 307 return;
299 } 308 }
309
300 public override PhysicsVector RotationalVelocity 310 public override PhysicsVector RotationalVelocity
301 { 311 {
302 get { return PhysicsVector.Zero; } 312 get { return PhysicsVector.Zero; }
303 set { return; } 313 set { return; }
304 } 314 }
315
305 public override void SetMomentum(PhysicsVector momentum) 316 public override void SetMomentum(PhysicsVector momentum)
306 { 317 {
307 return; 318 return;
308 } 319 }
309 } 320 }
310} 321} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index badcc04..a4ac54f 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
33using Nini.Config;
34 33
35namespace OpenSim.Region.Physics.Manager 34namespace OpenSim.Region.Physics.Manager
36{ 35{
@@ -91,7 +90,7 @@ namespace OpenSim.Region.Physics.Manager
91 plugHard = new ZeroMesherPlugin(); 90 plugHard = new ZeroMesherPlugin();
92 _MeshPlugins.Add(plugHard.GetName(), plugHard); 91 _MeshPlugins.Add(plugHard.GetName(), plugHard);
93 MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plugHard.GetName()); 92 MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plugHard.GetName());
94 93
95 // And now walk all assemblies (DLLs effectively) and see if they are home 94 // And now walk all assemblies (DLLs effectively) and see if they are home
96 // of a plugin that is of interest for us 95 // of a plugin that is of interest for us
97 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Physics"); 96 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Physics");
@@ -129,7 +128,7 @@ namespace OpenSim.Region.Physics.Manager
129 if (meshTypeInterface != null) 128 if (meshTypeInterface != null)
130 { 129 {
131 IMeshingPlugin plug = 130 IMeshingPlugin plug =
132 (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 131 (IMeshingPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
133 _MeshPlugins.Add(plug.GetName(), plug); 132 _MeshPlugins.Add(plug.GetName(), plug);
134 MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plug.GetName()); 133 MainLog.Instance.Verbose("PHYSICS", "Added meshing engine: " + plug.GetName());
135 } 134 }
@@ -155,6 +154,7 @@ namespace OpenSim.Region.Physics.Manager
155 MainLog.Instance.Verbose("PHYSICS", message); 154 MainLog.Instance.Verbose("PHYSICS", message);
156 } 155 }
157 } 156 }
157
158 //--- 158 //---
159 } 159 }
160 160
@@ -171,4 +171,4 @@ namespace OpenSim.Region.Physics.Manager
171 string GetName(); 171 string GetName();
172 IMesher GetMesher(); 172 IMesher GetMesher();
173 } 173 }
174} 174} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index c63a66d..37481f1 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -28,7 +28,6 @@
28using Axiom.Math; 28using Axiom.Math;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
31using OpenSim.Region.Physics.Manager;
32 31
33namespace OpenSim.Region.Physics.Manager 32namespace OpenSim.Region.Physics.Manager
34{ 33{
@@ -45,6 +44,7 @@ namespace OpenSim.Region.Physics.Manager
45 { 44 {
46 get { return new NullPhysicsScene(); } 45 get { return new NullPhysicsScene(); }
47 } 46 }
47
48 public virtual void TriggerPhysicsBasedRestart() 48 public virtual void TriggerPhysicsBasedRestart()
49 { 49 {
50 physicsCrash handler = OnPhysicsCrash; 50 physicsCrash handler = OnPhysicsCrash;
@@ -52,9 +52,8 @@ namespace OpenSim.Region.Physics.Manager
52 { 52 {
53 OnPhysicsCrash(); 53 OnPhysicsCrash();
54 } 54 }
55
56 } 55 }
57 56
58 57
59 public abstract void Initialise(IMesher meshmerizer); 58 public abstract void Initialise(IMesher meshmerizer);
60 59
@@ -68,6 +67,7 @@ namespace OpenSim.Region.Physics.Manager
68 PhysicsVector size, Quaternion rotation); //To be removed 67 PhysicsVector size, Quaternion rotation); //To be removed
69 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 68 public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
70 PhysicsVector size, Quaternion rotation, bool isPhysical); 69 PhysicsVector size, Quaternion rotation, bool isPhysical);
70
71 public abstract void AddPhysicsActorTaint(PhysicsActor prim); 71 public abstract void AddPhysicsActorTaint(PhysicsActor prim);
72 72
73 public abstract float Simulate(float timeStep); 73 public abstract float Simulate(float timeStep);
@@ -111,21 +111,24 @@ namespace OpenSim.Region.Physics.Manager
111 return PhysicsActor.Null; 111 return PhysicsActor.Null;
112 } 112 }
113*/ 113*/
114
114 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 115 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
115 PhysicsVector size, Quaternion rotation) //To be removed 116 PhysicsVector size, Quaternion rotation) //To be removed
116 { 117 {
117 return this.AddPrimShape(primName, pbs, position, size, rotation, false); 118 return AddPrimShape(primName, pbs, position, size, rotation, false);
118 } 119 }
120
119 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 121 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
120 PhysicsVector size, Quaternion rotation, bool isPhysical) 122 PhysicsVector size, Quaternion rotation, bool isPhysical)
121 { 123 {
122 MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : AddPrim({0},{1})", position, size); 124 MainLog.Instance.Verbose("PHYSICS", "NullPhysicsScene : AddPrim({0},{1})", position, size);
123 return PhysicsActor.Null; 125 return PhysicsActor.Null;
124 } 126 }
127
125 public override void AddPhysicsActorTaint(PhysicsActor prim) 128 public override void AddPhysicsActorTaint(PhysicsActor prim)
126 { 129 {
127
128 } 130 }
131
129 public override float Simulate(float timeStep) 132 public override float Simulate(float timeStep)
130 { 133 {
131 m_workIndicator = (m_workIndicator + 1)%10; 134 m_workIndicator = (m_workIndicator + 1)%10;
@@ -154,4 +157,4 @@ namespace OpenSim.Region.Physics.Manager
154 } 157 }
155 } 158 }
156 } 159 }
157} 160} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
index be82fca..1f5d0dc 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsVector.cs
@@ -28,7 +28,6 @@
28 28
29using System; 29using System;
30 30
31
32namespace OpenSim.Region.Physics.Manager 31namespace OpenSim.Region.Physics.Manager
33{ 32{
34 public class PhysicsVector 33 public class PhysicsVector
@@ -68,27 +67,27 @@ namespace OpenSim.Region.Physics.Manager
68 67
69 public static PhysicsVector cross(PhysicsVector a, PhysicsVector b) 68 public static PhysicsVector cross(PhysicsVector a, PhysicsVector b)
70 { 69 {
71 return new PhysicsVector(a.Y * b.Z - a.Z * b.Y, a.Z * b.X - a.X * b.Z, a.X * b.Y - a.Y * b.X); 70 return new PhysicsVector(a.Y*b.Z - a.Z*b.Y, a.Z*b.X - a.X*b.Z, a.X*b.Y - a.Y*b.X);
72 } 71 }
73 72
74 public float length() 73 public float length()
75 { 74 {
76 return (float)Math.Sqrt(X*X + Y*Y + Z*Z); 75 return (float) Math.Sqrt(X*X + Y*Y + Z*Z);
77 } 76 }
78 77
79 public static PhysicsVector operator / (PhysicsVector v, float f) 78 public static PhysicsVector operator /(PhysicsVector v, float f)
80 { 79 {
81 return new PhysicsVector(v.X / f, v.Y / f, v.Z / f); 80 return new PhysicsVector(v.X/f, v.Y/f, v.Z/f);
82 } 81 }
83 82
84 public static PhysicsVector operator *(PhysicsVector v, float f) 83 public static PhysicsVector operator *(PhysicsVector v, float f)
85 { 84 {
86 return new PhysicsVector(v.X * f, v.Y * f, v.Z * f); 85 return new PhysicsVector(v.X*f, v.Y*f, v.Z*f);
87 } 86 }
88 87
89 public static PhysicsVector operator *(float f, PhysicsVector v) 88 public static PhysicsVector operator *(float f, PhysicsVector v)
90 { 89 {
91 return v * f; 90 return v*f;
92 } 91 }
93 92
94 public virtual bool IsIdentical(PhysicsVector v, float tolerance) 93 public virtual bool IsIdentical(PhysicsVector v, float tolerance)
@@ -101,4 +100,4 @@ namespace OpenSim.Region.Physics.Manager
101 return false; 100 return false;
102 } 101 }
103 } 102 }
104} 103} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs
index a88656e..7dae4ac 100644
--- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs
+++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs
@@ -27,11 +27,8 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Framework; 30using OpenSim.Framework;
33 31
34
35/* 32/*
36 * This is the zero mesher. 33 * This is the zero mesher.
37 * Whatever you want him to mesh, he can't, telling you that by responding with a null pointer. 34 * Whatever you want him to mesh, he can't, telling you that by responding with a null pointer.
@@ -62,13 +59,11 @@ namespace OpenSim.Region.Physics.Manager
62 } 59 }
63 } 60 }
64 61
65 public class ZeroMesher: IMesher 62 public class ZeroMesher : IMesher
66 { 63 {
67
68 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size) 64 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size)
69 { 65 {
70 return null; 66 return null;
71 } 67 }
72 } 68 }
73 69} \ No newline at end of file
74}
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs
index eecac5a..7ef5b5b 100644
--- a/OpenSim/Region/Physics/Meshing/Extruder.cs
+++ b/OpenSim/Region/Physics/Meshing/Extruder.cs
@@ -26,24 +26,22 @@
26* 26*
27*/ 27*/
28 28
29using System; 29using OpenSim.Region.Physics.Manager;
30using System.Collections.Generic;
31using System.Text;
32 30
33namespace OpenSim.Region.Physics.Meshing 31namespace OpenSim.Region.Physics.Meshing
34{ 32{
35 class Extruder 33 internal class Extruder
36 { 34 {
37 public float startParameter; 35 public float startParameter;
38 public float stopParameter; 36 public float stopParameter;
39 public Manager.PhysicsVector size; 37 public PhysicsVector size;
40 38
41 public Mesh Extrude(Mesh m) 39 public Mesh Extrude(Mesh m)
42 { 40 {
43 // Currently only works for iSteps=1; 41 // Currently only works for iSteps=1;
44 Mesh result = new Mesh(); 42 Mesh result = new Mesh();
45 43
46 Mesh workingPlus = m.Clone(); 44 Mesh workingPlus = m.Clone();
47 Mesh workingMinus = m.Clone(); 45 Mesh workingMinus = m.Clone();
48 46
49 foreach (Vertex v in workingPlus.vertices) 47 foreach (Vertex v in workingPlus.vertices)
@@ -80,14 +78,14 @@ namespace OpenSim.Region.Physics.Meshing
80 for (int i = 0; i < workingPlus.vertices.Count; i++) 78 for (int i = 0; i < workingPlus.vertices.Count; i++)
81 { 79 {
82 int iNext = (i + 1); 80 int iNext = (i + 1);
83 81
84 if (workingPlus.vertices[i] == null) // Can't make a simplex here 82 if (workingPlus.vertices[i] == null) // Can't make a simplex here
85 { 83 {
86 iLastNull = i+1; 84 iLastNull = i + 1;
87 continue; 85 continue;
88 } 86 }
89 87
90 if (i == workingPlus.vertices.Count-1) // End of list 88 if (i == workingPlus.vertices.Count - 1) // End of list
91 { 89 {
92 iNext = iLastNull; 90 iNext = iLastNull;
93 } 91 }
@@ -101,11 +99,12 @@ namespace OpenSim.Region.Physics.Meshing
101 tSide = new Triangle(workingPlus.vertices[i], workingMinus.vertices[i], workingPlus.vertices[iNext]); 99 tSide = new Triangle(workingPlus.vertices[i], workingMinus.vertices[i], workingPlus.vertices[iNext]);
102 result.Add(tSide); 100 result.Add(tSide);
103 101
104 tSide = new Triangle(workingPlus.vertices[iNext], workingMinus.vertices[i], workingMinus.vertices[iNext]); 102 tSide =
103 new Triangle(workingPlus.vertices[iNext], workingMinus.vertices[i], workingMinus.vertices[iNext]);
105 result.Add(tSide); 104 result.Add(tSide);
106 } 105 }
107 106
108 return result; 107 return result;
109 } 108 }
110 } 109 }
111} 110} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs
index be82c32..ac06614 100644
--- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs
+++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs
@@ -30,9 +30,7 @@ using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Diagnostics; 31using System.Diagnostics;
32using System.Globalization; 32using System.Globalization;
33using OpenSim.Framework.Console;
34using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.Physics.Manager;
35
36using OpenSim.Region.Physics.Meshing; 34using OpenSim.Region.Physics.Meshing;
37 35
38public class Vertex : PhysicsVector, IComparable<Vertex> 36public class Vertex : PhysicsVector, IComparable<Vertex>
@@ -54,7 +52,7 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
54 52
55 public static Vertex FromAngle(double angle) 53 public static Vertex FromAngle(double angle)
56 { 54 {
57 return new Vertex((float)Math.Cos(angle), (float)Math.Sin(angle), 0.0f); 55 return new Vertex((float) Math.Cos(angle), (float) Math.Sin(angle), 0.0f);
58 } 56 }
59 57
60 58
@@ -101,6 +99,7 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
101 { 99 {
102 return me.CompareTo(other) < 0; 100 return me.CompareTo(other) < 0;
103 } 101 }
102
104 public String ToRaw() 103 public String ToRaw()
105 { 104 {
106 // Why this stuff with the number formatter? 105 // Why this stuff with the number formatter?
@@ -117,7 +116,6 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
117 116
118 return s1; 117 return s1;
119 } 118 }
120
121} 119}
122 120
123public class Triangle 121public class Triangle
@@ -283,7 +281,7 @@ public class Triangle
283 float l = n.length(); 281 float l = n.length();
284 282
285 // Normalized "normal" 283 // Normalized "normal"
286 n = n / l; 284 n = n/l;
287 285
288 return n; 286 return n;
289 } 287 }
@@ -300,7 +298,7 @@ public class Triangle
300 // debugging purposes 298 // debugging purposes
301 public String ToStringRaw() 299 public String ToStringRaw()
302 { 300 {
303 String output = v1.ToRaw() + " " + v2.ToRaw() + " " +v3.ToRaw(); 301 String output = v1.ToRaw() + " " + v2.ToRaw() + " " + v3.ToRaw();
304 return output; 302 return output;
305 } 303 }
306} \ No newline at end of file 304} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs
index 2ebfa1c..9c2667e 100644
--- a/OpenSim/Region/Physics/Meshing/Mesh.cs
+++ b/OpenSim/Region/Physics/Meshing/Mesh.cs
@@ -26,14 +26,11 @@
26* 26*
27*/ 27*/
28 28
29
29using System; 30using System;
30using System.IO;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Text; 32using System.IO;
33
34using System.Runtime.InteropServices; 33using System.Runtime.InteropServices;
35
36
37using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Physics.Manager;
38 35
39namespace OpenSim.Region.Physics.Meshing 36namespace OpenSim.Region.Physics.Meshing
@@ -66,9 +63,9 @@ namespace OpenSim.Region.Physics.Meshing
66 foreach (Triangle t in triangles) 63 foreach (Triangle t in triangles)
67 { 64 {
68 int iV1, iV2, iV3; 65 int iV1, iV2, iV3;
69 iV1 = this.vertices.IndexOf(t.v1); 66 iV1 = vertices.IndexOf(t.v1);
70 iV2 = this.vertices.IndexOf(t.v2); 67 iV2 = vertices.IndexOf(t.v2);
71 iV3 = this.vertices.IndexOf(t.v3); 68 iV3 = vertices.IndexOf(t.v3);
72 69
73 Triangle newT = new Triangle(result.vertices[iV1], result.vertices[iV2], result.vertices[iV3]); 70 Triangle newT = new Triangle(result.vertices[iV1], result.vertices[iV2], result.vertices[iV3]);
74 result.Add(newT); 71 result.Add(newT);
@@ -77,8 +74,7 @@ namespace OpenSim.Region.Physics.Meshing
77 return result; 74 return result;
78 } 75 }
79 76
80 77
81
82 public void Add(Triangle triangle) 78 public void Add(Triangle triangle)
83 { 79 {
84 int i; 80 int i;
@@ -160,15 +156,15 @@ namespace OpenSim.Region.Physics.Meshing
160 156
161 public float[] getVertexListAsFloatLocked() 157 public float[] getVertexListAsFloatLocked()
162 { 158 {
163 float[] result = new float[vertices.Count * 3]; 159 float[] result = new float[vertices.Count*3];
164 for (int i = 0; i < vertices.Count; i++) 160 for (int i = 0; i < vertices.Count; i++)
165 { 161 {
166 Vertex v = vertices[i]; 162 Vertex v = vertices[i];
167 if (v == null) 163 if (v == null)
168 continue; 164 continue;
169 result[3 * i + 0] = v.X; 165 result[3*i + 0] = v.X;
170 result[3 * i + 1] = v.Y; 166 result[3*i + 1] = v.Y;
171 result[3 * i + 2] = v.Z; 167 result[3*i + 2] = v.Z;
172 } 168 }
173 GCHandle.Alloc(result, GCHandleType.Pinned); 169 GCHandle.Alloc(result, GCHandleType.Pinned);
174 return result; 170 return result;
@@ -176,13 +172,13 @@ namespace OpenSim.Region.Physics.Meshing
176 172
177 public int[] getIndexListAsInt() 173 public int[] getIndexListAsInt()
178 { 174 {
179 int[] result = new int[triangles.Count * 3]; 175 int[] result = new int[triangles.Count*3];
180 for (int i = 0; i < triangles.Count; i++) 176 for (int i = 0; i < triangles.Count; i++)
181 { 177 {
182 Triangle t = triangles[i]; 178 Triangle t = triangles[i];
183 result[3 * i + 0] = vertices.IndexOf(t.v1); 179 result[3*i + 0] = vertices.IndexOf(t.v1);
184 result[3 * i + 1] = vertices.IndexOf(t.v2); 180 result[3*i + 1] = vertices.IndexOf(t.v2);
185 result[3 * i + 2] = vertices.IndexOf(t.v3); 181 result[3*i + 2] = vertices.IndexOf(t.v3);
186 } 182 }
187 return result; 183 return result;
188 } 184 }
@@ -202,7 +198,6 @@ namespace OpenSim.Region.Physics.Meshing
202 198
203 foreach (Triangle t in newMesh.triangles) 199 foreach (Triangle t in newMesh.triangles)
204 Add(t); 200 Add(t);
205
206 } 201 }
207 202
208 // Do a linear transformation of mesh. 203 // Do a linear transformation of mesh.
@@ -213,9 +208,9 @@ namespace OpenSim.Region.Physics.Meshing
213 if (v == null) 208 if (v == null)
214 continue; 209 continue;
215 float x, y, z; 210 float x, y, z;
216 x = v.X * matrix[0, 0] + v.Y * matrix[1, 0] + v.Z * matrix[2, 0]; 211 x = v.X*matrix[0, 0] + v.Y*matrix[1, 0] + v.Z*matrix[2, 0];
217 y = v.X * matrix[0, 1] + v.Y * matrix[1, 1] + v.Z * matrix[2, 1]; 212 y = v.X*matrix[0, 1] + v.Y*matrix[1, 1] + v.Z*matrix[2, 1];
218 z = v.X * matrix[0, 2] + v.Y * matrix[1, 2] + v.Z * matrix[2, 2]; 213 z = v.X*matrix[0, 2] + v.Y*matrix[1, 2] + v.Z*matrix[2, 2];
219 v.X = x + offset[0]; 214 v.X = x + offset[0];
220 v.Y = y + offset[1]; 215 v.Y = y + offset[1];
221 v.Z = z + offset[2]; 216 v.Z = z + offset[2];
@@ -237,5 +232,4 @@ namespace OpenSim.Region.Physics.Meshing
237 sw.Close(); 232 sw.Close();
238 } 233 }
239 } 234 }
240 235} \ No newline at end of file
241}
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 9c35f81..3217dd8 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -27,18 +27,13 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.IO;
31using System.Globalization;
32using System.Diagnostics;
33using System.Collections.Generic; 30using System.Collections.Generic;
34using System.Runtime.InteropServices;
35using OpenSim.Framework; 31using OpenSim.Framework;
36using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
37using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.Physics.Manager;
38 34
39namespace OpenSim.Region.Physics.Meshing 35namespace OpenSim.Region.Physics.Meshing
40{ 36{
41
42 public class MeshmerizerPlugin : IMeshingPlugin 37 public class MeshmerizerPlugin : IMeshingPlugin
43 { 38 {
44 public MeshmerizerPlugin() 39 public MeshmerizerPlugin()
@@ -61,10 +56,11 @@ namespace OpenSim.Region.Physics.Meshing
61 // Setting baseDir to a path will enable the dumping of raw files 56 // Setting baseDir to a path will enable the dumping of raw files
62 // raw files can be imported by blender so a visual inspection of the results can be done 57 // raw files can be imported by blender so a visual inspection of the results can be done
63 // const string baseDir = "rawFiles"; 58 // const string baseDir = "rawFiles";
64 const string baseDir = null; 59 private const string baseDir = null;
65 60
66 static void IntersectionParameterPD(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2, PhysicsVector r2, ref float lambda, ref float mu) 61 private static void IntersectionParameterPD(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2,
67 { 62 PhysicsVector r2, ref float lambda, ref float mu)
63 {
68 // p1, p2, points on the straight 64 // p1, p2, points on the straight
69 // r1, r2, directional vectors of the straight. Not necessarily of length 1! 65 // r1, r2, directional vectors of the straight. Not necessarily of length 1!
70 // note, that l, m can be scaled such, that the range 0..1 is mapped to the area between two points, 66 // note, that l, m can be scaled such, that the range 0..1 is mapped to the area between two points,
@@ -88,9 +84,8 @@ namespace OpenSim.Region.Physics.Meshing
88 float p1y = p1.Y; 84 float p1y = p1.Y;
89 float p2x = p2.X; 85 float p2x = p2.X;
90 float p2y = p2.Y; 86 float p2y = p2.Y;
91 lambda = (-p2x * r2y + p1x * r2y + (p2y - p1y) * r2x) / denom; 87 lambda = (-p2x*r2y + p1x*r2y + (p2y - p1y)*r2x)/denom;
92 mu = (-p2x * r1y + p1x * r1y + (p2y - p1y) * r1x) / denom; 88 mu = (-p2x*r1y + p1x*r1y + (p2y - p1y)*r1x)/denom;
93
94 } 89 }
95 90
96 private static List<Triangle> FindInfluencedTriangles(List<Triangle> triangles, Vertex v) 91 private static List<Triangle> FindInfluencedTriangles(List<Triangle> triangles, Vertex v)
@@ -105,8 +100,8 @@ namespace OpenSim.Region.Physics.Meshing
105 } 100 }
106 return influenced; 101 return influenced;
107 } 102 }
108 103
109 104
110 private static void InsertVertices(List<Vertex> vertices, int usedForSeed, List<Triangle> triangles) 105 private static void InsertVertices(List<Vertex> vertices, int usedForSeed, List<Triangle> triangles)
111 { 106 {
112 // This is a variant of the delaunay algorithm 107 // This is a variant of the delaunay algorithm
@@ -126,10 +121,10 @@ namespace OpenSim.Region.Physics.Meshing
126 // do not fulfill this condition with respect to the new triangle 121 // do not fulfill this condition with respect to the new triangle
127 122
128 // Find the triangles that are influenced by the new vertex 123 // Find the triangles that are influenced by the new vertex
129 Vertex v=vertices[iCurrentVertex]; 124 Vertex v = vertices[iCurrentVertex];
130 if (v == null) 125 if (v == null)
131 continue; // Null is polygon stop marker. Ignore it 126 continue; // Null is polygon stop marker. Ignore it
132 List<Triangle> influencedTriangles=FindInfluencedTriangles(triangles, v); 127 List<Triangle> influencedTriangles = FindInfluencedTriangles(triangles, v);
133 128
134 List<Simplex> simplices = new List<Simplex>(); 129 List<Simplex> simplices = new List<Simplex>();
135 130
@@ -177,12 +172,11 @@ namespace OpenSim.Region.Physics.Meshing
177 } 172 }
178 } 173 }
179 } 174 }
180
181 } 175 }
182 176
183 177
184 static Mesh CreateBoxMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size) 178 private static Mesh CreateBoxMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size)
185 // Builds the z (+ and -) surfaces of a box shaped prim 179 // Builds the z (+ and -) surfaces of a box shaped prim
186 { 180 {
187 UInt16 hollowFactor = primShape.ProfileHollow; 181 UInt16 hollowFactor = primShape.ProfileHollow;
188 UInt16 profileBegin = primShape.ProfileBegin; 182 UInt16 profileBegin = primShape.ProfileBegin;
@@ -201,7 +195,7 @@ namespace OpenSim.Region.Physics.Meshing
201 Vertex MP = new Vertex(-0.5f, +0.5f, 0.0f); 195 Vertex MP = new Vertex(-0.5f, +0.5f, 0.0f);
202 Vertex PP = new Vertex(+0.5f, +0.5f, 0.0f); 196 Vertex PP = new Vertex(+0.5f, +0.5f, 0.0f);
203 197
204 Meshing.SimpleHull outerHull = new SimpleHull(); 198 SimpleHull outerHull = new SimpleHull();
205 outerHull.AddVertex(MM); 199 outerHull.AddVertex(MM);
206 outerHull.AddVertex(PM); 200 outerHull.AddVertex(PM);
207 outerHull.AddVertex(PP); 201 outerHull.AddVertex(PP);
@@ -210,9 +204,10 @@ namespace OpenSim.Region.Physics.Meshing
210 // Deal with cuts now 204 // Deal with cuts now
211 if ((profileBegin != 0) || (profileEnd != 0)) 205 if ((profileBegin != 0) || (profileEnd != 0))
212 { 206 {
213 double fProfileBeginAngle = profileBegin / 50000.0 * 360.0; // In degree, for easier debugging and understanding 207 double fProfileBeginAngle = profileBegin/50000.0*360.0;
214 fProfileBeginAngle -= (90.0 + 45.0); // for some reasons, the SL client counts from the corner -X/-Y 208 // In degree, for easier debugging and understanding
215 double fProfileEndAngle = 360.0 - profileEnd / 50000.0 * 360.0; // Pathend comes as complement to 1.0 209 fProfileBeginAngle -= (90.0 + 45.0); // for some reasons, the SL client counts from the corner -X/-Y
210 double fProfileEndAngle = 360.0 - profileEnd/50000.0*360.0; // Pathend comes as complement to 1.0
216 fProfileEndAngle -= (90.0 + 45.0); 211 fProfileEndAngle -= (90.0 + 45.0);
217 if (fProfileBeginAngle < fProfileEndAngle) 212 if (fProfileBeginAngle < fProfileEndAngle)
218 fProfileEndAngle -= 360.0; 213 fProfileEndAngle -= 360.0;
@@ -222,20 +217,23 @@ namespace OpenSim.Region.Physics.Meshing
222 // and we approximate this arc by a polygon chain 217 // and we approximate this arc by a polygon chain
223 // Also note, that these vectors are of length 1.0 and thus their endpoints lay outside the model space 218 // Also note, that these vectors are of length 1.0 and thus their endpoints lay outside the model space
224 // So it can easily be subtracted from the outer hull 219 // So it can easily be subtracted from the outer hull
225 int iSteps = (int)(((fProfileBeginAngle - fProfileEndAngle) / 45.0) + .5); // how many steps do we need with approximately 45 degree 220 int iSteps = (int) (((fProfileBeginAngle - fProfileEndAngle)/45.0) + .5);
226 double dStepWidth=(fProfileBeginAngle-fProfileEndAngle)/iSteps; 221 // how many steps do we need with approximately 45 degree
222 double dStepWidth = (fProfileBeginAngle - fProfileEndAngle)/iSteps;
227 223
228 Vertex origin = new Vertex(0.0f, 0.0f, 0.0f); 224 Vertex origin = new Vertex(0.0f, 0.0f, 0.0f);
229 225
230 // Note the sequence of vertices here. It's important to have the other rotational sense than in outerHull 226 // Note the sequence of vertices here. It's important to have the other rotational sense than in outerHull
231 SimpleHull cutHull = new SimpleHull(); 227 SimpleHull cutHull = new SimpleHull();
232 cutHull.AddVertex(origin); 228 cutHull.AddVertex(origin);
233 for (int i=0; i<iSteps; i++) { 229 for (int i = 0; i < iSteps; i++)
234 double angle=fProfileBeginAngle-i*dStepWidth; // we count against the angle orientation!!!! 230 {
235 Vertex v = Vertex.FromAngle(angle * Math.PI / 180.0); 231 double angle = fProfileBeginAngle - i*dStepWidth; // we count against the angle orientation!!!!
232 Vertex v = Vertex.FromAngle(angle*Math.PI/180.0);
236 cutHull.AddVertex(v); 233 cutHull.AddVertex(v);
237 } 234 }
238 Vertex legEnd = Vertex.FromAngle(fProfileEndAngle * Math.PI / 180.0); // Calculated separately to avoid errors 235 Vertex legEnd = Vertex.FromAngle(fProfileEndAngle*Math.PI/180.0);
236 // Calculated separately to avoid errors
239 cutHull.AddVertex(legEnd); 237 cutHull.AddVertex(legEnd);
240 238
241 MainLog.Instance.Debug("Starting cutting of the hollow shape from the prim {1}", 0, primName); 239 MainLog.Instance.Debug("Starting cutting of the hollow shape from the prim {1}", 0, primName);
@@ -248,10 +246,10 @@ namespace OpenSim.Region.Physics.Meshing
248 if (hollowFactor > 0) 246 if (hollowFactor > 0)
249 { 247 {
250 float hollowFactorF = (float) hollowFactor/(float) 50000; 248 float hollowFactorF = (float) hollowFactor/(float) 50000;
251 Vertex IMM = new Vertex(-0.5f * hollowFactorF, -0.5f * hollowFactorF, 0.0f); 249 Vertex IMM = new Vertex(-0.5f*hollowFactorF, -0.5f*hollowFactorF, 0.0f);
252 Vertex IPM = new Vertex(+0.5f * hollowFactorF, -0.5f * hollowFactorF, 0.0f); 250 Vertex IPM = new Vertex(+0.5f*hollowFactorF, -0.5f*hollowFactorF, 0.0f);
253 Vertex IMP = new Vertex(-0.5f * hollowFactorF, +0.5f * hollowFactorF, 0.0f); 251 Vertex IMP = new Vertex(-0.5f*hollowFactorF, +0.5f*hollowFactorF, 0.0f);
254 Vertex IPP = new Vertex(+0.5f * hollowFactorF, +0.5f * hollowFactorF, 0.0f); 252 Vertex IPP = new Vertex(+0.5f*hollowFactorF, +0.5f*hollowFactorF, 0.0f);
255 253
256 SimpleHull holeHull = new SimpleHull(); 254 SimpleHull holeHull = new SimpleHull();
257 255
@@ -263,7 +261,6 @@ namespace OpenSim.Region.Physics.Meshing
263 SimpleHull hollowedHull = SimpleHull.SubtractHull(outerHull, holeHull); 261 SimpleHull hollowedHull = SimpleHull.SubtractHull(outerHull, holeHull);
264 262
265 outerHull = hollowedHull; 263 outerHull = hollowedHull;
266
267 } 264 }
268 265
269 Mesh m = new Mesh(); 266 Mesh m = new Mesh();
@@ -286,7 +283,7 @@ namespace OpenSim.Region.Physics.Meshing
286 m.Remove(Seed2); 283 m.Remove(Seed2);
287 m.Remove(Seed3); 284 m.Remove(Seed3);
288 m.DumpRaw(baseDir, primName, "Proto seeds removed"); 285 m.DumpRaw(baseDir, primName, "Proto seeds removed");
289 286
290 m.RemoveTrianglesOutside(outerHull); 287 m.RemoveTrianglesOutside(outerHull);
291 m.DumpRaw(baseDir, primName, "Proto outsides removed"); 288 m.DumpRaw(baseDir, primName, "Proto outsides removed");
292 289
@@ -374,7 +371,7 @@ namespace OpenSim.Region.Physics.Meshing
374 switch (primShape.ProfileShape) 371 switch (primShape.ProfileShape)
375 { 372 {
376 case ProfileShape.Square: 373 case ProfileShape.Square:
377 mesh=CreateBoxMesh(primName, primShape, size); 374 mesh = CreateBoxMesh(primName, primShape, size);
378 CalcNormals(mesh); 375 CalcNormals(mesh);
379 break; 376 break;
380 default: 377 default:
@@ -389,5 +386,4 @@ namespace OpenSim.Region.Physics.Meshing
389 return mesh; 386 return mesh;
390 } 387 }
391 } 388 }
392 389} \ No newline at end of file
393}
diff --git a/OpenSim/Region/Physics/Meshing/SimpleHull.cs b/OpenSim/Region/Physics/Meshing/SimpleHull.cs
index a769053..809f3d5 100644
--- a/OpenSim/Region/Physics/Meshing/SimpleHull.cs
+++ b/OpenSim/Region/Physics/Meshing/SimpleHull.cs
@@ -28,9 +28,8 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32
33using OpenSim.Framework.Console; 31using OpenSim.Framework.Console;
32using OpenSim.Region.Physics.Manager;
34 33
35namespace OpenSim.Region.Physics.Meshing 34namespace OpenSim.Region.Physics.Meshing
36{ 35{
@@ -43,17 +42,18 @@ namespace OpenSim.Region.Physics.Meshing
43 // is defined by the hull lies inside or outside the simplex chain 42 // is defined by the hull lies inside or outside the simplex chain
44 public class SimpleHull 43 public class SimpleHull
45 { 44 {
46 List<Vertex> vertices = new List<Vertex>(); 45 private List<Vertex> vertices = new List<Vertex>();
47 List<Vertex> holeVertices = new List<Vertex>(); // Only used, when the hull is hollow 46 private List<Vertex> holeVertices = new List<Vertex>(); // Only used, when the hull is hollow
48 47
49 // Adds a vertex to the end of the list 48 // Adds a vertex to the end of the list
50 public void AddVertex(Vertex v) { 49 public void AddVertex(Vertex v)
50 {
51 vertices.Add(v); 51 vertices.Add(v);
52 } 52 }
53 53
54 override public String ToString() 54 public override String ToString()
55 { 55 {
56 String result=""; 56 String result = "";
57 foreach (Vertex v in vertices) 57 foreach (Vertex v in vertices)
58 { 58 {
59 result += "b:" + v.ToString() + "\n"; 59 result += "b:" + v.ToString() + "\n";
@@ -63,7 +63,8 @@ namespace OpenSim.Region.Physics.Meshing
63 } 63 }
64 64
65 65
66 public List<Vertex> getVertices() { 66 public List<Vertex> getVertices()
67 {
67 List<Vertex> newVertices = new List<Vertex>(); 68 List<Vertex> newVertices = new List<Vertex>();
68 69
69 newVertices.AddRange(vertices); 70 newVertices.AddRange(vertices);
@@ -81,27 +82,27 @@ namespace OpenSim.Region.Physics.Meshing
81 result.AddVertex(v.Clone()); 82 result.AddVertex(v.Clone());
82 } 83 }
83 84
84 foreach (Vertex v in this.holeVertices) 85 foreach (Vertex v in holeVertices)
85 { 86 {
86 result.holeVertices.Add(v.Clone()); 87 result.holeVertices.Add(v.Clone());
87 } 88 }
88 89
89 return result; 90 return result;
90 } 91 }
91 92
92 public bool IsPointIn(Vertex v1) 93 public bool IsPointIn(Vertex v1)
93 { 94 {
94 int iCounter=0; 95 int iCounter = 0;
95 List<Simplex> simplices=buildSimplexList(); 96 List<Simplex> simplices = buildSimplexList();
96 foreach (Simplex s in simplices) 97 foreach (Simplex s in simplices)
97 { 98 {
98 // Send a ray along the positive X-Direction 99 // Send a ray along the positive X-Direction
99 // Note, that this direction must correlate with the "below" interpretation 100 // Note, that this direction must correlate with the "below" interpretation
100 // of handling for the special cases below 101 // of handling for the special cases below
101 Manager.PhysicsVector intersection = s.RayIntersect(v1, new Manager.PhysicsVector(1.0f, 0.0f, 0.0f), true); 102 PhysicsVector intersection = s.RayIntersect(v1, new PhysicsVector(1.0f, 0.0f, 0.0f), true);
102 103
103 if (intersection == null) 104 if (intersection == null)
104 continue; // No intersection. Done. More tests to follow otherwise 105 continue; // No intersection. Done. More tests to follow otherwise
105 106
106 // Did we hit the end of a simplex? 107 // Did we hit the end of a simplex?
107 // Then this can be one of two special cases: 108 // Then this can be one of two special cases:
@@ -111,19 +112,21 @@ namespace OpenSim.Region.Physics.Meshing
111 // Solution: If the other vertex is "below" the ray, we don't count it 112 // Solution: If the other vertex is "below" the ray, we don't count it
112 // Thus corners pointing down are counted twice, corners pointing up are not counted 113 // Thus corners pointing down are counted twice, corners pointing up are not counted
113 // borders are counted once 114 // borders are counted once
114 if (intersection.IsIdentical(s.v1, 0.001f)) { 115 if (intersection.IsIdentical(s.v1, 0.001f))
116 {
115 if (s.v2.Y < v1.Y) 117 if (s.v2.Y < v1.Y)
116 continue; 118 continue;
117 } 119 }
118 // Do this for the other vertex two 120 // Do this for the other vertex two
119 if (intersection.IsIdentical(s.v2, 0.001f)) { 121 if (intersection.IsIdentical(s.v2, 0.001f))
120 if (s.v1.Y<v1.Y) 122 {
123 if (s.v1.Y < v1.Y)
121 continue; 124 continue;
122 } 125 }
123 iCounter++; 126 iCounter++;
124 } 127 }
125 128
126 return iCounter % 2 == 1; // Point is inside if the number of intersections is odd 129 return iCounter%2 == 1; // Point is inside if the number of intersections is odd
127 } 130 }
128 131
129 public bool containsPointsFrom(SimpleHull otherHull) 132 public bool containsPointsFrom(SimpleHull otherHull)
@@ -138,19 +141,20 @@ namespace OpenSim.Region.Physics.Meshing
138 } 141 }
139 142
140 143
141 List<Simplex> buildSimplexList() { 144 private List<Simplex> buildSimplexList()
142 145 {
143 List<Simplex> result = new List<Simplex>(); 146 List<Simplex> result = new List<Simplex>();
144 147
145 // Not asserted but assumed: at least three vertices 148 // Not asserted but assumed: at least three vertices
146 for (int i=0; i<vertices.Count-1; i++) { 149 for (int i = 0; i < vertices.Count - 1; i++)
147 Simplex s=new Simplex(vertices[i], vertices[i+1]); 150 {
151 Simplex s = new Simplex(vertices[i], vertices[i + 1]);
148 result.Add(s); 152 result.Add(s);
149 } 153 }
150 Simplex s1=new Simplex(vertices[vertices.Count-1], vertices[0]); 154 Simplex s1 = new Simplex(vertices[vertices.Count - 1], vertices[0]);
151 result.Add(s1); 155 result.Add(s1);
152 156
153 if (holeVertices.Count==0) 157 if (holeVertices.Count == 0)
154 return result; 158 return result;
155 159
156 // Same here. At least three vertices in hole assumed 160 // Same here. At least three vertices in hole assumed
@@ -159,19 +163,19 @@ namespace OpenSim.Region.Physics.Meshing
159 Simplex s = new Simplex(holeVertices[i], holeVertices[i + 1]); 163 Simplex s = new Simplex(holeVertices[i], holeVertices[i + 1]);
160 result.Add(s); 164 result.Add(s);
161 } 165 }
162 166
163 s1 = new Simplex(holeVertices[holeVertices.Count - 1], holeVertices[0]); 167 s1 = new Simplex(holeVertices[holeVertices.Count - 1], holeVertices[0]);
164 result.Add(s1); 168 result.Add(s1);
165 return result; 169 return result;
166 } 170 }
167 171
168 bool InsertVertex(Vertex v, int iAfter) 172 private bool InsertVertex(Vertex v, int iAfter)
169 { 173 {
170 vertices.Insert(iAfter + 1, v); 174 vertices.Insert(iAfter + 1, v);
171 return true; 175 return true;
172 } 176 }
173 177
174 Vertex getNextVertex(Vertex currentVertex) 178 private Vertex getNextVertex(Vertex currentVertex)
175 { 179 {
176 int iCurrentIndex; 180 int iCurrentIndex;
177 iCurrentIndex = vertices.IndexOf(currentVertex); 181 iCurrentIndex = vertices.IndexOf(currentVertex);
@@ -185,8 +189,10 @@ namespace OpenSim.Region.Physics.Meshing
185 return vertices[iCurrentIndex]; 189 return vertices[iCurrentIndex];
186 } 190 }
187 191
188 public Vertex FindVertex(Vertex vBase, float tolerance) { 192 public Vertex FindVertex(Vertex vBase, float tolerance)
189 foreach (Vertex v in vertices) { 193 {
194 foreach (Vertex v in vertices)
195 {
190 if (v.IsIdentical(vBase, tolerance)) 196 if (v.IsIdentical(vBase, tolerance))
191 return v; 197 return v;
192 } 198 }
@@ -196,32 +202,31 @@ namespace OpenSim.Region.Physics.Meshing
196 202
197 public void FindIntersection(Simplex s, ref Vertex Intersection, ref Vertex nextVertex) 203 public void FindIntersection(Simplex s, ref Vertex Intersection, ref Vertex nextVertex)
198 { 204 {
199 Vertex bestIntersection=null; 205 Vertex bestIntersection = null;
200 float distToV1=Single.PositiveInfinity; 206 float distToV1 = Single.PositiveInfinity;
201 Simplex bestIntersectingSimplex=null; 207 Simplex bestIntersectingSimplex = null;
202 208
203 List<Simplex> simple = buildSimplexList(); 209 List<Simplex> simple = buildSimplexList();
204 foreach (Simplex sTest in simple) 210 foreach (Simplex sTest in simple)
205 { 211 {
206 Manager.PhysicsVector vvTemp = Simplex.Intersect(sTest, s, -.001f, -.001f, 0.999f, .999f); 212 PhysicsVector vvTemp = Simplex.Intersect(sTest, s, -.001f, -.001f, 0.999f, .999f);
207 213
208 Vertex vTemp=null; 214 Vertex vTemp = null;
209 if (vvTemp != null) 215 if (vvTemp != null)
210 vTemp = new Vertex(vvTemp); 216 vTemp = new Vertex(vvTemp);
211 217
212 if (vTemp!=null) { 218 if (vTemp != null)
213 219 {
214 Manager.PhysicsVector diff=(s.v1-vTemp); 220 PhysicsVector diff = (s.v1 - vTemp);
215 float distTemp=diff.length(); 221 float distTemp = diff.length();
216 222
217 if (bestIntersection==null || distTemp<distToV1) { 223 if (bestIntersection == null || distTemp < distToV1)
218 bestIntersection=vTemp; 224 {
219 distToV1=distTemp; 225 bestIntersection = vTemp;
226 distToV1 = distTemp;
220 bestIntersectingSimplex = sTest; 227 bestIntersectingSimplex = sTest;
221 } 228 }
222
223 } // end if vTemp 229 } // end if vTemp
224
225 } // end foreach 230 } // end foreach
226 231
227 Intersection = bestIntersection; 232 Intersection = bestIntersection;
@@ -234,7 +239,6 @@ namespace OpenSim.Region.Physics.Meshing
234 239
235 public static SimpleHull SubtractHull(SimpleHull baseHull, SimpleHull otherHull) 240 public static SimpleHull SubtractHull(SimpleHull baseHull, SimpleHull otherHull)
236 { 241 {
237
238 SimpleHull baseHullClone = baseHull.Clone(); 242 SimpleHull baseHullClone = baseHull.Clone();
239 SimpleHull otherHullClone = otherHull.Clone(); 243 SimpleHull otherHullClone = otherHull.Clone();
240 bool intersects = false; 244 bool intersects = false;
@@ -249,15 +253,16 @@ namespace OpenSim.Region.Physics.Meshing
249 // Insert into baseHull 253 // Insert into baseHull
250 for (iBase = 0; iBase < baseHullClone.vertices.Count; iBase++) 254 for (iBase = 0; iBase < baseHullClone.vertices.Count; iBase++)
251 { 255 {
252 int iBaseNext = (iBase + 1) % baseHullClone.vertices.Count; 256 int iBaseNext = (iBase + 1)%baseHullClone.vertices.Count;
253 Simplex sBase = new Simplex(baseHullClone.vertices[iBase], baseHullClone.vertices[iBaseNext]); 257 Simplex sBase = new Simplex(baseHullClone.vertices[iBase], baseHullClone.vertices[iBaseNext]);
254 258
255 for (iOther = 0; iOther < otherHullClone.vertices.Count; iOther++) 259 for (iOther = 0; iOther < otherHullClone.vertices.Count; iOther++)
256 { 260 {
257 int iOtherNext = (iOther + 1) % otherHullClone.vertices.Count; 261 int iOtherNext = (iOther + 1)%otherHullClone.vertices.Count;
258 Simplex sOther = new Simplex(otherHullClone.vertices[iOther], otherHullClone.vertices[iOtherNext]); 262 Simplex sOther =
263 new Simplex(otherHullClone.vertices[iOther], otherHullClone.vertices[iOtherNext]);
259 264
260 Manager.PhysicsVector intersect = Simplex.Intersect(sBase, sOther, 0.001f, -.001f, 0.999f, 1.001f); 265 PhysicsVector intersect = Simplex.Intersect(sBase, sOther, 0.001f, -.001f, 0.999f, 1.001f);
261 if (intersect != null) 266 if (intersect != null)
262 { 267 {
263 Vertex vIntersect = new Vertex(intersect); 268 Vertex vIntersect = new Vertex(intersect);
@@ -278,15 +283,15 @@ namespace OpenSim.Region.Physics.Meshing
278 // Insert into otherHull 283 // Insert into otherHull
279 for (iOther = 0; iOther < otherHullClone.vertices.Count; iOther++) 284 for (iOther = 0; iOther < otherHullClone.vertices.Count; iOther++)
280 { 285 {
281 int iOtherNext = (iOther + 1) % otherHullClone.vertices.Count; 286 int iOtherNext = (iOther + 1)%otherHullClone.vertices.Count;
282 Simplex sOther = new Simplex(otherHullClone.vertices[iOther], otherHullClone.vertices[iOtherNext]); 287 Simplex sOther = new Simplex(otherHullClone.vertices[iOther], otherHullClone.vertices[iOtherNext]);
283 288
284 for (iBase = 0; iBase < baseHullClone.vertices.Count; iBase++) 289 for (iBase = 0; iBase < baseHullClone.vertices.Count; iBase++)
285 { 290 {
286 int iBaseNext = (iBase + 1) % baseHullClone.vertices.Count; 291 int iBaseNext = (iBase + 1)%baseHullClone.vertices.Count;
287 Simplex sBase = new Simplex(baseHullClone.vertices[iBase], baseHullClone.vertices[iBaseNext]); 292 Simplex sBase = new Simplex(baseHullClone.vertices[iBase], baseHullClone.vertices[iBaseNext]);
288 293
289 Manager.PhysicsVector intersect = Simplex.Intersect(sBase, sOther, -.001f, 0.001f, 1.001f, 0.999f); 294 PhysicsVector intersect = Simplex.Intersect(sBase, sOther, -.001f, 0.001f, 1.001f, 0.999f);
290 if (intersect != null) 295 if (intersect != null)
291 { 296 {
292 Vertex vIntersect = new Vertex(intersect); 297 Vertex vIntersect = new Vertex(intersect);
@@ -321,8 +326,8 @@ namespace OpenSim.Region.Physics.Meshing
321 int iBase; 326 int iBase;
322 for (iBase = 0; iBase < baseHullClone.vertices.Count; iBase++) 327 for (iBase = 0; iBase < baseHullClone.vertices.Count; iBase++)
323 { 328 {
324 int iBaseNext = (iBase + 1) % baseHullClone.vertices.Count; 329 int iBaseNext = (iBase + 1)%baseHullClone.vertices.Count;
325 Vertex center = new Vertex((baseHullClone.vertices[iBase] + baseHullClone.vertices[iBaseNext]) / 2.0f); 330 Vertex center = new Vertex((baseHullClone.vertices[iBase] + baseHullClone.vertices[iBaseNext])/2.0f);
326 bool isOutside = !otherHullClone.IsPointIn(center); 331 bool isOutside = !otherHullClone.IsPointIn(center);
327 if (isOutside) 332 if (isOutside)
328 { 333 {
@@ -334,7 +339,7 @@ namespace OpenSim.Region.Physics.Meshing
334 339
335 340
336 if (baseStartVertex == null) // i.e. no simplex fulfilled the "outside" condition. 341 if (baseStartVertex == null) // i.e. no simplex fulfilled the "outside" condition.
337 // In otherwords, subtractHull completely embraces baseHull 342 // In otherwords, subtractHull completely embraces baseHull
338 { 343 {
339 return result; 344 return result;
340 } 345 }
@@ -369,7 +374,7 @@ namespace OpenSim.Region.Physics.Meshing
369 374
370 if (nextVertex != null) // A node that represents an intersection 375 if (nextVertex != null) // A node that represents an intersection
371 { 376 {
372 V1 = nextVertex; // Needed to find the next vertex on the other hull 377 V1 = nextVertex; // Needed to find the next vertex on the other hull
373 onBase = !onBase; 378 onBase = !onBase;
374 } 379 }
375 380
@@ -385,7 +390,6 @@ namespace OpenSim.Region.Physics.Meshing
385 MainLog.Instance.Debug("The resulting Hull is:\n{1}", 0, result.ToString()); 390 MainLog.Instance.Debug("The resulting Hull is:\n{1}", 0, result.ToString());
386 391
387 return result; 392 return result;
388
389 } 393 }
390 } 394 }
391} 395} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/Meshing/Simplex.cs b/OpenSim/Region/Physics/Meshing/Simplex.cs
index 98e693a..8fba2bf 100644
--- a/OpenSim/Region/Physics/Meshing/Simplex.cs
+++ b/OpenSim/Region/Physics/Meshing/Simplex.cs
@@ -27,8 +27,6 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Region.Physics.Manager; 30using OpenSim.Region.Physics.Manager;
33 31
34namespace OpenSim.Region.Physics.Meshing 32namespace OpenSim.Region.Physics.Meshing
@@ -49,7 +47,6 @@ namespace OpenSim.Region.Physics.Meshing
49 47
50 public int CompareTo(Simplex other) 48 public int CompareTo(Simplex other)
51 { 49 {
52
53 Vertex lv1, lv2, ov1, ov2, temp; 50 Vertex lv1, lv2, ov1, ov2, temp;
54 51
55 lv1 = v1; 52 lv1 = v1;
@@ -92,8 +89,9 @@ namespace OpenSim.Region.Physics.Meshing
92 return 0; 89 return 0;
93 } 90 }
94 91
95 private static void intersectParameter(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2, PhysicsVector r2, ref float lambda, ref float mu) 92 private static void intersectParameter(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2, PhysicsVector r2,
96 { 93 ref float lambda, ref float mu)
94 {
97 // Intersects two straights 95 // Intersects two straights
98 // p1, p2, points on the straight 96 // p1, p2, points on the straight
99 // r1, r2, directional vectors of the straight. Not necessarily of length 1! 97 // r1, r2, directional vectors of the straight. Not necessarily of length 1!
@@ -112,27 +110,28 @@ namespace OpenSim.Region.Physics.Meshing
112 float p2x = p2.X; 110 float p2x = p2.X;
113 float p2y = p2.Y; 111 float p2y = p2.Y;
114 112
115 float z1=-p2x * r2y + p1x * r2y + (p2y - p1y) * r2x; 113 float z1 = -p2x*r2y + p1x*r2y + (p2y - p1y)*r2x;
116 float z2=-p2x * r1y + p1x * r1y + (p2y - p1y) * r1x; 114 float z2 = -p2x*r1y + p1x*r1y + (p2y - p1y)*r1x;
117 115
118 if (denom == 0.0f) // Means the straights are parallel. Either no intersection or an infinite number of them 116 if (denom == 0.0f) // Means the straights are parallel. Either no intersection or an infinite number of them
119 { 117 {
120 if (z1==0.0f) {// Means they are identical -> many, many intersections 118 if (z1 == 0.0f)
119 {
120// Means they are identical -> many, many intersections
121 lambda = Single.NaN; 121 lambda = Single.NaN;
122 mu = Single.NaN; 122 mu = Single.NaN;
123 } else { 123 }
124 else
125 {
124 lambda = Single.PositiveInfinity; 126 lambda = Single.PositiveInfinity;
125 mu = Single.PositiveInfinity; 127 mu = Single.PositiveInfinity;
126 } 128 }
127 return; 129 return;
128
129 } 130 }
130 131
131 132
132 133 lambda = z1/denom;
133 lambda = z1 / denom; 134 mu = z2/denom;
134 mu = z2 / denom;
135
136 } 135 }
137 136
138 137
@@ -145,12 +144,12 @@ namespace OpenSim.Region.Physics.Meshing
145 // upperBorder2 : 1.0 144 // upperBorder2 : 1.0
146 // Set these to values near the given parameters (e.g. 0.001 instead of 1 to exclude simplex starts safely, or to -0.001 to include them safely) 145 // Set these to values near the given parameters (e.g. 0.001 instead of 1 to exclude simplex starts safely, or to -0.001 to include them safely)
147 public static PhysicsVector Intersect( 146 public static PhysicsVector Intersect(
148 Simplex s1, 147 Simplex s1,
149 Simplex s2, 148 Simplex s2,
150 float lowerBorder1, 149 float lowerBorder1,
151 float lowerBorder2, 150 float lowerBorder2,
152 float upperBorder1, 151 float upperBorder1,
153 float upperBorder2) 152 float upperBorder2)
154 { 153 {
155 PhysicsVector firstSimplexDirection = s1.v2 - s1.v1; 154 PhysicsVector firstSimplexDirection = s1.v2 - s1.v1;
156 PhysicsVector secondSimplexDirection = s2.v2 - s2.v1; 155 PhysicsVector secondSimplexDirection = s2.v2 - s2.v1;
@@ -181,8 +180,7 @@ namespace OpenSim.Region.Physics.Meshing
181 if (mu > upperBorder2) // outside simplex 2 180 if (mu > upperBorder2) // outside simplex 2
182 return null; 181 return null;
183 182
184 return s1.v1 + lambda * firstSimplexDirection; 183 return s1.v1 + lambda*firstSimplexDirection;
185
186 } 184 }
187 185
188 // Intersects the simplex with a ray. The ray is defined as all p=origin + lambda*direction 186 // Intersects the simplex with a ray. The ray is defined as all p=origin + lambda*direction
@@ -212,15 +210,12 @@ namespace OpenSim.Region.Physics.Meshing
212 return null; 210 return null;
213 211
214 if (lambda == 1.0 && !bEndsIncluded) 212 if (lambda == 1.0 && !bEndsIncluded)
215 return null; // The end of the simplices are not included 213 return null; // The end of the simplices are not included
216 214
217 if (lambda < 0.0f) // we're before v1; 215 if (lambda < 0.0f) // we're before v1;
218 return null; 216 return null;
219 217
220 return this.v1 + lambda * simplexDirection; 218 return v1 + lambda*simplexDirection;
221
222 } 219 }
223
224
225 } 220 }
226} \ No newline at end of file 221} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
index 1e5713b..1ea5458 100644
--- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("1.0.*")] 58[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 9676db4..a118e7c 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -27,11 +27,9 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using Axiom.Math; 30using Axiom.Math;
32using Ode.NET; 31using Ode.NET;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Framework.Console;
35using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.Physics.Manager;
36 34
37namespace OpenSim.Region.Physics.OdePlugin 35namespace OpenSim.Region.Physics.OdePlugin
@@ -87,7 +85,9 @@ namespace OpenSim.Region.Physics.OdePlugin
87 _acceleration = new PhysicsVector(); 85 _acceleration = new PhysicsVector();
88 _parent_scene = parent_scene; 86 _parent_scene = parent_scene;
89 87
90 m_StandUpRotation = new d.Matrix3(0.8184158f, -0.5744568f, -0.0139677f, 0.5744615f, 0.8185215f, -0.004074608f, 0.01377355f, -0.004689182f, 0.9998941f); 88 m_StandUpRotation =
89 new d.Matrix3(0.8184158f, -0.5744568f, -0.0139677f, 0.5744615f, 0.8185215f, -0.004074608f, 0.01377355f,
90 -0.004689182f, 0.9998941f);
91 91
92 for (int i = 0; i < 11; i++) 92 for (int i = 0; i < 11; i++)
93 { 93 {
@@ -105,12 +105,9 @@ namespace OpenSim.Region.Physics.OdePlugin
105 d.GeomSetBody(Shell, Body); 105 d.GeomSetBody(Shell, Body);
106 106
107 107
108
109
110 d.BodySetRotation(Body, ref m_StandUpRotation); 108 d.BodySetRotation(Body, ref m_StandUpRotation);
111 109
112 110
113
114 //Amotor = d.JointCreateAMotor(parent_scene.world, IntPtr.Zero); 111 //Amotor = d.JointCreateAMotor(parent_scene.world, IntPtr.Zero);
115 //d.JointAttach(Amotor, Body, IntPtr.Zero); 112 //d.JointAttach(Amotor, Body, IntPtr.Zero);
116 //d.JointSetAMotorMode(Amotor, dAMotorEuler); 113 //d.JointSetAMotorMode(Amotor, dAMotorEuler);
@@ -124,45 +121,47 @@ namespace OpenSim.Region.Physics.OdePlugin
124 //d.JointSetAMotorParam(Amotor, 0, -0); 121 //d.JointSetAMotorParam(Amotor, 0, -0);
125 //d.JointSetAMotorParam(Amotor, 0x200, -0); 122 //d.JointSetAMotorParam(Amotor, 0x200, -0);
126 //d.JointSetAMotorParam(Amotor, 0x100, -0); 123 //d.JointSetAMotorParam(Amotor, 0x100, -0);
127 // d.JointSetAMotorParam(Amotor, 0, 0); 124 // d.JointSetAMotorParam(Amotor, 0, 0);
128 // d.JointSetAMotorParam(Amotor, 3, 0); 125 // d.JointSetAMotorParam(Amotor, 3, 0);
129 // d.JointSetAMotorParam(Amotor, 2, 0); 126 // d.JointSetAMotorParam(Amotor, 2, 0);
130
131
132
133 } 127 }
134 m_name = avName; 128 m_name = avName;
135 parent_scene.geom_name_map[Shell] = avName; 129 parent_scene.geom_name_map[Shell] = avName;
136 parent_scene.actor_name_map[Shell] = (PhysicsActor)this; 130 parent_scene.actor_name_map[Shell] = (PhysicsActor) this;
137 } 131 }
132
138 public override int PhysicsActorType 133 public override int PhysicsActorType
139 { 134 {
140 get { return (int)ActorTypes.Agent; } 135 get { return (int) ActorTypes.Agent; }
141 set { return; } 136 set { return; }
142 } 137 }
138
143 public override bool SetAlwaysRun 139 public override bool SetAlwaysRun
144 { 140 {
145 get { return m_alwaysRun; } 141 get { return m_alwaysRun; }
146 set { m_alwaysRun = value; } 142 set { m_alwaysRun = value; }
147 } 143 }
144
148 public override bool IsPhysical 145 public override bool IsPhysical
149 { 146 {
150 get { return false; } 147 get { return false; }
151 set { return; } 148 set { return; }
152 } 149 }
150
153 public override bool ThrottleUpdates 151 public override bool ThrottleUpdates
154 { 152 {
155 get { return false; } 153 get { return false; }
156 set { return; } 154 set { return; }
157 } 155 }
156
158 public override bool Flying 157 public override bool Flying
159 { 158 {
160 get { return flying; } 159 get { return flying; }
161 set { flying = value; } 160 set { flying = value; }
162 } 161 }
162
163 public override bool IsColliding 163 public override bool IsColliding
164 { 164 {
165
166 get { return m_iscolliding; } 165 get { return m_iscolliding; }
167 set 166 set
168 { 167 {
@@ -193,24 +192,22 @@ namespace OpenSim.Region.Physics.OdePlugin
193 192
194 // Equal truecounts and false counts means we're colliding with something. 193 // Equal truecounts and false counts means we're colliding with something.
195 194
196 if (falsecount > 1.2 * truecount) 195 if (falsecount > 1.2*truecount)
197 { 196 {
198 m_iscolliding = false; 197 m_iscolliding = false;
199 } 198 }
200 else 199 else
201 { 200 {
202 m_iscolliding = true; 201 m_iscolliding = true;
203
204
205 } 202 }
206 if (m_wascolliding != m_iscolliding) 203 if (m_wascolliding != m_iscolliding)
207 { 204 {
208 //base.SendCollisionUpdate(new CollisionEventUpdate()); 205 //base.SendCollisionUpdate(new CollisionEventUpdate());
209
210 } 206 }
211 m_wascolliding = m_iscolliding; 207 m_wascolliding = m_iscolliding;
212 } 208 }
213 } 209 }
210
214 public override bool CollidingGround 211 public override bool CollidingGround
215 { 212 {
216 get { return m_iscollidingGround; } 213 get { return m_iscollidingGround; }
@@ -243,7 +240,7 @@ namespace OpenSim.Region.Physics.OdePlugin
243 240
244 // Equal truecounts and false counts means we're colliding with something. 241 // Equal truecounts and false counts means we're colliding with something.
245 242
246 if (falsecount > 1.2 * truecount) 243 if (falsecount > 1.2*truecount)
247 { 244 {
248 m_iscollidingGround = false; 245 m_iscollidingGround = false;
249 } 246 }
@@ -258,10 +255,12 @@ namespace OpenSim.Region.Physics.OdePlugin
258 m_wascollidingGround = m_iscollidingGround; 255 m_wascollidingGround = m_iscollidingGround;
259 } 256 }
260 } 257 }
258
261 public override bool CollidingObj 259 public override bool CollidingObj
262 { 260 {
263 get { return m_iscollidingObj; } 261 get { return m_iscollidingObj; }
264 set { 262 set
263 {
265 m_iscollidingObj = value; 264 m_iscollidingObj = value;
266 if (value) 265 if (value)
267 m_pidControllerActive = false; 266 m_pidControllerActive = false;
@@ -269,10 +268,12 @@ namespace OpenSim.Region.Physics.OdePlugin
269 m_pidControllerActive = true; 268 m_pidControllerActive = true;
270 } 269 }
271 } 270 }
271
272 public void SetPidStatus(bool status) 272 public void SetPidStatus(bool status)
273 { 273 {
274 m_pidControllerActive = status; 274 m_pidControllerActive = status;
275 } 275 }
276
276 public override PhysicsVector Position 277 public override PhysicsVector Position
277 { 278 {
278 get { return _position; } 279 get { return _position; }
@@ -285,14 +286,16 @@ namespace OpenSim.Region.Physics.OdePlugin
285 } 286 }
286 } 287 }
287 } 288 }
289
288 public override PhysicsVector RotationalVelocity 290 public override PhysicsVector RotationalVelocity
289 { 291 {
290 get { return m_rotationalVelocity; } 292 get { return m_rotationalVelocity; }
291 set { m_rotationalVelocity = value; } 293 set { m_rotationalVelocity = value; }
292 } 294 }
295
293 public override PhysicsVector Size 296 public override PhysicsVector Size
294 { 297 {
295 get { return new PhysicsVector(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); } 298 get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); }
296 set 299 set
297 { 300 {
298 m_pidControllerActive = true; 301 m_pidControllerActive = true;
@@ -303,7 +306,7 @@ namespace OpenSim.Region.Physics.OdePlugin
303 float capsuleradius = CAPSULE_RADIUS; 306 float capsuleradius = CAPSULE_RADIUS;
304 capsuleradius = 0.2f; 307 capsuleradius = 0.2f;
305 308
306 CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z * 0.43f))); // subtract 43% of the size 309 CAPSULE_LENGTH = (SetSize.Z - ((SetSize.Z*0.43f))); // subtract 43% of the size
307 d.BodyDestroy(Body); 310 d.BodyDestroy(Body);
308 d.GeomDestroy(Shell); 311 d.GeomDestroy(Shell);
309 //MainLog.Instance.Verbose("PHYSICS", "Set Avatar Height To: " + (CAPSULE_RADIUS + CAPSULE_LENGTH)); 312 //MainLog.Instance.Verbose("PHYSICS", "Set Avatar Height To: " + (CAPSULE_RADIUS + CAPSULE_LENGTH));
@@ -311,25 +314,27 @@ namespace OpenSim.Region.Physics.OdePlugin
311 d.MassSetCapsule(out ShellMass, m_density, 3, CAPSULE_RADIUS, CAPSULE_LENGTH); 314 d.MassSetCapsule(out ShellMass, m_density, 3, CAPSULE_RADIUS, CAPSULE_LENGTH);
312 Body = d.BodyCreate(_parent_scene.world); 315 Body = d.BodyCreate(_parent_scene.world);
313 d.BodySetMass(Body, ref ShellMass); 316 d.BodySetMass(Body, ref ShellMass);
314 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z + Math.Abs(CAPSULE_LENGTH - prevCapsule)); 317 d.BodySetPosition(Body, _position.X, _position.Y,
318 _position.Z + Math.Abs(CAPSULE_LENGTH - prevCapsule));
315 d.GeomSetBody(Shell, Body); 319 d.GeomSetBody(Shell, Body);
316 } 320 }
317 _parent_scene.geom_name_map[Shell] = m_name; 321 _parent_scene.geom_name_map[Shell] = m_name;
318 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; 322 _parent_scene.actor_name_map[Shell] = (PhysicsActor) this;
319 } 323 }
320 } 324 }
325
321 public override float Mass 326 public override float Mass
322 { 327 {
323 get { 328 get
324 329 {
325 float AVvolume = (float)(Math.PI * Math.Pow(CAPSULE_RADIUS, 2) * CAPSULE_LENGTH); 330 float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH);
326 return m_density * AVvolume; 331 return m_density*AVvolume;
327 } 332 }
328 } 333 }
329 334
330 public override PhysicsVector Force 335 public override PhysicsVector Force
331 { 336 {
332 get { return new PhysicsVector(_target_velocity.X,_target_velocity.Y,_target_velocity.Z); } 337 get { return new PhysicsVector(_target_velocity.X, _target_velocity.Y, _target_velocity.Z); }
333 } 338 }
334 339
335 public override PhysicsVector CenterOfMass 340 public override PhysicsVector CenterOfMass
@@ -344,18 +349,17 @@ namespace OpenSim.Region.Physics.OdePlugin
344 349
345 public override PrimitiveBaseShape Shape 350 public override PrimitiveBaseShape Shape
346 { 351 {
347 set 352 set { return; }
348 {
349 return;
350 }
351 } 353 }
352 354
353 public override PhysicsVector Velocity 355 public override PhysicsVector Velocity
354 { 356 {
355 get { return _velocity; } 357 get { return _velocity; }
356 set { 358 set
359 {
357 m_pidControllerActive = true; 360 m_pidControllerActive = true;
358 _target_velocity = value; } 361 _target_velocity = value;
362 }
359 } 363 }
360 364
361 public override bool Kinematic 365 public override bool Kinematic
@@ -390,6 +394,7 @@ namespace OpenSim.Region.Physics.OdePlugin
390 394
391 //m_lastUpdateSent = false; 395 //m_lastUpdateSent = false;
392 } 396 }
397
393 public void doForce(PhysicsVector force) 398 public void doForce(PhysicsVector force)
394 { 399 {
395 if (!collidelock) 400 if (!collidelock)
@@ -413,13 +418,11 @@ namespace OpenSim.Region.Physics.OdePlugin
413 //d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); 418 //d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f);
414 419
415 //m_lastUpdateSent = false; 420 //m_lastUpdateSent = false;
416
417 } 421 }
418
419 } 422 }
423
420 public override void SetMomentum(PhysicsVector momentum) 424 public override void SetMomentum(PhysicsVector momentum)
421 { 425 {
422
423 } 426 }
424 427
425 public void Move(float timeStep) 428 public void Move(float timeStep)
@@ -442,7 +445,6 @@ namespace OpenSim.Region.Physics.OdePlugin
442 else 445 else
443 { 446 {
444 movementdivisor = 0.8f; 447 movementdivisor = 0.8f;
445
446 } 448 }
447 449
448 // if velocity is zero, use position control; otherwise, velocity control 450 // if velocity is zero, use position control; otherwise, velocity control
@@ -457,11 +459,11 @@ namespace OpenSim.Region.Physics.OdePlugin
457 if (m_pidControllerActive) 459 if (m_pidControllerActive)
458 { 460 {
459 d.Vector3 pos = d.BodyGetPosition(Body); 461 d.Vector3 pos = d.BodyGetPosition(Body);
460 vec.X = (_target_velocity.X - vel.X) * PID_D + (_zeroPosition.X - pos.X) * PID_P; 462 vec.X = (_target_velocity.X - vel.X)*PID_D + (_zeroPosition.X - pos.X)*PID_P;
461 vec.Y = (_target_velocity.Y - vel.Y) * PID_D + (_zeroPosition.Y - pos.Y) * PID_P; 463 vec.Y = (_target_velocity.Y - vel.Y)*PID_D + (_zeroPosition.Y - pos.Y)*PID_P;
462 if (flying) 464 if (flying)
463 { 465 {
464 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D + 5100) + (_zeroPosition.Z - pos.Z) * PID_P; 466 vec.Z = (_target_velocity.Z - vel.Z)*(PID_D + 5100) + (_zeroPosition.Z - pos.Z)*PID_P;
465 } 467 }
466 } 468 }
467 //PidStatus = true; 469 //PidStatus = true;
@@ -472,21 +474,20 @@ namespace OpenSim.Region.Physics.OdePlugin
472 _zeroFlag = false; 474 _zeroFlag = false;
473 if (m_iscolliding || flying) 475 if (m_iscolliding || flying)
474 { 476 {
475 477 vec.X = ((_target_velocity.X/movementdivisor) - vel.X)*PID_D;
476 vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * PID_D; 478 vec.Y = ((_target_velocity.Y/movementdivisor) - vel.Y)*PID_D;
477 vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * PID_D;
478 } 479 }
479 if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) 480 if (m_iscolliding && !flying && _target_velocity.Z > 0.0f)
480 { 481 {
481 d.Vector3 pos = d.BodyGetPosition(Body); 482 d.Vector3 pos = d.BodyGetPosition(Body);
482 vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; 483 vec.Z = (_target_velocity.Z - vel.Z)*PID_D + (_zeroPosition.Z - pos.Z)*PID_P;
483 if (_target_velocity.X > 0) 484 if (_target_velocity.X > 0)
484 { 485 {
485 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D; 486 vec.X = ((_target_velocity.X - vel.X)/1.2f)*PID_D;
486 } 487 }
487 if (_target_velocity.Y > 0) 488 if (_target_velocity.Y > 0)
488 { 489 {
489 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D; 490 vec.Y = ((_target_velocity.Y - vel.Y)/1.2f)*PID_D;
490 } 491 }
491 } 492 }
492 else if (!m_iscolliding && !flying) 493 else if (!m_iscolliding && !flying)
@@ -494,19 +495,18 @@ namespace OpenSim.Region.Physics.OdePlugin
494 d.Vector3 pos = d.BodyGetPosition(Body); 495 d.Vector3 pos = d.BodyGetPosition(Body);
495 if (_target_velocity.X > 0) 496 if (_target_velocity.X > 0)
496 { 497 {
497 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D; 498 vec.X = ((_target_velocity.X - vel.X)/1.2f)*PID_D;
498 } 499 }
499 if (_target_velocity.Y > 0) 500 if (_target_velocity.Y > 0)
500 { 501 {
501 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D; 502 vec.Y = ((_target_velocity.Y - vel.Y)/1.2f)*PID_D;
502 } 503 }
503
504 } 504 }
505 505
506 506
507 if (flying) 507 if (flying)
508 { 508 {
509 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D + 5100); 509 vec.Z = (_target_velocity.Z - vel.Z)*(PID_D + 5100);
510 } 510 }
511 } 511 }
512 if (flying) 512 if (flying)
@@ -546,13 +546,12 @@ namespace OpenSim.Region.Physics.OdePlugin
546 int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); 546 int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position);
547 //if (primScenAvatarIn == "0") 547 //if (primScenAvatarIn == "0")
548 //{ 548 //{
549 //MainLog.Instance.Verbose("Physics", "Avatar " + m_name + " in space with no prim. Arr:':" + arrayitem[0].ToString() + "," + arrayitem[1].ToString()); 549 //MainLog.Instance.Verbose("Physics", "Avatar " + m_name + " in space with no prim. Arr:':" + arrayitem[0].ToString() + "," + arrayitem[1].ToString());
550 //} 550 //}
551 //else 551 //else
552 //{ 552 //{
553 // MainLog.Instance.Verbose("Physics", "Avatar " + m_name + " in Prim space':" + primScenAvatarIn + ". Arr:" + arrayitem[0].ToString() + "," + arrayitem[1].ToString()); 553 // MainLog.Instance.Verbose("Physics", "Avatar " + m_name + " in Prim space':" + primScenAvatarIn + ". Arr:" + arrayitem[0].ToString() + "," + arrayitem[1].ToString());
554 //} 554 //}
555
556 } 555 }
557 } 556 }
558 else 557 else
@@ -586,12 +585,11 @@ namespace OpenSim.Region.Physics.OdePlugin
586 { 585 {
587 lock (OdeScene.OdeLock) 586 lock (OdeScene.OdeLock)
588 { 587 {
589 // d.JointDestroy(Amotor); 588 // d.JointDestroy(Amotor);
590 d.GeomDestroy(Shell); 589 d.GeomDestroy(Shell);
591 _parent_scene.geom_name_map.Remove(Shell); 590 _parent_scene.geom_name_map.Remove(Shell);
592 d.BodyDestroy(Body); 591 d.BodyDestroy(Body);
593 } 592 }
594 } 593 }
595 } 594 }
596 595} \ No newline at end of file
597}
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 35328b8..5fef47d 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -27,16 +27,13 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using Axiom.Math; 30using Axiom.Math;
32using Ode.NET; 31using Ode.NET;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Framework.Console;
35using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.Physics.Manager;
36 34
37namespace OpenSim.Region.Physics.OdePlugin 35namespace OpenSim.Region.Physics.OdePlugin
38{ 36{
39
40 public class OdePrim : PhysicsActor 37 public class OdePrim : PhysicsActor
41 { 38 {
42 public PhysicsVector _position; 39 public PhysicsVector _position;
@@ -57,7 +54,7 @@ namespace OpenSim.Region.Physics.OdePlugin
57 private IMesh _mesh; 54 private IMesh _mesh;
58 private PrimitiveBaseShape _pbs; 55 private PrimitiveBaseShape _pbs;
59 private OdeScene _parent_scene; 56 private OdeScene _parent_scene;
60 public IntPtr m_targetSpace = (IntPtr)0; 57 public IntPtr m_targetSpace = (IntPtr) 0;
61 public IntPtr prim_geom; 58 public IntPtr prim_geom;
62 public IntPtr _triMeshData; 59 public IntPtr _triMeshData;
63 private bool iscolliding = false; 60 private bool iscolliding = false;
@@ -65,18 +62,17 @@ namespace OpenSim.Region.Physics.OdePlugin
65 private bool m_throttleUpdates = false; 62 private bool m_throttleUpdates = false;
66 private int throttleCounter = 0; 63 private int throttleCounter = 0;
67 public bool outofBounds = false; 64 public bool outofBounds = false;
68 private float m_density = 10.000006836f;// Aluminum g/cm3; 65 private float m_density = 10.000006836f; // Aluminum g/cm3;
69 66
70
71 67
72 public bool _zeroFlag = false; 68 public bool _zeroFlag = false;
73 private bool m_lastUpdateSent = false; 69 private bool m_lastUpdateSent = false;
74 70
75 public IntPtr Body = (IntPtr)0; 71 public IntPtr Body = (IntPtr) 0;
76 private String m_primName; 72 private String m_primName;
77 private PhysicsVector _target_velocity; 73 private PhysicsVector _target_velocity;
78 public d.Mass pMass; 74 public d.Mass pMass;
79 75
80 private int debugcounter = 0; 76 private int debugcounter = 0;
81 77
82 public OdePrim(String primName, OdeScene parent_scene, IntPtr targetSpace, PhysicsVector pos, PhysicsVector size, 78 public OdePrim(String primName, OdeScene parent_scene, IntPtr targetSpace, PhysicsVector pos, PhysicsVector size,
@@ -123,7 +119,6 @@ namespace OpenSim.Region.Physics.OdePlugin
123 // linksets *should* be in a space together.. but are not currently 119 // linksets *should* be in a space together.. but are not currently
124 if (m_isphysical) 120 if (m_isphysical)
125 m_targetSpace = _parent_scene.space; 121 m_targetSpace = _parent_scene.space;
126
127 } 122 }
128 m_primName = primName; 123 m_primName = primName;
129 124
@@ -147,25 +142,28 @@ namespace OpenSim.Region.Physics.OdePlugin
147 d.GeomSetQuaternion(prim_geom, ref myrot); 142 d.GeomSetQuaternion(prim_geom, ref myrot);
148 143
149 144
150 if (m_isphysical && Body == (IntPtr)0) 145 if (m_isphysical && Body == (IntPtr) 0)
151 { 146 {
152 enableBody(); 147 enableBody();
153 } 148 }
154 parent_scene.geom_name_map[prim_geom] = primName; 149 parent_scene.geom_name_map[prim_geom] = primName;
155 parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this; 150 parent_scene.actor_name_map[prim_geom] = (PhysicsActor) this;
156 // don't do .add() here; old geoms get recycled with the same hash 151 // don't do .add() here; old geoms get recycled with the same hash
157 } 152 }
158 } 153 }
154
159 public override int PhysicsActorType 155 public override int PhysicsActorType
160 { 156 {
161 get { return (int)ActorTypes.Prim; } 157 get { return (int) ActorTypes.Prim; }
162 set { return; } 158 set { return; }
163 } 159 }
160
164 public override bool SetAlwaysRun 161 public override bool SetAlwaysRun
165 { 162 {
166 get { return false; } 163 get { return false; }
167 set { return; } 164 set { return; }
168 } 165 }
166
169 public void enableBody() 167 public void enableBody()
170 { 168 {
171 // Sets the geom to a body 169 // Sets the geom to a body
@@ -185,13 +183,14 @@ namespace OpenSim.Region.Physics.OdePlugin
185 183
186 _parent_scene.addActivePrim(this); 184 _parent_scene.addActivePrim(this);
187 } 185 }
186
188 private float CalculateMass() 187 private float CalculateMass()
189 { 188 {
190 float volume = 0; 189 float volume = 0;
191 190
192 // No material is passed to the physics engines yet.. soo.. 191 // No material is passed to the physics engines yet.. soo..
193 // we're using the m_density constant in the class definition 192 // we're using the m_density constant in the class definition
194 193
195 194
196 float returnMass = 0; 195 float returnMass = 0;
197 196
@@ -199,17 +198,17 @@ namespace OpenSim.Region.Physics.OdePlugin
199 { 198 {
200 case ProfileShape.Square: 199 case ProfileShape.Square:
201 // Profile Volume 200 // Profile Volume
202 201
203 volume = _size.X * _size.Y * _size.Z; 202 volume = _size.X*_size.Y*_size.Z;
204 203
205 // If the user has 'hollowed out' 204 // If the user has 'hollowed out'
206 // ProfileHollow is one of those 0 to 50000 values :P 205 // ProfileHollow is one of those 0 to 50000 values :P
207 // we like percentages better.. so turning into a percentage 206 // we like percentages better.. so turning into a percentage
208 207
209 if (((float)_pbs.ProfileHollow / 50000f) > 0.0) 208 if (((float) _pbs.ProfileHollow/50000f) > 0.0)
210 { 209 {
211 float hollowAmount = (float)_pbs.ProfileHollow / 50000f; 210 float hollowAmount = (float) _pbs.ProfileHollow/50000f;
212 211
213 // calculate the hollow volume by it's shape compared to the prim shape 212 // calculate the hollow volume by it's shape compared to the prim shape
214 float hollowVolume = 0; 213 float hollowVolume = 0;
215 switch (_pbs.HollowShape) 214 switch (_pbs.HollowShape)
@@ -217,29 +216,29 @@ namespace OpenSim.Region.Physics.OdePlugin
217 case HollowShape.Square: 216 case HollowShape.Square:
218 case HollowShape.Same: 217 case HollowShape.Same:
219 // Cube Hollow volume calculation 218 // Cube Hollow volume calculation
220 float hollowsizex = _size.X * hollowAmount; 219 float hollowsizex = _size.X*hollowAmount;
221 float hollowsizey = _size.Y * hollowAmount; 220 float hollowsizey = _size.Y*hollowAmount;
222 float hollowsizez = _size.Z * hollowAmount; 221 float hollowsizez = _size.Z*hollowAmount;
223 hollowVolume = hollowsizex * hollowsizey * hollowsizez; 222 hollowVolume = hollowsizex*hollowsizey*hollowsizez;
224 break; 223 break;
225 224
226 case HollowShape.Circle: 225 case HollowShape.Circle:
227 // Hollow shape is a perfect cyllinder in respect to the cube's scale 226 // Hollow shape is a perfect cyllinder in respect to the cube's scale
228 // Cyllinder hollow volume calculation 227 // Cyllinder hollow volume calculation
229 float hRadius = _size.X / 2; 228 float hRadius = _size.X/2;
230 float hLength = _size.Z; 229 float hLength = _size.Z;
231 230
232 // pi * r2 * h 231 // pi * r2 * h
233 hollowVolume = ((float)(Math.PI * Math.Pow(hRadius, 2) * hLength) * hollowAmount); 232 hollowVolume = ((float) (Math.PI*Math.Pow(hRadius, 2)*hLength)*hollowAmount);
234 break; 233 break;
235 234
236 case HollowShape.Triangle: 235 case HollowShape.Triangle:
237 // Equilateral Triangular Prism volume hollow calculation 236 // Equilateral Triangular Prism volume hollow calculation
238 // Triangle is an Equilateral Triangular Prism with aLength = to _size.Y 237 // Triangle is an Equilateral Triangular Prism with aLength = to _size.Y
239 238
240 float aLength = _size.Y; 239 float aLength = _size.Y;
241 // 1/2 abh 240 // 1/2 abh
242 hollowVolume = (float)((0.5 * aLength * _size.X * _size.Z) * hollowAmount); 241 hollowVolume = (float) ((0.5*aLength*_size.X*_size.Z)*hollowAmount);
243 break; 242 break;
244 243
245 default: 244 default:
@@ -247,15 +246,14 @@ namespace OpenSim.Region.Physics.OdePlugin
247 break; 246 break;
248 } 247 }
249 volume = volume - hollowVolume; 248 volume = volume - hollowVolume;
250
251 } 249 }
252 250
253 break; 251 break;
254 252
255 default: 253 default:
256 // we don't have all of the volume formulas yet so 254 // we don't have all of the volume formulas yet so
257 // use the common volume formula for all 255 // use the common volume formula for all
258 volume = _size.X * _size.Y * _size.Z; 256 volume = _size.X*_size.Y*_size.Z;
259 break; 257 break;
260 } 258 }
261 259
@@ -273,70 +271,70 @@ namespace OpenSim.Region.Physics.OdePlugin
273 float PathCutStartAmount = _pbs.ProfileBegin; 271 float PathCutStartAmount = _pbs.ProfileBegin;
274 if (((PathCutStartAmount + PathCutEndAmount)/50000f) > 0.0f) 272 if (((PathCutStartAmount + PathCutEndAmount)/50000f) > 0.0f)
275 { 273 {
274 float pathCutAmount = ((PathCutStartAmount + PathCutEndAmount)/50000f);
276 275
277 float pathCutAmount = ((PathCutStartAmount + PathCutEndAmount) / 50000f);
278
279 // Check the return amount for sanity 276 // Check the return amount for sanity
280 if (pathCutAmount >= 0.99f) 277 if (pathCutAmount >= 0.99f)
281 pathCutAmount=0.99f; 278 pathCutAmount = 0.99f;
282 279
283 volume = volume - (volume * pathCutAmount); 280 volume = volume - (volume*pathCutAmount);
284 } 281 }
285 282
286 // Mass = density * volume 283 // Mass = density * volume
287 284
288 returnMass = m_density * volume; 285 returnMass = m_density*volume;
289 286
290 return returnMass; 287 return returnMass;
291 } 288 }
292 289
293 public void setMass() 290 public void setMass()
294 { 291 {
295 if (Body != (IntPtr)0) 292 if (Body != (IntPtr) 0)
296 { 293 {
297 d.MassSetBoxTotal(out pMass, CalculateMass(), _size.X, _size.Y, _size.Z); 294 d.MassSetBoxTotal(out pMass, CalculateMass(), _size.X, _size.Y, _size.Z);
298 d.BodySetMass(Body, ref pMass); 295 d.BodySetMass(Body, ref pMass);
299 } 296 }
300 } 297 }
301 298
302
303 299
304 public void disableBody() 300 public void disableBody()
305 { 301 {
306 //this kills the body so things like 'mesh' can re-create it. 302 //this kills the body so things like 'mesh' can re-create it.
307 if (Body != (IntPtr)0) 303 if (Body != (IntPtr) 0)
308 { 304 {
309 _parent_scene.remActivePrim(this); 305 _parent_scene.remActivePrim(this);
310 d.BodyDestroy(Body); 306 d.BodyDestroy(Body);
311 Body = (IntPtr)0; 307 Body = (IntPtr) 0;
312 } 308 }
313 } 309 }
310
314 public void setMesh(OdeScene parent_scene, IMesh mesh) 311 public void setMesh(OdeScene parent_scene, IMesh mesh)
315 { 312 {
316 //Kill Body so that mesh can re-make the geom 313 //Kill Body so that mesh can re-make the geom
317 if (IsPhysical && Body != (IntPtr)0) 314 if (IsPhysical && Body != (IntPtr) 0)
318 { 315 {
319 disableBody(); 316 disableBody();
320 } 317 }
321 float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory 318 float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory
322 int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage 319 int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage
323 int VertexCount = vertexList.GetLength(0) / 3; 320 int VertexCount = vertexList.GetLength(0)/3;
324 int IndexCount = indexList.GetLength(0); 321 int IndexCount = indexList.GetLength(0);
325 322
326 _triMeshData = d.GeomTriMeshDataCreate(); 323 _triMeshData = d.GeomTriMeshDataCreate();
327 324
328 d.GeomTriMeshDataBuildSimple(_triMeshData, vertexList, 3 * sizeof(float), VertexCount, indexList, IndexCount, 325 d.GeomTriMeshDataBuildSimple(_triMeshData, vertexList, 3*sizeof (float), VertexCount, indexList, IndexCount,
329 3 * sizeof(int)); 326 3*sizeof (int));
330 d.GeomTriMeshDataPreprocess(_triMeshData); 327 d.GeomTriMeshDataPreprocess(_triMeshData);
331 328
332 prim_geom = d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null); 329 prim_geom = d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null);
333 330
334 if (IsPhysical && Body == (IntPtr)0) 331 if (IsPhysical && Body == (IntPtr) 0)
335 { 332 {
336 // Recreate the body 333 // Recreate the body
337 enableBody(); 334 enableBody();
338 } 335 }
339 } 336 }
337
340 public void ProcessTaints(float timestep) 338 public void ProcessTaints(float timestep)
341 { 339 {
342 if (m_taintposition != _position) 340 if (m_taintposition != _position)
@@ -357,14 +355,14 @@ namespace OpenSim.Region.Physics.OdePlugin
357 if (m_taintshape) 355 if (m_taintshape)
358 changeshape(timestep); 356 changeshape(timestep);
359 // 357 //
360
361 } 358 }
359
362 public void Move(float timestep) 360 public void Move(float timestep)
363 { 361 {
364 if (m_isphysical) 362 if (m_isphysical)
365 { 363 {
366 // This is a fallback.. May no longer be necessary. 364 // This is a fallback.. May no longer be necessary.
367 if (Body == (IntPtr)0) 365 if (Body == (IntPtr) 0)
368 enableBody(); 366 enableBody();
369 //Prim auto disable after 20 frames, 367 //Prim auto disable after 20 frames,
370 ///if you move it, re-enable the prim manually. 368 ///if you move it, re-enable the prim manually.
@@ -382,35 +380,35 @@ namespace OpenSim.Region.Physics.OdePlugin
382 380
383 m_taintposition = _position; 381 m_taintposition = _position;
384 } 382 }
383
385 public void rotate(float timestep) 384 public void rotate(float timestep)
386 { 385 {
387
388 d.Quaternion myrot = new d.Quaternion(); 386 d.Quaternion myrot = new d.Quaternion();
389 myrot.W = _orientation.w; 387 myrot.W = _orientation.w;
390 myrot.X = _orientation.x; 388 myrot.X = _orientation.x;
391 myrot.Y = _orientation.y; 389 myrot.Y = _orientation.y;
392 myrot.Z = _orientation.z; 390 myrot.Z = _orientation.z;
393 d.GeomSetQuaternion(prim_geom, ref myrot); 391 d.GeomSetQuaternion(prim_geom, ref myrot);
394 if (m_isphysical && Body != (IntPtr)0) 392 if (m_isphysical && Body != (IntPtr) 0)
395 { 393 {
396 d.BodySetQuaternion(Body, ref myrot); 394 d.BodySetQuaternion(Body, ref myrot);
397 } 395 }
398 396
399 m_taintrot = _orientation; 397 m_taintrot = _orientation;
400 } 398 }
399
401 public void changePhysicsStatus(float timestap) 400 public void changePhysicsStatus(float timestap)
402 { 401 {
403 if (m_isphysical == true) 402 if (m_isphysical == true)
404 { 403 {
405 if (Body == (IntPtr)0) 404 if (Body == (IntPtr) 0)
406 { 405 {
407 enableBody(); 406 enableBody();
408 } 407 }
409
410 } 408 }
411 else 409 else
412 { 410 {
413 if (Body != (IntPtr)0) 411 if (Body != (IntPtr) 0)
414 { 412 {
415 disableBody(); 413 disableBody();
416 } 414 }
@@ -419,6 +417,7 @@ namespace OpenSim.Region.Physics.OdePlugin
419 417
420 m_taintPhysics = m_isphysical; 418 m_taintPhysics = m_isphysical;
421 } 419 }
420
422 public void changesize(float timestamp) 421 public void changesize(float timestamp)
423 { 422 {
424 string oldname = _parent_scene.geom_name_map[prim_geom]; 423 string oldname = _parent_scene.geom_name_map[prim_geom];
@@ -429,7 +428,7 @@ namespace OpenSim.Region.Physics.OdePlugin
429 // Cleanup meshing here 428 // Cleanup meshing here
430 } 429 }
431 //kill body to rebuild 430 //kill body to rebuild
432 if (IsPhysical && Body != (IntPtr)0) 431 if (IsPhysical && Body != (IntPtr) 0)
433 { 432 {
434 disableBody(); 433 disableBody();
435 } 434 }
@@ -442,10 +441,8 @@ namespace OpenSim.Region.Physics.OdePlugin
442 // we don't need to do space calculation because the client sends a position update also. 441 // we don't need to do space calculation because the client sends a position update also.
443 442
444 // Construction of new prim 443 // Construction of new prim
445 if (this._parent_scene.needsMeshing(_pbs)) 444 if (_parent_scene.needsMeshing(_pbs))
446 { 445 {
447
448
449 // Don't need to re-enable body.. it's done in SetMesh 446 // Don't need to re-enable body.. it's done in SetMesh
450 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size); 447 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size);
451 // createmesh returns null when it's a shape that isn't a cube. 448 // createmesh returns null when it's a shape that isn't a cube.
@@ -463,8 +460,6 @@ namespace OpenSim.Region.Physics.OdePlugin
463 myrot.Y = _orientation.y; 460 myrot.Y = _orientation.y;
464 myrot.Z = _orientation.z; 461 myrot.Z = _orientation.z;
465 d.GeomSetQuaternion(prim_geom, ref myrot); 462 d.GeomSetQuaternion(prim_geom, ref myrot);
466
467
468 } 463 }
469 } 464 }
470 else 465 else
@@ -480,7 +475,7 @@ namespace OpenSim.Region.Physics.OdePlugin
480 475
481 476
482 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); 477 //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z);
483 if (IsPhysical && Body == (IntPtr)0) 478 if (IsPhysical && Body == (IntPtr) 0)
484 { 479 {
485 // Re creates body on size. 480 // Re creates body on size.
486 // EnableBody also does setMass() 481 // EnableBody also does setMass()
@@ -493,12 +488,13 @@ namespace OpenSim.Region.Physics.OdePlugin
493 488
494 m_taintsize = _size; 489 m_taintsize = _size;
495 } 490 }
491
496 public void changeshape(float timestamp) 492 public void changeshape(float timestamp)
497 { 493 {
498 string oldname = _parent_scene.geom_name_map[prim_geom]; 494 string oldname = _parent_scene.geom_name_map[prim_geom];
499 495
500 // Cleanup of old prim geometry and Bodies 496 // Cleanup of old prim geometry and Bodies
501 if (IsPhysical && Body != (IntPtr)0) 497 if (IsPhysical && Body != (IntPtr) 0)
502 { 498 {
503 disableBody(); 499 disableBody();
504 } 500 }
@@ -509,7 +505,7 @@ namespace OpenSim.Region.Physics.OdePlugin
509 } 505 }
510 506
511 // Construction of new prim 507 // Construction of new prim
512 if (this._parent_scene.needsMeshing(_pbs)) 508 if (_parent_scene.needsMeshing(_pbs))
513 { 509 {
514 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size); 510 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size);
515 if (mesh != null) 511 if (mesh != null)
@@ -525,7 +521,7 @@ namespace OpenSim.Region.Physics.OdePlugin
525 { 521 {
526 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); 522 prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z);
527 } 523 }
528 if (IsPhysical && Body == (IntPtr)0) 524 if (IsPhysical && Body == (IntPtr) 0)
529 { 525 {
530 //re-create new body 526 //re-create new body
531 enableBody(); 527 enableBody();
@@ -544,11 +540,13 @@ namespace OpenSim.Region.Physics.OdePlugin
544 540
545 m_taintshape = false; 541 m_taintshape = false;
546 } 542 }
543
547 public override bool IsPhysical 544 public override bool IsPhysical
548 { 545 {
549 get { return m_isphysical; } 546 get { return m_isphysical; }
550 set { m_isphysical = value; } 547 set { m_isphysical = value; }
551 } 548 }
549
552 public void setPrimForRemoval() 550 public void setPrimForRemoval()
553 { 551 {
554 m_taintremove = true; 552 m_taintremove = true;
@@ -556,9 +554,7 @@ namespace OpenSim.Region.Physics.OdePlugin
556 554
557 public override bool Flying 555 public override bool Flying
558 { 556 {
559 get 557 get { return false; //no flying prims for you
560 {
561 return false; //no flying prims for you
562 } 558 }
563 set { } 559 set { }
564 } 560 }
@@ -568,16 +564,19 @@ namespace OpenSim.Region.Physics.OdePlugin
568 get { return iscolliding; } 564 get { return iscolliding; }
569 set { iscolliding = value; } 565 set { iscolliding = value; }
570 } 566 }
567
571 public override bool CollidingGround 568 public override bool CollidingGround
572 { 569 {
573 get { return false; } 570 get { return false; }
574 set { return; } 571 set { return; }
575 } 572 }
573
576 public override bool CollidingObj 574 public override bool CollidingObj
577 { 575 {
578 get { return false; } 576 get { return false; }
579 set { return; } 577 set { return; }
580 } 578 }
579
581 public override bool ThrottleUpdates 580 public override bool ThrottleUpdates
582 { 581 {
583 get { return m_throttleUpdates; } 582 get { return m_throttleUpdates; }
@@ -588,20 +587,13 @@ namespace OpenSim.Region.Physics.OdePlugin
588 { 587 {
589 get { return _position; } 588 get { return _position; }
590 589
591 set 590 set { _position = value; }
592 {
593 _position = value;
594
595 }
596 } 591 }
597 592
598 public override PhysicsVector Size 593 public override PhysicsVector Size
599 { 594 {
600 get { return _size; } 595 get { return _size; }
601 set 596 set { _size = value; }
602 {
603 _size = value;
604 }
605 } 597 }
606 598
607 public override float Mass 599 public override float Mass
@@ -626,10 +618,7 @@ namespace OpenSim.Region.Physics.OdePlugin
626 618
627 public override PrimitiveBaseShape Shape 619 public override PrimitiveBaseShape Shape
628 { 620 {
629 set 621 set { _pbs = value; }
630 {
631 _pbs = value;
632 }
633 } 622 }
634 623
635 public override PhysicsVector Velocity 624 public override PhysicsVector Velocity
@@ -639,9 +628,9 @@ namespace OpenSim.Region.Physics.OdePlugin
639 // Averate previous velocity with the new one so 628 // Averate previous velocity with the new one so
640 // client object interpolation works a 'little' better 629 // client object interpolation works a 'little' better
641 PhysicsVector returnVelocity = new PhysicsVector(); 630 PhysicsVector returnVelocity = new PhysicsVector();
642 returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2; 631 returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2;
643 returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2; 632 returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2;
644 returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2; 633 returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2;
645 return returnVelocity; 634 return returnVelocity;
646 } 635 }
647 set { _velocity = value; } 636 set { _velocity = value; }
@@ -656,11 +645,7 @@ namespace OpenSim.Region.Physics.OdePlugin
656 public override Quaternion Orientation 645 public override Quaternion Orientation
657 { 646 {
658 get { return _orientation; } 647 get { return _orientation; }
659 set 648 set { _orientation = value; }
660 {
661 _orientation = value;
662
663 }
664 } 649 }
665 650
666 public override PhysicsVector Acceleration 651 public override PhysicsVector Acceleration
@@ -688,7 +673,7 @@ namespace OpenSim.Region.Physics.OdePlugin
688 { 673 {
689 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! 674 // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit!
690 675
691 if (Body != (IntPtr)0) 676 if (Body != (IntPtr) 0)
692 { 677 {
693 d.Vector3 vec = d.BodyGetPosition(Body); 678 d.Vector3 vec = d.BodyGetPosition(Body);
694 d.Quaternion ori = d.BodyGetQuaternion(Body); 679 d.Quaternion ori = d.BodyGetQuaternion(Body);
@@ -715,8 +700,6 @@ namespace OpenSim.Region.Physics.OdePlugin
715 // It's a hack and will generate a console message if it fails. 700 // It's a hack and will generate a console message if it fails.
716 701
717 702
718
719
720 //IsPhysical = false; 703 //IsPhysical = false;
721 base.RaiseOutOfBounds(_position); 704 base.RaiseOutOfBounds(_position);
722 _velocity.X = 0; 705 _velocity.X = 0;
@@ -736,7 +719,6 @@ namespace OpenSim.Region.Physics.OdePlugin
736 && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02) 719 && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02)
737 && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02)) 720 && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02))
738 { 721 {
739
740 _zeroFlag = true; 722 _zeroFlag = true;
741 } 723 }
742 else 724 else
@@ -746,7 +728,6 @@ namespace OpenSim.Region.Physics.OdePlugin
746 } 728 }
747 729
748 730
749
750 if (_zeroFlag) 731 if (_zeroFlag)
751 { 732 {
752 // Supposedly this is supposed to tell SceneObjectGroup that 733 // Supposedly this is supposed to tell SceneObjectGroup that
@@ -811,10 +792,10 @@ namespace OpenSim.Region.Physics.OdePlugin
811 m_rotationalVelocity.Z = 0; 792 m_rotationalVelocity.Z = 0;
812 _zeroFlag = true; 793 _zeroFlag = true;
813 } 794 }
814
815 } 795 }
796
816 public override void SetMomentum(PhysicsVector momentum) 797 public override void SetMomentum(PhysicsVector momentum)
817 { 798 {
818 } 799 }
819 } 800 }
820} 801} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 8bb822e..f2c9b57 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -28,6 +28,7 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Runtime.InteropServices;
31using Axiom.Math; 32using Axiom.Math;
32using Ode.NET; 33using Ode.NET;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -99,17 +100,17 @@ namespace OpenSim.Region.Physics.OdePlugin
99 private d.Contact TerrainContact; 100 private d.Contact TerrainContact;
100 private d.Contact AvatarMovementprimContact; 101 private d.Contact AvatarMovementprimContact;
101 private d.Contact AvatarMovementTerrainContact; 102 private d.Contact AvatarMovementTerrainContact;
102 103
103 private int m_physicsiterations = 10; 104 private int m_physicsiterations = 10;
104 private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag 105 private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
105 private PhysicsActor PANull = new NullPhysicsActor(); 106 private PhysicsActor PANull = new NullPhysicsActor();
106 private float step_time = 0.0f; 107 private float step_time = 0.0f;
107 public IntPtr world; 108 public IntPtr world;
108 109
109 public IntPtr space; 110 public IntPtr space;
110 // split static geometry collision handling into spaces of 30 meters 111 // split static geometry collision handling into spaces of 30 meters
111 public IntPtr[,] staticPrimspace = new IntPtr[(int)(300/metersInSpace),(int)(300/metersInSpace)]; 112 public IntPtr[,] staticPrimspace = new IntPtr[(int) (300/metersInSpace),(int) (300/metersInSpace)];
112 113
113 public static Object OdeLock = new Object(); 114 public static Object OdeLock = new Object();
114 115
115 public IMesher mesher; 116 public IMesher mesher;
@@ -126,7 +127,7 @@ namespace OpenSim.Region.Physics.OdePlugin
126 contact.surface.soft_erp = 0.005f; 127 contact.surface.soft_erp = 0.005f;
127 contact.surface.soft_cfm = 0.00003f; 128 contact.surface.soft_cfm = 0.00003f;
128 */ 129 */
129 130
130 contact.surface.mu = 250.0f; 131 contact.surface.mu = 250.0f;
131 contact.surface.bounce = 0.2f; 132 contact.surface.bounce = 0.2f;
132 133
@@ -151,7 +152,7 @@ namespace OpenSim.Region.Physics.OdePlugin
151 contactgroup = d.JointGroupCreate(0); 152 contactgroup = d.JointGroupCreate(0);
152 //contactgroup 153 //contactgroup
153 154
154 155
155 d.WorldSetGravity(world, 0.0f, 0.0f, -10.0f); 156 d.WorldSetGravity(world, 0.0f, 0.0f, -10.0f);
156 d.WorldSetAutoDisableFlag(world, false); 157 d.WorldSetAutoDisableFlag(world, false);
157 d.WorldSetContactSurfaceLayer(world, 0.001f); 158 d.WorldSetContactSurfaceLayer(world, 0.001f);
@@ -165,10 +166,9 @@ namespace OpenSim.Region.Physics.OdePlugin
165 { 166 {
166 for (int j = 0; j < staticPrimspace.GetLength(1); j++) 167 for (int j = 0; j < staticPrimspace.GetLength(1); j++)
167 { 168 {
168 staticPrimspace[i,j] = IntPtr.Zero; 169 staticPrimspace[i, j] = IntPtr.Zero;
169 } 170 }
170 } 171 }
171
172 } 172 }
173 173
174 public override void Initialise(IMesher meshmerizer) 174 public override void Initialise(IMesher meshmerizer)
@@ -184,25 +184,25 @@ namespace OpenSim.Region.Physics.OdePlugin
184 private void near(IntPtr space, IntPtr g1, IntPtr g2) 184 private void near(IntPtr space, IntPtr g1, IntPtr g2)
185 { 185 {
186 // no lock here! It's invoked from within Simulate(), which is thread-locked 186 // no lock here! It's invoked from within Simulate(), which is thread-locked
187 if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2) ) 187 if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2))
188 { 188 {
189 // Separating static prim geometry spaces. 189 // Separating static prim geometry spaces.
190 // We'll be calling near recursivly if one 190 // We'll be calling near recursivly if one
191 // of them is a space to find all of the 191 // of them is a space to find all of the
192 // contact points in the space 192 // contact points in the space
193 193
194 d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); 194 d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
195 //Colliding a space or a geom with a space or a geom. 195 //Colliding a space or a geom with a space or a geom.
196 196
197 //Collide all geoms in each space.. 197 //Collide all geoms in each space..
198 //if (d.GeomIsSpace(g1)) d.SpaceCollide(g1, IntPtr.Zero, nearCallback); 198 //if (d.GeomIsSpace(g1)) d.SpaceCollide(g1, IntPtr.Zero, nearCallback);
199 //if (d.GeomIsSpace(g2)) d.SpaceCollide(g2, IntPtr.Zero, nearCallback); 199 //if (d.GeomIsSpace(g2)) d.SpaceCollide(g2, IntPtr.Zero, nearCallback);
200 } 200 }
201 else 201 else
202 { 202 {
203 // Colliding Geom To Geom 203 // Colliding Geom To Geom
204 // This portion of the function 'was' blatantly ripped off from BoxStack.cs 204 // This portion of the function 'was' blatantly ripped off from BoxStack.cs
205 205
206 IntPtr b1 = d.GeomGetBody(g1); 206 IntPtr b1 = d.GeomGetBody(g1);
207 IntPtr b2 = d.GeomGetBody(g2); 207 IntPtr b2 = d.GeomGetBody(g2);
208 208
@@ -213,7 +213,7 @@ namespace OpenSim.Region.Physics.OdePlugin
213 return; 213 return;
214 214
215 d.GeomClassID id = d.GeomGetClass(g1); 215 d.GeomClassID id = d.GeomGetClass(g1);
216 216
217 String name1 = null; 217 String name1 = null;
218 String name2 = null; 218 String name2 = null;
219 219
@@ -228,21 +228,22 @@ namespace OpenSim.Region.Physics.OdePlugin
228 228
229 if (id == d.GeomClassID.TriMeshClass) 229 if (id == d.GeomClassID.TriMeshClass)
230 { 230 {
231 // MainLog.Instance.Verbose("near: A collision was detected between {1} and {2}", 0, name1, name2); 231 // MainLog.Instance.Verbose("near: A collision was detected between {1} and {2}", 0, name1, name2);
232 //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); 232 //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2);
233 } 233 }
234 234
235 int count = 0; 235 int count = 0;
236 try 236 try
237 { 237 {
238 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); 238 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf);
239 } 239 }
240 catch (System.Runtime.InteropServices.SEHException) 240 catch (SEHException)
241 { 241 {
242 MainLog.Instance.Error("PHYSICS", "The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim."); 242 MainLog.Instance.Error("PHYSICS",
243 "The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim.");
243 base.TriggerPhysicsBasedRestart(); 244 base.TriggerPhysicsBasedRestart();
244 } 245 }
245 246
246 for (int i = 0; i < count; i++) 247 for (int i = 0; i < count; i++)
247 { 248 {
248 IntPtr joint; 249 IntPtr joint;
@@ -263,17 +264,17 @@ namespace OpenSim.Region.Physics.OdePlugin
263 // We only need to test p2 for 'jump crouch purposes' 264 // We only need to test p2 for 'jump crouch purposes'
264 p2.IsColliding = true; 265 p2.IsColliding = true;
265 266
266
267 267
268 switch(p1.PhysicsActorType) { 268 switch (p1.PhysicsActorType)
269 case (int)ActorTypes.Agent: 269 {
270 case (int) ActorTypes.Agent:
270 p2.CollidingObj = true; 271 p2.CollidingObj = true;
271 break; 272 break;
272 case (int)ActorTypes.Prim: 273 case (int) ActorTypes.Prim:
273 if (p2.Velocity.X >0 || p2.Velocity.Y > 0 || p2.Velocity.Z > 0) 274 if (p2.Velocity.X > 0 || p2.Velocity.Y > 0 || p2.Velocity.Z > 0)
274 p2.CollidingObj = true; 275 p2.CollidingObj = true;
275 break; 276 break;
276 case (int)ActorTypes.Unknown: 277 case (int) ActorTypes.Unknown:
277 p2.CollidingGround = true; 278 p2.CollidingGround = true;
278 break; 279 break;
279 default: 280 default:
@@ -282,7 +283,9 @@ namespace OpenSim.Region.Physics.OdePlugin
282 } 283 }
283 284
284 // we don't want prim or avatar to explode 285 // we don't want prim or avatar to explode
286
285 #region InterPenetration Handling - Unintended physics explosions 287 #region InterPenetration Handling - Unintended physics explosions
288
286 if (contacts[i].depth >= 0.08f) 289 if (contacts[i].depth >= 0.08f)
287 { 290 {
288 if (contacts[i].depth >= 1.00f) 291 if (contacts[i].depth >= 1.00f)
@@ -290,30 +293,31 @@ namespace OpenSim.Region.Physics.OdePlugin
290 //MainLog.Instance.Debug("PHYSICS",contacts[i].depth.ToString()); 293 //MainLog.Instance.Debug("PHYSICS",contacts[i].depth.ToString());
291 } 294 }
292 // If you interpenetrate a prim with an agent 295 // If you interpenetrate a prim with an agent
293 if ((p2.PhysicsActorType == (int)ActorTypes.Agent && p1.PhysicsActorType == (int)ActorTypes.Prim) || (p1.PhysicsActorType == (int)ActorTypes.Agent && p2.PhysicsActorType == (int)ActorTypes.Prim)) 296 if ((p2.PhysicsActorType == (int) ActorTypes.Agent &&
297 p1.PhysicsActorType == (int) ActorTypes.Prim) ||
298 (p1.PhysicsActorType == (int) ActorTypes.Agent &&
299 p2.PhysicsActorType == (int) ActorTypes.Prim))
294 { 300 {
295 301 if (p2.PhysicsActorType == (int) ActorTypes.Agent)
296 if (p2.PhysicsActorType == (int)ActorTypes.Agent)
297 { 302 {
298 p2.CollidingObj = true; 303 p2.CollidingObj = true;
299 //contacts[i].depth = 0.003f; 304 //contacts[i].depth = 0.003f;
300 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); 305 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f);
301 OdeCharacter character = (OdeCharacter)p2; 306 OdeCharacter character = (OdeCharacter) p2;
302 character.SetPidStatus(true); 307 character.SetPidStatus(true);
303 //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); 308 //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2));
304
305 } 309 }
306 else 310 else
307 { 311 {
308 contacts[i].depth = 0.0000000f; 312 contacts[i].depth = 0.0000000f;
309 } 313 }
310 if (p1.PhysicsActorType == (int)ActorTypes.Agent) 314 if (p1.PhysicsActorType == (int) ActorTypes.Agent)
311 { 315 {
312 p1.CollidingObj = true; 316 p1.CollidingObj = true;
313 //contacts[i].depth = 0.003f; 317 //contacts[i].depth = 0.003f;
314 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); 318 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f);
315 //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p2.Size.X / 2), contacts[i].pos.Y + (p2.Size.Y / 2), contacts[i].pos.Z + (p2.Size.Z / 2)); 319 //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p2.Size.X / 2), contacts[i].pos.Y + (p2.Size.Y / 2), contacts[i].pos.Z + (p2.Size.Z / 2));
316 OdeCharacter character = (OdeCharacter)p2; 320 OdeCharacter character = (OdeCharacter) p2;
317 character.SetPidStatus(true); 321 character.SetPidStatus(true);
318 } 322 }
319 else 323 else
@@ -322,39 +326,45 @@ namespace OpenSim.Region.Physics.OdePlugin
322 } 326 }
323 } 327 }
324 // If you interpenetrate a prim with another prim 328 // If you interpenetrate a prim with another prim
325 if (p1.PhysicsActorType == (int)ActorTypes.Prim && p2.PhysicsActorType == (int)ActorTypes.Prim) 329 if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim)
326 { 330 {
327 // Don't collide, one or both prim will explode. 331 // Don't collide, one or both prim will explode.
328 contacts[i].depth = -1f; 332 contacts[i].depth = -1f;
329 } 333 }
330 if (contacts[i].depth >= 1.00f) 334 if (contacts[i].depth >= 1.00f)
331 { 335 {
332 if ((p2.PhysicsActorType == (int)ActorTypes.Agent && p1.PhysicsActorType == (int)ActorTypes.Unknown) || (p1.PhysicsActorType == (int)ActorTypes.Agent && p2.PhysicsActorType == (int)ActorTypes.Unknown)) 336 if ((p2.PhysicsActorType == (int) ActorTypes.Agent &&
337 p1.PhysicsActorType == (int) ActorTypes.Unknown) ||
338 (p1.PhysicsActorType == (int) ActorTypes.Agent &&
339 p2.PhysicsActorType == (int) ActorTypes.Unknown))
333 { 340 {
334 341 if (p2.PhysicsActorType == (int) ActorTypes.Agent)
335 if (p2.PhysicsActorType == (int)ActorTypes.Agent)
336 { 342 {
337 OdeCharacter character = (OdeCharacter)p2; 343 OdeCharacter character = (OdeCharacter) p2;
338 344
339 //p2.CollidingObj = true; 345 //p2.CollidingObj = true;
340 contacts[i].depth = 0.003f; 346 contacts[i].depth = 0.003f;
341 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f); 347 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f);
342 contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); 348 contacts[i].pos =
349 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
350 contacts[i].pos.Y + (p1.Size.Y/2),
351 contacts[i].pos.Z + (p1.Size.Z/2));
343 character.SetPidStatus(true); 352 character.SetPidStatus(true);
344
345 } 353 }
346 else 354 else
347 { 355 {
348
349 } 356 }
350 if (p1.PhysicsActorType == (int)ActorTypes.Agent) 357 if (p1.PhysicsActorType == (int) ActorTypes.Agent)
351 { 358 {
352 OdeCharacter character = (OdeCharacter)p2; 359 OdeCharacter character = (OdeCharacter) p2;
353 360
354 //p2.CollidingObj = true; 361 //p2.CollidingObj = true;
355 contacts[i].depth = 0.003f; 362 contacts[i].depth = 0.003f;
356 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f); 363 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 0.5f);
357 contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); 364 contacts[i].pos =
365 new d.Vector3(contacts[i].pos.X + (p1.Size.X/2),
366 contacts[i].pos.Y + (p1.Size.Y/2),
367 contacts[i].pos.Z + (p1.Size.Z/2));
358 character.SetPidStatus(true); 368 character.SetPidStatus(true);
359 } 369 }
360 else 370 else
@@ -364,18 +374,18 @@ namespace OpenSim.Region.Physics.OdePlugin
364 } 374 }
365 } 375 }
366 } 376 }
377
367 #endregion 378 #endregion
368 379
369 if (contacts[i].depth >= 0f) 380 if (contacts[i].depth >= 0f)
370 { 381 {
371 if (name1 == "Terrain" || name2 == "Terrain") 382 if (name1 == "Terrain" || name2 == "Terrain")
372 { 383 {
373 384 if ((p2.PhysicsActorType == (int) ActorTypes.Agent) &&
374 if ((p2.PhysicsActorType == (int)ActorTypes.Agent) && (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) 385 (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f))
375 { 386 {
376 AvatarMovementTerrainContact.geom = contacts[i]; 387 AvatarMovementTerrainContact.geom = contacts[i];
377 joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementTerrainContact); 388 joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementTerrainContact);
378
379 } 389 }
380 else 390 else
381 { 391 {
@@ -385,11 +395,11 @@ namespace OpenSim.Region.Physics.OdePlugin
385 } 395 }
386 else 396 else
387 { 397 {
388 if ((p2.PhysicsActorType == (int)ActorTypes.Agent) && (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) 398 if ((p2.PhysicsActorType == (int) ActorTypes.Agent) &&
399 (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f))
389 { 400 {
390 AvatarMovementprimContact.geom = contacts[i]; 401 AvatarMovementprimContact.geom = contacts[i];
391 joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementprimContact); 402 joint = d.JointCreateContact(world, contactgroup, ref AvatarMovementprimContact);
392
393 } 403 }
394 else 404 else
395 { 405 {
@@ -399,7 +409,7 @@ namespace OpenSim.Region.Physics.OdePlugin
399 } 409 }
400 d.JointAttach(joint, b1, b2); 410 d.JointAttach(joint, b1, b2);
401 } 411 }
402 412
403 if (count > 3) 413 if (count > 3)
404 { 414 {
405 p2.ThrottleUpdates = true; 415 p2.ThrottleUpdates = true;
@@ -421,7 +431,7 @@ namespace OpenSim.Region.Physics.OdePlugin
421 } 431 }
422 // If the sim is running slow this frame, 432 // If the sim is running slow this frame,
423 // don't process collision for prim! 433 // don't process collision for prim!
424 if (timeStep < (m_SkipFramesAtms / 3)) 434 if (timeStep < (m_SkipFramesAtms/3))
425 { 435 {
426 foreach (OdePrim chr in _activeprims) 436 foreach (OdePrim chr in _activeprims)
427 { 437 {
@@ -432,16 +442,16 @@ namespace OpenSim.Region.Physics.OdePlugin
432 //foreach (OdePrim ch2 in _prims) 442 //foreach (OdePrim ch2 in _prims)
433 /// should be a separate space -- lots of avatars will be N**2 slow 443 /// should be a separate space -- lots of avatars will be N**2 slow
434 //{ 444 //{
435 //if (ch2.IsPhysical && d.BodyIsEnabled(ch2.Body)) 445 //if (ch2.IsPhysical && d.BodyIsEnabled(ch2.Body))
436 //{ 446 //{
437 // Only test prim that are 0.03 meters away in one direction. 447 // Only test prim that are 0.03 meters away in one direction.
438 // This should be Optimized! 448 // This should be Optimized!
439 449
440 //if ((Math.Abs(ch2.Position.X - chr.Position.X) < 0.03) || (Math.Abs(ch2.Position.Y - chr.Position.Y) < 0.03) || (Math.Abs(ch2.Position.X - chr.Position.X) < 0.03)) 450 //if ((Math.Abs(ch2.Position.X - chr.Position.X) < 0.03) || (Math.Abs(ch2.Position.Y - chr.Position.Y) < 0.03) || (Math.Abs(ch2.Position.X - chr.Position.X) < 0.03))
441 //{ 451 //{
442 //d.SpaceCollide2(chr.prim_geom, ch2.prim_geom, IntPtr.Zero, nearCallback); 452 //d.SpaceCollide2(chr.prim_geom, ch2.prim_geom, IntPtr.Zero, nearCallback);
443 //} 453 //}
444 //} 454 //}
445 //} 455 //}
446 } 456 }
447 } 457 }
@@ -456,7 +466,6 @@ namespace OpenSim.Region.Physics.OdePlugin
456 if (d.BodyIsEnabled(chr.Body)) 466 if (d.BodyIsEnabled(chr.Body))
457 { 467 {
458 d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); 468 d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback);
459
460 } 469 }
461 } 470 }
462 } 471 }
@@ -492,7 +501,6 @@ namespace OpenSim.Region.Physics.OdePlugin
492 501
493 p.setPrimForRemoval(); 502 p.setPrimForRemoval();
494 AddPhysicsActorTaint(prim); 503 AddPhysicsActorTaint(prim);
495
496 } 504 }
497 } 505 }
498 } 506 }
@@ -519,13 +527,14 @@ namespace OpenSim.Region.Physics.OdePlugin
519 } 527 }
520 else 528 else
521 { 529 {
522 MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'removeprim from scene':" + ((OdePrim)prim).m_targetSpace.ToString()); 530 MainLog.Instance.Verbose("Physics",
531 "Invalid Scene passed to 'removeprim from scene':" +
532 ((OdePrim) prim).m_targetSpace.ToString());
523 } 533 }
524 } 534 }
525 } 535 }
526 536
527 537
528
529 //If there are no more geometries in the sub-space, we don't need it in the main space anymore 538 //If there are no more geometries in the sub-space, we don't need it in the main space anymore
530 if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0) 539 if (d.SpaceGetNumGeoms(prim.m_targetSpace) == 0)
531 { 540 {
@@ -541,17 +550,18 @@ namespace OpenSim.Region.Physics.OdePlugin
541 } 550 }
542 else 551 else
543 { 552 {
544 MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'removeprim from scene':" + ((OdePrim)prim).m_targetSpace.ToString()); 553 MainLog.Instance.Verbose("Physics",
554 "Invalid Scene passed to 'removeprim from scene':" +
555 ((OdePrim) prim).m_targetSpace.ToString());
545 } 556 }
546 } 557 }
547 } 558 }
548 } 559 }
549 560
550 d.GeomDestroy(prim.prim_geom); 561 d.GeomDestroy(prim.prim_geom);
551 562
552 _prims.Remove(prim); 563 _prims.Remove(prim);
553 } 564 }
554
555 } 565 }
556 566
557 public void resetSpaceArrayItemToZero(IntPtr space) 567 public void resetSpaceArrayItemToZero(IntPtr space)
@@ -566,7 +576,7 @@ namespace OpenSim.Region.Physics.OdePlugin
566 } 576 }
567 } 577 }
568 578
569 public void resetSpaceArrayItemToZero(int arrayitemX,int arrayitemY) 579 public void resetSpaceArrayItemToZero(int arrayitemX, int arrayitemY)
570 { 580 {
571 staticPrimspace[arrayitemX, arrayitemY] = IntPtr.Zero; 581 staticPrimspace[arrayitemX, arrayitemY] = IntPtr.Zero;
572 } 582 }
@@ -582,16 +592,17 @@ namespace OpenSim.Region.Physics.OdePlugin
582 // never be called if the prim is physical(active) 592 // never be called if the prim is physical(active)
583 if (currentspace != space) 593 if (currentspace != space)
584 { 594 {
585 if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr)0) 595 if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr) 0)
586 { 596 {
587 if (d.GeomIsSpace(currentspace)) 597 if (d.GeomIsSpace(currentspace))
588 { 598 {
589
590 d.SpaceRemove(currentspace, geom); 599 d.SpaceRemove(currentspace, geom);
591 } 600 }
592 else 601 else
593 { 602 {
594 MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() + " Geom:" + geom.ToString()); 603 MainLog.Instance.Verbose("Physics",
604 "Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() +
605 " Geom:" + geom.ToString());
595 } 606 }
596 } 607 }
597 else 608 else
@@ -599,7 +610,7 @@ namespace OpenSim.Region.Physics.OdePlugin
599 IntPtr sGeomIsIn = d.GeomGetSpace(geom); 610 IntPtr sGeomIsIn = d.GeomGetSpace(geom);
600 if (!(sGeomIsIn.Equals(null))) 611 if (!(sGeomIsIn.Equals(null)))
601 { 612 {
602 if (sGeomIsIn != (IntPtr)0) 613 if (sGeomIsIn != (IntPtr) 0)
603 { 614 {
604 if (d.GeomIsSpace(currentspace)) 615 if (d.GeomIsSpace(currentspace))
605 { 616 {
@@ -607,7 +618,9 @@ namespace OpenSim.Region.Physics.OdePlugin
607 } 618 }
608 else 619 else
609 { 620 {
610 MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'recalculatespace':" + sGeomIsIn.ToString() + " Geom:" + geom.ToString()); 621 MainLog.Instance.Verbose("Physics",
622 "Invalid Scene passed to 'recalculatespace':" +
623 sGeomIsIn.ToString() + " Geom:" + geom.ToString());
611 } 624 }
612 } 625 }
613 } 626 }
@@ -617,7 +630,7 @@ namespace OpenSim.Region.Physics.OdePlugin
617 //If there are no more geometries in the sub-space, we don't need it in the main space anymore 630 //If there are no more geometries in the sub-space, we don't need it in the main space anymore
618 if (d.SpaceGetNumGeoms(currentspace) == 0) 631 if (d.SpaceGetNumGeoms(currentspace) == 0)
619 { 632 {
620 if (currentspace != (IntPtr)0) 633 if (currentspace != (IntPtr) 0)
621 { 634 {
622 if (d.GeomIsSpace(currentspace)) 635 if (d.GeomIsSpace(currentspace))
623 { 636 {
@@ -628,9 +641,10 @@ namespace OpenSim.Region.Physics.OdePlugin
628 } 641 }
629 else 642 else
630 { 643 {
631 MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() + " Geom:" + geom.ToString()); 644 MainLog.Instance.Verbose("Physics",
645 "Invalid Scene passed to 'recalculatespace':" +
646 currentspace.ToString() + " Geom:" + geom.ToString());
632 } 647 }
633
634 } 648 }
635 } 649 }
636 } 650 }
@@ -639,15 +653,16 @@ namespace OpenSim.Region.Physics.OdePlugin
639 // this is a physical object that got disabled. ;.; 653 // this is a physical object that got disabled. ;.;
640 if (d.SpaceQuery(currentspace, geom)) 654 if (d.SpaceQuery(currentspace, geom))
641 { 655 {
642 if (currentspace != (IntPtr)0) 656 if (currentspace != (IntPtr) 0)
643 if (d.GeomIsSpace(currentspace)) 657 if (d.GeomIsSpace(currentspace))
644 { 658 {
645 d.SpaceRemove(currentspace, geom); 659 d.SpaceRemove(currentspace, geom);
646 } 660 }
647 else 661 else
648 { 662 {
649 MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'recalculatespace':" + currentspace.ToString() + " Geom:" + geom.ToString()); 663 MainLog.Instance.Verbose("Physics",
650 664 "Invalid Scene passed to 'recalculatespace':" +
665 currentspace.ToString() + " Geom:" + geom.ToString());
651 } 666 }
652 } 667 }
653 else 668 else
@@ -655,7 +670,7 @@ namespace OpenSim.Region.Physics.OdePlugin
655 IntPtr sGeomIsIn = d.GeomGetSpace(geom); 670 IntPtr sGeomIsIn = d.GeomGetSpace(geom);
656 if (!(sGeomIsIn.Equals(null))) 671 if (!(sGeomIsIn.Equals(null)))
657 { 672 {
658 if (sGeomIsIn != (IntPtr)0) 673 if (sGeomIsIn != (IntPtr) 0)
659 { 674 {
660 if (d.GeomIsSpace(sGeomIsIn)) 675 if (d.GeomIsSpace(sGeomIsIn))
661 { 676 {
@@ -663,14 +678,16 @@ namespace OpenSim.Region.Physics.OdePlugin
663 } 678 }
664 else 679 else
665 { 680 {
666 MainLog.Instance.Verbose("Physics", "Invalid Scene passed to 'recalculatespace':" + sGeomIsIn.ToString() + " Geom:" + geom.ToString()); 681 MainLog.Instance.Verbose("Physics",
682 "Invalid Scene passed to 'recalculatespace':" +
683 sGeomIsIn.ToString() + " Geom:" + geom.ToString());
667 } 684 }
668 } 685 }
669 } 686 }
670 } 687 }
671 } 688 }
672 689
673 690
674 // The routines in the Position and Size sections do the 'inserting' into the space, 691 // The routines in the Position and Size sections do the 'inserting' into the space,
675 // so all we have to do is make sure that the space that we're putting the prim into 692 // so all we have to do is make sure that the space that we're putting the prim into
676 // is in the 'main' space. 693 // is in the 'main' space.
@@ -679,17 +696,18 @@ namespace OpenSim.Region.Physics.OdePlugin
679 696
680 if (newspace == IntPtr.Zero) 697 if (newspace == IntPtr.Zero)
681 { 698 {
682 newspace = createprimspace(iprimspaceArrItem[0],iprimspaceArrItem[1]); 699 newspace = createprimspace(iprimspaceArrItem[0], iprimspaceArrItem[1]);
683 d.HashSpaceSetLevels(newspace, -4, 66); 700 d.HashSpaceSetLevels(newspace, -4, 66);
684 } 701 }
685 702
686 return newspace; 703 return newspace;
687 } 704 }
688 705
689 public IntPtr createprimspace(int iprimspaceArrItemX, int iprimspaceArrItemY) { 706 public IntPtr createprimspace(int iprimspaceArrItemX, int iprimspaceArrItemY)
707 {
690 // creating a new space for prim and inserting it into main space. 708 // creating a new space for prim and inserting it into main space.
691 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero); 709 staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY] = d.HashSpaceCreate(IntPtr.Zero);
692 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX,iprimspaceArrItemY]); 710 d.SpaceAdd(space, staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]);
693 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY]; 711 return staticPrimspace[iprimspaceArrItemX, iprimspaceArrItemY];
694 } 712 }
695 713
@@ -697,7 +715,7 @@ namespace OpenSim.Region.Physics.OdePlugin
697 { 715 {
698 int[] xyspace = calculateSpaceArrayItemFromPos(pos); 716 int[] xyspace = calculateSpaceArrayItemFromPos(pos);
699 //MainLog.Instance.Verbose("Physics", "Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); 717 //MainLog.Instance.Verbose("Physics", "Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString());
700 IntPtr locationbasedspace = staticPrimspace[xyspace[0],xyspace[1]]; 718 IntPtr locationbasedspace = staticPrimspace[xyspace[0], xyspace[1]];
701 719
702 //locationbasedspace = space; 720 //locationbasedspace = space;
703 return locationbasedspace; 721 return locationbasedspace;
@@ -706,17 +724,17 @@ namespace OpenSim.Region.Physics.OdePlugin
706 public int[] calculateSpaceArrayItemFromPos(PhysicsVector pos) 724 public int[] calculateSpaceArrayItemFromPos(PhysicsVector pos)
707 { 725 {
708 int[] returnint = new int[2]; 726 int[] returnint = new int[2];
709 727
710 returnint[0] = (int)(pos.X / metersInSpace); 728 returnint[0] = (int) (pos.X/metersInSpace);
711 729
712 if (returnint[0] > ((int)(259f / metersInSpace))) 730 if (returnint[0] > ((int) (259f/metersInSpace)))
713 returnint[0] = ((int)(259f / metersInSpace)); 731 returnint[0] = ((int) (259f/metersInSpace));
714 if (returnint[0] < 0) 732 if (returnint[0] < 0)
715 returnint[0] = 0; 733 returnint[0] = 0;
716 734
717 returnint[1] = (int)(pos.Y / metersInSpace); 735 returnint[1] = (int) (pos.Y/metersInSpace);
718 if (returnint[0] > ((int)(259f / metersInSpace))) 736 if (returnint[0] > ((int) (259f/metersInSpace)))
719 returnint[0] = ((int)(259f / metersInSpace)); 737 returnint[0] = ((int) (259f/metersInSpace));
720 if (returnint[0] < 0) 738 if (returnint[0] < 0)
721 returnint[0] = 0; 739 returnint[0] = 0;
722 740
@@ -726,7 +744,6 @@ namespace OpenSim.Region.Physics.OdePlugin
726 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, 744 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
727 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) 745 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
728 { 746 {
729
730 PhysicsVector pos = new PhysicsVector(); 747 PhysicsVector pos = new PhysicsVector();
731 pos.X = position.X; 748 pos.X = position.X;
732 pos.Y = position.Y; 749 pos.Y = position.Y;
@@ -741,21 +758,21 @@ namespace OpenSim.Region.Physics.OdePlugin
741 rot.y = rotation.y; 758 rot.y = rotation.y;
742 rot.z = rotation.z; 759 rot.z = rotation.z;
743 760
744 761
745 int[] iprimspaceArrItem = calculateSpaceArrayItemFromPos(pos); 762 int[] iprimspaceArrItem = calculateSpaceArrayItemFromPos(pos);
746 IntPtr targetspace = calculateSpaceForGeom(pos); 763 IntPtr targetspace = calculateSpaceForGeom(pos);
747 764
748 if (targetspace == IntPtr.Zero) 765 if (targetspace == IntPtr.Zero)
749 targetspace = createprimspace(iprimspaceArrItem[0],iprimspaceArrItem[1]); 766 targetspace = createprimspace(iprimspaceArrItem[0], iprimspaceArrItem[1]);
750 767
751 OdePrim newPrim; 768 OdePrim newPrim;
752 lock (OdeLock) 769 lock (OdeLock)
753 { 770 {
754 newPrim = new OdePrim(name, this, targetspace, pos, siz, rot, mesh, pbs, isphysical); 771 newPrim = new OdePrim(name, this, targetspace, pos, siz, rot, mesh, pbs, isphysical);
755 772
756 _prims.Add(newPrim); 773 _prims.Add(newPrim);
757 } 774 }
758 775
759 return newPrim; 776 return newPrim;
760 } 777 }
761 778
@@ -763,16 +780,14 @@ namespace OpenSim.Region.Physics.OdePlugin
763 { 780 {
764 // adds active prim.. (ones that should be iterated over in collisions_optimized 781 // adds active prim.. (ones that should be iterated over in collisions_optimized
765 782
766 _activeprims.Add(activatePrim); 783 _activeprims.Add(activatePrim);
767
768 } 784 }
785
769 public void remActivePrim(OdePrim deactivatePrim) 786 public void remActivePrim(OdePrim deactivatePrim)
770 { 787 {
771 788 _activeprims.Remove(deactivatePrim);
772 _activeprims.Remove(deactivatePrim);
773
774
775 } 789 }
790
776 public int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount) 791 public int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount)
777 { 792 {
778/* String name1 = null; 793/* String name1 = null;
@@ -818,7 +833,7 @@ namespace OpenSim.Region.Physics.OdePlugin
818 return 1; 833 return 1;
819 } 834 }
820 835
821 836
822 public bool needsMeshing(PrimitiveBaseShape pbs) 837 public bool needsMeshing(PrimitiveBaseShape pbs)
823 { 838 {
824 if (pbs.ProfileHollow != 0) 839 if (pbs.ProfileHollow != 0)
@@ -833,7 +848,7 @@ namespace OpenSim.Region.Physics.OdePlugin
833 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 848 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
834 PhysicsVector size, Quaternion rotation) //To be removed 849 PhysicsVector size, Quaternion rotation) //To be removed
835 { 850 {
836 return this.AddPrimShape(primName, pbs, position, size, rotation, false); 851 return AddPrimShape(primName, pbs, position, size, rotation, false);
837 } 852 }
838 853
839 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 854 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
@@ -848,12 +863,12 @@ namespace OpenSim.Region.Physics.OdePlugin
848 /// support simple box & hollow box now; later, more shapes 863 /// support simple box & hollow box now; later, more shapes
849 if (needsMeshing(pbs)) 864 if (needsMeshing(pbs))
850 { 865 {
851 mesh = mesher.CreateMesh(primName, pbs, size); 866 mesh = mesher.CreateMesh(primName, pbs, size);
852 } 867 }
853 868
854 break; 869 break;
855 } 870 }
856 871
857 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); 872 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical);
858 873
859 874
@@ -864,10 +879,9 @@ namespace OpenSim.Region.Physics.OdePlugin
864 { 879 {
865 if (prim is OdePrim) 880 if (prim is OdePrim)
866 { 881 {
867 OdePrim taintedprim = ((OdePrim)prim); 882 OdePrim taintedprim = ((OdePrim) prim);
868 if (!(_taintedPrim.Contains(taintedprim))) 883 if (!(_taintedPrim.Contains(taintedprim)))
869 _taintedPrim.Add(taintedprim); 884 _taintedPrim.Add(taintedprim);
870
871 } 885 }
872 } 886 }
873 887
@@ -877,19 +891,18 @@ namespace OpenSim.Region.Physics.OdePlugin
877 891
878 step_time += timeStep; 892 step_time += timeStep;
879 893
880 894
881 // If We're loaded down by something else, 895 // If We're loaded down by something else,
882 // or debugging with the Visual Studio project on pause 896 // or debugging with the Visual Studio project on pause
883 // skip a few frames to catch up gracefully. 897 // skip a few frames to catch up gracefully.
884 // without shooting the physicsactors all over the place 898 // without shooting the physicsactors all over the place
885
886 899
887 900
888 if (step_time >= m_SkipFramesAtms) 901 if (step_time >= m_SkipFramesAtms)
889 { 902 {
890 // Instead of trying to catch up, it'll do one physics frame only 903 // Instead of trying to catch up, it'll do one physics frame only
891 step_time = ODE_STEPSIZE; 904 step_time = ODE_STEPSIZE;
892 this.m_physicsiterations = 5; 905 m_physicsiterations = 5;
893 } 906 }
894 else 907 else
895 { 908 {
@@ -897,35 +910,36 @@ namespace OpenSim.Region.Physics.OdePlugin
897 } 910 }
898 lock (OdeLock) 911 lock (OdeLock)
899 { 912 {
900 // Process 10 frames if the sim is running normal.. 913 // Process 10 frames if the sim is running normal..
901 // process 5 frames if the sim is running slow 914 // process 5 frames if the sim is running slow
902 try{ 915 try
916 {
903 d.WorldSetQuickStepNumIterations(world, m_physicsiterations); 917 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
904 } 918 }
905 catch (System.StackOverflowException) 919 catch (StackOverflowException)
906 { 920 {
907 MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim."); 921 MainLog.Instance.Error("PHYSICS",
922 "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
908 base.TriggerPhysicsBasedRestart(); 923 base.TriggerPhysicsBasedRestart();
909 } 924 }
910 925
911 int i = 0; 926 int i = 0;
912 927
913 928
914 // Figure out the Frames Per Second we're going at. 929 // Figure out the Frames Per Second we're going at.
915 930
916 fps = (((step_time / ODE_STEPSIZE * m_physicsiterations)*2)* 10); 931 fps = (((step_time/ODE_STEPSIZE*m_physicsiterations)*2)*10);
917 932
918 933
919 while (step_time > 0.0f) 934 while (step_time > 0.0f)
920 { 935 {
921
922 foreach (OdeCharacter actor in _characters) 936 foreach (OdeCharacter actor in _characters)
923 { 937 {
924 actor.Move(timeStep); 938 actor.Move(timeStep);
925 actor.collidelock = true; 939 actor.collidelock = true;
926 } 940 }
927 941
928 942
929 collision_optimized(timeStep); 943 collision_optimized(timeStep);
930 d.WorldQuickStep(world, ODE_STEPSIZE); 944 d.WorldQuickStep(world, ODE_STEPSIZE);
931 d.JointGroupEmpty(contactgroup); 945 d.JointGroupEmpty(contactgroup);
@@ -933,7 +947,7 @@ namespace OpenSim.Region.Physics.OdePlugin
933 { 947 {
934 actor.collidelock = false; 948 actor.collidelock = false;
935 } 949 }
936 950
937 step_time -= ODE_STEPSIZE; 951 step_time -= ODE_STEPSIZE;
938 i++; 952 i++;
939 } 953 }
@@ -941,7 +955,6 @@ namespace OpenSim.Region.Physics.OdePlugin
941 foreach (OdeCharacter actor in _characters) 955 foreach (OdeCharacter actor in _characters)
942 { 956 {
943 actor.UpdatePositionAndVelocity(); 957 actor.UpdatePositionAndVelocity();
944
945 } 958 }
946 bool processedtaints = false; 959 bool processedtaints = false;
947 foreach (OdePrim prim in _taintedPrim) 960 foreach (OdePrim prim in _taintedPrim)
@@ -963,7 +976,6 @@ namespace OpenSim.Region.Physics.OdePlugin
963 if (actor.IsPhysical && (d.BodyIsEnabled(actor.Body) || !actor._zeroFlag)) 976 if (actor.IsPhysical && (d.BodyIsEnabled(actor.Body) || !actor._zeroFlag))
964 { 977 {
965 actor.UpdatePositionAndVelocity(); 978 actor.UpdatePositionAndVelocity();
966
967 } 979 }
968 } 980 }
969 } 981 }
@@ -984,25 +996,25 @@ namespace OpenSim.Region.Physics.OdePlugin
984 public float[] ResizeTerrain512(float[] heightMap) 996 public float[] ResizeTerrain512(float[] heightMap)
985 { 997 {
986 float[] returnarr = new float[262144]; 998 float[] returnarr = new float[262144];
987 float[,] resultarr = new float[m_regionWidth, m_regionHeight]; 999 float[,] resultarr = new float[m_regionWidth,m_regionHeight];
988 1000
989 // Filling out the array into it's multi-dimentional components 1001 // Filling out the array into it's multi-dimentional components
990 for (int y = 0; y < m_regionHeight; y++) 1002 for (int y = 0; y < m_regionHeight; y++)
991 { 1003 {
992 for (int x = 0; x < m_regionWidth; x++) 1004 for (int x = 0; x < m_regionWidth; x++)
993 { 1005 {
994 resultarr[y,x] = heightMap[y * m_regionWidth + x]; 1006 resultarr[y, x] = heightMap[y*m_regionWidth + x];
995 } 1007 }
996 } 1008 }
997 1009
998 // Resize using interpolation 1010 // Resize using interpolation
999 1011
1000 // This particular way is quick but it only works on a multiple of the original 1012 // This particular way is quick but it only works on a multiple of the original
1001 1013
1002 // The idea behind this method can be described with the following diagrams 1014 // The idea behind this method can be described with the following diagrams
1003 // second pass and third pass happen in the same loop really.. just separated 1015 // second pass and third pass happen in the same loop really.. just separated
1004 // them to show what this does. 1016 // them to show what this does.
1005 1017
1006 // First Pass 1018 // First Pass
1007 // ResultArr: 1019 // ResultArr:
1008 // 1,1,1,1,1,1 1020 // 1,1,1,1,1,1
@@ -1054,12 +1066,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1054 // 4th # 1066 // 4th #
1055 // on single loop. 1067 // on single loop.
1056 1068
1057 float[,] resultarr2 = new float[512, 512]; 1069 float[,] resultarr2 = new float[512,512];
1058 for (int y = 0; y < m_regionHeight; y++) 1070 for (int y = 0; y < m_regionHeight; y++)
1059 { 1071 {
1060 for (int x = 0; x < m_regionWidth; x++) 1072 for (int x = 0; x < m_regionWidth; x++)
1061 { 1073 {
1062 resultarr2[y*2,x*2] = resultarr[y,x]; 1074 resultarr2[y*2, x*2] = resultarr[y, x];
1063 1075
1064 if (y < m_regionHeight) 1076 if (y < m_regionHeight)
1065 { 1077 {
@@ -1067,16 +1079,17 @@ namespace OpenSim.Region.Physics.OdePlugin
1067 { 1079 {
1068 if (x + 1 < m_regionWidth) 1080 if (x + 1 < m_regionWidth)
1069 { 1081 {
1070 resultarr2[(y * 2) + 1, x * 2] = ((resultarr[y, x] + resultarr[y + 1, x] + resultarr[y, x+1] + resultarr[y+1, x+1])/4); 1082 resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x] +
1083 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
1071 } 1084 }
1072 else 1085 else
1073 { 1086 {
1074 resultarr2[(y * 2) + 1, x * 2] = ((resultarr[y, x] + resultarr[y + 1, x]) / 2); 1087 resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x])/2);
1075 } 1088 }
1076 } 1089 }
1077 else 1090 else
1078 { 1091 {
1079 resultarr2[(y * 2) + 1, x * 2] = resultarr[y, x]; 1092 resultarr2[(y*2) + 1, x*2] = resultarr[y, x];
1080 } 1093 }
1081 } 1094 }
1082 if (x < m_regionWidth) 1095 if (x < m_regionWidth)
@@ -1085,31 +1098,32 @@ namespace OpenSim.Region.Physics.OdePlugin
1085 { 1098 {
1086 if (y + 1 < m_regionHeight) 1099 if (y + 1 < m_regionHeight)
1087 { 1100 {
1088 resultarr2[y * 2, (x * 2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + resultarr[y, x + 1] + resultarr[y + 1, x + 1]) / 4); 1101 resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] +
1102 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
1089 } 1103 }
1090 else 1104 else
1091 { 1105 {
1092 resultarr2[y * 2, (x * 2) + 1] = ((resultarr[y, x] + resultarr[y, x + 1]) / 2); 1106 resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y, x + 1])/2);
1093 } 1107 }
1094 } 1108 }
1095 else 1109 else
1096 { 1110 {
1097 resultarr2[y * 2, (x * 2) + 1] = resultarr[y, x]; 1111 resultarr2[y*2, (x*2) + 1] = resultarr[y, x];
1098 } 1112 }
1099 } 1113 }
1100 if (x < m_regionWidth && y < m_regionHeight) 1114 if (x < m_regionWidth && y < m_regionHeight)
1101 { 1115 {
1102 if ((x + 1 < m_regionWidth) && (y + 1 < m_regionHeight)) 1116 if ((x + 1 < m_regionWidth) && (y + 1 < m_regionHeight))
1103 { 1117 {
1104 resultarr2[(y * 2) + 1, (x * 2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + resultarr[y, x + 1] + resultarr[y + 1, x + 1]) / 4); 1118 resultarr2[(y*2) + 1, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] +
1119 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
1105 } 1120 }
1106 else 1121 else
1107 { 1122 {
1108 resultarr2[(y * 2) + 1, (x * 2) + 1] = resultarr[y, x]; 1123 resultarr2[(y*2) + 1, (x*2) + 1] = resultarr[y, x];
1109 } 1124 }
1110 } 1125 }
1111 } 1126 }
1112
1113 } 1127 }
1114 //Flatten out the array 1128 //Flatten out the array
1115 int i = 0; 1129 int i = 0;
@@ -1119,7 +1133,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1119 { 1133 {
1120 if (resultarr2[y, x] <= 0) 1134 if (resultarr2[y, x] <= 0)
1121 returnarr[i] = 0.0000001f; 1135 returnarr[i] = 0.0000001f;
1122 else 1136 else
1123 returnarr[i] = resultarr2[y, x]; 1137 returnarr[i] = resultarr2[y, x];
1124 1138
1125 i++; 1139 i++;
@@ -1127,8 +1141,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1127 } 1141 }
1128 1142
1129 return returnarr; 1143 return returnarr;
1130
1131 } 1144 }
1145
1132 public override void SetTerrain(float[] heightMap) 1146 public override void SetTerrain(float[] heightMap)
1133 { 1147 {
1134 // this._heightmap[i] = (double)heightMap[i]; 1148 // this._heightmap[i] = (double)heightMap[i];
@@ -1137,8 +1151,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1137 1151
1138 const uint heightmapWidth = m_regionWidth + 2; 1152 const uint heightmapWidth = m_regionWidth + 2;
1139 const uint heightmapHeight = m_regionHeight + 2; 1153 const uint heightmapHeight = m_regionHeight + 2;
1140 const uint heightmapWidthSamples = 2 * m_regionWidth + 2; 1154 const uint heightmapWidthSamples = 2*m_regionWidth + 2;
1141 const uint heightmapHeightSamples = 2 * m_regionHeight + 2; 1155 const uint heightmapHeightSamples = 2*m_regionHeight + 2;
1142 const float scale = 1.0f; 1156 const float scale = 1.0f;
1143 const float offset = 0.0f; 1157 const float offset = 0.0f;
1144 const float thickness = 2.0f; 1158 const float thickness = 2.0f;
@@ -1166,7 +1180,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1166 } 1180 }
1167 IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); 1181 IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
1168 d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight, 1182 d.GeomHeightfieldDataBuildDouble(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight,
1169 (int) heightmapWidthSamples, (int) heightmapHeightSamples, scale, offset, thickness, wrap); 1183 (int) heightmapWidthSamples, (int) heightmapHeightSamples, scale,
1184 offset, thickness, wrap);
1170 d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); 1185 d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight);
1171 LandGeom = d.CreateHeightfield(space, HeightmapData, 1); 1186 LandGeom = d.CreateHeightfield(space, HeightmapData, 1);
1172 geom_name_map[LandGeom] = "Terrain"; 1187 geom_name_map[LandGeom] = "Terrain";
@@ -1193,7 +1208,4 @@ namespace OpenSim.Region.Physics.OdePlugin
1193 { 1208 {
1194 } 1209 }
1195 } 1210 }
1196 1211} \ No newline at end of file
1197
1198
1199}
diff --git a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
index da9f587..3bb71d4 100644
--- a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("1.0.*")] 58[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
index 26310f9..1bc3490 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
@@ -25,8 +25,8 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System.Collections.Generic;
29using System; 28using System;
29using System.Collections.Generic;
30using Axiom.Math; 30using Axiom.Math;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.Physics.Manager;
@@ -114,10 +114,10 @@ namespace OpenSim.Region.Physics.POSPlugin
114 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 114 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
115 PhysicsVector size, Quaternion rotation) 115 PhysicsVector size, Quaternion rotation)
116 { 116 {
117 return this.AddPrimShape(primName, pbs, position, size, rotation, false); 117 return AddPrimShape(primName, pbs, position, size, rotation, false);
118 } 118 }
119 119
120 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 120 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
121 PhysicsVector size, Quaternion rotation, bool isPhysical) 121 PhysicsVector size, Quaternion rotation, bool isPhysical)
122 { 122 {
123 POSPrim prim = new POSPrim(); 123 POSPrim prim = new POSPrim();
@@ -136,18 +136,20 @@ namespace OpenSim.Region.Physics.POSPlugin
136 " sizeX: " + p.Size.X * 0.5 + 0.5); 136 " sizeX: " + p.Size.X * 0.5 + 0.5);
137 */ 137 */
138 138
139 Vector3 rotatedPos = p.Orientation.Inverse() * new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y, c.Position.Z - p.Position.Z); 139 Vector3 rotatedPos = p.Orientation.Inverse()*
140 Vector3 avatarSize = p.Orientation.Inverse() * new Vector3(c.Size.X, c.Size.Y, c.Size.Z); 140 new Vector3(c.Position.X - p.Position.X, c.Position.Y - p.Position.Y,
141 c.Position.Z - p.Position.Z);
142 Vector3 avatarSize = p.Orientation.Inverse()*new Vector3(c.Size.X, c.Size.Y, c.Size.Z);
141 143
142 if (Math.Abs(rotatedPos.x) >= (p.Size.X * 0.5 + Math.Abs(avatarSize.x))) 144 if (Math.Abs(rotatedPos.x) >= (p.Size.X*0.5 + Math.Abs(avatarSize.x)))
143 { 145 {
144 return false; 146 return false;
145 } 147 }
146 if (Math.Abs(rotatedPos.y) >= (p.Size.Y * 0.5 + Math.Abs(avatarSize.y))) 148 if (Math.Abs(rotatedPos.y) >= (p.Size.Y*0.5 + Math.Abs(avatarSize.y)))
147 { 149 {
148 return false; 150 return false;
149 } 151 }
150 if (Math.Abs(rotatedPos.z) >= (p.Size.Z * 0.5 + Math.Abs(avatarSize.z))) 152 if (Math.Abs(rotatedPos.z) >= (p.Size.Z*0.5 + Math.Abs(avatarSize.z)))
151 { 153 {
152 return false; 154 return false;
153 } 155 }
@@ -182,12 +184,12 @@ namespace OpenSim.Region.Physics.POSPlugin
182 184
183 if (!character.Flying) 185 if (!character.Flying)
184 { 186 {
185 character._target_velocity.Z += gravity * timeStep; 187 character._target_velocity.Z += gravity*timeStep;
186 } 188 }
187 189
188 bool forcedZ = false; 190 bool forcedZ = false;
189 character.Position.X += character._target_velocity.X * timeStep; 191 character.Position.X += character._target_velocity.X*timeStep;
190 character.Position.Y += character._target_velocity.Y * timeStep; 192 character.Position.Y += character._target_velocity.Y*timeStep;
191 193
192 if (character.Position.Y < 0) 194 if (character.Position.Y < 0)
193 { 195 {
@@ -207,15 +209,15 @@ namespace OpenSim.Region.Physics.POSPlugin
207 character.Position.X = 255.9F; 209 character.Position.X = 255.9F;
208 } 210 }
209 211
210 float terrainheight = _heightMap[(int)character.Position.Y * 256 + (int)character.Position.X]; 212 float terrainheight = _heightMap[(int) character.Position.Y*256 + (int) character.Position.X];
211 if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2) 213 if (character.Position.Z + (character._target_velocity.Z*timeStep) < terrainheight + 2)
212 { 214 {
213 character.Position.Z = terrainheight + 1.0f; 215 character.Position.Z = terrainheight + 1.0f;
214 forcedZ = true; 216 forcedZ = true;
215 } 217 }
216 else 218 else
217 { 219 {
218 character.Position.Z += character._target_velocity.Z * timeStep; 220 character.Position.Z += character._target_velocity.Z*timeStep;
219 } 221 }
220 222
221 /// this is it -- the magic you've all been waiting for! Ladies and gentlemen -- 223 /// this is it -- the magic you've all been waiting for! Ladies and gentlemen --
@@ -224,21 +226,21 @@ namespace OpenSim.Region.Physics.POSPlugin
224 226
225 if (check_all_prims(character)) 227 if (check_all_prims(character))
226 { 228 {
227 character.Position.Z = oldposZ; // first try Z axis 229 character.Position.Z = oldposZ; // first try Z axis
228 if (check_all_prims(character)) 230 if (check_all_prims(character))
229 { 231 {
230 character.Position.Z = oldposZ + 0.4f; // try harder 232 character.Position.Z = oldposZ + 0.4f; // try harder
231 if (check_all_prims(character)) 233 if (check_all_prims(character))
232 { 234 {
233 character.Position.X = oldposX; 235 character.Position.X = oldposX;
234 character.Position.Y = oldposY; 236 character.Position.Y = oldposY;
235 character.Position.Z = oldposZ; 237 character.Position.Z = oldposZ;
236 character.Position.X = character.Position.X + (character._target_velocity.X * timeStep); 238 character.Position.X = character.Position.X + (character._target_velocity.X*timeStep);
237 if (check_all_prims(character)) 239 if (check_all_prims(character))
238 { 240 {
239 character.Position.X = oldposX; 241 character.Position.X = oldposX;
240 } 242 }
241 character.Position.Y = character.Position.Y + (character._target_velocity.Y * timeStep); 243 character.Position.Y = character.Position.Y + (character._target_velocity.Y*timeStep);
242 if (check_all_prims(character)) 244 if (check_all_prims(character))
243 { 245 {
244 character.Position.Y = oldposY; 246 character.Position.Y = oldposY;
@@ -253,7 +255,7 @@ namespace OpenSim.Region.Physics.POSPlugin
253 { 255 {
254 forcedZ = true; 256 forcedZ = true;
255 } 257 }
256 } 258 }
257 259
258 if (character.Position.Y < 0) 260 if (character.Position.Y < 0)
259 { 261 {
@@ -273,8 +275,8 @@ namespace OpenSim.Region.Physics.POSPlugin
273 character.Position.X = 255.9F; 275 character.Position.X = 255.9F;
274 } 276 }
275 277
276 character._velocity.X = (character.Position.X - oldposX) / timeStep; 278 character._velocity.X = (character.Position.X - oldposX)/timeStep;
277 character._velocity.Y = (character.Position.Y - oldposY) / timeStep; 279 character._velocity.Y = (character.Position.Y - oldposY)/timeStep;
278 280
279 if (forcedZ) 281 if (forcedZ)
280 { 282 {
@@ -284,7 +286,7 @@ namespace OpenSim.Region.Physics.POSPlugin
284 } 286 }
285 else 287 else
286 { 288 {
287 character._velocity.Z = (character.Position.Z - oldposZ) / timeStep; 289 character._velocity.Z = (character.Position.Z - oldposZ)/timeStep;
288 } 290 }
289 } 291 }
290 return fps; 292 return fps;
@@ -326,31 +328,37 @@ namespace OpenSim.Region.Physics.POSPlugin
326 _position = new PhysicsVector(); 328 _position = new PhysicsVector();
327 _acceleration = new PhysicsVector(); 329 _acceleration = new PhysicsVector();
328 } 330 }
331
329 public override int PhysicsActorType 332 public override int PhysicsActorType
330 { 333 {
331 get { return (int)ActorTypes.Agent; } 334 get { return (int) ActorTypes.Agent; }
332 set { return; } 335 set { return; }
333 } 336 }
337
334 public override PhysicsVector RotationalVelocity 338 public override PhysicsVector RotationalVelocity
335 { 339 {
336 get { return m_rotationalVelocity; } 340 get { return m_rotationalVelocity; }
337 set { m_rotationalVelocity = value; } 341 set { m_rotationalVelocity = value; }
338 } 342 }
343
339 public override bool SetAlwaysRun 344 public override bool SetAlwaysRun
340 { 345 {
341 get { return false; } 346 get { return false; }
342 set { return; } 347 set { return; }
343 } 348 }
349
344 public override bool IsPhysical 350 public override bool IsPhysical
345 { 351 {
346 get { return false; } 352 get { return false; }
347 set { return; } 353 set { return; }
348 } 354 }
355
349 public override bool ThrottleUpdates 356 public override bool ThrottleUpdates
350 { 357 {
351 get { return false; } 358 get { return false; }
352 set { return; } 359 set { return; }
353 } 360 }
361
354 public override bool Flying 362 public override bool Flying
355 { 363 {
356 get { return flying; } 364 get { return flying; }
@@ -362,16 +370,19 @@ namespace OpenSim.Region.Physics.POSPlugin
362 get { return iscolliding; } 370 get { return iscolliding; }
363 set { iscolliding = value; } 371 set { iscolliding = value; }
364 } 372 }
373
365 public override bool CollidingGround 374 public override bool CollidingGround
366 { 375 {
367 get { return false; } 376 get { return false; }
368 set { return; } 377 set { return; }
369 } 378 }
379
370 public override bool CollidingObj 380 public override bool CollidingObj
371 { 381 {
372 get { return false; } 382 get { return false; }
373 set { return; } 383 set { return; }
374 } 384 }
385
375 public override PhysicsVector Position 386 public override PhysicsVector Position
376 { 387 {
377 get { return _position; } 388 get { return _position; }
@@ -383,18 +394,22 @@ namespace OpenSim.Region.Physics.POSPlugin
383 get { return new PhysicsVector(0.5f, 0.5f, 1.0f); } 394 get { return new PhysicsVector(0.5f, 0.5f, 1.0f); }
384 set { } 395 set { }
385 } 396 }
397
386 public override float Mass 398 public override float Mass
387 { 399 {
388 get { return 0f; } 400 get { return 0f; }
389 } 401 }
402
390 public override PhysicsVector Force 403 public override PhysicsVector Force
391 { 404 {
392 get { return PhysicsVector.Zero; } 405 get { return PhysicsVector.Zero; }
393 } 406 }
407
394 public override PhysicsVector CenterOfMass 408 public override PhysicsVector CenterOfMass
395 { 409 {
396 get { return PhysicsVector.Zero; } 410 get { return PhysicsVector.Zero; }
397 } 411 }
412
398 public override PhysicsVector GeometricCenter 413 public override PhysicsVector GeometricCenter
399 { 414 {
400 get { return PhysicsVector.Zero; } 415 get { return PhysicsVector.Zero; }
@@ -402,10 +417,7 @@ namespace OpenSim.Region.Physics.POSPlugin
402 417
403 public override PrimitiveBaseShape Shape 418 public override PrimitiveBaseShape Shape
404 { 419 {
405 set 420 set { return; }
406 {
407 return;
408 }
409 } 421 }
410 422
411 public override PhysicsVector Velocity 423 public override PhysicsVector Velocity
@@ -461,41 +473,49 @@ namespace OpenSim.Region.Physics.POSPlugin
461 _position = new PhysicsVector(); 473 _position = new PhysicsVector();
462 _acceleration = new PhysicsVector(); 474 _acceleration = new PhysicsVector();
463 } 475 }
476
464 public override int PhysicsActorType 477 public override int PhysicsActorType
465 { 478 {
466 get { return (int)ActorTypes.Prim; } 479 get { return (int) ActorTypes.Prim; }
467 set { return; } 480 set { return; }
468 } 481 }
482
469 public override PhysicsVector RotationalVelocity 483 public override PhysicsVector RotationalVelocity
470 { 484 {
471 get { return m_rotationalVelocity; } 485 get { return m_rotationalVelocity; }
472 set { m_rotationalVelocity = value; } 486 set { m_rotationalVelocity = value; }
473 } 487 }
488
474 public override bool IsPhysical 489 public override bool IsPhysical
475 { 490 {
476 get { return false; } 491 get { return false; }
477 set { return; } 492 set { return; }
478 } 493 }
494
479 public override bool ThrottleUpdates 495 public override bool ThrottleUpdates
480 { 496 {
481 get { return false; } 497 get { return false; }
482 set { return; } 498 set { return; }
483 } 499 }
500
484 public override bool IsColliding 501 public override bool IsColliding
485 { 502 {
486 get { return iscolliding; } 503 get { return iscolliding; }
487 set { iscolliding = value; } 504 set { iscolliding = value; }
488 } 505 }
506
489 public override bool CollidingGround 507 public override bool CollidingGround
490 { 508 {
491 get { return false; } 509 get { return false; }
492 set { return; } 510 set { return; }
493 } 511 }
512
494 public override bool CollidingObj 513 public override bool CollidingObj
495 { 514 {
496 get { return false; } 515 get { return false; }
497 set { return; } 516 set { return; }
498 } 517 }
518
499 public override PhysicsVector Position 519 public override PhysicsVector Position
500 { 520 {
501 get { return _position; } 521 get { return _position; }
@@ -530,10 +550,7 @@ namespace OpenSim.Region.Physics.POSPlugin
530 550
531 public override PrimitiveBaseShape Shape 551 public override PrimitiveBaseShape Shape
532 { 552 {
533 set 553 set { return; }
534 {
535 return;
536 }
537 } 554 }
538 555
539 public override PhysicsVector Velocity 556 public override PhysicsVector Velocity
@@ -571,6 +588,7 @@ namespace OpenSim.Region.Physics.POSPlugin
571 public override void SetMomentum(PhysicsVector momentum) 588 public override void SetMomentum(PhysicsVector momentum)
572 { 589 {
573 } 590 }
591
574 public override bool Flying 592 public override bool Flying
575 { 593 {
576 get { return false; } 594 get { return false; }
@@ -583,4 +601,4 @@ namespace OpenSim.Region.Physics.POSPlugin
583 set { return; } 601 set { return; }
584 } 602 }
585 } 603 }
586} 604} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
index 8e6d2a6..36cb952 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs
@@ -55,4 +55,4 @@ using System.Runtime.InteropServices;
55// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
56// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
57 57
58[assembly : AssemblyVersion("1.0.*")] 58[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 8525e75..20bf358 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -128,17 +128,19 @@ namespace OpenSim.Region.Physics.PhysXPlugin
128 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 128 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
129 PhysicsVector size, Quaternion rotation) //To be removed 129 PhysicsVector size, Quaternion rotation) //To be removed
130 { 130 {
131 return this.AddPrimShape(primName, pbs, position, size, rotation, false); 131 return AddPrimShape(primName, pbs, position, size, rotation, false);
132 } 132 }
133
133 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 134 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position,
134 PhysicsVector size, Quaternion rotation, bool isPhysical) 135 PhysicsVector size, Quaternion rotation, bool isPhysical)
135 { 136 {
136 return AddPrim(position, size, rotation); 137 return AddPrim(position, size, rotation);
137 } 138 }
139
138 public override void AddPhysicsActorTaint(PhysicsActor prim) 140 public override void AddPhysicsActorTaint(PhysicsActor prim)
139 { 141 {
140
141 } 142 }
143
142 public override float Simulate(float timeStep) 144 public override float Simulate(float timeStep)
143 { 145 {
144 float fps = 0f; 146 float fps = 0f;
@@ -209,51 +211,61 @@ namespace OpenSim.Region.Physics.PhysXPlugin
209 _acceleration = new PhysicsVector(); 211 _acceleration = new PhysicsVector();
210 _character = character; 212 _character = character;
211 } 213 }
214
212 public override int PhysicsActorType 215 public override int PhysicsActorType
213 { 216 {
214 get { return (int)ActorTypes.Agent; } 217 get { return (int) ActorTypes.Agent; }
215 set { return; } 218 set { return; }
216 } 219 }
220
217 public override bool SetAlwaysRun 221 public override bool SetAlwaysRun
218 { 222 {
219 get { return false; } 223 get { return false; }
220 set { return; } 224 set { return; }
221 } 225 }
226
222 public override bool IsPhysical 227 public override bool IsPhysical
223 { 228 {
224 get { return false; } 229 get { return false; }
225 set { return; } 230 set { return; }
226 } 231 }
232
227 public override bool ThrottleUpdates 233 public override bool ThrottleUpdates
228 { 234 {
229 get { return false; } 235 get { return false; }
230 set { return; } 236 set { return; }
231 } 237 }
238
232 public override bool Flying 239 public override bool Flying
233 { 240 {
234 get { return flying; } 241 get { return flying; }
235 set { flying = value; } 242 set { flying = value; }
236 } 243 }
244
237 public override bool IsColliding 245 public override bool IsColliding
238 { 246 {
239 get { return iscolliding; } 247 get { return iscolliding; }
240 set { iscolliding = value; } 248 set { iscolliding = value; }
241 } 249 }
250
242 public override bool CollidingGround 251 public override bool CollidingGround
243 { 252 {
244 get { return false; } 253 get { return false; }
245 set { return; } 254 set { return; }
246 } 255 }
256
247 public override bool CollidingObj 257 public override bool CollidingObj
248 { 258 {
249 get { return false; } 259 get { return false; }
250 set { return; } 260 set { return; }
251 } 261 }
262
252 public override PhysicsVector RotationalVelocity 263 public override PhysicsVector RotationalVelocity
253 { 264 {
254 get { return m_rotationalVelocity; } 265 get { return m_rotationalVelocity; }
255 set { m_rotationalVelocity = value; } 266 set { m_rotationalVelocity = value; }
256 } 267 }
268
257 public override PhysicsVector Position 269 public override PhysicsVector Position
258 { 270 {
259 get { return _position; } 271 get { return _position; }
@@ -273,22 +285,27 @@ namespace OpenSim.Region.Physics.PhysXPlugin
273 get { return PhysicsVector.Zero; } 285 get { return PhysicsVector.Zero; }
274 set { } 286 set { }
275 } 287 }
288
276 public override float Mass 289 public override float Mass
277 { 290 {
278 get { return 0f; } 291 get { return 0f; }
279 } 292 }
293
280 public override PhysicsVector Force 294 public override PhysicsVector Force
281 { 295 {
282 get { return PhysicsVector.Zero; } 296 get { return PhysicsVector.Zero; }
283 } 297 }
298
284 public override PhysicsVector CenterOfMass 299 public override PhysicsVector CenterOfMass
285 { 300 {
286 get { return PhysicsVector.Zero; } 301 get { return PhysicsVector.Zero; }
287 } 302 }
303
288 public override PhysicsVector GeometricCenter 304 public override PhysicsVector GeometricCenter
289 { 305 {
290 get { return PhysicsVector.Zero; } 306 get { return PhysicsVector.Zero; }
291 } 307 }
308
292 public override PhysicsVector Velocity 309 public override PhysicsVector Velocity
293 { 310 {
294 get { return _velocity; } 311 get { return _velocity; }
@@ -345,23 +362,21 @@ namespace OpenSim.Region.Physics.PhysXPlugin
345 gravityAccel = 0; 362 gravityAccel = 0;
346 } 363 }
347 } 364 }
365
348 public override PrimitiveBaseShape Shape 366 public override PrimitiveBaseShape Shape
349 { 367 {
350 set 368 set { return; }
351 { 369 }
352 return; 370
353 } 371 public void UpdatePosition()
372 {
373 Vec3 vec = _character.Position;
374 _position.X = vec.X;
375 _position.Y = vec.Y;
376 _position.Z = vec.Z;
354 } 377 }
355 378 }
356 public void UpdatePosition() 379
357 {
358 Vec3 vec = this._character.Position;
359 this._position.X = vec.X;
360 this._position.Y = vec.Y;
361 this._position.Z = vec.Z;
362 }
363 }
364
365 380
366 public class PhysXPrim : PhysicsActor 381 public class PhysXPrim : PhysicsActor
367 { 382 {
@@ -376,55 +391,62 @@ namespace OpenSim.Region.Physics.PhysXPlugin
376 _acceleration = new PhysicsVector(); 391 _acceleration = new PhysicsVector();
377 _prim = prim; 392 _prim = prim;
378 } 393 }
394
379 public override int PhysicsActorType 395 public override int PhysicsActorType
380 { 396 {
381 get { return (int)ActorTypes.Prim; } 397 get { return (int) ActorTypes.Prim; }
382 set { return; } 398 set { return; }
383 } 399 }
400
384 public override bool IsPhysical 401 public override bool IsPhysical
385 { 402 {
386 get { return false; } 403 get { return false; }
387 set { return; } 404 set { return; }
388 } 405 }
406
389 public override bool SetAlwaysRun 407 public override bool SetAlwaysRun
390 { 408 {
391 get { return false; } 409 get { return false; }
392 set { return; } 410 set { return; }
393 } 411 }
412
394 public override bool ThrottleUpdates 413 public override bool ThrottleUpdates
395 { 414 {
396 get { return false; } 415 get { return false; }
397 set { return; } 416 set { return; }
398 } 417 }
418
399 public override PhysicsVector RotationalVelocity 419 public override PhysicsVector RotationalVelocity
400 { 420 {
401 get { return m_rotationalVelocity; } 421 get { return m_rotationalVelocity; }
402 set { m_rotationalVelocity = value; } 422 set { m_rotationalVelocity = value; }
403 } 423 }
424
404 public override bool Flying 425 public override bool Flying
405 { 426 {
406 get { return false; //no flying prims for you 427 get { return false; //no flying prims for you
407 } 428 }
408 set { } 429 set { }
409 } 430 }
431
410 public override bool IsColliding 432 public override bool IsColliding
411 { 433 {
412 get 434 get { return false; }
413 {
414 return false;
415 }
416 set { } 435 set { }
417 } 436 }
437
418 public override bool CollidingGround 438 public override bool CollidingGround
419 { 439 {
420 get { return false; } 440 get { return false; }
421 set { return; } 441 set { return; }
422 } 442 }
443
423 public override bool CollidingObj 444 public override bool CollidingObj
424 { 445 {
425 get { return false; } 446 get { return false; }
426 set { return; } 447 set { return; }
427 } 448 }
449
428 public override PhysicsVector Position 450 public override PhysicsVector Position
429 { 451 {
430 get 452 get
@@ -449,75 +471,52 @@ namespace OpenSim.Region.Physics.PhysXPlugin
449 471
450 public override PrimitiveBaseShape Shape 472 public override PrimitiveBaseShape Shape
451 { 473 {
452 set 474 set { return; }
453 {
454 return;
455 }
456 } 475 }
457 476
458 public override PhysicsVector Velocity 477 public override PhysicsVector Velocity
459 { 478 {
460 get 479 get { return _velocity; }
461 { 480 set { _velocity = value; }
462 return _velocity;
463 }
464 set
465 {
466 _velocity = value;
467 }
468 } 481 }
469 482
470 public override bool Kinematic 483 public override bool Kinematic
471 { 484 {
472 get 485 get { return _prim.Kinematic; }
473 { 486 set { _prim.Kinematic = value; }
474 return this._prim.Kinematic;
475 }
476 set
477 {
478 this._prim.Kinematic = value;
479 }
480 } 487 }
481 488
482 public override Quaternion Orientation 489 public override Quaternion Orientation
483 { 490 {
484 get 491 get
485 { 492 {
486 Quaternion res = new Quaternion(); 493 Quaternion res = new Quaternion();
487 PhysXWrapper.Quaternion quat = this._prim.GetOrientation(); 494 PhysXWrapper.Quaternion quat = _prim.GetOrientation();
488 res.w = quat.W; 495 res.w = quat.W;
489 res.x = quat.X; 496 res.x = quat.X;
490 res.y = quat.Y; 497 res.y = quat.Y;
491 res.z = quat.Z; 498 res.z = quat.Z;
492 return res; 499 return res;
493 } 500 }
494 set 501 set { }
495 {
496
497 }
498 } 502 }
499 503
500 public override PhysicsVector Acceleration 504 public override PhysicsVector Acceleration
501 { 505 {
502 get 506 get { return _acceleration; }
503 {
504 return _acceleration;
505 }
506
507 } 507 }
508 public void SetAcceleration (PhysicsVector accel) 508
509 public void SetAcceleration(PhysicsVector accel)
509 { 510 {
510 this._acceleration = accel; 511 _acceleration = accel;
511 } 512 }
512 513
513 public override void AddForce(PhysicsVector force) 514 public override void AddForce(PhysicsVector force)
514 { 515 {
515
516 } 516 }
517 517
518 public override void SetMomentum(PhysicsVector momentum) 518 public override void SetMomentum(PhysicsVector momentum)
519 { 519 {
520
521 } 520 }
522 521
523 public override PhysicsVector Size 522 public override PhysicsVector Size
@@ -545,6 +544,5 @@ namespace OpenSim.Region.Physics.PhysXPlugin
545 { 544 {
546 get { return PhysicsVector.Zero; } 545 get { return PhysicsVector.Zero; }
547 } 546 }
548
549 } 547 }
550} 548} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
index 6ba7018..9c595ed 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
@@ -634,4 +634,4 @@ namespace OpenSim.Region.ScriptEngine.Common
634 //OpenSim functions 634 //OpenSim functions
635 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer); 635 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
636 } 636 }
637} 637} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index 3a0b8ed..232baf8 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Common
80 { 80 {
81 if (!(o is Vector3)) return false; 81 if (!(o is Vector3)) return false;
82 82
83 Vector3 vector = (Vector3)o; 83 Vector3 vector = (Vector3) o;
84 84
85 return (x == vector.x && x == vector.x && z == vector.z); 85 return (x == vector.x && x == vector.x && z == vector.z);
86 } 86 }
@@ -88,11 +88,12 @@ namespace OpenSim.Region.ScriptEngine.Common
88 #endregion 88 #endregion
89 89
90 #region Vector & Vector Math 90 #region Vector & Vector Math
91
91 // Vector-Vector Math 92 // Vector-Vector Math
92 public static Vector3 operator +(Vector3 lhs, Vector3 rhs) 93 public static Vector3 operator +(Vector3 lhs, Vector3 rhs)
93 { 94 {
94 return new Vector3(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z); 95 return new Vector3(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z);
95 } 96 }
96 97
97 public static Vector3 operator -(Vector3 lhs, Vector3 rhs) 98 public static Vector3 operator -(Vector3 lhs, Vector3 rhs)
98 { 99 {
@@ -101,51 +102,53 @@ namespace OpenSim.Region.ScriptEngine.Common
101 102
102 public static Vector3 operator *(Vector3 lhs, Vector3 rhs) 103 public static Vector3 operator *(Vector3 lhs, Vector3 rhs)
103 { 104 {
104 return new Vector3(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z); 105 return new Vector3(lhs.x*rhs.x, lhs.y*rhs.y, lhs.z*rhs.z);
105 } 106 }
106 107
107 public static Vector3 operator %(Vector3 v1, Vector3 v2) 108 public static Vector3 operator %(Vector3 v1, Vector3 v2)
108 { 109 {
109 //Cross product 110 //Cross product
110 Vector3 tv; 111 Vector3 tv;
111 tv.x = (v1.y * v2.z) - (v1.z * v2.y); 112 tv.x = (v1.y*v2.z) - (v1.z*v2.y);
112 tv.y = (v1.z * v2.x) - (v1.x * v2.z); 113 tv.y = (v1.z*v2.x) - (v1.x*v2.z);
113 tv.z = (v1.x * v2.y) - (v1.y * v2.x); 114 tv.z = (v1.x*v2.y) - (v1.y*v2.x);
114 return tv; 115 return tv;
115 } 116 }
116 117
117 #endregion 118 #endregion
118 119
119 #region Vector & Float Math 120 #region Vector & Float Math
121
120 // Vector-Float and Float-Vector Math 122 // Vector-Float and Float-Vector Math
121 public static Vector3 operator *(Vector3 vec, float val) 123 public static Vector3 operator *(Vector3 vec, float val)
122 { 124 {
123 return new Vector3(vec.x * val, vec.y * val, vec.z * val); 125 return new Vector3(vec.x*val, vec.y*val, vec.z*val);
124 } 126 }
125 127
126 public static Vector3 operator *(float val, Vector3 vec) 128 public static Vector3 operator *(float val, Vector3 vec)
127 { 129 {
128 return new Vector3(vec.x * val, vec.y * val, vec.z * val); 130 return new Vector3(vec.x*val, vec.y*val, vec.z*val);
129 } 131 }
130 132
131 public static Vector3 operator /(Vector3 v, float f) 133 public static Vector3 operator /(Vector3 v, float f)
132 { 134 {
133 v.x = v.x / f; 135 v.x = v.x/f;
134 v.y = v.y / f; 136 v.y = v.y/f;
135 v.z = v.z / f; 137 v.z = v.z/f;
136 return v; 138 return v;
137 } 139 }
138 140
139 #endregion 141 #endregion
140 142
141 #region Vector & Rotation Math 143 #region Vector & Rotation Math
144
142 // Vector-Rotation Math 145 // Vector-Rotation Math
143 public static Vector3 operator *(Vector3 v, Quaternion r) 146 public static Vector3 operator *(Vector3 v, Quaternion r)
144 { 147 {
145 Quaternion vq = new Quaternion(v.x, v.y, v.z, 0); 148 Quaternion vq = new Quaternion(v.x, v.y, v.z, 0);
146 Quaternion nq = new Quaternion(-r.x, -r.y, -r.z, r.s); 149 Quaternion nq = new Quaternion(-r.x, -r.y, -r.z, r.s);
147 150
148 Quaternion result = (r * vq) * nq; 151 Quaternion result = (r*vq)*nq;
149 152
150 return new Vector3(result.x, result.y, result.z); 153 return new Vector3(result.x, result.y, result.z);
151 } 154 }
@@ -157,38 +160,41 @@ namespace OpenSim.Region.ScriptEngine.Common
157 Quaternion vq = new Quaternion(vec.x, vec.y, vec.z, 0); 160 Quaternion vq = new Quaternion(vec.x, vec.y, vec.z, 0);
158 Quaternion nq = new Quaternion(-quat.x, -quat.y, -quat.z, quat.s); 161 Quaternion nq = new Quaternion(-quat.x, -quat.y, -quat.z, quat.s);
159 162
160 Quaternion result = (quat * vq) * nq; 163 Quaternion result = (quat*vq)*nq;
161 164
162 return new Vector3(result.x, result.y, result.z); 165 return new Vector3(result.x, result.y, result.z);
163 } 166 }
167
164 #endregion 168 #endregion
165 169
166 #region Static Helper Functions 170 #region Static Helper Functions
171
167 public static double Dot(Vector3 v1, Vector3 v2) 172 public static double Dot(Vector3 v1, Vector3 v2)
168 { 173 {
169 return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z); 174 return (v1.x*v2.x) + (v1.y*v2.y) + (v1.z*v2.z);
170 } 175 }
171 176
172 public static Vector3 Cross(Vector3 v1, Vector3 v2) 177 public static Vector3 Cross(Vector3 v1, Vector3 v2)
173 { 178 {
174 return new Vector3 179 return new Vector3
175 ( 180 (
176 v1.y * v2.z - v1.z * v2.y, 181 v1.y*v2.z - v1.z*v2.y,
177 v1.z * v2.x - v1.x * v2.z, 182 v1.z*v2.x - v1.x*v2.z,
178 v1.x * v2.y - v1.y * v2.x 183 v1.x*v2.y - v1.y*v2.x
179 ); 184 );
180 } 185 }
181 186
182 public static float Mag(Vector3 v) 187 public static float Mag(Vector3 v)
183 { 188 {
184 return (float)Math.Sqrt(v.x * v.y + v.y * v.y + v.z * v.z); 189 return (float) Math.Sqrt(v.x*v.y + v.y*v.y + v.z*v.z);
185 } 190 }
186 191
187 public static Vector3 Norm(Vector3 vector) 192 public static Vector3 Norm(Vector3 vector)
188 { 193 {
189 float mag = Mag(vector); 194 float mag = Mag(vector);
190 return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); 195 return new Vector3(vector.x/mag, vector.y/mag, vector.z/mag);
191 } 196 }
197
192 #endregion 198 #endregion
193 } 199 }
194 200
@@ -227,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Common
227 { 233 {
228 if (!(o is Quaternion)) return false; 234 if (!(o is Quaternion)) return false;
229 235
230 Quaternion quaternion = (Quaternion)o; 236 Quaternion quaternion = (Quaternion) o;
231 237
232 return x == quaternion.x && y == quaternion.y && z == quaternion.z && s == quaternion.s; 238 return x == quaternion.x && y == quaternion.y && z == quaternion.z && s == quaternion.s;
233 } 239 }
@@ -253,10 +259,10 @@ namespace OpenSim.Region.ScriptEngine.Common
253 public static Quaternion operator *(Quaternion a, Quaternion b) 259 public static Quaternion operator *(Quaternion a, Quaternion b)
254 { 260 {
255 Quaternion c; 261 Quaternion c;
256 c.x = a.s * b.x + a.x * b.s + a.y * b.z - a.z * b.y; 262 c.x = a.s*b.x + a.x*b.s + a.y*b.z - a.z*b.y;
257 c.y = a.s * b.y + a.y * b.s + a.z * b.x - a.x * b.z; 263 c.y = a.s*b.y + a.y*b.s + a.z*b.x - a.x*b.z;
258 c.z = a.s * b.z + a.z * b.s + a.x * b.y - a.y * b.x; 264 c.z = a.s*b.z + a.z*b.s + a.x*b.y - a.y*b.x;
259 c.s = a.s * b.s - a.x * b.x - a.y * b.y - a.z * b.z; 265 c.s = a.s*b.s - a.x*b.x - a.y*b.y - a.z*b.z;
260 return c; 266 return c;
261 } 267 }
262 } 268 }
@@ -324,7 +330,7 @@ namespace OpenSim.Region.ScriptEngine.Common
324 { 330 {
325 if (start >= m_data.Length) 331 if (start >= m_data.Length)
326 { 332 {
327 return this.GetSublist(0, end); 333 return GetSublist(0, end);
328 } 334 }
329 if (end >= m_data.Length) 335 if (end >= m_data.Length)
330 { 336 {
@@ -334,7 +340,7 @@ namespace OpenSim.Region.ScriptEngine.Common
334 //ret = new object[m_data.Length - Math.Abs(end - start + 1)]; 340 //ret = new object[m_data.Length - Math.Abs(end - start + 1)];
335 //Array.Copy(m_data, 0, ret, m_data.Length - start, end + 1); 341 //Array.Copy(m_data, 0, ret, m_data.Length - start, end + 1);
336 //Array.Copy(m_data, start, ret, 0, m_data.Length - start); 342 //Array.Copy(m_data, start, ret, 0, m_data.Length - start);
337 return this.GetSublist(0, end) + this.GetSublist(start, this.Data.Length - 1); 343 return GetSublist(0, end) + GetSublist(start, Data.Length - 1);
338 //return new list(ret); 344 //return new list(ret);
339 } 345 }
340 } 346 }
@@ -379,4 +385,4 @@ namespace OpenSim.Region.ScriptEngine.Common
379 } 385 }
380 } 386 }
381 } 387 }
382} 388} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
index e5f7220..4594ad8 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Common.cs
@@ -52,4 +52,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
52 //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message); 52 //SendToLogEvent("\r\n" + DateTime.Now.ToString("[HH:mm:ss] ") + Message);
53 } 53 }
54 } 54 }
55} 55} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index c81e6bd..0623cc5 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -39,7 +39,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
39 private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); 39 private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
40 private CSharpCodeProvider codeProvider = new CSharpCodeProvider(); 40 private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
41 private static UInt64 scriptCompileCounter = 0; 41 private static UInt64 scriptCompileCounter = 0;
42 private static int instanceID = new Random().Next(0, int.MaxValue); // Implemented due to peer preassure --- will cause garbage in ScriptEngines folder ;) 42
43 private static int instanceID = new Random().Next(0, int.MaxValue);
44 // Implemented due to peer preassure --- will cause garbage in ScriptEngines folder ;)
45
43 //private ICodeCompiler icc = codeProvider.CreateCompiler(); 46 //private ICodeCompiler icc = codeProvider.CreateCompiler();
44 public string CompileFromFile(string LSOFileName) 47 public string CompileFromFile(string LSOFileName)
45 { 48 {
@@ -83,7 +86,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
83 { 86 {
84 // Output assembly name 87 // Output assembly name
85 scriptCompileCounter++; 88 scriptCompileCounter++;
86 string OutFile = Path.Combine("ScriptEngines", "DotNetScript_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll"); 89 string OutFile =
90 Path.Combine("ScriptEngines",
91 "DotNetScript_" + instanceID.ToString() + "_" + scriptCompileCounter.ToString() + ".dll");
87 try 92 try
88 { 93 {
89 File.Delete(OutFile); 94 File.Delete(OutFile);
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
index 4063647..8e37798 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs
@@ -316,8 +316,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
316 316
317 317
318 quotes.Clear(); 318 quotes.Clear();
319 319
320 return Return; 320 return Return;
321 } 321 }
322 } 322 }
323} 323} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
index a9297fd..2796b64 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs
@@ -1638,7 +1638,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
1638 1638
1639 public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) 1639 public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end)
1640 { 1640 {
1641 return m_LSL_Functions.llListReplaceList(dest,src,start,end); 1641 return m_LSL_Functions.llListReplaceList(dest, src, start, end);
1642 } 1642 }
1643 1643
1644 public void llLoadURL(string avatar_id, string message, string url) 1644 public void llLoadURL(string avatar_id, string message, string url)
@@ -2025,7 +2025,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
2025 public const int REMOTE_DATA_CHANNEL = 1; 2025 public const int REMOTE_DATA_CHANNEL = 1;
2026 public const int REMOTE_DATA_REQUEST = 2; 2026 public const int REMOTE_DATA_REQUEST = 2;
2027 public const int REMOTE_DATA_REPLY = 3; 2027 public const int REMOTE_DATA_REPLY = 3;
2028 2028
2029 public const int PRIM_MATERIAL = 2; 2029 public const int PRIM_MATERIAL = 2;
2030 public const int PRIM_PHYSICS = 3; 2030 public const int PRIM_PHYSICS = 3;
2031 public const int PRIM_TEMP_ON_REZ = 4; 2031 public const int PRIM_TEMP_ON_REZ = 4;
@@ -2041,7 +2041,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
2041 public const int PRIM_FLEXIBLE = 21; 2041 public const int PRIM_FLEXIBLE = 21;
2042 public const int PRIM_TEXGEN = 22; 2042 public const int PRIM_TEXGEN = 22;
2043 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake 2043 public const int PRIM_CAST_SHADOWS = 24; // Not implemented, here for completeness sake
2044 public const int PRIM_POINT_LIGHT = 23; // Huh? 2044 public const int PRIM_POINT_LIGHT = 23; // Huh?
2045 public const int PRIM_TEXGEN_DEFAULT = 0; 2045 public const int PRIM_TEXGEN_DEFAULT = 0;
2046 public const int PRIM_TEXGEN_PLANAR = 1; 2046 public const int PRIM_TEXGEN_PLANAR = 1;
2047 public const int PRIM_TYPE_BOX = 0; 2047 public const int PRIM_TYPE_BOX = 0;
@@ -2122,4 +2122,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
2122 public vector ZERO_VECTOR = new vector(0, 0, 0); 2122 public vector ZERO_VECTOR = new vector(0, 0, 0);
2123 public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0); 2123 public rotation ZERO_ROTATION = new rotation(0, 0, 0, 0);
2124 } 2124 }
2125} 2125} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index bc47241..d5a31fb 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -28,13 +28,11 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Collections;
32using System.Runtime.Remoting.Lifetime; 31using System.Runtime.Remoting.Lifetime;
33using System.Text; 32using System.Text;
34using System.Threading; 33using System.Threading;
35using Axiom.Math; 34using Axiom.Math;
36using libsecondlife; 35using libsecondlife;
37using libsecondlife.StructuredData;
38using OpenSim.Framework; 36using OpenSim.Framework;
39using OpenSim.Region.Environment.Interfaces; 37using OpenSim.Region.Environment.Interfaces;
40using OpenSim.Region.Environment.Scenes; 38using OpenSim.Region.Environment.Scenes;
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
index 161cedf..8dfd908 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs
@@ -217,4 +217,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
217 { 217 {
218 } 218 }
219 } 219 }
220} 220} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index 890335b..2d0d69d 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -184,9 +184,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
184 { 184 {
185#if DEBUG 185#if DEBUG
186 m_ScriptEngine.Log.Debug("ScriptEngine", "Executing event:\r\n" 186 m_ScriptEngine.Log.Debug("ScriptEngine", "Executing event:\r\n"
187 + "QIS.localID: " + QIS.localID 187 + "QIS.localID: " + QIS.localID
188 + ", QIS.itemID: " + QIS.itemID 188 + ", QIS.itemID: " + QIS.itemID
189 + ", QIS.functionName: " + QIS.functionName); 189 + ", QIS.functionName: " + QIS.functionName);
190#endif 190#endif
191 m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID, 191 m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, QIS.itemID,
192 QIS.functionName, QIS.param); 192 QIS.functionName, QIS.param);
@@ -197,14 +197,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
197 string text = "Error executing script function \"" + QIS.functionName + "\":\r\n"; 197 string text = "Error executing script function \"" + QIS.functionName + "\":\r\n";
198 //if (e.InnerException != null) 198 //if (e.InnerException != null)
199 //{ 199 //{
200 // Send inner exception 200 // Send inner exception
201 text += e.InnerException.Message.ToString(); 201 text += e.InnerException.Message.ToString();
202 //} 202 //}
203 //else 203 //else
204 //{ 204 //{
205 text += "\r\n"; 205 text += "\r\n";
206 // Send normal 206 // Send normal
207 text += e.Message.ToString(); 207 text += e.Message.ToString();
208 //} 208 //}
209 try 209 try
210 { 210 {
@@ -222,7 +222,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
222 //else 222 //else
223 //{ 223 //{
224 // T oconsole 224 // T oconsole
225 m_ScriptEngine.Log.Error("ScriptEngine", "Unable to send text in-world:\r\n" + text); 225 m_ScriptEngine.Log.Error("ScriptEngine",
226 "Unable to send text in-world:\r\n" + text);
226 } 227 }
227 } 228 }
228 finally 229 finally
@@ -338,4 +339,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
338 } 339 }
339 } 340 }
340 } 341 }
341} 342} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
index fdd7260..e403385 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/LSLLongCmdHandler.cs
@@ -202,17 +202,16 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
202 202
203 public void CheckHttpRequests() 203 public void CheckHttpRequests()
204 { 204 {
205 IHttpRequests iHttpReq = 205 IHttpRequests iHttpReq =
206 m_ScriptEngine.World.RequestModuleInterface<IHttpRequests>(); 206 m_ScriptEngine.World.RequestModuleInterface<IHttpRequests>();
207 207
208 HttpRequestClass httpInfo = null; 208 HttpRequestClass httpInfo = null;
209 209
210 if( iHttpReq != null ) 210 if (iHttpReq != null)
211 httpInfo = iHttpReq.GetNextCompletedRequest(); 211 httpInfo = iHttpReq.GetNextCompletedRequest();
212 212
213 while ( httpInfo != null ) 213 while (httpInfo != null)
214 { 214 {
215
216 //Console.WriteLine("PICKED HTTP REQ:" + httpInfo.response_body + httpInfo.status); 215 //Console.WriteLine("PICKED HTTP REQ:" + httpInfo.response_body + httpInfo.status);
217 216
218 // Deliver data to prim's remote_data handler 217 // Deliver data to prim's remote_data handler
@@ -221,7 +220,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
221 // only returns the byte for HTTP_BODY_TRUNCATED, which is not 220 // only returns the byte for HTTP_BODY_TRUNCATED, which is not
222 // implemented here yet anyway. Should be fixed if/when maxsize 221 // implemented here yet anyway. Should be fixed if/when maxsize
223 // is supported 222 // is supported
224 223
225 object[] resobj = new object[] 224 object[] resobj = new object[]
226 { 225 {
227 httpInfo.reqID.ToString(), httpInfo.status, null, httpInfo.response_body 226 httpInfo.reqID.ToString(), httpInfo.status, null, httpInfo.response_body
@@ -254,7 +253,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
254 //Deliver data to prim's remote_data handler 253 //Deliver data to prim's remote_data handler
255 object[] resobj = new object[] 254 object[] resobj = new object[]
256 { 255 {
257 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "", rInfo.GetIntValue(), 256 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), "",
257 rInfo.GetIntValue(),
258 rInfo.GetStrVal() 258 rInfo.GetStrVal()
259 }; 259 };
260 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 260 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -284,4 +284,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
284 } 284 }
285 } 285 }
286 } 286 }
287} 287} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
index c1c792c..82049f7 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs
@@ -121,4 +121,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
121 121
122 #endregion 122 #endregion
123 } 123 }
124} 124} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 6b83dff..e211902 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -224,7 +224,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
224 224
225 #region Start/Stop/Reset script 225 #region Start/Stop/Reset script
226 226
227 Object startStopLock = new Object(); 227 private Object startStopLock = new Object();
228 228
229 /// <summary> 229 /// <summary>
230 /// Fetches, loads and hooks up a script to an objects events 230 /// Fetches, loads and hooks up a script to an objects events
@@ -261,7 +261,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
261 } 261 }
262 262
263 // Create a new instance of the compiler (reuse) 263 // Create a new instance of the compiler (reuse)
264 Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler(); 264 private Compiler.LSL.Compiler LSLCompiler = new Compiler.LSL.Compiler();
265
265 private void _StartScript(uint localID, LLUUID itemID, string Script) 266 private void _StartScript(uint localID, LLUUID itemID, string Script)
266 { 267 {
267 lock (startStopLock) 268 lock (startStopLock)
@@ -316,7 +317,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
316 CompiledScript.Start(LSLB); 317 CompiledScript.Start(LSLB);
317 318
318 // Fire the first start-event 319 // Fire the first start-event
319 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] { }); 320 m_scriptEngine.m_EventQueueManager.AddToScriptQueue(localID, itemID, "state_entry", new object[] {});
320 } 321 }
321 catch (Exception e) 322 catch (Exception e)
322 { 323 {
@@ -327,12 +328,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
327 string text = "Error compiling script:\r\n" + e.Message.ToString(); 328 string text = "Error compiling script:\r\n" + e.Message.ToString();
328 if (text.Length > 1500) 329 if (text.Length > 1500)
329 text = text.Substring(0, 1500); 330 text = text.Substring(0, 1500);
330 World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 331 World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition,
332 m_host.Name, m_host.UUID);
331 } 333 }
332 catch (Exception e2) 334 catch (Exception e2)
333 { 335 {
334 m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); 336 m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString());
335 m_scriptEngine.Log.Error("ScriptEngine", "Errormessage: Error compiling script:\r\n" + e.Message.ToString()); 337 m_scriptEngine.Log.Error("ScriptEngine",
338 "Errormessage: Error compiling script:\r\n" + e.Message.ToString());
336 } 339 }
337 } 340 }
338 } 341 }
@@ -342,39 +345,39 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
342 { 345 {
343 lock (startStopLock) 346 lock (startStopLock)
344 { 347 {
345 // Stop script 348 // Stop script
346 Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString()); 349 Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString());
347 350
348 351
349 // Stop long command on script 352 // Stop long command on script
350 m_scriptEngine.m_LSLLongCmdHandler.RemoveScript(localID, itemID); 353 m_scriptEngine.m_LSLLongCmdHandler.RemoveScript(localID, itemID);
351 354
352 LSL_BaseClass LSLBC = GetScript(localID, itemID); 355 LSL_BaseClass LSLBC = GetScript(localID, itemID);
353 if (LSLBC == null) 356 if (LSLBC == null)
354 return; 357 return;
355 358
356 // TEMP: First serialize it 359 // TEMP: First serialize it
357 //GetSerializedScript(localID, itemID); 360 //GetSerializedScript(localID, itemID);
358 361
359 362
360 try 363 try
361 { 364 {
362 // Get AppDomain 365 // Get AppDomain
363 AppDomain ad = LSLBC.Exec.GetAppDomain(); 366 AppDomain ad = LSLBC.Exec.GetAppDomain();
364 // Tell script not to accept new requests 367 // Tell script not to accept new requests
365 GetScript(localID, itemID).Exec.StopScript(); 368 GetScript(localID, itemID).Exec.StopScript();
366 // Remove from internal structure 369 // Remove from internal structure
367 RemoveScript(localID, itemID); 370 RemoveScript(localID, itemID);
368 // Tell AppDomain that we have stopped script 371 // Tell AppDomain that we have stopped script
369 m_scriptEngine.m_AppDomainManager.StopScript(ad); 372 m_scriptEngine.m_AppDomainManager.StopScript(ad);
370 } 373 }
371 catch (Exception e) 374 catch (Exception e)
372 { 375 {
373 Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + 376 Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
374 ": " + e.ToString()); 377 ": " + e.ToString());
378 }
375 } 379 }
376 } 380 }
377 }
378 381
379 private string ProcessYield(string FileName) 382 private string ProcessYield(string FileName)
380 { 383 {
@@ -435,4 +438,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
435 438
436 #endregion 439 #endregion
437 } 440 }
438} 441} \ No newline at end of file
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
index 60aeb83..5818583 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MSSQL/MSSQLDataStore.cs
@@ -33,8 +33,8 @@ using System.Data.SqlClient;
33using System.IO; 33using System.IO;
34using libsecondlife; 34using libsecondlife;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Data;
37using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Data;
38using OpenSim.Region.Environment.Interfaces; 38using OpenSim.Region.Environment.Interfaces;
39using OpenSim.Region.Environment.LandManagement; 39using OpenSim.Region.Environment.LandManagement;
40using OpenSim.Region.Environment.Scenes; 40using OpenSim.Region.Environment.Scenes;
@@ -62,7 +62,9 @@ namespace OpenSim.DataStore.MSSQL
62 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id"); 62 string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
63 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); 63 string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
64 64
65 string connectionString = "Data Source=" + settingDataSource + ";Initial Catalog=" + settingInitialCatalog + ";Persist Security Info=" + settingPersistSecurityInfo + ";User ID=" + settingUserId + ";Password=" + settingPassword + ";"; 65 string connectionString = "Data Source=" + settingDataSource + ";Initial Catalog=" + settingInitialCatalog +
66 ";Persist Security Info=" + settingPersistSecurityInfo + ";User ID=" +
67 settingUserId + ";Password=" + settingPassword + ";";
66 68
67 ds = new DataSet(); 69 ds = new DataSet();
68 70
@@ -85,11 +87,12 @@ namespace OpenSim.DataStore.MSSQL
85 // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema"); 87 // primDa.FillSchema(ds, SchemaType.Source, "PrimSchema");
86 TestTables(conn); 88 TestTables(conn);
87 89
88 lock(ds) { 90 lock (ds)
91 {
89 ds.Tables.Add(createPrimTable()); 92 ds.Tables.Add(createPrimTable());
90 setupPrimCommands(primDa, conn); 93 setupPrimCommands(primDa, conn);
91 primDa.Fill(ds.Tables["prims"]); 94 primDa.Fill(ds.Tables["prims"]);
92 95
93 ds.Tables.Add(createShapeTable()); 96 ds.Tables.Add(createShapeTable());
94 setupShapeCommands(shapeDa, conn); 97 setupShapeCommands(shapeDa, conn);
95 98
@@ -122,7 +125,8 @@ namespace OpenSim.DataStore.MSSQL
122 125
123 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) 126 public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
124 { 127 {
125 lock (ds) { 128 lock (ds)
129 {
126 foreach (SceneObjectPart prim in obj.Children.Values) 130 foreach (SceneObjectPart prim in obj.Children.Values)
127 { 131 {
128 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); 132 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID);
@@ -140,11 +144,12 @@ namespace OpenSim.DataStore.MSSQL
140 DataTable shapes = ds.Tables["primshapes"]; 144 DataTable shapes = ds.Tables["primshapes"];
141 145
142 string selectExp = "SceneGroupID = '" + obj.ToString() + "'"; 146 string selectExp = "SceneGroupID = '" + obj.ToString() + "'";
143 lock (ds) { 147 lock (ds)
148 {
144 DataRow[] primRows = prims.Select(selectExp); 149 DataRow[] primRows = prims.Select(selectExp);
145 foreach (DataRow row in primRows) 150 foreach (DataRow row in primRows)
146 { 151 {
147 LLUUID uuid = new LLUUID((string)row["UUID"]); 152 LLUUID uuid = new LLUUID((string) row["UUID"]);
148 DataRow shapeRow = shapes.Rows.Find(uuid); 153 DataRow shapeRow = shapes.Rows.Find(uuid);
149 if (shapeRow != null) 154 if (shapeRow != null)
150 { 155 {
@@ -153,7 +158,7 @@ namespace OpenSim.DataStore.MSSQL
153 row.Delete(); 158 row.Delete();
154 } 159 }
155 } 160 }
156 161
157 Commit(); 162 Commit();
158 } 163 }
159 164
@@ -169,16 +174,18 @@ namespace OpenSim.DataStore.MSSQL
169 string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'"; 174 string byRegion = "RegionUUID = '" + regionUUID.ToString() + "'";
170 string orderByParent = "ParentID ASC"; 175 string orderByParent = "ParentID ASC";
171 176
172 lock (ds) { 177 lock (ds)
178 {
173 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); 179 DataRow[] primsForRegion = prims.Select(byRegion, orderByParent);
174 MainLog.Instance.Verbose("DATASTORE", "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); 180 MainLog.Instance.Verbose("DATASTORE",
175 181 "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
182
176 foreach (DataRow primRow in primsForRegion) 183 foreach (DataRow primRow in primsForRegion)
177 { 184 {
178 try 185 try
179 { 186 {
180 string uuid = (string)primRow["UUID"]; 187 string uuid = (string) primRow["UUID"];
181 string objID = (string)primRow["SceneGroupID"]; 188 string objID = (string) primRow["SceneGroupID"];
182 if (uuid == objID) //is new SceneObjectGroup ? 189 if (uuid == objID) //is new SceneObjectGroup ?
183 { 190 {
184 SceneObjectGroup group = new SceneObjectGroup(); 191 SceneObjectGroup group = new SceneObjectGroup();
@@ -190,12 +197,13 @@ namespace OpenSim.DataStore.MSSQL
190 } 197 }
191 else 198 else
192 { 199 {
193 MainLog.Instance.Notice("No shape found for prim in storage, so setting default box shape"); 200 MainLog.Instance.Notice(
201 "No shape found for prim in storage, so setting default box shape");
194 prim.Shape = BoxShape.Default; 202 prim.Shape = BoxShape.Default;
195 } 203 }
196 group.AddPart(prim); 204 group.AddPart(prim);
197 group.RootPart = prim; 205 group.RootPart = prim;
198 206
199 createdObjects.Add(group.UUID, group); 207 createdObjects.Add(group.UUID, group);
200 retvals.Add(group); 208 retvals.Add(group);
201 } 209 }
@@ -209,7 +217,8 @@ namespace OpenSim.DataStore.MSSQL
209 } 217 }
210 else 218 else
211 { 219 {
212 MainLog.Instance.Notice("No shape found for prim in storage, so setting default box shape"); 220 MainLog.Instance.Notice(
221 "No shape found for prim in storage, so setting default box shape");
213 prim.Shape = BoxShape.Default; 222 prim.Shape = BoxShape.Default;
214 } 223 }
215 createdObjects[new LLUUID(objID)].AddPart(prim); 224 createdObjects[new LLUUID(objID)].AddPart(prim);
@@ -249,7 +258,7 @@ namespace OpenSim.DataStore.MSSQL
249 258
250 public double[,] LoadTerrain(LLUUID regionID) 259 public double[,] LoadTerrain(LLUUID regionID)
251 { 260 {
252 double[,] terret = new double[256, 256]; 261 double[,] terret = new double[256,256];
253 terret.Initialize(); 262 terret.Initialize();
254 263
255 DataTable terrain = ds.Tables["terrain"]; 264 DataTable terrain = ds.Tables["terrain"];
@@ -264,16 +273,16 @@ namespace OpenSim.DataStore.MSSQL
264 { 273 {
265 DataRow row = rows[0]; 274 DataRow row = rows[0];
266 275
267 byte[] heightmap = (byte[])row["Heightfield"]; 276 byte[] heightmap = (byte[]) row["Heightfield"];
268 for (int x = 0; x < 256; x++) 277 for (int x = 0; x < 256; x++)
269 { 278 {
270 for (int y = 0; y < 256; y++) 279 for (int y = 0; y < 256; y++)
271 { 280 {
272 terret[x, y] = BitConverter.ToDouble(heightmap, ((x * 256) + y) * 8); 281 terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8);
273 } 282 }
274 } 283 }
275 284
276 rev = (int)row["Revision"]; 285 rev = (int) row["Revision"];
277 } 286 }
278 else 287 else
279 { 288 {
@@ -290,22 +299,21 @@ namespace OpenSim.DataStore.MSSQL
290 299
291 public void RemoveLandObject(LLUUID globalID) 300 public void RemoveLandObject(LLUUID globalID)
292 { 301 {
293
294 } 302 }
295 303
296 public void StoreLandObject(Land parcel, LLUUID regionUUID) 304 public void StoreLandObject(Land parcel, LLUUID regionUUID)
297 { 305 {
298
299 } 306 }
300 307
301 public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID) 308 public List<LandData> LoadLandObjects(LLUUID regionUUID)
302 { 309 {
303 return new List<LandData>(); 310 return new List<LandData>();
304 } 311 }
305 312
306 public void Commit() 313 public void Commit()
307 { 314 {
308 lock (ds) { 315 lock (ds)
316 {
309 primDa.Update(ds, "prims"); 317 primDa.Update(ds, "prims");
310 shapeDa.Update(ds, "primshapes"); 318 shapeDa.Update(ds, "primshapes");
311 terrainDa.Update(ds, "terrain"); 319 terrainDa.Update(ds, "terrain");
@@ -326,7 +334,7 @@ namespace OpenSim.DataStore.MSSQL
326 * 334 *
327 **********************************************************************/ 335 **********************************************************************/
328 336
329 private void createCol(DataTable dt, string name, System.Type type) 337 private void createCol(DataTable dt, string name, Type type)
330 { 338 {
331 DataColumn col = new DataColumn(name, type); 339 DataColumn col = new DataColumn(name, type);
332 dt.Columns.Add(col); 340 dt.Columns.Add(col);
@@ -336,9 +344,9 @@ namespace OpenSim.DataStore.MSSQL
336 { 344 {
337 DataTable terrain = new DataTable("terrain"); 345 DataTable terrain = new DataTable("terrain");
338 346
339 createCol(terrain, "RegionUUID", typeof(String)); 347 createCol(terrain, "RegionUUID", typeof (String));
340 createCol(terrain, "Revision", typeof(Int32)); 348 createCol(terrain, "Revision", typeof (Int32));
341 createCol(terrain, "Heightfield", typeof(Byte[])); 349 createCol(terrain, "Heightfield", typeof (Byte[]));
342 350
343 return terrain; 351 return terrain;
344 } 352 }
@@ -347,62 +355,62 @@ namespace OpenSim.DataStore.MSSQL
347 { 355 {
348 DataTable prims = new DataTable("prims"); 356 DataTable prims = new DataTable("prims");
349 357
350 createCol(prims, "UUID", typeof(System.String)); 358 createCol(prims, "UUID", typeof (String));
351 createCol(prims, "RegionUUID", typeof(System.String)); 359 createCol(prims, "RegionUUID", typeof (String));
352 createCol(prims, "ParentID", typeof(System.Int32)); 360 createCol(prims, "ParentID", typeof (Int32));
353 createCol(prims, "CreationDate", typeof(System.Int32)); 361 createCol(prims, "CreationDate", typeof (Int32));
354 createCol(prims, "Name", typeof(System.String)); 362 createCol(prims, "Name", typeof (String));
355 createCol(prims, "SceneGroupID", typeof(System.String)); 363 createCol(prims, "SceneGroupID", typeof (String));
356 // various text fields 364 // various text fields
357 createCol(prims, "Text", typeof(System.String)); 365 createCol(prims, "Text", typeof (String));
358 createCol(prims, "Description", typeof(System.String)); 366 createCol(prims, "Description", typeof (String));
359 createCol(prims, "SitName", typeof(System.String)); 367 createCol(prims, "SitName", typeof (String));
360 createCol(prims, "TouchName", typeof(System.String)); 368 createCol(prims, "TouchName", typeof (String));
361 // permissions 369 // permissions
362 createCol(prims, "ObjectFlags", typeof(System.Int32)); 370 createCol(prims, "ObjectFlags", typeof (Int32));
363 createCol(prims, "CreatorID", typeof(System.String)); 371 createCol(prims, "CreatorID", typeof (String));
364 createCol(prims, "OwnerID", typeof(System.String)); 372 createCol(prims, "OwnerID", typeof (String));
365 createCol(prims, "GroupID", typeof(System.String)); 373 createCol(prims, "GroupID", typeof (String));
366 createCol(prims, "LastOwnerID", typeof(System.String)); 374 createCol(prims, "LastOwnerID", typeof (String));
367 createCol(prims, "OwnerMask", typeof(System.Int32)); 375 createCol(prims, "OwnerMask", typeof (Int32));
368 createCol(prims, "NextOwnerMask", typeof(System.Int32)); 376 createCol(prims, "NextOwnerMask", typeof (Int32));
369 createCol(prims, "GroupMask", typeof(System.Int32)); 377 createCol(prims, "GroupMask", typeof (Int32));
370 createCol(prims, "EveryoneMask", typeof(System.Int32)); 378 createCol(prims, "EveryoneMask", typeof (Int32));
371 createCol(prims, "BaseMask", typeof(System.Int32)); 379 createCol(prims, "BaseMask", typeof (Int32));
372 // vectors 380 // vectors
373 createCol(prims, "PositionX", typeof(System.Double)); 381 createCol(prims, "PositionX", typeof (Double));
374 createCol(prims, "PositionY", typeof(System.Double)); 382 createCol(prims, "PositionY", typeof (Double));
375 createCol(prims, "PositionZ", typeof(System.Double)); 383 createCol(prims, "PositionZ", typeof (Double));
376 createCol(prims, "GroupPositionX", typeof(System.Double)); 384 createCol(prims, "GroupPositionX", typeof (Double));
377 createCol(prims, "GroupPositionY", typeof(System.Double)); 385 createCol(prims, "GroupPositionY", typeof (Double));
378 createCol(prims, "GroupPositionZ", typeof(System.Double)); 386 createCol(prims, "GroupPositionZ", typeof (Double));
379 createCol(prims, "VelocityX", typeof(System.Double)); 387 createCol(prims, "VelocityX", typeof (Double));
380 createCol(prims, "VelocityY", typeof(System.Double)); 388 createCol(prims, "VelocityY", typeof (Double));
381 createCol(prims, "VelocityZ", typeof(System.Double)); 389 createCol(prims, "VelocityZ", typeof (Double));
382 createCol(prims, "AngularVelocityX", typeof(System.Double)); 390 createCol(prims, "AngularVelocityX", typeof (Double));
383 createCol(prims, "AngularVelocityY", typeof(System.Double)); 391 createCol(prims, "AngularVelocityY", typeof (Double));
384 createCol(prims, "AngularVelocityZ", typeof(System.Double)); 392 createCol(prims, "AngularVelocityZ", typeof (Double));
385 createCol(prims, "AccelerationX", typeof(System.Double)); 393 createCol(prims, "AccelerationX", typeof (Double));
386 createCol(prims, "AccelerationY", typeof(System.Double)); 394 createCol(prims, "AccelerationY", typeof (Double));
387 createCol(prims, "AccelerationZ", typeof(System.Double)); 395 createCol(prims, "AccelerationZ", typeof (Double));
388 // quaternions 396 // quaternions
389 createCol(prims, "RotationX", typeof(System.Double)); 397 createCol(prims, "RotationX", typeof (Double));
390 createCol(prims, "RotationY", typeof(System.Double)); 398 createCol(prims, "RotationY", typeof (Double));
391 createCol(prims, "RotationZ", typeof(System.Double)); 399 createCol(prims, "RotationZ", typeof (Double));
392 createCol(prims, "RotationW", typeof(System.Double)); 400 createCol(prims, "RotationW", typeof (Double));
393 401
394 // sit target 402 // sit target
395 createCol(prims, "SitTargetOffsetX", typeof(System.Double)); 403 createCol(prims, "SitTargetOffsetX", typeof (Double));
396 createCol(prims, "SitTargetOffsetY", typeof(System.Double)); 404 createCol(prims, "SitTargetOffsetY", typeof (Double));
397 createCol(prims, "SitTargetOffsetZ", typeof(System.Double)); 405 createCol(prims, "SitTargetOffsetZ", typeof (Double));
398 406
399 createCol(prims, "SitTargetOrientW", typeof(System.Double)); 407 createCol(prims, "SitTargetOrientW", typeof (Double));
400 createCol(prims, "SitTargetOrientX", typeof(System.Double)); 408 createCol(prims, "SitTargetOrientX", typeof (Double));
401 createCol(prims, "SitTargetOrientY", typeof(System.Double)); 409 createCol(prims, "SitTargetOrientY", typeof (Double));
402 createCol(prims, "SitTargetOrientZ", typeof(System.Double)); 410 createCol(prims, "SitTargetOrientZ", typeof (Double));
403 411
404 // Add in contraints 412 // Add in contraints
405 prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] }; 413 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
406 414
407 return prims; 415 return prims;
408 } 416 }
@@ -410,40 +418,40 @@ namespace OpenSim.DataStore.MSSQL
410 private DataTable createShapeTable() 418 private DataTable createShapeTable()
411 { 419 {
412 DataTable shapes = new DataTable("primshapes"); 420 DataTable shapes = new DataTable("primshapes");
413 createCol(shapes, "UUID", typeof(System.String)); 421 createCol(shapes, "UUID", typeof (String));
414 // shape is an enum 422 // shape is an enum
415 createCol(shapes, "Shape", typeof(System.Int32)); 423 createCol(shapes, "Shape", typeof (Int32));
416 // vectors 424 // vectors
417 createCol(shapes, "ScaleX", typeof(System.Double)); 425 createCol(shapes, "ScaleX", typeof (Double));
418 createCol(shapes, "ScaleY", typeof(System.Double)); 426 createCol(shapes, "ScaleY", typeof (Double));
419 createCol(shapes, "ScaleZ", typeof(System.Double)); 427 createCol(shapes, "ScaleZ", typeof (Double));
420 // paths 428 // paths
421 createCol(shapes, "PCode", typeof(System.Int32)); 429 createCol(shapes, "PCode", typeof (Int32));
422 createCol(shapes, "PathBegin", typeof(System.Int32)); 430 createCol(shapes, "PathBegin", typeof (Int32));
423 createCol(shapes, "PathEnd", typeof(System.Int32)); 431 createCol(shapes, "PathEnd", typeof (Int32));
424 createCol(shapes, "PathScaleX", typeof(System.Int32)); 432 createCol(shapes, "PathScaleX", typeof (Int32));
425 createCol(shapes, "PathScaleY", typeof(System.Int32)); 433 createCol(shapes, "PathScaleY", typeof (Int32));
426 createCol(shapes, "PathShearX", typeof(System.Int32)); 434 createCol(shapes, "PathShearX", typeof (Int32));
427 createCol(shapes, "PathShearY", typeof(System.Int32)); 435 createCol(shapes, "PathShearY", typeof (Int32));
428 createCol(shapes, "PathSkew", typeof(System.Int32)); 436 createCol(shapes, "PathSkew", typeof (Int32));
429 createCol(shapes, "PathCurve", typeof(System.Int32)); 437 createCol(shapes, "PathCurve", typeof (Int32));
430 createCol(shapes, "PathRadiusOffset", typeof(System.Int32)); 438 createCol(shapes, "PathRadiusOffset", typeof (Int32));
431 createCol(shapes, "PathRevolutions", typeof(System.Int32)); 439 createCol(shapes, "PathRevolutions", typeof (Int32));
432 createCol(shapes, "PathTaperX", typeof(System.Int32)); 440 createCol(shapes, "PathTaperX", typeof (Int32));
433 createCol(shapes, "PathTaperY", typeof(System.Int32)); 441 createCol(shapes, "PathTaperY", typeof (Int32));
434 createCol(shapes, "PathTwist", typeof(System.Int32)); 442 createCol(shapes, "PathTwist", typeof (Int32));
435 createCol(shapes, "PathTwistBegin", typeof(System.Int32)); 443 createCol(shapes, "PathTwistBegin", typeof (Int32));
436 // profile 444 // profile
437 createCol(shapes, "ProfileBegin", typeof(System.Int32)); 445 createCol(shapes, "ProfileBegin", typeof (Int32));
438 createCol(shapes, "ProfileEnd", typeof(System.Int32)); 446 createCol(shapes, "ProfileEnd", typeof (Int32));
439 createCol(shapes, "ProfileCurve", typeof(System.Int32)); 447 createCol(shapes, "ProfileCurve", typeof (Int32));
440 createCol(shapes, "ProfileHollow", typeof(System.Int32)); 448 createCol(shapes, "ProfileHollow", typeof (Int32));
441 // text TODO: this isn't right, but I'm not sure the right 449 // text TODO: this isn't right, but I'm not sure the right
442 // way to specify this as a blob atm 450 // way to specify this as a blob atm
443 createCol(shapes, "Texture", typeof(System.Byte[])); 451 createCol(shapes, "Texture", typeof (Byte[]));
444 createCol(shapes, "ExtraParams", typeof(System.Byte[])); 452 createCol(shapes, "ExtraParams", typeof (Byte[]));
445 453
446 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; 454 shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
447 455
448 return shapes; 456 return shapes;
449 } 457 }
@@ -462,23 +470,23 @@ namespace OpenSim.DataStore.MSSQL
462 // interesting has to be done to actually get these values 470 // interesting has to be done to actually get these values
463 // back out. Not enough time to figure it out yet. 471 // back out. Not enough time to figure it out yet.
464 SceneObjectPart prim = new SceneObjectPart(); 472 SceneObjectPart prim = new SceneObjectPart();
465 prim.UUID = new LLUUID((String)row["UUID"]); 473 prim.UUID = new LLUUID((String) row["UUID"]);
466 // explicit conversion of integers is required, which sort 474 // explicit conversion of integers is required, which sort
467 // of sucks. No idea if there is a shortcut here or not. 475 // of sucks. No idea if there is a shortcut here or not.
468 prim.ParentID = Convert.ToUInt32(row["ParentID"]); 476 prim.ParentID = Convert.ToUInt32(row["ParentID"]);
469 prim.CreationDate = Convert.ToInt32(row["CreationDate"]); 477 prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
470 prim.Name = (String)row["Name"]; 478 prim.Name = (String) row["Name"];
471 // various text fields 479 // various text fields
472 prim.Text = (String)row["Text"]; 480 prim.Text = (String) row["Text"];
473 prim.Description = (String)row["Description"]; 481 prim.Description = (String) row["Description"];
474 prim.SitName = (String)row["SitName"]; 482 prim.SitName = (String) row["SitName"];
475 prim.TouchName = (String)row["TouchName"]; 483 prim.TouchName = (String) row["TouchName"];
476 // permissions 484 // permissions
477 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]); 485 prim.ObjectFlags = Convert.ToUInt32(row["ObjectFlags"]);
478 prim.CreatorID = new LLUUID((String)row["CreatorID"]); 486 prim.CreatorID = new LLUUID((String) row["CreatorID"]);
479 prim.OwnerID = new LLUUID((String)row["OwnerID"]); 487 prim.OwnerID = new LLUUID((String) row["OwnerID"]);
480 prim.GroupID = new LLUUID((String)row["GroupID"]); 488 prim.GroupID = new LLUUID((String) row["GroupID"]);
481 prim.LastOwnerID = new LLUUID((String)row["LastOwnerID"]); 489 prim.LastOwnerID = new LLUUID((String) row["LastOwnerID"]);
482 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]); 490 prim.OwnerMask = Convert.ToUInt32(row["OwnerMask"]);
483 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]); 491 prim.NextOwnerMask = Convert.ToUInt32(row["NextOwnerMask"]);
484 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]); 492 prim.GroupMask = Convert.ToUInt32(row["GroupMask"]);
@@ -521,15 +529,19 @@ namespace OpenSim.DataStore.MSSQL
521 try 529 try
522 { 530 {
523 prim.SetSitTargetLL(new LLVector3( 531 prim.SetSitTargetLL(new LLVector3(
524 Convert.ToSingle(row["SitTargetOffsetX"]), 532 Convert.ToSingle(row["SitTargetOffsetX"]),
525 Convert.ToSingle(row["SitTargetOffsetY"]), 533 Convert.ToSingle(row["SitTargetOffsetY"]),
526 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( 534 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
527 Convert.ToSingle(row["SitTargetOrientX"]), 535 Convert.ToSingle(
528 Convert.ToSingle(row["SitTargetOrientY"]), 536 row["SitTargetOrientX"]),
529 Convert.ToSingle(row["SitTargetOrientZ"]), 537 Convert.ToSingle(
530 Convert.ToSingle(row["SitTargetOrientW"]))); 538 row["SitTargetOrientY"]),
539 Convert.ToSingle(
540 row["SitTargetOrientZ"]),
541 Convert.ToSingle(
542 row["SitTargetOrientW"])));
531 } 543 }
532 catch (System.InvalidCastException) 544 catch (InvalidCastException)
533 { 545 {
534 // Database table was created before we got here and now has null values :P 546 // Database table was created before we got here and now has null values :P
535 } 547 }
@@ -598,11 +610,10 @@ namespace OpenSim.DataStore.MSSQL
598 row["SitTargetOrientY"] = sitTargetOrient.Y; 610 row["SitTargetOrientY"] = sitTargetOrient.Y;
599 row["SitTargetOrientZ"] = sitTargetOrient.Z; 611 row["SitTargetOrientZ"] = sitTargetOrient.Z;
600 } 612 }
601 catch (System.Exception) 613 catch (Exception)
602 { 614 {
603 // TODO: Add Sit Target Rows! 615 // TODO: Add Sit Target Rows!
604 } 616 }
605
606 } 617 }
607 618
608 private PrimitiveBaseShape buildShape(DataRow row) 619 private PrimitiveBaseShape buildShape(DataRow row)
@@ -634,14 +645,14 @@ namespace OpenSim.DataStore.MSSQL
634 s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); 645 s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]);
635 s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); 646 s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
636 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); 647 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
637 648
638 // text TODO: this isn't right] = but I'm not sure the right 649 // text TODO: this isn't right] = but I'm not sure the right
639 // way to specify this as a blob atm 650 // way to specify this as a blob atm
640 byte[] textureEntry = (byte[])row["Texture"]; 651 byte[] textureEntry = (byte[]) row["Texture"];
641 s.TextureEntry = textureEntry; 652 s.TextureEntry = textureEntry;
642
643 653
644 s.ExtraParams = (byte[])row["ExtraParams"]; 654
655 s.ExtraParams = (byte[]) row["ExtraParams"];
645 // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); 656 // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
646 // string texture = encoding.GetString((Byte[])row["Texture"]); 657 // string texture = encoding.GetString((Byte[])row["Texture"]);
647 // if (!texture.StartsWith("<")) 658 // if (!texture.StartsWith("<"))
@@ -774,7 +785,7 @@ namespace OpenSim.DataStore.MSSQL
774 sql += ") values (@"; 785 sql += ") values (@";
775 sql += String.Join(", @", cols); 786 sql += String.Join(", @", cols);
776 sql += ")"; 787 sql += ")";
777 SqlCommand cmd = new SqlCommand(sql); 788 SqlCommand cmd = new SqlCommand(sql);
778 // this provides the binding for all our parameters, so 789 // this provides the binding for all our parameters, so
779 // much less code than it used to be 790 // much less code than it used to be
780 foreach (DataColumn col in dt.Columns) 791 foreach (DataColumn col in dt.Columns)
@@ -791,14 +802,15 @@ namespace OpenSim.DataStore.MSSQL
791 foreach (DataColumn col in dt.Columns) 802 foreach (DataColumn col in dt.Columns)
792 { 803 {
793 if (subsql.Length > 0) 804 if (subsql.Length > 0)
794 { // a map function would rock so much here 805 {
806 // a map function would rock so much here
795 subsql += ", "; 807 subsql += ", ";
796 } 808 }
797 subsql += col.ColumnName + "= @" + col.ColumnName; 809 subsql += col.ColumnName + "= @" + col.ColumnName;
798 } 810 }
799 sql += subsql; 811 sql += subsql;
800 sql += " where " + pk; 812 sql += " where " + pk;
801 SqlCommand cmd = new SqlCommand(sql); 813 SqlCommand cmd = new SqlCommand(sql);
802 // this provides the binding for all our parameters, so 814 // this provides the binding for all our parameters, so
803 // much less code than it used to be 815 // much less code than it used to be
804 816
@@ -817,7 +829,8 @@ namespace OpenSim.DataStore.MSSQL
817 foreach (DataColumn col in dt.Columns) 829 foreach (DataColumn col in dt.Columns)
818 { 830 {
819 if (subsql.Length > 0) 831 if (subsql.Length > 0)
820 { // a map function would rock so much here 832 {
833 // a map function would rock so much here
821 subsql += ",\n"; 834 subsql += ",\n";
822 } 835 }
823 subsql += col.ColumnName + " " + SqlType(col.DataType); 836 subsql += col.ColumnName + " " + SqlType(col.DataType);
@@ -828,7 +841,7 @@ namespace OpenSim.DataStore.MSSQL
828 } 841 }
829 sql += subsql; 842 sql += subsql;
830 sql += ")"; 843 sql += ")";
831 844
832 return sql; 845 return sql;
833 } 846 }
834 847
@@ -837,7 +850,7 @@ namespace OpenSim.DataStore.MSSQL
837 row["RegionUUID"] = regionUUID; 850 row["RegionUUID"] = regionUUID;
838 row["Revision"] = rev; 851 row["Revision"] = rev;
839 852
840 MemoryStream str = new MemoryStream(65536 * sizeof(double)); 853 MemoryStream str = new MemoryStream(65536*sizeof (double));
841 BinaryWriter bw = new BinaryWriter(str); 854 BinaryWriter bw = new BinaryWriter(str);
842 855
843 // TODO: COMPATIBILITY - Add byte-order conversions 856 // TODO: COMPATIBILITY - Add byte-order conversions
@@ -868,7 +881,7 @@ namespace OpenSim.DataStore.MSSQL
868 /// for us. 881 /// for us.
869 ///</summary> 882 ///</summary>
870 ///<returns>a built Sql parameter</returns> 883 ///<returns>a built Sql parameter</returns>
871 private SqlParameter createSqlParameter(string name, System.Type type) 884 private SqlParameter createSqlParameter(string name, Type type)
872 { 885 {
873 SqlParameter param = new SqlParameter(); 886 SqlParameter param = new SqlParameter();
874 param.ParameterName = "@" + name; 887 param.ParameterName = "@" + name;
@@ -887,7 +900,7 @@ namespace OpenSim.DataStore.MSSQL
887 da.UpdateCommand.Connection = conn; 900 da.UpdateCommand.Connection = conn;
888 901
889 SqlCommand delete = new SqlCommand("delete from prims where UUID = @UUID"); 902 SqlCommand delete = new SqlCommand("delete from prims where UUID = @UUID");
890 delete.Parameters.Add(createSqlParameter("UUID", typeof(System.String))); 903 delete.Parameters.Add(createSqlParameter("UUID", typeof (String)));
891 delete.Connection = conn; 904 delete.Connection = conn;
892 da.DeleteCommand = delete; 905 da.DeleteCommand = delete;
893 } 906 }
@@ -901,7 +914,7 @@ namespace OpenSim.DataStore.MSSQL
901 da.UpdateCommand.Connection = conn; 914 da.UpdateCommand.Connection = conn;
902 915
903 SqlCommand delete = new SqlCommand("delete from primshapes where UUID = @UUID"); 916 SqlCommand delete = new SqlCommand("delete from primshapes where UUID = @UUID");
904 delete.Parameters.Add(createSqlParameter("UUID", typeof(System.String))); 917 delete.Parameters.Add(createSqlParameter("UUID", typeof (String)));
905 delete.Connection = conn; 918 delete.Connection = conn;
906 da.DeleteCommand = delete; 919 da.DeleteCommand = delete;
907 } 920 }
@@ -957,14 +970,13 @@ namespace OpenSim.DataStore.MSSQL
957 970
958 private bool TestTables(SqlConnection conn) 971 private bool TestTables(SqlConnection conn)
959 { 972 {
960
961 SqlCommand primSelectCmd = new SqlCommand(primSelect, conn); 973 SqlCommand primSelectCmd = new SqlCommand(primSelect, conn);
962 SqlDataAdapter pDa = new SqlDataAdapter(primSelectCmd); 974 SqlDataAdapter pDa = new SqlDataAdapter(primSelectCmd);
963 SqlCommand shapeSelectCmd = new SqlCommand(shapeSelect, conn); 975 SqlCommand shapeSelectCmd = new SqlCommand(shapeSelect, conn);
964 SqlDataAdapter sDa = new SqlDataAdapter(shapeSelectCmd); 976 SqlDataAdapter sDa = new SqlDataAdapter(shapeSelectCmd);
965 SqlCommand terrainSelectCmd = new SqlCommand(terrainSelect, conn); 977 SqlCommand terrainSelectCmd = new SqlCommand(terrainSelect, conn);
966 SqlDataAdapter tDa = new SqlDataAdapter(terrainSelectCmd); 978 SqlDataAdapter tDa = new SqlDataAdapter(terrainSelectCmd);
967 979
968 DataSet tmpDS = new DataSet(); 980 DataSet tmpDS = new DataSet();
969 try 981 try
970 { 982 {
@@ -978,7 +990,7 @@ namespace OpenSim.DataStore.MSSQL
978 InitDB(conn); 990 InitDB(conn);
979 } 991 }
980 992
981 try 993 try
982 { 994 {
983 if (tmpDS.Tables == null || tmpDS.Tables.Count == 0) 995 if (tmpDS.Tables == null || tmpDS.Tables.Count == 0)
984 { 996 {
@@ -986,11 +998,10 @@ namespace OpenSim.DataStore.MSSQL
986 sDa.Fill(tmpDS, "primshapes"); 998 sDa.Fill(tmpDS, "primshapes");
987 tDa.Fill(tmpDS, "terrain"); 999 tDa.Fill(tmpDS, "terrain");
988 } 1000 }
989
990 } 1001 }
991 catch (SqlException e) 1002 catch (SqlException e)
992 { 1003 {
993 MainLog.Instance.Verbose("DATASTORE", e.ToString()); 1004 MainLog.Instance.Verbose("DATASTORE", e.ToString());
994 } 1005 }
995 1006
996 foreach (DataColumn col in createPrimTable().Columns) 1007 foreach (DataColumn col in createPrimTable().Columns)
@@ -1028,19 +1039,19 @@ namespace OpenSim.DataStore.MSSQL
1028 1039
1029 private DbType dbtypeFromType(Type type) 1040 private DbType dbtypeFromType(Type type)
1030 { 1041 {
1031 if (type == typeof(System.String)) 1042 if (type == typeof (String))
1032 { 1043 {
1033 return DbType.String; 1044 return DbType.String;
1034 } 1045 }
1035 else if (type == typeof(System.Int32)) 1046 else if (type == typeof (Int32))
1036 { 1047 {
1037 return DbType.Int32; 1048 return DbType.Int32;
1038 } 1049 }
1039 else if (type == typeof(System.Double)) 1050 else if (type == typeof (Double))
1040 { 1051 {
1041 return DbType.Double; 1052 return DbType.Double;
1042 } 1053 }
1043 else if (type == typeof(System.Byte[])) 1054 else if (type == typeof (Byte[]))
1044 { 1055 {
1045 return DbType.Binary; 1056 return DbType.Binary;
1046 } 1057 }
@@ -1054,19 +1065,19 @@ namespace OpenSim.DataStore.MSSQL
1054 // slightly differently. 1065 // slightly differently.
1055 private string SqlType(Type type) 1066 private string SqlType(Type type)
1056 { 1067 {
1057 if (type == typeof(System.String)) 1068 if (type == typeof (String))
1058 { 1069 {
1059 return "varchar(255)"; 1070 return "varchar(255)";
1060 } 1071 }
1061 else if (type == typeof(System.Int32)) 1072 else if (type == typeof (Int32))
1062 { 1073 {
1063 return "integer"; 1074 return "integer";
1064 } 1075 }
1065 else if (type == typeof(System.Double)) 1076 else if (type == typeof (Double))
1066 { 1077 {
1067 return "float"; 1078 return "float";
1068 } 1079 }
1069 else if (type == typeof(System.Byte[])) 1080 else if (type == typeof (Byte[]))
1070 { 1081 {
1071 return "image"; 1082 return "image";
1072 } 1083 }
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index c885310..065d37d 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -59,7 +59,7 @@ namespace OpenSim.DataStore.MonoSqlite
59 private SqliteConnection m_conn; 59 private SqliteConnection m_conn;
60 60
61 private String m_connectionString; 61 private String m_connectionString;
62 62
63 private bool persistPrimInventories; 63 private bool persistPrimInventories;
64 64
65 /*********************************************************************** 65 /***********************************************************************
@@ -71,7 +71,7 @@ namespace OpenSim.DataStore.MonoSqlite
71 // see IRegionDataStore 71 // see IRegionDataStore
72 public void Initialise(string connectionString, bool persistPrimInventories) 72 public void Initialise(string connectionString, bool persistPrimInventories)
73 { 73 {
74 m_connectionString = connectionString; 74 m_connectionString = connectionString;
75 this.persistPrimInventories = persistPrimInventories; 75 this.persistPrimInventories = persistPrimInventories;
76 76
77 ds = new DataSet(); 77 ds = new DataSet();
@@ -182,20 +182,20 @@ namespace OpenSim.DataStore.MonoSqlite
182 { 182 {
183 foreach (SceneObjectPart prim in obj.Children.Values) 183 foreach (SceneObjectPart prim in obj.Children.Values)
184 { 184 {
185 if ((prim.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) == 0) 185 if ((prim.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) == 0)
186 { 186 {
187 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID); 187 MainLog.Instance.Verbose("DATASTORE", "Adding obj: " + obj.UUID + " to region: " + regionUUID);
188 addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); 188 addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID));
189 } 189 }
190 else if (Stopped(prim)) 190 else if (Stopped(prim))
191 { 191 {
192 MainLog.Instance.Verbose("DATASTORE", "Adding stopped obj: " + obj.UUID + " to region: " + regionUUID); 192 MainLog.Instance.Verbose("DATASTORE",
193 "Adding stopped obj: " + obj.UUID + " to region: " + regionUUID);
193 addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID)); 194 addPrim(prim, Util.ToRawUuidString(obj.UUID), Util.ToRawUuidString(regionUUID));
194 } 195 }
195 else 196 else
196 { 197 {
197 // MainLog.Instance.Verbose("DATASTORE", "Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID); 198 // MainLog.Instance.Verbose("DATASTORE", "Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID);
198
199 } 199 }
200 } 200 }
201 } 201 }
@@ -307,18 +307,19 @@ namespace OpenSim.DataStore.MonoSqlite
307 307
308 public void StoreTerrain(double[,] ter, LLUUID regionID) 308 public void StoreTerrain(double[,] ter, LLUUID regionID)
309 { 309 {
310 lock (ds) { 310 lock (ds)
311 {
311 int revision = Util.UnixTimeSinceEpoch(); 312 int revision = Util.UnixTimeSinceEpoch();
312 313
313 // the following is an work around for .NET. The perf 314 // the following is an work around for .NET. The perf
314 // issues associated with it aren't as bad as you think. 315 // issues associated with it aren't as bad as you think.
315 SqliteConnection conn = new SqliteConnection(m_connectionString); 316 SqliteConnection conn = new SqliteConnection(m_connectionString);
316 conn.Open(); 317 conn.Open();
317 MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString()); 318 MainLog.Instance.Verbose("DATASTORE", "Storing terrain revision r" + revision.ToString());
318 String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" + 319 String sql = "insert into terrain(RegionUUID, Revision, Heightfield)" +
319 " values(:RegionUUID, :Revision, :Heightfield)"; 320 " values(:RegionUUID, :Revision, :Heightfield)";
320 321
321 using(SqliteCommand cmd = new SqliteCommand(sql, conn)) 322 using (SqliteCommand cmd = new SqliteCommand(sql, conn))
322 { 323 {
323 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); 324 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID)));
324 cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); 325 cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
@@ -333,7 +334,10 @@ namespace OpenSim.DataStore.MonoSqlite
333 // revisions in the database, as this old 334 // revisions in the database, as this old
334 // implementation is a DOS attack waiting to happen. 335 // implementation is a DOS attack waiting to happen.
335 336
336 using(SqliteCommand cmd = new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision < :Revision", conn)) 337 using (
338 SqliteCommand cmd =
339 new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision < :Revision",
340 conn))
337 { 341 {
338 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); 342 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID)));
339 cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); 343 cmd.Parameters.Add(new SqliteParameter(":Revision", revision));
@@ -345,21 +349,22 @@ namespace OpenSim.DataStore.MonoSqlite
345 349
346 public double[,] LoadTerrain(LLUUID regionID) 350 public double[,] LoadTerrain(LLUUID regionID)
347 { 351 {
348 lock (ds) { 352 lock (ds)
353 {
349 double[,] terret = new double[256,256]; 354 double[,] terret = new double[256,256];
350 terret.Initialize(); 355 terret.Initialize();
351 // the following is an work around for .NET. The perf 356 // the following is an work around for .NET. The perf
352 // issues associated with it aren't as bad as you think. 357 // issues associated with it aren't as bad as you think.
353 SqliteConnection conn = new SqliteConnection(m_connectionString); 358 SqliteConnection conn = new SqliteConnection(m_connectionString);
354 conn.Open(); 359 conn.Open();
355 String sql = "select RegionUUID, Revision, Heightfield from terrain" + 360 String sql = "select RegionUUID, Revision, Heightfield from terrain" +
356 " where RegionUUID=:RegionUUID order by Revision desc"; 361 " where RegionUUID=:RegionUUID order by Revision desc";
357 362
358 363
359 using (SqliteCommand cmd = new SqliteCommand(sql, conn)) 364 using (SqliteCommand cmd = new SqliteCommand(sql, conn))
360 { 365 {
361 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID))); 366 cmd.Parameters.Add(new SqliteParameter(":RegionUUID", Util.ToRawUuidString(regionID)));
362 367
363 using (IDataReader row = cmd.ExecuteReader()) 368 using (IDataReader row = cmd.ExecuteReader())
364 { 369 {
365 int rev = 0; 370 int rev = 0;
@@ -374,7 +379,7 @@ namespace OpenSim.DataStore.MonoSqlite
374 terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8); 379 terret[x, y] = BitConverter.ToDouble(heightmap, ((x*256) + y)*8);
375 } 380 }
376 } 381 }
377 rev = (int)row["Revision"]; 382 rev = (int) row["Revision"];
378 } 383 }
379 else 384 else
380 { 385 {
@@ -382,7 +387,7 @@ namespace OpenSim.DataStore.MonoSqlite
382 conn.Close(); 387 conn.Close();
383 return null; 388 return null;
384 } 389 }
385 390
386 MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString()); 391 MainLog.Instance.Verbose("DATASTORE", "Loaded terrain revision r" + rev.ToString());
387 } 392 }
388 } 393 }
@@ -434,7 +439,8 @@ namespace OpenSim.DataStore.MonoSqlite
434 fillLandRow(landRow, parcel.landData, regionUUID); 439 fillLandRow(landRow, parcel.landData, regionUUID);
435 } 440 }
436 441
437 using (SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", conn)) 442 using (
443 SqliteCommand cmd = new SqliteCommand("delete from landaccesslist where LandUUID=:LandUUID", conn))
438 { 444 {
439 cmd.Parameters.Add(new SqliteParameter(":LandUUID", Util.ToRawUuidString(parcel.landData.globalID))); 445 cmd.Parameters.Add(new SqliteParameter(":LandUUID", Util.ToRawUuidString(parcel.landData.globalID)));
440 cmd.ExecuteNonQuery(); 446 cmd.ExecuteNonQuery();
@@ -447,16 +453,15 @@ namespace OpenSim.DataStore.MonoSqlite
447 landaccesslist.Rows.Add(newAccessRow); 453 landaccesslist.Rows.Add(newAccessRow);
448 } 454 }
449 conn.Close(); 455 conn.Close();
450
451 } 456 }
452 457
453 Commit(); 458 Commit();
454 } 459 }
455 460
456 public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID) 461 public List<LandData> LoadLandObjects(LLUUID regionUUID)
457 { 462 {
458 List<LandData> landDataForRegion = new List<LandData>(); 463 List<LandData> landDataForRegion = new List<LandData>();
459 lock(ds) 464 lock (ds)
460 { 465 {
461 DataTable land = ds.Tables["land"]; 466 DataTable land = ds.Tables["land"];
462 DataTable landaccesslist = ds.Tables["landaccesslist"]; 467 DataTable landaccesslist = ds.Tables["landaccesslist"];
@@ -570,14 +575,14 @@ namespace OpenSim.DataStore.MonoSqlite
570 createCol(prims, "RotationW", typeof (Double)); 575 createCol(prims, "RotationW", typeof (Double));
571 576
572 // sit target 577 // sit target
573 createCol(prims, "SitTargetOffsetX", typeof(Double)); 578 createCol(prims, "SitTargetOffsetX", typeof (Double));
574 createCol(prims, "SitTargetOffsetY", typeof(Double)); 579 createCol(prims, "SitTargetOffsetY", typeof (Double));
575 createCol(prims, "SitTargetOffsetZ", typeof(Double)); 580 createCol(prims, "SitTargetOffsetZ", typeof (Double));
576 581
577 createCol(prims, "SitTargetOrientW", typeof(Double)); 582 createCol(prims, "SitTargetOrientW", typeof (Double));
578 createCol(prims, "SitTargetOrientX", typeof(Double)); 583 createCol(prims, "SitTargetOrientX", typeof (Double));
579 createCol(prims, "SitTargetOrientY", typeof(Double)); 584 createCol(prims, "SitTargetOrientY", typeof (Double));
580 createCol(prims, "SitTargetOrientZ", typeof(Double)); 585 createCol(prims, "SitTargetOrientZ", typeof (Double));
581 586
582 // Add in contraints 587 // Add in contraints
583 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]}; 588 prims.PrimaryKey = new DataColumn[] {prims.Columns["UUID"]};
@@ -621,11 +626,11 @@ namespace OpenSim.DataStore.MonoSqlite
621 createCol(shapes, "Texture", typeof (Byte[])); 626 createCol(shapes, "Texture", typeof (Byte[]));
622 createCol(shapes, "ExtraParams", typeof (Byte[])); 627 createCol(shapes, "ExtraParams", typeof (Byte[]));
623 628
624 shapes.PrimaryKey = new DataColumn[] { shapes.Columns["UUID"] }; 629 shapes.PrimaryKey = new DataColumn[] {shapes.Columns["UUID"]};
625 630
626 return shapes; 631 return shapes;
627 } 632 }
628 633
629 private DataTable createItemsTable() 634 private DataTable createItemsTable()
630 { 635 {
631 DataTable items = new DataTable("primitems"); 636 DataTable items = new DataTable("primitems");
@@ -635,10 +640,10 @@ namespace OpenSim.DataStore.MonoSqlite
635 createCol(items, "assetID", typeof (String)); 640 createCol(items, "assetID", typeof (String));
636 createCol(items, "assetType", typeof (Int32)); 641 createCol(items, "assetType", typeof (Int32));
637 createCol(items, "parentFolderID", typeof (String)); 642 createCol(items, "parentFolderID", typeof (String));
638 643
639 createCol(items, "name", typeof (String)); 644 createCol(items, "name", typeof (String));
640 createCol(items, "description", typeof (String)); 645 createCol(items, "description", typeof (String));
641 646
642 createCol(items, "creationDate", typeof (Int64)); 647 createCol(items, "creationDate", typeof (Int64));
643 createCol(items, "creatorID", typeof (String)); 648 createCol(items, "creatorID", typeof (String));
644 createCol(items, "ownerID", typeof (String)); 649 createCol(items, "ownerID", typeof (String));
@@ -651,50 +656,50 @@ namespace OpenSim.DataStore.MonoSqlite
651 createCol(items, "everyonePermissions", typeof (Int32)); 656 createCol(items, "everyonePermissions", typeof (Int32));
652 createCol(items, "groupPermissions", typeof (Int32)); 657 createCol(items, "groupPermissions", typeof (Int32));
653 658
654 items.PrimaryKey = new DataColumn[] { items.Columns["UUID"] }; 659 items.PrimaryKey = new DataColumn[] {items.Columns["UUID"]};
655 660
656 return items; 661 return items;
657 } 662 }
658 663
659 private DataTable createLandTable() 664 private DataTable createLandTable()
660 { 665 {
661 DataTable land = new DataTable("land"); 666 DataTable land = new DataTable("land");
662 createCol(land, "UUID", typeof(String)); 667 createCol(land, "UUID", typeof (String));
663 createCol(land, "RegionUUID", typeof(String)); 668 createCol(land, "RegionUUID", typeof (String));
664 createCol(land, "LocalLandID", typeof(UInt32)); 669 createCol(land, "LocalLandID", typeof (UInt32));
665 670
666 // Bitmap is a byte[512] 671 // Bitmap is a byte[512]
667 createCol(land, "Bitmap", typeof(Byte[])); 672 createCol(land, "Bitmap", typeof (Byte[]));
668 673
669 createCol(land, "Name", typeof(String)); 674 createCol(land, "Name", typeof (String));
670 createCol(land, "Desc", typeof(String)); 675 createCol(land, "Desc", typeof (String));
671 createCol(land, "OwnerUUID", typeof(String)); 676 createCol(land, "OwnerUUID", typeof (String));
672 createCol(land, "IsGroupOwned", typeof(Boolean)); 677 createCol(land, "IsGroupOwned", typeof (Boolean));
673 createCol(land, "Area", typeof(Int32)); 678 createCol(land, "Area", typeof (Int32));
674 createCol(land, "AuctionID", typeof(Int32)); //Unemplemented 679 createCol(land, "AuctionID", typeof (Int32)); //Unemplemented
675 createCol(land, "Category", typeof(Int32)); //Enum libsecondlife.Parcel.ParcelCategory 680 createCol(land, "Category", typeof (Int32)); //Enum libsecondlife.Parcel.ParcelCategory
676 createCol(land, "ClaimDate", typeof(Int32)); 681 createCol(land, "ClaimDate", typeof (Int32));
677 createCol(land, "ClaimPrice", typeof(Int32)); 682 createCol(land, "ClaimPrice", typeof (Int32));
678 createCol(land, "GroupUUID", typeof(string)); 683 createCol(land, "GroupUUID", typeof (string));
679 createCol(land, "SalePrice", typeof(Int32)); 684 createCol(land, "SalePrice", typeof (Int32));
680 createCol(land, "LandStatus", typeof(Int32)); //Enum. libsecondlife.Parcel.ParcelStatus 685 createCol(land, "LandStatus", typeof (Int32)); //Enum. libsecondlife.Parcel.ParcelStatus
681 createCol(land, "LandFlags", typeof(UInt32)); 686 createCol(land, "LandFlags", typeof (UInt32));
682 createCol(land, "LandingType", typeof(Byte)); 687 createCol(land, "LandingType", typeof (Byte));
683 createCol(land, "MediaAutoScale", typeof(Byte)); 688 createCol(land, "MediaAutoScale", typeof (Byte));
684 createCol(land, "MediaTextureUUID", typeof(String)); 689 createCol(land, "MediaTextureUUID", typeof (String));
685 createCol(land, "MediaURL", typeof(String)); 690 createCol(land, "MediaURL", typeof (String));
686 createCol(land, "MusicURL", typeof(String)); 691 createCol(land, "MusicURL", typeof (String));
687 createCol(land, "PassHours", typeof(Double)); 692 createCol(land, "PassHours", typeof (Double));
688 createCol(land, "PassPrice", typeof(UInt32)); 693 createCol(land, "PassPrice", typeof (UInt32));
689 createCol(land, "SnapshotUUID", typeof(String)); 694 createCol(land, "SnapshotUUID", typeof (String));
690 createCol(land, "UserLocationX", typeof(Double)); 695 createCol(land, "UserLocationX", typeof (Double));
691 createCol(land, "UserLocationY", typeof(Double)); 696 createCol(land, "UserLocationY", typeof (Double));
692 createCol(land, "UserLocationZ", typeof(Double)); 697 createCol(land, "UserLocationZ", typeof (Double));
693 createCol(land, "UserLookAtX", typeof(Double)); 698 createCol(land, "UserLookAtX", typeof (Double));
694 createCol(land, "UserLookAtY", typeof(Double)); 699 createCol(land, "UserLookAtY", typeof (Double));
695 createCol(land, "UserLookAtZ", typeof(Double)); 700 createCol(land, "UserLookAtZ", typeof (Double));
696 701
697 land.PrimaryKey = new DataColumn[] { land.Columns["UUID"] }; 702 land.PrimaryKey = new DataColumn[] {land.Columns["UUID"]};
698 703
699 return land; 704 return land;
700 } 705 }
@@ -702,9 +707,9 @@ namespace OpenSim.DataStore.MonoSqlite
702 private DataTable createLandAccessListTable() 707 private DataTable createLandAccessListTable()
703 { 708 {
704 DataTable landaccess = new DataTable("landaccesslist"); 709 DataTable landaccess = new DataTable("landaccesslist");
705 createCol(landaccess, "LandUUID", typeof(String)); 710 createCol(landaccess, "LandUUID", typeof (String));
706 createCol(landaccess, "AccessUUID", typeof(String)); 711 createCol(landaccess, "AccessUUID", typeof (String));
707 createCol(landaccess, "Flags", typeof(UInt32)); 712 createCol(landaccess, "Flags", typeof (UInt32));
708 713
709 return landaccess; 714 return landaccess;
710 } 715 }
@@ -782,35 +787,43 @@ namespace OpenSim.DataStore.MonoSqlite
782 try 787 try
783 { 788 {
784 prim.SetSitTargetLL(new LLVector3( 789 prim.SetSitTargetLL(new LLVector3(
785 Convert.ToSingle(row["SitTargetOffsetX"]), 790 Convert.ToSingle(row["SitTargetOffsetX"]),
786 Convert.ToSingle(row["SitTargetOffsetY"]), 791 Convert.ToSingle(row["SitTargetOffsetY"]),
787 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion( 792 Convert.ToSingle(row["SitTargetOffsetZ"])), new LLQuaternion(
788 Convert.ToSingle(row["SitTargetOrientX"]), 793 Convert.ToSingle(
789 Convert.ToSingle(row["SitTargetOrientY"]), 794 row["SitTargetOrientX"]),
790 Convert.ToSingle(row["SitTargetOrientZ"]), 795 Convert.ToSingle(
791 Convert.ToSingle(row["SitTargetOrientW"]))); 796 row["SitTargetOrientY"]),
797 Convert.ToSingle(
798 row["SitTargetOrientZ"]),
799 Convert.ToSingle(
800 row["SitTargetOrientW"])));
792 } 801 }
793 catch (System.InvalidCastException) 802 catch (InvalidCastException)
794 { 803 {
795 // Database table was created before we got here and now has null values :P 804 // Database table was created before we got here and now has null values :P
796 m_conn.Open(); 805 m_conn.Open();
797 SqliteCommand cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetX float NOT NULL default 0;", m_conn); 806 SqliteCommand cmd =
807 new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetX float NOT NULL default 0;", m_conn);
798 cmd.ExecuteNonQuery(); 808 cmd.ExecuteNonQuery();
799 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetY float NOT NULL default 0;", m_conn); 809 cmd =
810 new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetY float NOT NULL default 0;", m_conn);
800 cmd.ExecuteNonQuery(); 811 cmd.ExecuteNonQuery();
801 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetZ float NOT NULL default 0;", m_conn); 812 cmd =
813 new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOffsetZ float NOT NULL default 0;", m_conn);
802 cmd.ExecuteNonQuery(); 814 cmd.ExecuteNonQuery();
803 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientW float NOT NULL default 0;", m_conn); 815 cmd =
816 new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientW float NOT NULL default 0;", m_conn);
804 cmd.ExecuteNonQuery(); 817 cmd.ExecuteNonQuery();
805 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientX float NOT NULL default 0;", m_conn); 818 cmd =
819 new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientX float NOT NULL default 0;", m_conn);
806 cmd.ExecuteNonQuery(); 820 cmd.ExecuteNonQuery();
807 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientY float NOT NULL default 0;", m_conn); 821 cmd =
822 new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientY float NOT NULL default 0;", m_conn);
808 cmd.ExecuteNonQuery(); 823 cmd.ExecuteNonQuery();
809 cmd = new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientZ float NOT NULL default 0;", m_conn); 824 cmd =
825 new SqliteCommand("ALTER TABLE prims ADD COLUMN SitTargetOrientZ float NOT NULL default 0;", m_conn);
810 cmd.ExecuteNonQuery(); 826 cmd.ExecuteNonQuery();
811
812
813
814 } 827 }
815 828
816 return prim; 829 return prim;
@@ -820,36 +833,42 @@ namespace OpenSim.DataStore.MonoSqlite
820 { 833 {
821 LandData newData = new LandData(); 834 LandData newData = new LandData();
822 835
823 newData.globalID = new LLUUID((String)row["UUID"]); 836 newData.globalID = new LLUUID((String) row["UUID"]);
824 newData.localID= Convert.ToInt32(row["LocalLandID"]); 837 newData.localID = Convert.ToInt32(row["LocalLandID"]);
825 838
826 // Bitmap is a byte[512] 839 // Bitmap is a byte[512]
827 newData.landBitmapByteArray = (Byte[]) row["Bitmap"]; 840 newData.landBitmapByteArray = (Byte[]) row["Bitmap"];
828 841
829 newData.landName= (String) row["Name"]; 842 newData.landName = (String) row["Name"];
830 newData.landDesc= (String) row["Desc"]; 843 newData.landDesc = (String) row["Desc"];
831 newData.ownerID= (String) row["OwnerUUID"]; 844 newData.ownerID = (String) row["OwnerUUID"];
832 newData.isGroupOwned= (Boolean) row["IsGroupOwned"]; 845 newData.isGroupOwned = (Boolean) row["IsGroupOwned"];
833 newData.area= Convert.ToInt32(row["Area"]); 846 newData.area = Convert.ToInt32(row["Area"]);
834 newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented 847 newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
835 newData.category= (Parcel.ParcelCategory) Convert.ToInt32(row["Category"]); //Enum libsecondlife.Parcel.ParcelCategory 848 newData.category = (Parcel.ParcelCategory) Convert.ToInt32(row["Category"]);
836 newData.claimDate= Convert.ToInt32(row["ClaimDate"]); 849 //Enum libsecondlife.Parcel.ParcelCategory
837 newData.claimPrice= Convert.ToInt32(row["ClaimPrice"]); 850 newData.claimDate = Convert.ToInt32(row["ClaimDate"]);
838 newData.groupID= new LLUUID((String)row["GroupUUID"]); 851 newData.claimPrice = Convert.ToInt32(row["ClaimPrice"]);
852 newData.groupID = new LLUUID((String) row["GroupUUID"]);
839 newData.salePrice = Convert.ToInt32(row["SalePrice"]); 853 newData.salePrice = Convert.ToInt32(row["SalePrice"]);
840 newData.landStatus= (Parcel.ParcelStatus) Convert.ToInt32(row["LandStatus"]); //Enum. libsecondlife.Parcel.ParcelStatus 854 newData.landStatus = (Parcel.ParcelStatus) Convert.ToInt32(row["LandStatus"]);
841 newData.landFlags= Convert.ToUInt32(row["LandFlags"]); 855 //Enum. libsecondlife.Parcel.ParcelStatus
842 newData.landingType= (Byte) row["LandingType"]; 856 newData.landFlags = Convert.ToUInt32(row["LandFlags"]);
843 newData.mediaAutoScale= (Byte) row["MediaAutoScale"]; 857 newData.landingType = (Byte) row["LandingType"];
844 newData.mediaID= new LLUUID((String)row["MediaTextureUUID"]); 858 newData.mediaAutoScale = (Byte) row["MediaAutoScale"];
845 newData.mediaURL= (String) row["MediaURL"]; 859 newData.mediaID = new LLUUID((String) row["MediaTextureUUID"]);
846 newData.musicURL= (String) row["MusicURL"]; 860 newData.mediaURL = (String) row["MediaURL"];
847 newData.passHours= Convert.ToSingle(row["PassHours"]); 861 newData.musicURL = (String) row["MusicURL"];
848 newData.passPrice= Convert.ToInt32(row["PassPrice"]); 862 newData.passHours = Convert.ToSingle(row["PassHours"]);
849 newData.snapshotID= (String) row["SnapshotUUID"]; 863 newData.passPrice = Convert.ToInt32(row["PassPrice"]);
850 864 newData.snapshotID = (String) row["SnapshotUUID"];
851 newData.userLocation = new LLVector3(Convert.ToSingle(row["UserLocationX"]),Convert.ToSingle(row["UserLocationY"]), Convert.ToSingle(row["UserLocationZ"])); 865
852 newData.userLookAt = new LLVector3(Convert.ToSingle(row["UserLookAtX"]),Convert.ToSingle(row["UserLookAtY"]), Convert.ToSingle(row["UserLookAtZ"])); 866 newData.userLocation =
867 new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
868 Convert.ToSingle(row["UserLocationZ"]));
869 newData.userLookAt =
870 new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
871 Convert.ToSingle(row["UserLookAtZ"]));
853 newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); 872 newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
854 873
855 return newData; 874 return newData;
@@ -858,13 +877,13 @@ namespace OpenSim.DataStore.MonoSqlite
858 private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row) 877 private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
859 { 878 {
860 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 879 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
861 entry.AgentID = new LLUUID((string)row["AccessUUID"]); 880 entry.AgentID = new LLUUID((string) row["AccessUUID"]);
862 entry.Flags = (ParcelManager.AccessList)row["Flags"]; 881 entry.Flags = (ParcelManager.AccessList) row["Flags"];
863 entry.Time = new DateTime(); 882 entry.Time = new DateTime();
864 return entry; 883 return entry;
865 } 884 }
866 885
867 private Array serializeTerrain(double[,] val) 886 private Array serializeTerrain(double[,] val)
868 { 887 {
869 MemoryStream str = new MemoryStream(65536*sizeof (double)); 888 MemoryStream str = new MemoryStream(65536*sizeof (double));
870 BinaryWriter bw = new BinaryWriter(str); 889 BinaryWriter bw = new BinaryWriter(str);
@@ -900,7 +919,8 @@ namespace OpenSim.DataStore.MonoSqlite
900 row["ParentID"] = prim.ParentID; 919 row["ParentID"] = prim.ParentID;
901 row["CreationDate"] = prim.CreationDate; 920 row["CreationDate"] = prim.CreationDate;
902 row["Name"] = prim.Name; 921 row["Name"] = prim.Name;
903 row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID); // the UUID of the root part for this SceneObjectGroup 922 row["SceneGroupID"] = Util.ToRawUuidString(sceneGroupID);
923 // the UUID of the root part for this SceneObjectGroup
904 // various text fields 924 // various text fields
905 row["Text"] = prim.Text; 925 row["Text"] = prim.Text;
906 row["Description"] = prim.Description; 926 row["Description"] = prim.Description;
@@ -1028,10 +1048,10 @@ namespace OpenSim.DataStore.MonoSqlite
1028 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); 1048 s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
1029 // text TODO: this isn't right] = but I'm not sure the right 1049 // text TODO: this isn't right] = but I'm not sure the right
1030 // way to specify this as a blob atm 1050 // way to specify this as a blob atm
1031 1051
1032 byte[] textureEntry = (byte[])row["Texture"]; 1052 byte[] textureEntry = (byte[]) row["Texture"];
1033 s.TextureEntry = textureEntry; 1053 s.TextureEntry = textureEntry;
1034 1054
1035 1055
1036 s.ExtraParams = (byte[]) row["ExtraParams"]; 1056 s.ExtraParams = (byte[]) row["ExtraParams"];
1037 // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); 1057 // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
@@ -1278,6 +1298,7 @@ namespace OpenSim.DataStore.MonoSqlite
1278 da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]); 1298 da.InsertCommand = createInsertCommand("landaccesslist", ds.Tables["landaccesslist"]);
1279 da.InsertCommand.Connection = conn; 1299 da.InsertCommand.Connection = conn;
1280 } 1300 }
1301
1281 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn) 1302 private void setupShapeCommands(SqliteDataAdapter da, SqliteConnection conn)
1282 { 1303 {
1283 da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]); 1304 da.InsertCommand = createInsertCommand("primshapes", ds.Tables["primshapes"]);
@@ -1331,7 +1352,7 @@ namespace OpenSim.DataStore.MonoSqlite
1331 { 1352 {
1332 MainLog.Instance.Warn("SQLITE", "Shapes Table Already Exists"); 1353 MainLog.Instance.Warn("SQLITE", "Shapes Table Already Exists");
1333 } 1354 }
1334 1355
1335 if (persistPrimInventories) 1356 if (persistPrimInventories)
1336 { 1357 {
1337 try 1358 try
@@ -1341,7 +1362,7 @@ namespace OpenSim.DataStore.MonoSqlite
1341 catch (SqliteSyntaxException) 1362 catch (SqliteSyntaxException)
1342 { 1363 {
1343 MainLog.Instance.Warn("SQLITE", "Primitives Inventory Table Already Exists"); 1364 MainLog.Instance.Warn("SQLITE", "Primitives Inventory Table Already Exists");
1344 } 1365 }
1345 } 1366 }
1346 1367
1347 try 1368 try
@@ -1377,32 +1398,31 @@ namespace OpenSim.DataStore.MonoSqlite
1377 { 1398 {
1378 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn); 1399 SqliteCommand primSelectCmd = new SqliteCommand(primSelect, conn);
1379 SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd); 1400 SqliteDataAdapter pDa = new SqliteDataAdapter(primSelectCmd);
1380 1401
1381 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn); 1402 SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, conn);
1382 SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd); 1403 SqliteDataAdapter sDa = new SqliteDataAdapter(shapeSelectCmd);
1383 1404
1384 SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, conn); 1405 SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, conn);
1385 SqliteDataAdapter iDa = new SqliteDataAdapter(itemsSelectCmd); 1406 SqliteDataAdapter iDa = new SqliteDataAdapter(itemsSelectCmd);
1386 1407
1387 SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn); 1408 SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, conn);
1388 SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd); 1409 SqliteDataAdapter tDa = new SqliteDataAdapter(terrainSelectCmd);
1389 1410
1390 SqliteCommand landSelectCmd = new SqliteCommand(landSelect, conn); 1411 SqliteCommand landSelectCmd = new SqliteCommand(landSelect, conn);
1391 SqliteDataAdapter lDa = new SqliteDataAdapter(landSelectCmd); 1412 SqliteDataAdapter lDa = new SqliteDataAdapter(landSelectCmd);
1392 1413
1393 SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, conn); 1414 SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, conn);
1394 SqliteDataAdapter lalDa = new SqliteDataAdapter(landAccessListSelectCmd); 1415 SqliteDataAdapter lalDa = new SqliteDataAdapter(landAccessListSelectCmd);
1395 1416
1396 DataSet tmpDS = new DataSet(); 1417 DataSet tmpDS = new DataSet();
1397 try 1418 try
1398 { 1419 {
1399
1400 pDa.Fill(tmpDS, "prims"); 1420 pDa.Fill(tmpDS, "prims");
1401 sDa.Fill(tmpDS, "primshapes"); 1421 sDa.Fill(tmpDS, "primshapes");
1402 1422
1403 if (persistPrimInventories) 1423 if (persistPrimInventories)
1404 iDa.Fill(tmpDS, "primitems"); 1424 iDa.Fill(tmpDS, "primitems");
1405 1425
1406 tDa.Fill(tmpDS, "terrain"); 1426 tDa.Fill(tmpDS, "terrain");
1407 lDa.Fill(tmpDS, "land"); 1427 lDa.Fill(tmpDS, "land");
1408 lalDa.Fill(tmpDS, "landaccesslist"); 1428 lalDa.Fill(tmpDS, "landaccesslist");
@@ -1415,13 +1435,13 @@ namespace OpenSim.DataStore.MonoSqlite
1415 1435
1416 pDa.Fill(tmpDS, "prims"); 1436 pDa.Fill(tmpDS, "prims");
1417 sDa.Fill(tmpDS, "primshapes"); 1437 sDa.Fill(tmpDS, "primshapes");
1418 1438
1419 if (persistPrimInventories) 1439 if (persistPrimInventories)
1420 iDa.Fill(tmpDS, "primitems"); 1440 iDa.Fill(tmpDS, "primitems");
1421 1441
1422 tDa.Fill(tmpDS, "terrain"); 1442 tDa.Fill(tmpDS, "terrain");
1423 lDa.Fill(tmpDS, "land"); 1443 lDa.Fill(tmpDS, "land");
1424 lalDa.Fill(tmpDS,"landaccesslist"); 1444 lalDa.Fill(tmpDS, "landaccesslist");
1425 1445
1426 foreach (DataColumn col in createPrimTable().Columns) 1446 foreach (DataColumn col in createPrimTable().Columns)
1427 { 1447 {
@@ -1431,7 +1451,7 @@ namespace OpenSim.DataStore.MonoSqlite
1431 return false; 1451 return false;
1432 } 1452 }
1433 } 1453 }
1434 1454
1435 foreach (DataColumn col in createShapeTable().Columns) 1455 foreach (DataColumn col in createShapeTable().Columns)
1436 { 1456 {
1437 if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) 1457 if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName))
@@ -1440,9 +1460,9 @@ namespace OpenSim.DataStore.MonoSqlite
1440 return false; 1460 return false;
1441 } 1461 }
1442 } 1462 }
1443 1463
1444 // TODO Not restoring prim inventories quite yet 1464 // TODO Not restoring prim inventories quite yet
1445 1465
1446 foreach (DataColumn col in createTerrainTable().Columns) 1466 foreach (DataColumn col in createTerrainTable().Columns)
1447 { 1467 {
1448 if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) 1468 if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName))
@@ -1451,7 +1471,7 @@ namespace OpenSim.DataStore.MonoSqlite
1451 return false; 1471 return false;
1452 } 1472 }
1453 } 1473 }
1454 1474
1455 foreach (DataColumn col in createLandTable().Columns) 1475 foreach (DataColumn col in createLandTable().Columns)
1456 { 1476 {
1457 if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) 1477 if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName))
@@ -1460,7 +1480,7 @@ namespace OpenSim.DataStore.MonoSqlite
1460 return false; 1480 return false;
1461 } 1481 }
1462 } 1482 }
1463 1483
1464 foreach (DataColumn col in createLandAccessListTable().Columns) 1484 foreach (DataColumn col in createLandAccessListTable().Columns)
1465 { 1485 {
1466 if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) 1486 if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName))
@@ -1469,7 +1489,7 @@ namespace OpenSim.DataStore.MonoSqlite
1469 return false; 1489 return false;
1470 } 1490 }
1471 } 1491 }
1472 1492
1473 return true; 1493 return true;
1474 } 1494 }
1475 1495
@@ -1526,7 +1546,7 @@ namespace OpenSim.DataStore.MonoSqlite
1526 else if (type == typeof (Int64)) 1546 else if (type == typeof (Int64))
1527 { 1547 {
1528 return "integer"; 1548 return "integer";
1529 } 1549 }
1530 else if (type == typeof (Double)) 1550 else if (type == typeof (Double))
1531 { 1551 {
1532 return "float"; 1552 return "float";
@@ -1541,4 +1561,4 @@ namespace OpenSim.DataStore.MonoSqlite
1541 } 1561 }
1542 } 1562 }
1543 } 1563 }
1544} 1564} \ No newline at end of file
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
index da05018..035c3ba 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.NullStorage/NullDataStore.cs
@@ -28,6 +28,7 @@
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework;
31using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
32using OpenSim.Region.Environment.LandManagement; 33using OpenSim.Region.Environment.LandManagement;
33using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
@@ -71,9 +72,9 @@ namespace OpenSim.DataStore.NullStorage
71 { 72 {
72 } 73 }
73 74
74 public List<Framework.LandData> LoadLandObjects(LLUUID regionUUID) 75 public List<LandData> LoadLandObjects(LLUUID regionUUID)
75 { 76 {
76 return new List<Framework.LandData>(); 77 return new List<LandData>();
77 } 78 }
78 79
79 public void Shutdown() 80 public void Shutdown()
diff --git a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs
index 3c0facb..3195140 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/Properties/AssemblyInfo.cs
@@ -62,4 +62,4 @@ using System.Runtime.InteropServices;
62// by using the '*' as shown below: 62// by using the '*' as shown below:
63 63
64[assembly : AssemblyVersion("1.0.0.0")] 64[assembly : AssemblyVersion("1.0.0.0")]
65[assembly : AssemblyFileVersion("1.0.0.0")] 65[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
index e89ff62..2405e86 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
@@ -159,12 +159,13 @@ namespace OpenSim.Region.Terrain
159 /// <param name="action">The action to be performed</param> 159 /// <param name="action">The action to be performed</param>
160 /// <param name="north">Distance from the north border where the cursor is located</param> 160 /// <param name="north">Distance from the north border where the cursor is located</param>
161 /// <param name="west">Distance from the west border where the cursor is located</param> 161 /// <param name="west">Distance from the west border where the cursor is located</param>
162 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, float south, float east, 162 public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
163 float south, float east,
163 IClientAPI remoteUser) 164 IClientAPI remoteUser)
164 { 165 {
165 // Shiny. 166 // Shiny.
166 double size = (double) (1 << brushsize); 167 double size = (double) (1 << brushsize);
167 168
168 /* Okay, so here's the deal 169 /* Okay, so here's the deal
169 * This has to handle both when a user draws on the terrain *and* when a user selects 170 * This has to handle both when a user draws on the terrain *and* when a user selects
170 * a selection of AABB on terrain and applies whatever routine the client requests 171 * a selection of AABB on terrain and applies whatever routine the client requests
@@ -189,8 +190,8 @@ namespace OpenSim.Region.Terrain
189 * Again, libTerrain is yx instead of xy.. so, it's reflected in the function calls 190 * Again, libTerrain is yx instead of xy.. so, it's reflected in the function calls
190 * 191 *
191 */ 192 */
192 193
193 194
194 switch (action) 195 switch (action)
195 { 196 {
196 case 0: 197 case 0:
@@ -199,7 +200,7 @@ namespace OpenSim.Region.Terrain
199 { 200 {
200 for (float y = west; y <= east; y++) 201 for (float y = west; y <= east; y++)
201 { 202 {
202 FlattenTerrain(y, x, size, (double)seconds / 5.0); 203 FlattenTerrain(y, x, size, (double) seconds/5.0);
203 lastEdit = DateTime.Now; 204 lastEdit = DateTime.Now;
204 } 205 }
205 } 206 }
@@ -210,7 +211,7 @@ namespace OpenSim.Region.Terrain
210 { 211 {
211 for (float y = west; y <= east; y++) 212 for (float y = west; y <= east; y++)
212 { 213 {
213 RaiseTerrain(y, x, size, (double)seconds / 5.0); 214 RaiseTerrain(y, x, size, (double) seconds/5.0);
214 lastEdit = DateTime.Now; 215 lastEdit = DateTime.Now;
215 } 216 }
216 } 217 }
@@ -221,7 +222,7 @@ namespace OpenSim.Region.Terrain
221 { 222 {
222 for (float y = west; y <= east; y++) 223 for (float y = west; y <= east; y++)
223 { 224 {
224 LowerTerrain(y, x, size, (double)seconds / 5.0); 225 LowerTerrain(y, x, size, (double) seconds/5.0);
225 lastEdit = DateTime.Now; 226 lastEdit = DateTime.Now;
226 } 227 }
227 } 228 }
@@ -235,13 +236,13 @@ namespace OpenSim.Region.Terrain
235 // 236 //
236 //for (float x = south; x <= north; x++) 237 //for (float x = south; x <= north; x++)
237 //{ 238 //{
238 //for (float y = west; y <= east; y++) 239 //for (float y = west; y <= east; y++)
239 //{ 240 //{
240 //SmoothTerrain(y, x , size, (double)seconds / 5.0); 241 //SmoothTerrain(y, x , size, (double)seconds / 5.0);
241 //} 242 //}
242 //} 243 //}
243 244
244 SmoothTerrain(west, north, size, (double)seconds / 5.0); 245 SmoothTerrain(west, north, size, (double) seconds/5.0);
245 246
246 break; 247 break;
247 case 4: 248 case 4:
@@ -250,7 +251,7 @@ namespace OpenSim.Region.Terrain
250 { 251 {
251 for (float y = west; y <= east; y++) 252 for (float y = west; y <= east; y++)
252 { 253 {
253 NoiseTerrain(y, x, size, (double)seconds / 5.0); 254 NoiseTerrain(y, x, size, (double) seconds/5.0);
254 lastEdit = DateTime.Now; 255 lastEdit = DateTime.Now;
255 } 256 }
256 } 257 }
@@ -261,7 +262,7 @@ namespace OpenSim.Region.Terrain
261 { 262 {
262 for (float y = west; y <= east; y++) 263 for (float y = west; y <= east; y++)
263 { 264 {
264 RevertTerrain(y, x, size, (double)seconds / 5.0); 265 RevertTerrain(y, x, size, (double) seconds/5.0);
265 lastEdit = DateTime.Now; 266 lastEdit = DateTime.Now;
266 } 267 }
267 } 268 }
@@ -1351,16 +1352,16 @@ namespace OpenSim.Region.Terrain
1351 } 1352 }
1352 1353
1353 Channel copy = heightmap.Copy(); 1354 Channel copy = heightmap.Copy();
1354 for (int y = 0; y <copy.h; y++) 1355 for (int y = 0; y < copy.h; y++)
1355 { 1356 {
1356 for (int x = 0; x < copy.w; x++) 1357 for (int x = 0; x < copy.w; x++)
1357 { 1358 {
1358 // 512 is the largest possible height before colours clamp 1359 // 512 is the largest possible height before colours clamp
1359 int colorindex = (int) (Math.Max(Math.Min(1.0, copy.Get(x, y)/512.0), 0.0)*(pallete - 1)); 1360 int colorindex = (int) (Math.Max(Math.Min(1.0, copy.Get(x, y)/512.0), 0.0)*(pallete - 1));
1360 bmp.SetPixel(x, copy.h-y-1, colours[colorindex]); 1361 bmp.SetPixel(x, copy.h - y - 1, colours[colorindex]);
1361 } 1362 }
1362 } 1363 }
1363 return bmp; 1364 return bmp;
1364 } 1365 }
1365 } 1366 }
1366} 1367} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs
index 4daa4b4..c56e29e 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainFilter.cs
@@ -122,4 +122,4 @@ namespace OpenSim.Region.Terrain
122 LoadFilter(compiler, filename); 122 LoadFilter(compiler, filename);
123 } 123 }
124 } 124 }
125} 125} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs
index 3aa321c..b761f1e 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs
@@ -83,4 +83,4 @@ namespace libTerrain
83 gd.DrawString(txt, new Font(font, (float) size), new SolidBrush(Color.White), area, sf); 83 gd.DrawString(txt, new Font(font, (float) size), new SolidBrush(Color.White), area, sf);
84 } 84 }
85 } 85 }
86} 86} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs
index 9c7ab35..a7f7246 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs
@@ -57,4 +57,4 @@ namespace libTerrain
57 diff = new int[(int) (w/16),(int) (h/16)]; 57 diff = new int[(int) (w/16),(int) (h/16)];
58 } 58 }
59 } 59 }
60} 60} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
index 083d2f5..8bc4a04 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs
@@ -280,4 +280,4 @@ namespace libTerrain
280 return false; 280 return false;
281 } 281 }
282 } 282 }
283} 283} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
index b4784f0..df34eeb 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs
@@ -143,4 +143,4 @@ namespace libTerrain
143 Blend(flat, temp); 143 Blend(flat, temp);
144 } 144 }
145 } 145 }
146} 146} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
index 5517c52..9a8b8f5 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs
@@ -134,4 +134,4 @@ namespace libTerrain
134 } 134 }
135 } 135 }
136 } 136 }
137} 137} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs
index fa3840f..3d51583 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs
@@ -73,4 +73,4 @@ namespace libTerrain
73 bit.Save(filename); 73 bit.Save(filename);
74 } 74 }
75 } 75 }
76} 76} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
index 549fe0b..992377f 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs
@@ -140,4 +140,4 @@ namespace libTerrain
140 Normalise(); 140 Normalise();
141 } 141 }
142 } 142 }
143} 143} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs
index 3ac1ed7..6cdf7ce 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs
@@ -58,4 +58,4 @@ namespace libTerrain
58 Normalise(); 58 Normalise();
59 } 59 }
60 } 60 }
61} 61} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs
index 9e86aaf..000bfcc 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs
@@ -279,4 +279,4 @@ namespace libTerrain
279 Normalise(); 279 Normalise();
280 } 280 }
281 } 281 }
282} 282} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs
index 80e10ba..0bce1b2 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs
@@ -51,4 +51,4 @@ namespace libTerrain
51 } 51 }
52 } 52 }
53 } 53 }
54} 54} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs
index 330e7f5..414f844 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs
@@ -154,4 +154,4 @@ namespace libTerrain
154 Normalise(); 154 Normalise();
155 } 155 }
156 } 156 }
157} 157} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs
index dc53343..e188486 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs
@@ -209,4 +209,4 @@ namespace libTerrain
209 Normalise(); 209 Normalise();
210 } 210 }
211 } 211 }
212} 212} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs
index 7727344..8f9f14b 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs
@@ -69,4 +69,4 @@ namespace libTerrain
69 } 69 }
70 } 70 }
71 } 71 }
72} 72} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs
index 41f6ece..4ff8e78 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs
@@ -356,4 +356,4 @@ namespace libTerrain
356 return this; 356 return this;
357 } 357 }
358 } 358 }
359} 359} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs
index 3560a80..8e8d30f 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs
@@ -209,4 +209,4 @@ namespace libTerrain
209 SaveImage("testimg/output.png"); 209 SaveImage("testimg/output.png");
210 } 210 }
211 } 211 }
212} 212} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs
index 35f5288..abb620a 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs
@@ -142,4 +142,4 @@ namespace libTerrain
142 } 142 }
143 } 143 }
144 } 144 }
145} 145} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
index f14cea7..896c354 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/NavierStokes.cs
@@ -304,4 +304,4 @@ namespace libTerrain
304 nsBufferToDoubles(ref dens, N, ref map); 304 nsBufferToDoubles(ref dens, N, ref map);
305 } 305 }
306 } 306 }
307} 307} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs
index 6767bb9..5be239f 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs
@@ -105,4 +105,4 @@ namespace libTerrain
105 return this; 105 return this;
106 } 106 }
107 } 107 }
108} 108} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs
index 2ffa231..a946b09 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs
@@ -134,4 +134,4 @@ namespace libTerrain
134 return coord; 134 return coord;
135 } 135 }
136 } 136 }
137} 137} \ No newline at end of file
diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs
index 0cca110..6de16ff 100644
--- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs
+++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs
@@ -237,4 +237,4 @@ namespace libTerrain
237 return A; 237 return A;
238 } 238 }
239 } 239 }
240} 240} \ No newline at end of file
diff --git a/OpenSim/Tools/Export/OpenSimExport.cs b/OpenSim/Tools/Export/OpenSimExport.cs
index b0764ff..4a5ba5d 100644
--- a/OpenSim/Tools/Export/OpenSimExport.cs
+++ b/OpenSim/Tools/Export/OpenSimExport.cs
@@ -27,15 +27,11 @@
27*/ 27*/
28using System; 28using System;
29using System.IO; 29using System.IO;
30using System.Reflection;
31using Nini.Config; 30using Nini.Config;
32using OpenSim;
33using OpenSim.Framework; 31using OpenSim.Framework;
34using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
35using OpenSim.Region.Environment; 33using OpenSim.Region.Environment;
36using OpenSim.Region.Environment.Scenes; 34using OpenSim.Region.Environment.Scenes;
37using Mono.Addins;
38using Mono.Addins.Description;
39 35
40namespace OpenSim.Tools.Export 36namespace OpenSim.Tools.Export
41{ 37{
@@ -43,7 +39,7 @@ namespace OpenSim.Tools.Export
43 { 39 {
44 public IniConfigSource config; 40 public IniConfigSource config;
45 public StorageManager sman; 41 public StorageManager sman;
46 42
47 public OpenSimExport(IniConfigSource config) 43 public OpenSimExport(IniConfigSource config)
48 { 44 {
49 this.config = config; 45 this.config = config;
@@ -53,13 +49,13 @@ namespace OpenSim.Tools.Export
53 49
54 // TODO: this really sucks, but given the way we do 50 // TODO: this really sucks, but given the way we do
55 // logging in OpenSim, we need to establish a log up front 51 // logging in OpenSim, we need to establish a log up front
56 52
57 MainLog.Instance = CreateLog(); 53 MainLog.Instance = CreateLog();
58 54
59 this.sman = new StorageManager( 55 sman = new StorageManager(
60 startup.GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"), 56 startup.GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"),
61 startup.GetString("storage_connection_string","") 57 startup.GetString("storage_connection_string", "")
62 ); 58 );
63 } 59 }
64 60
65 public static void Main(string[] args) 61 public static void Main(string[] args)
@@ -67,10 +63,10 @@ namespace OpenSim.Tools.Export
67 OpenSimExport export = new OpenSimExport(InitConfig(args)); 63 OpenSimExport export = new OpenSimExport(InitConfig(args));
68 RegionInfo reg = new RegionInfo("Sara Jane", "Regions/1000-1000.xml"); 64 RegionInfo reg = new RegionInfo("Sara Jane", "Regions/1000-1000.xml");
69 65
70 System.Console.WriteLine("This application does nothing useful yet: " + reg.RegionID); 66 Console.WriteLine("This application does nothing useful yet: " + reg.RegionID);
71 foreach (SceneObjectGroup group in export.sman.DataStore.LoadObjects(reg.RegionID)) 67 foreach (SceneObjectGroup group in export.sman.DataStore.LoadObjects(reg.RegionID))
72 { 68 {
73 System.Console.WriteLine("{0} -> {1}", reg.RegionID, group.UUID); 69 Console.WriteLine("{0} -> {1}", reg.RegionID, group.UUID);
74 } 70 }
75 } 71 }
76 72
@@ -83,25 +79,25 @@ namespace OpenSim.Tools.Export
83 79
84 return new LogBase((Path.Combine(Util.logDir(), "export.log")), "Export", null, true); 80 return new LogBase((Path.Combine(Util.logDir(), "export.log")), "Export", null, true);
85 } 81 }
86 82
87 83
88 private static IniConfigSource InitConfig(string[] args) 84 private static IniConfigSource InitConfig(string[] args)
89 { 85 {
90 System.Console.WriteLine("Good"); 86 Console.WriteLine("Good");
91 ArgvConfigSource configSource = new ArgvConfigSource(args); 87 ArgvConfigSource configSource = new ArgvConfigSource(args);
92 configSource.AddSwitch("Startup", "inifile"); 88 configSource.AddSwitch("Startup", "inifile");
93 89
94 IConfig startupConfig = configSource.Configs["Startup"]; 90 IConfig startupConfig = configSource.Configs["Startup"];
95 string iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini"); 91 string iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini");
96 System.Console.WriteLine(iniFilePath); 92 Console.WriteLine(iniFilePath);
97 IniConfigSource config = new IniConfigSource(); 93 IniConfigSource config = new IniConfigSource();
98 //check for .INI file (either default or name passed in command line) 94 //check for .INI file (either default or name passed in command line)
99 if(! File.Exists(iniFilePath)) 95 if (! File.Exists(iniFilePath))
100 { 96 {
101 iniFilePath = Path.Combine(Util.configDir(), iniFilePath); 97 iniFilePath = Path.Combine(Util.configDir(), iniFilePath);
102 } 98 }
103 99
104 if(File.Exists(iniFilePath)) 100 if (File.Exists(iniFilePath))
105 { 101 {
106 config.Merge(new IniConfigSource(iniFilePath)); 102 config.Merge(new IniConfigSource(iniFilePath));
107 config.Merge(configSource); 103 config.Merge(configSource);
@@ -109,8 +105,8 @@ namespace OpenSim.Tools.Export
109 else 105 else
110 { 106 {
111 // no default config files, so set default values, and save it 107 // no default config files, so set default values, and save it
112 System.Console.WriteLine("We didn't find a config!"); 108 Console.WriteLine("We didn't find a config!");
113 config.Merge(OpenSim.OpenSimMain.DefaultConfig()); 109 config.Merge(OpenSimMain.DefaultConfig());
114 config.Merge(configSource); 110 config.Merge(configSource);
115 } 111 }
116 112