From 4bbf49a17a0dbaa8030fe2bab0934a8191dc274b Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 14 Mar 2024 11:09:45 -0400 Subject: [PATCH] Core/Objects: Rename Object::m_isWorldObject and related functions to avoid conflicting with "WorldObject" class name Port From (https://github.com/TrinityCore/TrinityCore/commit/9402c66e8423243d13dbc19e8713e298bea0ac7b) --- Source/Game/Entities/DynamicObject.cs | 2 +- Source/Game/Entities/Object/WorldObject.cs | 18 +++++++++--------- Source/Game/Entities/Unit/Unit.cs | 4 ++-- Source/Game/Maps/Map.cs | 12 ++++++------ Source/Game/Maps/ObjectGridLoader.cs | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Source/Game/Entities/DynamicObject.cs b/Source/Game/Entities/DynamicObject.cs index b59ada84f..135172cb1 100644 --- a/Source/Game/Entities/DynamicObject.cs +++ b/Source/Game/Entities/DynamicObject.cs @@ -94,7 +94,7 @@ namespace Game.Entities SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.Radius), radius); SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.CastTime), GameTime.GetGameTimeMS()); - if (IsWorldObject()) + if (IsStoredInWorldObjectGridContainer()) SetActive(true); //must before add to map to be put in world container ITransport transport = caster.GetTransport(); diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index e87f58e95..0b4187015 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -25,7 +25,7 @@ namespace Game.Entities public WorldObject(bool isWorldObject) { _name = ""; - m_isWorldObject = isWorldObject; + m_isStoredInWorldObjectGridContainer = isWorldObject; m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive | GhostVisibilityType.Ghost); m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive); @@ -46,7 +46,7 @@ namespace Game.Entities public virtual void Dispose() { // this may happen because there are many !create/delete - if (IsWorldObject() && _currMap != null) + if (IsStoredInWorldObjectGridContainer() && _currMap != null) { if (IsTypeId(TypeId.Corpse)) { @@ -972,9 +972,9 @@ namespace Game.Entities AddToObjectUpdateIfNeeded(); } - public bool IsWorldObject() + public bool IsStoredInWorldObjectGridContainer() { - if (m_isWorldObject) + if (m_isStoredInWorldObjectGridContainer) return true; if (IsTypeId(TypeId.Unit) && ToCreature().m_isTempWorldObject) @@ -988,7 +988,7 @@ namespace Game.Entities m_Events.Update(diff); } - public void SetWorldObject(bool on) + public void SetIsStoredInWorldObjectGridContainer(bool on) { if (!IsInWorld) return; @@ -1480,7 +1480,7 @@ namespace Game.Entities _currMap = map; SetMapId(map.GetId()); instanceId = map.GetInstanceId(); - if (IsWorldObject()) + if (IsStoredInWorldObjectGridContainer()) _currMap.AddWorldObject(this); } @@ -1491,7 +1491,7 @@ namespace Game.Entities Cypher.Assert(_currMap != null); Cypher.Assert(!IsInWorld); - if (IsWorldObject()) + if (IsStoredInWorldObjectGridContainer()) _currMap.RemoveWorldObject(this); _currMap = null; } @@ -3118,7 +3118,7 @@ namespace Game.Entities public void ResetAllNotifies() { m_notifyflags = 0; } public bool IsActiveObject() { return m_isActive; } - public bool IsPermanentWorldObject() { return m_isWorldObject; } + public bool IsAlwaysStoredInWorldObjectGridContainer() { return m_isStoredInWorldObjectGridContainer; } public ITransport GetTransport() { return m_transport; } public T GetTransport() where T : class, ITransport @@ -3819,7 +3819,7 @@ namespace Game.Entities protected bool m_isActive; bool m_isFarVisible; float? m_visibilityDistanceOverride; - bool m_isWorldObject; + bool m_isStoredInWorldObjectGridContainer; public ZoneScript m_zoneScript; ITransport m_transport; diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index ae39f0dbb..dceeeac3f 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -341,7 +341,7 @@ namespace Game.Entities if (m_sharedVision.Empty()) { SetActive(true); - SetWorldObject(true); + SetIsStoredInWorldObjectGridContainer(true); } m_sharedVision.Add(player); } @@ -353,7 +353,7 @@ namespace Game.Entities if (m_sharedVision.Empty()) { SetActive(false); - SetWorldObject(false); + SetIsStoredInWorldObjectGridContainer(false); } } diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index aeff69a5f..ad78ad5e8 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -78,7 +78,7 @@ namespace Game.Maps for (var i = 0; i < i_worldObjects.Count; ++i) { WorldObject obj = i_worldObjects[i]; - Cypher.Assert(obj.IsWorldObject()); + Cypher.Assert(obj.IsStoredInWorldObjectGridContainer()); obj.RemoveFromWorld(); obj.ResetMap(); } @@ -120,7 +120,7 @@ namespace Game.Maps // ObjectGridLoader loads all corpses from _corpsesByCell even if they were already added to grid before it was loaded // so we need to explicitly check it here (Map::AddToGrid is only called from Player::BuildPlayerRepop, not from ObjectGridLoader) // to avoid failing an assertion in GridObject::AddToGrid - if (obj.IsWorldObject()) + if (obj.IsStoredInWorldObjectGridContainer()) { obj.SetCurrentCell(cell); grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).AddWorldObject(obj); @@ -135,7 +135,7 @@ namespace Game.Maps break; case TypeId.DynamicObject: default: - if (obj.IsWorldObject()) + if (obj.IsStoredInWorldObjectGridContainer()) grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).AddWorldObject(obj); else grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).AddGridObject(obj); @@ -154,7 +154,7 @@ namespace Game.Maps if (grid == null) return; - if (obj.IsWorldObject()) + if (obj.IsStoredInWorldObjectGridContainer()) grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).RemoveWorldObject(obj); else grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).RemoveGridObject(obj); @@ -164,7 +164,7 @@ namespace Game.Maps void SwitchGridContainers(WorldObject obj, bool on) { - if (obj.IsPermanentWorldObject()) + if (obj.IsAlwaysStoredInWorldObjectGridContainer()) return; CellCoord p = GridDefines.ComputeCellCoord(obj.GetPositionX(), obj.GetPositionY()); @@ -2530,7 +2530,7 @@ namespace Game.Maps bool on = pair.Value; i_objectsToSwitch.Remove(pair.Key); - if (!obj.IsPermanentWorldObject()) + if (!obj.IsAlwaysStoredInWorldObjectGridContainer()) { switch (obj.GetTypeId()) { diff --git a/Source/Game/Maps/ObjectGridLoader.cs b/Source/Game/Maps/ObjectGridLoader.cs index f2accf375..f853508a8 100644 --- a/Source/Game/Maps/ObjectGridLoader.cs +++ b/Source/Game/Maps/ObjectGridLoader.cs @@ -190,7 +190,7 @@ namespace Game.Maps { corpse.AddToWorld(); var cell = i_grid.GetGridCell(i_cell.GetCellX(), i_cell.GetCellY()); - if (corpse.IsWorldObject()) + if (corpse.IsStoredInWorldObjectGridContainer()) { i_map.AddToGrid(corpse, new Cell(cellCoord)); cell.AddWorldObject(corpse);