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)
This commit is contained in:
hondacrx
2024-03-14 11:09:45 -04:00
parent 26fe8a45b5
commit 4bbf49a17a
5 changed files with 19 additions and 19 deletions
+1 -1
View File
@@ -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.Radius), radius);
SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.CastTime), GameTime.GetGameTimeMS()); 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 SetActive(true); //must before add to map to be put in world container
ITransport transport = caster.GetTransport(); ITransport transport = caster.GetTransport();
+9 -9
View File
@@ -25,7 +25,7 @@ namespace Game.Entities
public WorldObject(bool isWorldObject) public WorldObject(bool isWorldObject)
{ {
_name = ""; _name = "";
m_isWorldObject = isWorldObject; m_isStoredInWorldObjectGridContainer = isWorldObject;
m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive | GhostVisibilityType.Ghost); m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive | GhostVisibilityType.Ghost);
m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive); m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive);
@@ -46,7 +46,7 @@ namespace Game.Entities
public virtual void Dispose() public virtual void Dispose()
{ {
// this may happen because there are many !create/delete // this may happen because there are many !create/delete
if (IsWorldObject() && _currMap != null) if (IsStoredInWorldObjectGridContainer() && _currMap != null)
{ {
if (IsTypeId(TypeId.Corpse)) if (IsTypeId(TypeId.Corpse))
{ {
@@ -972,9 +972,9 @@ namespace Game.Entities
AddToObjectUpdateIfNeeded(); AddToObjectUpdateIfNeeded();
} }
public bool IsWorldObject() public bool IsStoredInWorldObjectGridContainer()
{ {
if (m_isWorldObject) if (m_isStoredInWorldObjectGridContainer)
return true; return true;
if (IsTypeId(TypeId.Unit) && ToCreature().m_isTempWorldObject) if (IsTypeId(TypeId.Unit) && ToCreature().m_isTempWorldObject)
@@ -988,7 +988,7 @@ namespace Game.Entities
m_Events.Update(diff); m_Events.Update(diff);
} }
public void SetWorldObject(bool on) public void SetIsStoredInWorldObjectGridContainer(bool on)
{ {
if (!IsInWorld) if (!IsInWorld)
return; return;
@@ -1480,7 +1480,7 @@ namespace Game.Entities
_currMap = map; _currMap = map;
SetMapId(map.GetId()); SetMapId(map.GetId());
instanceId = map.GetInstanceId(); instanceId = map.GetInstanceId();
if (IsWorldObject()) if (IsStoredInWorldObjectGridContainer())
_currMap.AddWorldObject(this); _currMap.AddWorldObject(this);
} }
@@ -1491,7 +1491,7 @@ namespace Game.Entities
Cypher.Assert(_currMap != null); Cypher.Assert(_currMap != null);
Cypher.Assert(!IsInWorld); Cypher.Assert(!IsInWorld);
if (IsWorldObject()) if (IsStoredInWorldObjectGridContainer())
_currMap.RemoveWorldObject(this); _currMap.RemoveWorldObject(this);
_currMap = null; _currMap = null;
} }
@@ -3118,7 +3118,7 @@ namespace Game.Entities
public void ResetAllNotifies() { m_notifyflags = 0; } public void ResetAllNotifies() { m_notifyflags = 0; }
public bool IsActiveObject() { return m_isActive; } 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 ITransport GetTransport() { return m_transport; }
public T GetTransport<T>() where T : class, ITransport public T GetTransport<T>() where T : class, ITransport
@@ -3819,7 +3819,7 @@ namespace Game.Entities
protected bool m_isActive; protected bool m_isActive;
bool m_isFarVisible; bool m_isFarVisible;
float? m_visibilityDistanceOverride; float? m_visibilityDistanceOverride;
bool m_isWorldObject; bool m_isStoredInWorldObjectGridContainer;
public ZoneScript m_zoneScript; public ZoneScript m_zoneScript;
ITransport m_transport; ITransport m_transport;
+2 -2
View File
@@ -341,7 +341,7 @@ namespace Game.Entities
if (m_sharedVision.Empty()) if (m_sharedVision.Empty())
{ {
SetActive(true); SetActive(true);
SetWorldObject(true); SetIsStoredInWorldObjectGridContainer(true);
} }
m_sharedVision.Add(player); m_sharedVision.Add(player);
} }
@@ -353,7 +353,7 @@ namespace Game.Entities
if (m_sharedVision.Empty()) if (m_sharedVision.Empty())
{ {
SetActive(false); SetActive(false);
SetWorldObject(false); SetIsStoredInWorldObjectGridContainer(false);
} }
} }
+6 -6
View File
@@ -78,7 +78,7 @@ namespace Game.Maps
for (var i = 0; i < i_worldObjects.Count; ++i) for (var i = 0; i < i_worldObjects.Count; ++i)
{ {
WorldObject obj = i_worldObjects[i]; WorldObject obj = i_worldObjects[i];
Cypher.Assert(obj.IsWorldObject()); Cypher.Assert(obj.IsStoredInWorldObjectGridContainer());
obj.RemoveFromWorld(); obj.RemoveFromWorld();
obj.ResetMap(); 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 // 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) // 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 // to avoid failing an assertion in GridObject::AddToGrid
if (obj.IsWorldObject()) if (obj.IsStoredInWorldObjectGridContainer())
{ {
obj.SetCurrentCell(cell); obj.SetCurrentCell(cell);
grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).AddWorldObject(obj); grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).AddWorldObject(obj);
@@ -135,7 +135,7 @@ namespace Game.Maps
break; break;
case TypeId.DynamicObject: case TypeId.DynamicObject:
default: default:
if (obj.IsWorldObject()) if (obj.IsStoredInWorldObjectGridContainer())
grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).AddWorldObject(obj); grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).AddWorldObject(obj);
else else
grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).AddGridObject(obj); grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).AddGridObject(obj);
@@ -154,7 +154,7 @@ namespace Game.Maps
if (grid == null) if (grid == null)
return; return;
if (obj.IsWorldObject()) if (obj.IsStoredInWorldObjectGridContainer())
grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).RemoveWorldObject(obj); grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).RemoveWorldObject(obj);
else else
grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).RemoveGridObject(obj); grid.GetGridCell(cell.GetCellX(), cell.GetCellY()).RemoveGridObject(obj);
@@ -164,7 +164,7 @@ namespace Game.Maps
void SwitchGridContainers(WorldObject obj, bool on) void SwitchGridContainers(WorldObject obj, bool on)
{ {
if (obj.IsPermanentWorldObject()) if (obj.IsAlwaysStoredInWorldObjectGridContainer())
return; return;
CellCoord p = GridDefines.ComputeCellCoord(obj.GetPositionX(), obj.GetPositionY()); CellCoord p = GridDefines.ComputeCellCoord(obj.GetPositionX(), obj.GetPositionY());
@@ -2530,7 +2530,7 @@ namespace Game.Maps
bool on = pair.Value; bool on = pair.Value;
i_objectsToSwitch.Remove(pair.Key); i_objectsToSwitch.Remove(pair.Key);
if (!obj.IsPermanentWorldObject()) if (!obj.IsAlwaysStoredInWorldObjectGridContainer())
{ {
switch (obj.GetTypeId()) switch (obj.GetTypeId())
{ {
+1 -1
View File
@@ -190,7 +190,7 @@ namespace Game.Maps
{ {
corpse.AddToWorld(); corpse.AddToWorld();
var cell = i_grid.GetGridCell(i_cell.GetCellX(), i_cell.GetCellY()); var cell = i_grid.GetGridCell(i_cell.GetCellX(), i_cell.GetCellY());
if (corpse.IsWorldObject()) if (corpse.IsStoredInWorldObjectGridContainer())
{ {
i_map.AddToGrid(corpse, new Cell(cellCoord)); i_map.AddToGrid(corpse, new Cell(cellCoord));
cell.AddWorldObject(corpse); cell.AddWorldObject(corpse);