From 5bcb1c0e721322238e84eee21cf2513d6111fb69 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Sat, 7 Jan 2017 18:10:30 +0000
Subject: rename same variables to make their meaning more clear

---
 OpenSim/Region/Framework/Scenes/GodController.cs | 51 ++++++++++---------
 OpenSim/Region/Framework/Scenes/ScenePresence.cs | 62 ++++++++++++------------
 2 files changed, 56 insertions(+), 57 deletions(-)

(limited to 'OpenSim')

diff --git a/OpenSim/Region/Framework/Scenes/GodController.cs b/OpenSim/Region/Framework/Scenes/GodController.cs
index 8035760..ac11ba9 100644
--- a/OpenSim/Region/Framework/Scenes/GodController.cs
+++ b/OpenSim/Region/Framework/Scenes/GodController.cs
@@ -66,9 +66,9 @@ namespace OpenSim.Region.Framework.Scenes
         // the god level from local or grid user rights
         protected int m_rightsGodLevel = 0;
         // the level seen by viewers
-        protected int m_godlevel = 0;
+        protected int m_viewergodlevel = 0;
         // new level that can be fixed or equal to godlevel, acording to options
-        protected int m_effectivegodlevel = 0;
+        protected int m_godlevel = 0;
         protected int m_lastLevelToViewer = 0;
 
         public GodController(Scene scene, ScenePresence sp, int userlevel)
@@ -127,19 +127,18 @@ namespace OpenSim.Region.Framework.Scenes
 
             if(m_allowGodActionsWithoutGodMode)
             {
-                m_effectivegodlevel = m_rightsGodLevel;
-
+                m_godlevel = m_rightsGodLevel;
                 m_forceGodModeAlwaysOn = false;
             }
 
             else if(m_forceGodModeAlwaysOn)
             {
+                m_viewergodlevel = m_rightsGodLevel;
                 m_godlevel = m_rightsGodLevel;
-                m_effectivegodlevel = m_rightsGodLevel;
             }
 
-            m_scenePresence.isGod = (m_effectivegodlevel >= 200);
-            m_scenePresence.isLegacyGod = (m_godlevel >= 200);
+            m_scenePresence.isGod = (m_godlevel >= 200);
+            m_scenePresence.isViewerUIGod = (m_viewergodlevel >= 200);
         }
 
         // calculates god level at sp creation from local and grid user god rights
@@ -175,10 +174,10 @@ namespace OpenSim.Region.Framework.Scenes
         {
             if(!CanBeGod())
             {
+                m_viewergodlevel = 0;
                 m_godlevel = 0;
-                m_effectivegodlevel = 0;
                 m_scenePresence.isGod = false;
-                m_scenePresence.isLegacyGod = false;
+                m_scenePresence.isViewerUIGod = false;
                 return;
             }
 
@@ -186,58 +185,58 @@ namespace OpenSim.Region.Framework.Scenes
             if(m_allowGodActionsWithoutGodMode)
             {
                 if(viewerState)
-                    m_godlevel = m_rightsGodLevel;
+                    m_viewergodlevel = m_rightsGodLevel;
                 else
-                    m_godlevel = 0;
+                    m_viewergodlevel = 0;
 
-                m_effectivegodlevel = m_rightsGodLevel;
+                m_godlevel = m_rightsGodLevel;
             }
             else
             {
                 // new all change with viewer
                 if(viewerState)
                 {
+                    m_viewergodlevel = m_rightsGodLevel;
                     m_godlevel = m_rightsGodLevel;
-                    m_effectivegodlevel = m_rightsGodLevel;
                 }
                 else
                 {
+                    m_viewergodlevel = 0;
                     m_godlevel = 0;
-                    m_effectivegodlevel = 0;
                 }
             }
-            m_scenePresence.isGod = (m_effectivegodlevel >= 200);
-            m_scenePresence.isLegacyGod = (m_godlevel >= 200);
+            m_scenePresence.isGod = (m_godlevel >= 200);
+            m_scenePresence.isViewerUIGod = (m_viewergodlevel >= 200);
         }
 
         public void SyncViewerState()
         {
-            if(m_lastLevelToViewer == m_godlevel)
+            if(m_lastLevelToViewer == m_viewergodlevel)
                 return;
 
-            m_lastLevelToViewer = m_godlevel;
+            m_lastLevelToViewer = m_viewergodlevel;
 
             if(m_scenePresence.IsChildAgent)
                 return;            
 
-            m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)m_godlevel);
+            m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)m_viewergodlevel);
         }
 
         public void RequestGodMode(bool god)
         {
             UpdateGodLevels(god);
 
-            if(m_lastLevelToViewer != m_godlevel)
+            if(m_lastLevelToViewer != m_viewergodlevel)
             {
-                m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)m_godlevel);
-                m_lastLevelToViewer = m_godlevel;
+                m_scenePresence.ControllingClient.SendAdminResponse(UUID.Zero, (uint)m_viewergodlevel);
+                m_lastLevelToViewer = m_viewergodlevel;
             }
         }
 
        public OSD State()
         {
             OSDMap godMap = new OSDMap(2);
-            bool m_viewerUiIsGod = m_godlevel >= 200;
+            bool m_viewerUiIsGod = m_viewergodlevel >= 200;
             godMap.Add("ViewerUiIsGod", OSD.FromBoolean(m_viewerUiIsGod));
 
             return godMap;
@@ -256,7 +255,7 @@ namespace OpenSim.Region.Framework.Scenes
 
                     if (s.ContainsKey("ViewerUiIsGod"))
                         newstate = s["ViewerUiIsGod"].AsBoolean();
-                    m_lastLevelToViewer = m_godlevel; // we are not changing viewer level by default
+                    m_lastLevelToViewer = m_viewergodlevel; // we are not changing viewer level by default
                 }
             }       
             UpdateGodLevels(newstate);
@@ -275,12 +274,12 @@ namespace OpenSim.Region.Framework.Scenes
 
         public int GodLevel
         {
-            get { return m_godlevel; }
+            get { return m_viewergodlevel; }
         }
 
         public int EffectiveLevel
         {
-            get { return m_effectivegodlevel; }
+            get { return m_godlevel; }
         }
     }
 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index dbca68b..f851179 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -95,9 +95,9 @@ namespace OpenSim.Region.Framework.Scenes
         // simple yes or no isGOD from god level >= 200
         // should only be set by GodController
         // we have two to suport legacy behaviour
-        // isLegacyGod was controlled by viewer in older versions
+        // isViewerUIGod was controlled by viewer in older versions
         // isGod may now be also controled by viewer acording to options
-        public bool isLegacyGod { get; set; }
+        public bool isViewerUIGod { get; set; }
         public bool isGod { get; set; }
 
         private PresenceType m_presenceType;
@@ -1264,7 +1264,7 @@ namespace OpenSim.Region.Framework.Scenes
                     IsLoggingIn = false;
                 }
 
-                IsChildAgent = false;               
+                IsChildAgent = false;
             }
 
             m_log.DebugFormat("[MakeRootAgent] out lock: {0}ms", Util.EnvironmentTickCountSubtract(ts));
@@ -2156,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes
                             if (p == this)
                                 continue;
 
-                            if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+                            if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                                 continue;
 
                             SendAppearanceToAgentNF(p);
@@ -2206,7 +2206,7 @@ namespace OpenSim.Region.Framework.Scenes
                                     continue;
                                 }
 
-                                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+                                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                                     continue;
 
                                 SendAttachmentsToAgentNF(p);
@@ -3811,7 +3811,7 @@ namespace OpenSim.Region.Framework.Scenes
             if (!remoteClient.IsActive)
                 return;
 
-            if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && !p.isLegacyGod)
+            if (ParcelHideThisAvatar && p.currentParcelUUID != currentParcelUUID && !p.isViewerUIGod)
                 return;
 
             //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
@@ -3921,7 +3921,7 @@ namespace OpenSim.Region.Framework.Scenes
                 // get the avatar, then a kill if can't see it
                 p.SendInitialAvatarDataToAgent(this);
 
-                if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !isLegacyGod)
+                if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !isViewerUIGod)
                     return;
 
                 p.SendAppearanceToAgentNF(this);
@@ -3969,7 +3969,7 @@ namespace OpenSim.Region.Framework.Scenes
             foreach (ScenePresence p in presences)
             {
                 p.ControllingClient.SendAvatarDataImmediate(this);
-                if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+                if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                     // either just kill the object
                     // p.ControllingClient.SendKillObject(new List<uint> {LocalId});
                     // or also attachments viewer may still know about
@@ -3982,7 +3982,7 @@ namespace OpenSim.Region.Framework.Scenes
         public void SendInitialAvatarDataToAgent(ScenePresence p)
         {
             p.ControllingClient.SendAvatarDataImmediate(this);
-            if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+            if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                     // either just kill the object
                     // p.ControllingClient.SendKillObject(new List<uint> {LocalId});
                     // or also attachments viewer may still know about
@@ -3996,7 +3996,7 @@ namespace OpenSim.Region.Framework.Scenes
         public void SendAvatarDataToAgent(ScenePresence avatar)
         {
             //m_log.DebugFormat("[SCENE PRESENCE] SendAvatarDataToAgent from {0} ({1}) to {2} ({3})", Name, UUID, avatar.Name, avatar.UUID);
-            if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.isLegacyGod)
+            if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.isViewerUIGod)
                 return;
             avatar.ControllingClient.SendAvatarDataImmediate(this);
         }
@@ -4041,7 +4041,7 @@ namespace OpenSim.Region.Framework.Scenes
         {
             //            m_log.DebugFormat(
             //                "[SCENE PRESENCE]: Sending appearance data from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
-            if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.isLegacyGod)
+            if (ParcelHideThisAvatar && currentParcelUUID != avatar.currentParcelUUID && !avatar.isViewerUIGod)
                 return;
             SendAppearanceToAgentNF(avatar);
         }
@@ -4057,7 +4057,7 @@ namespace OpenSim.Region.Framework.Scenes
             if (IsChildAgent || Animator == null)
                 return;
 
-            if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+            if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                 return;
 
             Animator.SendAnimPackToClient(p.ControllingClient);
@@ -4068,7 +4068,7 @@ namespace OpenSim.Region.Framework.Scenes
             if (IsChildAgent)
                 return;
 
-            if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+            if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                 return;
 
             p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
@@ -4093,7 +4093,7 @@ namespace OpenSim.Region.Framework.Scenes
 
             m_scene.ForEachScenePresence(delegate(ScenePresence p)
             {
-                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                     return;
                 p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
             });
@@ -4473,9 +4473,9 @@ namespace OpenSim.Region.Framework.Scenes
             if (isNPC)
                 return;
 
-            bool wasgod = isLegacyGod;
+            bool wasgod = isViewerUIGod;
             GodController.RequestGodMode(godStatus);
-            if (wasgod != isLegacyGod)
+            if (wasgod != isViewerUIGod)
                 parcelGodCheck(m_currentParcelUUID);
         }
 
@@ -4909,7 +4909,7 @@ namespace OpenSim.Region.Framework.Scenes
             RaiseCollisionScriptEvents(coldata);
 
             // Gods do not take damage and Invulnerable is set depending on parcel/region flags
-            if (Invulnerable || isLegacyGod)
+            if (Invulnerable || isViewerUIGod)
                 return;
 
             // The following may be better in the ICombatModule
@@ -5194,7 +5194,7 @@ namespace OpenSim.Region.Framework.Scenes
                         if (p != this && sog.HasPrivateAttachmentPoint)
                             return;
 
-                        if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+                        if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                             return;
 
                         SendTerseUpdateToAgentNF(p);
@@ -5308,7 +5308,7 @@ namespace OpenSim.Region.Framework.Scenes
                 if (p == this)
                     continue;
 
-                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                     continue;
 
                 p.ControllingClient.SendEntityUpdate(rootpart, rootflag);
@@ -5366,7 +5366,7 @@ namespace OpenSim.Region.Framework.Scenes
                 if (p == this)
                     continue;
 
-                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                     continue;
 
                 p.ControllingClient.SendEntityUpdate(rootpart, flag);
@@ -5416,7 +5416,7 @@ namespace OpenSim.Region.Framework.Scenes
                 if (p == this)
                     continue;
 
-                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                     continue;
 
                 p.ControllingClient.SendEntityUpdate(part, flag);
@@ -5457,7 +5457,7 @@ namespace OpenSim.Region.Framework.Scenes
             {
                 if (p == this)
                     continue;
-                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isLegacyGod)
+                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && !p.isViewerUIGod)
                     continue;
 
                 p.ControllingClient.SendEntityUpdate(part, flag);
@@ -6095,7 +6095,7 @@ namespace OpenSim.Region.Framework.Scenes
                     // the TP point. This behaviour mimics agni.
                     if (land.LandData.LandingType == (byte)LandingType.LandingPoint &&
                         land.LandData.UserLocation != Vector3.Zero &&
-                        !isLegacyGod &&
+                        !isViewerUIGod &&
                         ((land.LandData.OwnerID != m_uuid &&
                           !m_scene.Permissions.IsGod(m_uuid) &&
                           !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) ||
@@ -6120,7 +6120,7 @@ namespace OpenSim.Region.Framework.Scenes
             string reason;
 
             // dont mess with gods
-            if(isLegacyGod || m_scene.Permissions.IsGod(m_uuid))
+            if(isViewerUIGod || m_scene.Permissions.IsGod(m_uuid))
                 return true;
 
             // respect region owner and managers
@@ -6417,7 +6417,7 @@ namespace OpenSim.Region.Framework.Scenes
 
                 if (p.ParcelHideThisAvatar && p.currentParcelUUID != currentParcelID)
                 {
-                    if (isLegacyGod)
+                    if (isViewerUIGod)
                         p.SendViewTo(this);
                     else
                         p.SendKillTo(this);
@@ -6468,7 +6468,7 @@ namespace OpenSim.Region.Framework.Scenes
                             continue;
 
                         // those not on parcel dont see me
-                        if (currentParcelID != p.currentParcelUUID && !p.isLegacyGod)
+                        if (currentParcelID != p.currentParcelUUID && !p.isViewerUIGod)
                         {
                             killsToSendto.Add(p); // they dont see me
                         }
@@ -6494,9 +6494,9 @@ namespace OpenSim.Region.Framework.Scenes
                             // only those on previus parcel need receive kills
                             if (previusParcelID == p.currentParcelUUID)
                             {
-                                if(!p.isLegacyGod)
+                                if(!p.isViewerUIGod)
                                     killsToSendto.Add(p); // they dont see me
-                                if(!isLegacyGod)
+                                if(!isViewerUIGod)
                                     killsToSendme.Add(p);  // i dont see them
                             }
                             // only those on new parcel need see
@@ -6518,7 +6518,7 @@ namespace OpenSim.Region.Framework.Scenes
                                 continue;
 
                             // those not on new parcel dont see me
-                            if (currentParcelID != p.currentParcelUUID && !p.isLegacyGod)
+                            if (currentParcelID != p.currentParcelUUID && !p.isViewerUIGod)
                             {
                                 killsToSendto.Add(p); // they dont see me
                             }
@@ -6544,7 +6544,7 @@ namespace OpenSim.Region.Framework.Scenes
                             if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
                                 continue;
                             // only those old parcel need kills
-                            if (previusParcelID == p.currentParcelUUID && !isLegacyGod)
+                            if (previusParcelID == p.currentParcelUUID && !isViewerUIGod)
                             {
                                 killsToSendme.Add(p);  // i dont see them
                             }
@@ -6606,7 +6606,7 @@ namespace OpenSim.Region.Framework.Scenes
                 if (Scene.AttachmentsModule != null)
                     Scene.AttachmentsModule.DeleteAttachmentsFromScene(this, true);
 
-                if (!ParcelHideThisAvatar || isLegacyGod)
+                if (!ParcelHideThisAvatar || isViewerUIGod)
                     return;
 
                 List<ScenePresence> allpresences = m_scene.GetScenePresences();
-- 
cgit v1.1