* Spring cleaning on Region.Environment.

* Converted a large number of read-only fields to be actually, readonly.
* Reformatted code sections.
* Removed redundant code.
This commit is contained in:
Adam Frisby
2008-05-01 16:35:00 +00:00
parent 01f31fd933
commit 13526097f2
76 changed files with 4181 additions and 4314 deletions

View File

@@ -40,15 +40,16 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
/// <summary>
/// Asset requests with data which are ready to be sent back to requesters. This includes textures.
/// </summary>
private List<AssetRequest> AssetRequests;
private readonly List<AssetRequest> AssetRequests;
private Scene m_scene;
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
///
/// Assets requests (for each user) which are waiting for asset server data. This includes texture requests
/// </summary>
private Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> RequestedAssets;
private readonly Dictionary<LLUUID, Dictionary<LLUUID, AssetRequest>> RequestedAssets;
private Scene m_scene;
public AssetDownloadModule()
{
@@ -205,22 +206,18 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetDownload
{
public AssetBase AssetInf;
public byte AssetRequestSource = 2;
public long DataPointer = 0;
public long DataPointer;
public int DiscardLevel = -1;
public AssetBase ImageInfo;
public bool IsTextureRequest;
public int NumPackets = 0;
public int PacketCounter = 0;
public byte[] Params = null;
public int NumPackets;
public int PacketCounter;
public byte[] Params;
public LLUUID RequestAssetID;
public IClientAPI RequestUser;
public LLUUID TransferRequestID;
//public bool AssetInCache;
//public int TimeRequested;
public AssetRequest()
{
}
}
#endregion

View File

@@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Fields
private bool m_dumpAssetsToFile;
private readonly bool m_dumpAssetsToFile;
public AgentAssetTransactionsManager Manager;
public LLUUID UserID;
public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
@@ -141,23 +141,23 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
public class AssetXferUploader
{
// Fields
private readonly bool m_dumpAssetToFile;
private readonly AgentAssetTransactions m_userTransactions;
public bool AddToInventory;
public AssetBase Asset;
public LLUUID InventFolder = LLUUID.Zero;
private sbyte invType = 0;
private bool m_createItem = false;
private sbyte invType;
private bool m_createItem;
private string m_description = String.Empty;
private bool m_dumpAssetToFile;
private bool m_finished = false;
private bool m_finished;
private string m_name = String.Empty;
private bool m_storeLocal;
private AgentAssetTransactions m_userTransactions;
private uint nextPerm = 0;
private uint nextPerm;
private IClientAPI ourClient;
public LLUUID TransactionID = LLUUID.Zero;
private sbyte type = 0;
private sbyte type;
public bool UploadComplete;
private byte wearableType = 0;
private byte wearableType;
public ulong XferID;
public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
@@ -390,7 +390,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
item.BasePermissions = 2147483647;
item.CurrentPermissions = 2147483647;
item.NextPermissions = nextPerm;
item.Flags = (uint) wearableType;
item.Flags = wearableType;
userInfo.AddItem(ourClient.AgentId, item);
ourClient.SendInventoryItemCreateUpdate(item);

View File

@@ -40,16 +40,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions
{
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private bool m_dumpAssetsToFile = false;
private Scene m_scene = null;
private bool m_dumpAssetsToFile;
private Scene m_scene;
private AgentAssetTransactionsManager m_transactionManager;
public AssetTransactionModule()
{
// System.Console.WriteLine("creating AgentAssetTransactionModule");
}
#region IAgentAssetTransactions Members
public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
@@ -145,13 +140,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
/// <summary>
/// Each agent has its own singleton collection of transactions
/// </summary>
private Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
private readonly Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
new Dictionary<LLUUID, AgentAssetTransactions>();
/// <summary>
/// Should we dump uploaded assets to the filesystem?
/// </summary>
private bool m_dumpAssetsToFile;
private readonly bool m_dumpAssetsToFile;
public Scene MyScene;

View File

@@ -47,6 +47,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
private readonly BlockingQueue<ITextureSender> m_queueSenders
= new BlockingQueue<ITextureSender>();
private readonly List<Scene> m_scenes = new List<Scene>();
/// <summary>
/// Each user has their own texture download service.
/// </summary>
@@ -54,14 +56,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
new Dictionary<LLUUID, UserTextureDownloadService>();
private Scene m_scene;
private List<Scene> m_scenes = new List<Scene>();
private Thread m_thread;
public TextureDownloadModule()
{
}
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
@@ -69,7 +66,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
if (m_scene == null)
{
//Console.WriteLine("Creating Texture download module");
m_thread = new Thread(new ThreadStart(ProcessTextureSenders));
m_thread = new Thread(ProcessTextureSenders);
m_thread.Name = "ProcessTextureSenderThread";
m_thread.IsBackground = true;
m_thread.Start();

View File

@@ -40,13 +40,13 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureDownload
//private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private bool m_cancel = false;
private readonly LLUUID m_textureId;
private bool m_cancel;
private IClientAPI m_client;
// See ITextureSender
private bool m_sending = false;
private LLUUID m_textureId;
private bool m_sending;
// See ITextureSender

View File

@@ -43,12 +43,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly IClientAPI RequestUser;
/// <summary>
/// Records the number of times texture send has been called.
/// </summary>
public int counter = 0;
public int counter;
public bool ImageLoaded = false;
public bool ImageLoaded;
/// <summary>
/// Holds the texture asset to send.
@@ -57,27 +59,26 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
//public LLUUID assetID { get { return m_asset.FullID; } }
private bool m_cancel = false;
private bool m_cancel;
// See ITextureSender
private bool m_sending = false;
private bool m_sending;
/// <summary>
/// This is actually the number of extra packets required to send the texture data! We always assume
/// at least one is required.
/// </summary>
private int NumPackets = 0;
private int NumPackets;
/// <summary>
/// Holds the packet number to send next. In this case, each packet is 1000 bytes long and starts
/// at the 600th byte (0th indexed).
/// </summary>
private int PacketCounter = 0;
private int PacketCounter;
private int RequestedDiscardLevel = -1;
private IClientAPI RequestUser;
private uint StartPacketNumber = 0;
private uint StartPacketNumber;
public TextureSender(IClientAPI client, int discardLevel, uint packetNumber)
{
@@ -190,7 +191,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
catch (ArgumentOutOfRangeException)
{
m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" +
m_asset.FullID.ToString());
m_asset.FullID);
return;
}
RequestUser.OutPacket(im, ThrottleOutPacketType.Texture);

View File

@@ -41,10 +41,6 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
public XferModule()
{
}
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
@@ -149,11 +145,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
public IClientAPI Client;
private bool complete;
public byte[] Data = new byte[0];
public int DataPointer = 0;
public int DataPointer;
public string FileName = String.Empty;
public uint Packet = 0;
public uint Packet;
public uint Serial = 1;
public ulong XferID = 0;
public ulong XferID;
public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
{
@@ -217,7 +213,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
{
byte[] transferData = new byte[Data.Length - DataPointer];
Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
uint endPacket = Packet |= (uint) 0x80000000;
uint endPacket = Packet |= 0x80000000;
Client.SendXferPacket(XferID, endPacket, transferData);
Packet++;
DataPointer += (Data.Length - DataPointer);

View File

@@ -44,15 +44,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
public class ChatModule : IRegionModule, ISimChat
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_defaultzone = null;
private readonly List<Scene> m_scenes = new List<Scene>();
private string m_defaultzone;
private IRCChatModule m_irc = null;
private Thread m_irc_connector = null;
private IRCChatModule m_irc;
private Thread m_irc_connector;
private string m_last_leaving_user = null;
private string m_last_new_user = null;
private string m_last_leaving_user;
private string m_last_new_user;
private int m_saydistance = 30;
private List<Scene> m_scenes = new List<Scene>();
private int m_shoutdistance = 100;
internal object m_syncInit = new object();
internal object m_syncLogout = new object();
@@ -257,7 +257,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex)
{
m_log.Error("[IRC]: NewClient exception trap:" + ex.ToString());
m_log.Error("[IRC]: NewClient exception trap:" + ex);
}
}
@@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex)
{
m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex.ToString());
m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex);
}
}
}
@@ -372,24 +372,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
#endregion
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Thread listener;
private string m_basenick = null;
private string m_channel = null;
private bool m_connected = false;
private bool m_enabled = false;
private List<Scene> m_last_scenes = null;
private string m_nick = null;
private uint m_port = 6668;
private string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}";
private readonly string m_basenick;
private readonly string m_channel;
private readonly bool m_enabled;
private readonly uint m_port = 6668;
private readonly string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}";
private readonly string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private Thread listener;
private bool m_connected;
private List<Scene> m_last_scenes;
private string m_nick;
private StreamReader m_reader;
private List<Scene> m_scenes = null;
private string m_server = null;
private List<Scene> m_scenes;
private string m_server;
private NetworkStream m_stream;
internal object m_syncConnect = new object();
private TcpClient m_tcp;
private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private StreamWriter m_writer;
private Thread pingSender;
@@ -478,13 +478,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
m_reader = new StreamReader(m_stream);
m_writer = new StreamWriter(m_stream);
pingSender = new Thread(new ThreadStart(PingRun));
pingSender = new Thread(PingRun);
pingSender.Name = "PingSenderThread";
pingSender.IsBackground = true;
pingSender.Start();
ThreadTracker.Add(pingSender);
listener = new Thread(new ThreadStart(ListenerRun));
listener = new Thread(ListenerRun);
listener.Name = "IRCChatModuleListenerThread";
listener.IsBackground = true;
listener.Start();
@@ -545,7 +545,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex)
{
m_log.Error("[IRC]: PrivMsg exception trap:" + ex.ToString());
m_log.Error("[IRC]: PrivMsg exception trap:" + ex);
}
}
@@ -588,7 +588,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{
try
{
if (m_connected == true)
if (m_connected)
{
m_writer.WriteLine("PING :" + m_server);
m_writer.Flush();
@@ -602,7 +602,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex)
{
m_log.Error("[IRC]: PingRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace);
m_log.Error("[IRC]: PingRun exception trap:" + ex + "\n" + ex.StackTrace);
}
}
}
@@ -615,7 +615,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{
try
{
while ((m_connected == true) && ((inputLine = m_reader.ReadLine()) != null))
while (m_connected && ((inputLine = m_reader.ReadLine()) != null))
{
// Console.WriteLine(inputLine);
if (inputLine.Contains(m_channel))
@@ -659,7 +659,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex)
{
m_log.Error("[IRC]: ListenerRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace);
m_log.Error("[IRC]: ListenerRun exception trap:" + ex + "\n" + ex.StackTrace);
}
}
}
@@ -685,7 +685,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
catch (Exception ex) // IRC gate should not crash Sim
{
m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex.ToString() + "\n" + ex.StackTrace);
m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex + "\n" + ex.StackTrace);
}
}

View File

@@ -65,55 +65,55 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
public class SampleMoneyModule : IMoneyModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<LLUUID, int> m_KnownClientFunds = new Dictionary<LLUUID, int>();
/// <summary>
/// Region UUIDS indexed by AgentID
/// </summary>
private readonly Dictionary<LLUUID, LLUUID> m_rootAgents = new Dictionary<LLUUID, LLUUID>();
/// <summary>
/// Scenes by Region Handle
/// </summary>
private readonly Dictionary<ulong, Scene> m_scenel = new Dictionary<ulong, Scene>();
/// <summary>
/// Where Stipends come from and Fees go to.
/// </summary>
private LLUUID EconomyBaseAccount = LLUUID.Zero;
private float EnergyEfficiency = 0f;
private bool gridmode = false;
private float EnergyEfficiency;
private bool gridmode;
private ObjectPaid handerOnObjectPaid;
private bool m_enabled = true;
private IConfigSource m_gConfig;
private bool m_keepMoneyAcrossLogins = true;
private Dictionary<LLUUID, int> m_KnownClientFunds = new Dictionary<LLUUID, int>();
private string m_LandAddress = String.Empty;
private int m_minFundsBeforeRefresh = 100;
private string m_MoneyAddress = String.Empty;
/// <summary>
/// Region UUIDS indexed by AgentID
/// </summary>
private Dictionary<LLUUID, LLUUID> m_rootAgents = new Dictionary<LLUUID, LLUUID>();
/// <summary>
/// Scenes by Region Handle
/// </summary>
private Dictionary<ulong, Scene> m_scenel = new Dictionary<ulong, Scene>();
private int m_stipend = 1000;
private int ObjectCapacity = 45000;
private int ObjectCount = 0;
private int PriceEnergyUnit = 0;
private int PriceGroupCreate = 0;
private int PriceObjectClaim = 0;
private float PriceObjectRent = 0f;
private float PriceObjectScaleFactor = 0f;
private int PriceParcelClaim = 0;
private float PriceParcelClaimFactor = 0f;
private int PriceParcelRent = 0;
private int PricePublicObjectDecay = 0;
private int PricePublicObjectDelete = 0;
private int PriceRentLight = 0;
private int PriceUpload = 0;
private int TeleportMinPrice = 0;
private int ObjectCount;
private int PriceEnergyUnit;
private int PriceGroupCreate;
private int PriceObjectClaim;
private float PriceObjectRent;
private float PriceObjectScaleFactor;
private int PriceParcelClaim;
private float PriceParcelClaimFactor;
private int PriceParcelRent;
private int PricePublicObjectDecay;
private int PricePublicObjectDelete;
private int PriceRentLight;
private int PriceUpload;
private int TeleportMinPrice;
private float TeleportPriceExponent = 0f;
private float TeleportPriceExponent;
private int UserLevelPaysFees = 2;
private Scene XMLRPCHandler;
@@ -305,7 +305,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
Hashtable hbinfo =
GetBalanceForUserFromMoneyServer(client.AgentId, client.SecureSessionId, s.RegionInfo.originRegionID.ToString(),
s.RegionInfo.regionSecret);
if ((bool) hbinfo["success"] == true)
if ((bool) hbinfo["success"])
{
Helpers.TryParse((string) hbinfo["agentId"], out agentID);
try
@@ -333,7 +333,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
else
{
m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentID,
(string) hbinfo["errorMessage"]);
hbinfo["errorMessage"]);
client.SendAlertMessage((string) hbinfo["errorMessage"]);
}
SendMoneyBalance(client, agentID, client.SessionId, LLUUID.Zero);
@@ -660,7 +660,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
Hashtable hresult = genericCurrencyXMLRPCRequest(ht, "regionMoveMoney");
if ((bool) hresult["success"] == true)
if ((bool) hresult["success"])
{
int funds1 = 0;
int funds2 = 0;
@@ -718,7 +718,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
Hashtable hbinfo =
GetBalanceForUserFromMoneyServer(aClient.AgentId, aClient.SecureSessionId, s.RegionInfo.originRegionID.ToString(),
s.RegionInfo.regionSecret);
if ((bool) hbinfo["success"] == true)
if ((bool) hbinfo["success"])
{
try
{
@@ -743,7 +743,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
else
{
m_log.WarnFormat("[MONEY]: Getting Money for user {0} failed with the following message:{1}", agentId,
(string) hbinfo["errorMessage"]);
hbinfo["errorMessage"]);
aClient.SendAlertMessage((string) hbinfo["errorMessage"]);
}
}
@@ -812,7 +812,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
string secret = (string) requestData["secret"];
Scene userScene = GetRandomScene();
if (userScene.RegionInfo.regionSecret.ToString() == secret)
if (userScene.RegionInfo.regionSecret == secret)
{
IClientAPI client = LocateClientObject(agentId);
@@ -1238,7 +1238,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
{
lock (e)
{
if (e.economyValidated == true && e.transactionID == 0)
if (e.economyValidated && e.transactionID == 0)
{
e.transactionID = Util.UnixTimeSinceEpoch();
@@ -1328,7 +1328,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
else
{
m_log.Warn("[MONEY]: Potential Fraud Warning, got money transfer request for avatar that isn't in this simulator - Details; Sender:" +
e.sender.ToString() + " Receiver: " + e.receiver.ToString() + " Amount: " + e.amount.ToString());
e.sender + " Receiver: " + e.receiver + " Amount: " + e.amount);
}
}
@@ -1400,7 +1400,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
{
Hashtable hresult =
claim_user(avatar.UUID, avatar.ControllingClient.SecureSessionId, regionID, RegionItem.RegionInfo.regionSecret);
if ((bool) hresult["success"] == true)
if ((bool) hresult["success"])
{
int funds = 0;
try
@@ -1432,7 +1432,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
if (RegionItem != null)
{
Hashtable hresult = claim_user(avatar.UUID, avatar.ControllingClient.SecureSessionId, regionID, RegionItem.RegionInfo.regionSecret);
if ((bool) hresult["success"] == true)
if ((bool) hresult["success"])
{
int funds = 0;
try
@@ -1460,7 +1460,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
#endregion
}
public enum TransactionType : int
public enum TransactionType
{
SystemGenerated = 0,
RegionMoneyRequest = 1,

View File

@@ -42,10 +42,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<LLUUID, List<FriendListItem>> FriendLists = new Dictionary<LLUUID, List<FriendListItem>>();
private Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>();
private Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>();
private List<Scene> m_scene = new List<Scene>();
private readonly Dictionary<LLUUID, List<FriendListItem>> FriendLists = new Dictionary<LLUUID, List<FriendListItem>>();
private readonly Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>();
private readonly Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>();
private readonly List<Scene> m_scene = new List<Scene>();
#region IRegionModule Members
@@ -213,7 +213,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
List<LLUUID> updateUsers = new List<LLUUID>();
foreach (FriendListItem fli in lfli)
{
if (fli.onlinestatus == true)
if (fli.onlinestatus)
{
updateUsers.Add(fli.Friend);
}
@@ -357,20 +357,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
// https://wiki.secondlife.com/wiki/ImprovedInstantMessage
// 38 == Offer friendship
if (dialog == (byte) 38)
if (dialog == 38)
{
LLUUID friendTransactionID = LLUUID.Random();
m_pendingFriendRequests.Add(friendTransactionID, fromAgentID);
m_log.Info("[FRIEND]: 38 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
m_log.Info("[FRIEND]: 38 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" +
message);
GridInstantMessage msg = new GridInstantMessage();
msg.fromAgentID = fromAgentID.UUID;
msg.fromAgentSession = fromAgentSession.UUID;
msg.toAgentID = toAgentID.UUID;
msg.imSessionID = friendTransactionID.UUID; // This is the item we're mucking with here
m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID.ToString());
m_log.Info("[FRIEND]: Filling Session: " + msg.imSessionID);
msg.timestamp = timestamp;
if (client != null)
{
@@ -393,16 +393,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
}
// 39 == Accept Friendship
if (dialog == (byte) 39)
if (dialog == 39)
{
m_log.Info("[FRIEND]: 39 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
m_log.Info("[FRIEND]: 39 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" +
message);
}
// 40 == Decline Friendship
if (dialog == (byte) 40)
if (dialog == 40)
{
m_log.Info("[FRIEND]: 40 - From:" + fromAgentID.ToString() + " To: " + toAgentID.ToString() + " Session:" + imSessionID.ToString() + " Message:" +
m_log.Info("[FRIEND]: 40 - From:" + fromAgentID + " To: " + toAgentID + " Session:" + imSessionID + " Message:" +
message);
}
}
@@ -433,14 +433,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
msg.ParentEstateID = 0;
msg.timestamp = (uint) Util.UnixTimeSinceEpoch();
msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID;
msg.dialog = (byte) 39; // Approved friend request
msg.dialog = 39; // Approved friend request
msg.Position = new sLLVector3();
msg.offline = (byte) 0;
msg.offline = 0;
msg.binaryBucket = new byte[0];
// We don't really care which scene we pipe it through, it goes to the shared IM Module and/or the database
SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, (uint) 1);
SceneAgentIn.StoreAddFriendship(m_pendingFriendRequests[transactionID], agentID, 1);
m_pendingFriendRequests.Remove(transactionID);
// TODO: Inform agent that the friend is online
@@ -471,9 +471,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
msg.ParentEstateID = 0;
msg.timestamp = (uint) Util.UnixTimeSinceEpoch();
msg.RegionID = SceneAgentIn.RegionInfo.RegionID.UUID;
msg.dialog = (byte) 40; // Deny friend request
msg.dialog = 40; // Deny friend request
msg.Position = new sLLVector3();
msg.offline = (byte) 0;
msg.offline = 0;
msg.binaryBucket = new byte[0];
SceneAgentIn.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
m_pendingFriendRequests.Remove(transactionID);

View File

@@ -41,10 +41,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<LLUUID, GroupList> m_grouplistmap = new Dictionary<LLUUID, GroupList>();
private Dictionary<LLUUID, GroupData> m_groupmap = new Dictionary<LLUUID, GroupData>();
private Dictionary<LLUUID, IClientAPI> m_iclientmap = new Dictionary<LLUUID, IClientAPI>();
private List<Scene> m_scene = new List<Scene>();
private readonly Dictionary<LLUUID, GroupList> m_grouplistmap = new Dictionary<LLUUID, GroupList>();
private readonly Dictionary<LLUUID, GroupData> m_groupmap = new Dictionary<LLUUID, GroupData>();
private readonly Dictionary<LLUUID, IClientAPI> m_iclientmap = new Dictionary<LLUUID, IClientAPI>();
private readonly List<Scene> m_scene = new List<Scene>();
#region IRegionModule Members
@@ -214,7 +214,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Groups
}
else
{
m_log.Info("[GROUP]: Removing all reference to groups for " + agentID.ToString());
m_log.Info("[GROUP]: Removing all reference to groups for " + agentID);
}
m_iclientmap.Remove(agentID);
}

View File

@@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
/// occurs in the initial offer message, not the accept message. So this dictionary links
/// IM Session Ids to ItemIds
/// </summary>
private IDictionary<LLUUID, LLUUID> m_pendingOffers = new Dictionary<LLUUID, LLUUID>();
private readonly IDictionary<LLUUID, LLUUID> m_pendingOffers = new Dictionary<LLUUID, LLUUID>();
private Scene m_scene;

View File

@@ -41,10 +41,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Profiles
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene;
public AvatarProfilesModule()
{
}
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
@@ -104,7 +100,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Profiles
}
else
{
m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID.ToString());
m_log.Debug("[AvatarProfilesModule]: Got null for profile for " + avatarID);
}
}

View File

@@ -42,11 +42,11 @@ namespace OpenSim.Region.Environment.Modules.Framework
public class Command : ICommand
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<CommandArgument> m_args = new List<CommandArgument>();
private readonly List<CommandArgument> m_args = new List<CommandArgument>();
private Action<object[]> m_command;
private string m_help;
private string m_name;
private readonly Action<object[]> m_command;
private readonly string m_help;
private readonly string m_name;
public Command(string name, Action<Object[]> command, string help)
{
@@ -164,9 +164,9 @@ namespace OpenSim.Region.Environment.Modules.Framework
/// </summary>
public class CommandArgument
{
private string m_help;
private string m_name;
private string m_type;
private readonly string m_help;
private readonly string m_name;
private readonly string m_type;
private Object m_val;
public CommandArgument(string name, string help, string type)
@@ -204,8 +204,8 @@ namespace OpenSim.Region.Environment.Modules.Framework
public class Commander : ICommander
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>();
private string m_name;
private readonly Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>();
private readonly string m_name;
public Commander(string name)
{
@@ -235,11 +235,11 @@ namespace OpenSim.Region.Environment.Modules.Framework
}
classSrc = classSrc.Remove(classSrc.Length - 1); // Delete the last comma
classSrc += " )\n\t{\n";
classSrc += "\t\tObject[] args = new Object[" + com.Arguments.Count.ToString() + "];\n";
classSrc += "\t\tObject[] args = new Object[" + com.Arguments.Count + "];\n";
int i = 0;
foreach (KeyValuePair<string, string> arg in com.Arguments)
{
classSrc += "\t\targs[" + i.ToString() + "] = " + Util.Md5Hash(arg.Key) + " " + ";\n";
classSrc += "\t\targs[" + i + "] = " + Util.Md5Hash(arg.Key) + " " + ";\n";
i++;
}
classSrc += "\t\tGetCommander(\"" + m_name + "\").Run(\"" + com.Name + "\", args);\n";

View File

@@ -34,7 +34,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
{
public class CommanderTestModule : IRegionModule, ICommandableModule
{
private Commander m_commander = new Commander("CommanderTest");
private readonly Commander m_commander = new Commander("CommanderTest");
private Scene m_scene;
#region ICommandableModule Members

View File

@@ -29,14 +29,14 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
#endregion
private readonly Dictionary<Type, Object> m_interfaces = new Dictionary<Type, object>();
private readonly Object m_lockObject = new object();
private readonly List<Location> m_myLocations = new List<Location>();
private readonly Dictionary<Location, string[]> m_neighbourInterfaces = new Dictionary<Location, string[]>();
private readonly Dictionary<Location, RemotingObject> m_neighbourRemote = new Dictionary<Location, RemotingObject>();
private IConfigSource m_config;
private bool m_enabled = false;
private bool m_enabled;
private Object m_lockObject = new object();
private RemotingObject m_myRemote;
private TcpChannel m_tcpChannel;
private int m_tcpPort = 10101;

View File

@@ -40,12 +40,12 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
{
public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
{
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private readonly Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private Dictionary<string, IDynamicTextureRender> RenderPlugins =
private readonly Dictionary<string, IDynamicTextureRender> RenderPlugins =
new Dictionary<string, IDynamicTextureRender>();
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
private readonly Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
#region IDynamicTextureManager Members
@@ -176,14 +176,14 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
public class DynamicTextureUpdater
{
public bool BlendWithOldTexture = false;
public bool BlendWithOldTexture;
public string BodyData;
public string ContentType;
public byte FrontAlpha = 255;
public LLUUID LastAssetID;
public string Params;
public LLUUID PrimID;
public bool SetNewFrontAlpha = false;
public bool SetNewFrontAlpha;
public LLUUID SimUUID;
public LLUUID UpdaterID;
public int UpdateTimer;

View File

@@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
{
public class HttpRequestModule : IRegionModule, IHttpRequests
{
private object HttpListLock = new object();
private readonly object HttpListLock = new object();
private int httpTimeout = 30000;
private string m_name = "HttpScriptRequests";
@@ -93,10 +93,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest
private Scene m_scene;
private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>();
public HttpRequestModule()
{
}
#region IHttpRequests Members
public LLUUID MakeHttpRequest(string url, string parameters, string body)

View File

@@ -120,9 +120,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
private void MakeHttpRequest(string url, LLUUID requestID)
{
WebRequest request = HttpWebRequest.Create(url);
WebRequest request = WebRequest.Create(url);
RequestState state = new RequestState((HttpWebRequest) request, requestID);
IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
IAsyncResult result = request.BeginGetResponse(HttpRequestReturn, state);
TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
state.TimeOfRequest = (int) t.TotalSeconds;
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
private void HttpRequestReturn(IAsyncResult result)
{
RequestState state = (RequestState) result.AsyncState;
WebRequest request = (WebRequest) state.Request;
WebRequest request = state.Request;
HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result);
if (response.StatusCode == HttpStatusCode.OK)
{
@@ -175,9 +175,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
public class RequestState
{
public HttpWebRequest Request = null;
public HttpWebRequest Request;
public LLUUID RequestID = LLUUID.Zero;
public int TimeOfRequest = 0;
public int TimeOfRequest;
public RequestState(HttpWebRequest request, LLUUID requestID)
{

View File

@@ -48,10 +48,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
private Scene m_scene;
private IDynamicTextureManager m_textureManager;
public VectorRenderModule()
{
}
#region IDynamicTextureRender Members
public string GetContentType()
@@ -138,7 +134,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
catch (Exception e)
{
//Ckrinke: Add a WriteLine to remove the warning about 'e' defined but not used
Console.WriteLine("Problem with Draw. Please verify parameters." + e.ToString());
Console.WriteLine("Problem with Draw. Please verify parameters." + e);
}
if ((size < 128) || (size > 1024))
@@ -260,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
endPoint.X = (int) x;
endPoint.Y = (int) y;
Image image = ImageHttpRequest(nextLine);
graph.DrawImage(image, (float) startPoint.X, (float) startPoint.Y, x, y);
graph.DrawImage(image, startPoint.X, startPoint.Y, x, y);
startPoint.X += endPoint.X;
startPoint.Y += endPoint.Y;
}
@@ -353,7 +349,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.VectorRender
private Bitmap ImageHttpRequest(string url)
{
WebRequest request = HttpWebRequest.Create(url);
WebRequest request = WebRequest.Create(url);
//Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used.
//Ckrinke Stream str = null;
HttpWebResponse response = (HttpWebResponse) (request).GetResponse();

View File

@@ -75,10 +75,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
private Queue m_pendingQ;
private Scene m_scene;
public WorldCommModule()
{
}
#region IRegionModule Members
public void Initialise(Scene scene, IConfigSource config)
@@ -324,8 +320,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
public class ListenerManager
{
//private Dictionary<int, ListenerInfo> m_listeners;
private readonly Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
private object ListenersLock = new object();
private Hashtable m_listeners = Hashtable.Synchronized(new Hashtable());
private int m_MaxListeners = 100;
public int AddListener(uint localID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg)
@@ -485,6 +481,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
public class ListenerInfo
{
private readonly LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
private bool m_active; // Listener is active or not
private int m_channel; // Channel
private int m_handle; // Assigned handle of this listener
@@ -494,7 +491,6 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
private uint m_localID; // Local ID from script engine
private string m_message; // The message
private string m_name; // Object name to filter messages from
private LLUUID m_sourceItemID; // ID of the scenePart or avatar source of the message
public ListenerInfo(uint localID, int handle, LLUUID ItemID, LLUUID hostID, int channel, string name, LLUUID id, string message)
{

View File

@@ -78,20 +78,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
public class XMLRPCModule : IRegionModule, IXMLRPC
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly List<Scene> m_scenes = new List<Scene>();
private readonly object XMLRPCListLock = new object();
private string m_name = "XMLRPCModule";
// <channel id, RPCChannelInfo>
private Dictionary<LLUUID, RPCChannelInfo> m_openChannels;
private Dictionary<LLUUID, SendRemoteDataRequest> m_pendingSRDResponses;
private int m_remoteDataPort = 0;
private int m_remoteDataPort;
private Dictionary<LLUUID, RPCRequestInfo> m_rpcPending;
private Dictionary<LLUUID, RPCRequestInfo> m_rpcPendingResponses;
private List<Scene> m_scenes = new List<Scene>();
private int RemoteReplyScriptTimeout = 9000;
private int RemoteReplyScriptWait = 300;
private object XMLRPCListLock = new object();
#region IRegionModule Members
@@ -428,15 +428,15 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
public class RPCRequestInfo
{
private LLUUID m_ChannelKey;
private string m_IntVal;
private LLUUID m_ItemID;
private uint m_localID;
private LLUUID m_MessageID;
private readonly LLUUID m_ChannelKey;
private readonly string m_IntVal;
private readonly LLUUID m_ItemID;
private readonly uint m_localID;
private readonly LLUUID m_MessageID;
private readonly string m_StrVal;
private bool m_processed;
private int m_respInt;
private string m_respStr;
private string m_StrVal;
public RPCRequestInfo(uint localID, LLUUID itemID, LLUUID channelKey, string strVal, string intVal)
{
@@ -514,9 +514,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
public class RPCChannelInfo
{
private LLUUID m_ChannelKey;
private LLUUID m_itemID;
private uint m_localID;
private readonly LLUUID m_ChannelKey;
private readonly LLUUID m_itemID;
private readonly uint m_localID;
public RPCChannelInfo(uint localID, LLUUID itemID, LLUUID channelID)
{

View File

@@ -44,8 +44,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land
//Land types set with flags in ParcelOverlay.
//Only one of these can be used.
public const float BAN_LINE_SAFETY_HIEGHT = 100;
public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = (byte) 128; //Equals 10000000
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = (byte) 64; //Equals 01000000
public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = 128; //Equals 10000000
public const byte LAND_FLAG_PROPERTY_BORDER_WEST = 64; //Equals 01000000
//RequestResults (I think these are right, they seem to work):
public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land
@@ -55,26 +55,26 @@ namespace OpenSim.Region.Environment.Modules.World.Land
public const int LAND_SELECT_OBJECTS_GROUP = 4;
public const int LAND_SELECT_OBJECTS_OTHER = 8;
public const int LAND_SELECT_OBJECTS_OWNER = 2;
public const byte LAND_TYPE_IS_BEING_AUCTIONED = (byte) 5; //Equals 00000101
public const byte LAND_TYPE_IS_FOR_SALE = (byte) 4; //Equals 00000100
public const byte LAND_TYPE_OWNED_BY_GROUP = (byte) 2; //Equals 00000010
public const byte LAND_TYPE_OWNED_BY_OTHER = (byte) 1; //Equals 00000001
public const byte LAND_TYPE_OWNED_BY_REQUESTER = (byte) 3; //Equals 00000011
public const byte LAND_TYPE_PUBLIC = (byte) 0; //Equals 00000000
public const byte LAND_TYPE_IS_BEING_AUCTIONED = 5; //Equals 00000101
public const byte LAND_TYPE_IS_FOR_SALE = 4; //Equals 00000100
public const byte LAND_TYPE_OWNED_BY_GROUP = 2; //Equals 00000010
public const byte LAND_TYPE_OWNED_BY_OTHER = 1; //Equals 00000001
public const byte LAND_TYPE_OWNED_BY_REQUESTER = 3; //Equals 00000011
public const byte LAND_TYPE_PUBLIC = 0; //Equals 00000000
//These are other constants. Yay!
public const int START_LAND_LOCAL_ID = 1;
#endregion
private int[,] landIDList = new int[64,64];
private Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>();
private readonly int[,] landIDList = new int[64,64];
private readonly Dictionary<int, ILandObject> landList = new Dictionary<int, ILandObject>();
private readonly Scene m_scene;
private bool landPrimCountTainted = false;
private bool landPrimCountTainted;
private int lastLandLocalID = START_LAND_LOCAL_ID - 1;
private bool m_allowedForcefulBans = true;
private Scene m_scene;
public LandChannel(Scene scene)
{
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
lastLandLocalID++;
new_land.landData.localID = lastLandLocalID;
landList.Add(lastLandLocalID, (LandObject) new_land.Copy());
landList.Add(lastLandLocalID, new_land.Copy());
bool[,] landBitmap = new_land.getLandBitmap();
@@ -532,7 +532,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
for (x = 0; x < 64; x++)
{
byte tempByte = (byte) 0; //This represents the byte for the current 4x4
byte tempByte = 0; //This represents the byte for the current 4x4
ILandObject currentParcelBlock = null;
try
@@ -611,7 +611,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
packet = (ParcelOverlayPacket) PacketPool.Instance.GetPacket(PacketType.ParcelOverlay);
packet.ParcelData.Data = byteArray;
packet.ParcelData.SequenceID = sequenceID;
remote_client.OutPacket((Packet) packet, ThrottleOutPacketType.Task);
remote_client.OutPacket(packet, ThrottleOutPacketType.Task);
sequenceID++;
byteArray = new byte[LAND_BLOCKS_PER_PACKET];
}

View File

@@ -45,14 +45,14 @@ namespace OpenSim.Region.Environment.Modules.World.Land
m_scene.EventManager.OnParcelPrimCountAdd += landChannel.addPrimToLandPrimCounts;
m_scene.EventManager.OnParcelPrimCountUpdate += landChannel.updateLandPrimCounts;
m_scene.EventManager.OnAvatarEnteringNewParcel += new EventManager.AvatarEnteringNewParcel(landChannel.handleAvatarChangingParcel);
m_scene.EventManager.OnClientMovement += new EventManager.ClientMovement(landChannel.handleAnyClientMovement);
m_scene.EventManager.OnAvatarEnteringNewParcel += landChannel.handleAvatarChangingParcel;
m_scene.EventManager.OnClientMovement += landChannel.handleAnyClientMovement;
m_scene.EventManager.OnValidateLandBuy += landChannel.handleLandValidationRequest;
m_scene.EventManager.OnLandBuy += landChannel.handleLandBuyRequest;
lock (m_scene)
{
m_scene.LandChannel = (ILandChannel) landChannel;
m_scene.LandChannel = landChannel;
}
}

View File

@@ -73,6 +73,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land
get { return m_scene.RegionInfo.RegionID; }
}
#endregion
#region Constructors
public LandObject(LLUUID owner_id, bool is_group_owned, Scene scene)
@@ -98,7 +100,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize)
{
return (landBitmap[x / 4, y / 4] == true);
return landBitmap[x / 4, y / 4];
}
else
{
@@ -148,7 +150,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
updatePacket.ParcelData.GroupID = landData.groupID;
updatePacket.ParcelData.GroupPrims = landData.groupPrims;
updatePacket.ParcelData.IsGroupOwned = landData.isGroupOwned;
updatePacket.ParcelData.LandingType = (byte) landData.landingType;
updatePacket.ParcelData.LandingType = landData.landingType;
updatePacket.ParcelData.LocalID = landData.localID;
if (landData.area > 0)
{
@@ -212,7 +214,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
landData.selectedPrims;
updatePacket.ParcelData.UserLocation = landData.userLocation;
updatePacket.ParcelData.UserLookAt = landData.userLookAt;
remote_client.OutPacket((Packet) updatePacket, ThrottleOutPacketType.Task);
remote_client.OutPacket(updatePacket, ThrottleOutPacketType.Task);
}
public void updateLandProperties(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client)
@@ -355,7 +357,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock();
listBlock.Flags = (uint) 0;
listBlock.Flags = 0;
listBlock.ID = entry.AgentID;
listBlock.Time = 0;
@@ -367,7 +369,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock();
listBlock.Flags = (uint) 0;
listBlock.Flags = 0;
listBlock.ID = LLUUID.Zero;
listBlock.Time = 0;
@@ -390,7 +392,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
replyPacket.Data.SequenceID = 0;
replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access);
remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
remote_client.OutPacket(replyPacket, ThrottleOutPacketType.Task);
}
if (flags == (uint) ParcelManager.AccessList.Ban || flags == (uint) ParcelManager.AccessList.Both)
@@ -402,7 +404,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
replyPacket.Data.SequenceID = 0;
replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban);
remote_client.OutPacket((Packet) replyPacket, ThrottleOutPacketType.Task);
remote_client.OutPacket(replyPacket, ThrottleOutPacketType.Task);
}
}
@@ -482,7 +484,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
for (y = 0; y < 64; y++)
{
if (landBitmap[x, y] == true)
if (landBitmap[x, y])
{
if (min_x > x) min_x = x;
if (min_y > y) min_y = y;
@@ -499,7 +501,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
if (ty > 255)
ty = 255;
landData.AABBMin =
new LLVector3((float) (min_x * 4), (float) (min_y * 4),
new LLVector3((min_x * 4), (min_y * 4),
(float) m_scene.Heightmap[tx, ty]);
tx = max_x * 4;
@@ -509,7 +511,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
if (ty > 255)
ty = 255;
landData.AABBMax =
new LLVector3((float) (max_x * 4), (float) (max_y * 4),
new LLVector3((max_x * 4), (max_y * 4),
(float) m_scene.Heightmap[tx, ty]);
landData.area = tempArea;
}
@@ -657,7 +659,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
if (i % 8 == 0)
{
tempConvertArr[byteNum] = tempByte;
tempByte = (byte) 0;
tempByte = 0;
i = 0;
byteNum++;
}
@@ -677,7 +679,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
tempByte = landData.landBitmapByteArray[i];
for (bitNum = 0; bitNum < 8; bitNum++)
{
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & 1);
tempConvertMap[x, y] = bit;
x++;
if (x > 63)
@@ -751,7 +753,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
resultLocalIDs.RemoveAt(0);
}
pack.Data = data;
remote_client.OutPacket((Packet) pack, ThrottleOutPacketType.Task);
remote_client.OutPacket(pack, ThrottleOutPacketType.Task);
}
}
@@ -922,7 +924,5 @@ namespace OpenSim.Region.Environment.Modules.World.Land
#endregion
#endregion
#endregion
}
}

View File

@@ -37,10 +37,10 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
{
public class SerialiserModule : IRegionModule, IRegionSerialiser
{
private Commander m_commander = new Commander("Export");
private List<Scene> m_regions = new List<Scene>();
private readonly Commander m_commander = new Commander("Export");
private readonly List<Scene> m_regions = new List<Scene>();
private readonly List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
private string m_savedir = "exports" + "/";
private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
#region IRegionModule Members
@@ -105,8 +105,8 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
TextWriter regionInfoWriter = new StreamWriter(saveDir + "README.TXT");
regionInfoWriter.WriteLine("Region Name: " + scene.RegionInfo.RegionName);
regionInfoWriter.WriteLine("Region ID: " + scene.RegionInfo.RegionID.ToString());
regionInfoWriter.WriteLine("Backup Time: UTC " + DateTime.UtcNow.ToString());
regionInfoWriter.WriteLine("Region ID: " + scene.RegionInfo.RegionID);
regionInfoWriter.WriteLine("Backup Time: UTC " + DateTime.UtcNow);
regionInfoWriter.WriteLine("Serialise Version: 0.1");
regionInfoWriter.Close();
@@ -141,7 +141,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
{
if (region.RegionInfo.RegionName == (string) args[0])
{
List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/");
List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID + "/");
}
}
}
@@ -150,7 +150,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
{
foreach (Scene region in m_regions)
{
List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/");
List<string> results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID + "/");
}
}

View File

@@ -127,7 +127,7 @@ namespace OpenSim.Region.Environment.Modules.World.Sun
{
long m_addticks = (DateTime.Now.Ticks - m_start) * m_dilation;
DateTime dt = new DateTime(m_start + m_addticks);
return (double) dt.Hour + ((double) dt.Minute / 60.0);
return dt.Hour + (dt.Minute / 60.0);
}
private LLVector3 SunPos(double hour)

View File

@@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.Effects
{
for (y = 0; y < map.Height; y++)
{
if (cliffMask[x, y] == true)
if (cliffMask[x, y])
eroder.PaintEffect(map, x, y, 4, 0.1);
}
}

View File

@@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
{
for (x = 0; x < retval.Width; x++)
{
retval[x, y] = (double) bs.ReadByte() * ((double) bs.ReadByte() / 127.0);
retval[x, y] = bs.ReadByte() * (bs.ReadByte() / 127.0);
bs.ReadBytes(11); // Advance the stream to next bytes.
}
}
@@ -76,7 +76,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
{
for (j = 0; j < 256; j++)
{
lookupHeightTable[i + (j * 256)] = ((double) i * ((double) j / 127.0));
lookupHeightTable[i + (j * 256)] = (i * (j / 127.0));
}
}

View File

@@ -50,14 +50,14 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
BinaryReader bs = new BinaryReader(s);
bool eof = false;
if (ASCIIEncoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ")
if (Encoding.ASCII.GetString(bs.ReadBytes(16)) == "TERRAGENTERRAIN ")
{
// Terragen file
while (eof == false)
{
int w = 256;
int h = 256;
string tmp = ASCIIEncoding.ASCII.GetString(bs.ReadBytes(4));
string tmp = Encoding.ASCII.GetString(bs.ReadBytes(4));
switch (tmp)
{
case "SIZE":
@@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
{
for (y = 0; y < h; y++)
{
retval[x, y] = (double) baseHeight + (double) bs.ReadInt16() * (double) heightScale / 65536.0;
retval[x, y] = baseHeight + bs.ReadInt16() * (double) heightScale / 65536.0;
}
}
break;

View File

@@ -31,7 +31,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
{
public class FlattenSphere : ITerrainPaintableEffect
{
#region ITerrainPaintableEffect Members
public void PaintEffect(ITerrainChannel map, double rx, double ry, double strength, double duration)

View File

@@ -57,7 +57,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
z *= z;
z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
double noise = TerrainUtil.PerlinNoise2D((double) x / (double) Constants.RegionSize, (double) y / (double) Constants.RegionSize, 8, 1.0);
double noise = TerrainUtil.PerlinNoise2D(x / (double) Constants.RegionSize, y / (double) Constants.RegionSize, 8, 1.0);
if (z > 0.0)
map[x, y] += noise * z * duration;

View File

@@ -32,7 +32,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.PaintBrushes
{
public class RevertSphere : ITerrainPaintableEffect
{
private ITerrainChannel m_revertmap;
private readonly ITerrainChannel m_revertmap;
public RevertSphere(ITerrainChannel revertmap)
{

View File

@@ -31,7 +31,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
{
public class TerrainException : Exception
{
public TerrainException() : base()
public TerrainException()
{
}

View File

@@ -83,7 +83,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
private Dictionary<string, ITerrainEffect> m_plugineffects;
private ITerrainChannel m_revert;
private Scene m_scene;
private bool m_tainted = false;
private bool m_tainted;
#region ICommandableModule Members
@@ -223,6 +223,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
}
}
#endregion
#region Plugin Loading Methods
private void LoadPlugins()
@@ -276,8 +278,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
#endregion
#endregion
/// <summary>
/// Installs into terrain module the standard suite of brushes
/// </summary>

View File

@@ -66,10 +66,10 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
m_trees = new List<LLUUID>();
m_scene = scene;
m_scene.EventManager.OnPluginConsole += new EventManager.OnPluginConsoleDelegate(EventManager_OnPluginConsole);
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
Timer CalculateTrees = new Timer(m_tree_updates);
CalculateTrees.Elapsed += new ElapsedEventHandler(CalculateTrees_Elapsed);
CalculateTrees.Elapsed += CalculateTrees_Elapsed;
CalculateTrees.Start();
m_log.Debug("[TREES]: Initialised tree module");
}