Core/Misc: Misc Fixes

This commit is contained in:
hondacrx
2018-05-22 00:43:21 -04:00
parent 5dacd669b5
commit 0be2dc08e2
19 changed files with 72 additions and 115 deletions
+9 -9
View File
@@ -198,7 +198,7 @@ namespace Game.Maps
gridInfo.UpdateTimeTracker(diff);
}
public void Update(Map m, uint diff)
public void Update(Map map, uint diff)
{
switch (GetGridState())
{
@@ -207,24 +207,24 @@ namespace Game.Maps
getGridInfoRef().UpdateTimeTracker(diff);
if (getGridInfoRef().getTimeTracker().Passed())
{
if (GetWorldObjectCountInNGrid<Player>() == 0 && !m.ActiveObjectsNearGrid(this))
if (GetWorldObjectCountInNGrid<Player>() == 0 && !map.ActiveObjectsNearGrid(this))
{
ObjectGridStoper worker = new ObjectGridStoper();
var visitor = new Visitor(worker, GridMapTypeMask.AllGrid);
VisitAllGrids(visitor);
SetGridState(GridState.Idle);
Log.outDebug(LogFilter.Maps, "Grid[{0}, {1}] on map {2} moved to IDLE state", getX(), getY(),
m.GetId());
map.GetId());
}
else
m.ResetGridExpiry(this, 0.1f);
map.ResetGridExpiry(this, 0.1f);
}
break;
case GridState.Idle:
m.ResetGridExpiry(this);
map.ResetGridExpiry(this);
SetGridState(GridState.Removal);
Log.outDebug(LogFilter.Maps, "Grid[{0}, {1}] on map {2} moved to REMOVAL state", getX(), getY(),
m.GetId());
map.GetId());
break;
case GridState.Removal:
if (!getGridInfoRef().getUnloadLock())
@@ -232,12 +232,12 @@ namespace Game.Maps
getGridInfoRef().UpdateTimeTracker(diff);
if (getGridInfoRef().getTimeTracker().Passed())
{
if (!m.UnloadGrid(this, false))
if (!map.UnloadGrid(this, false))
{
Log.outDebug(LogFilter.Maps,
"Grid[{0}, {1}] for map {2} differed unloading due to players or active objects nearby",
getX(), getY(), m.GetId());
m.ResetGridExpiry(this);
getX(), getY(), map.GetId());
map.ResetGridExpiry(this);
}
}
}
+2 -1
View File
@@ -477,8 +477,9 @@ namespace Game.Maps
public override void Visit(IList<WorldObject> objs)
{
foreach (var obj in objs)
for (var i = 0; i < objs.Count; ++i)
{
var obj = objs[i];
if (obj.IsTypeId(TypeId.Player) || obj.IsTypeId(TypeId.Corpse))
continue;
+3 -3
View File
@@ -79,10 +79,9 @@ namespace Game.Maps
void LoadHelper<T>(SortedSet<ulong> guid_set, CellCoord cell, ref uint count, Map map) where T : WorldObject, new()
{
foreach (var i_guid in guid_set)
foreach (var guid in guid_set)
{
T obj = new T();
ulong guid = i_guid;
if (!obj.LoadFromDB(guid, map))
continue;
@@ -162,8 +161,9 @@ namespace Game.Maps
public override void Visit(IList<Creature> objs)
{
// stop any fights at grid de-activation and remove dynobjects/areatriggers created at cast by creatures
foreach (var creature in objs)
for (var i = 0; i < objs.Count; ++i)
{
Creature creature = objs[i];
creature.RemoveAllDynObjects();
creature.RemoveAllAreaTriggers();