mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core: Fix compile with WITH_COREDEBUG option enabled
This commit is contained in:
@@ -18,53 +18,58 @@
|
||||
|
||||
#include "GridStates.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "Grid.h"
|
||||
#include "Log.h"
|
||||
|
||||
void InvalidState::Update(Map &, NGridType &, GridInfo &, const uint32) const
|
||||
#ifdef TRINITY_DEBUG
|
||||
bool GridState::checkMagic()
|
||||
{
|
||||
if (i_Magic != MAGIC_TESTVAL)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_GENERAL, "!!! GridState: Magic value gone !!!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 t_diff) const
|
||||
void InvalidState::Update(Map&, NGridType&, GridInfo&, uint32) const
|
||||
{ }
|
||||
|
||||
void ActiveState::Update(Map& map, NGridType& grid, GridInfo& info, uint32 diff) const
|
||||
{
|
||||
// Only check grid activity every (grid_expiry/10) ms, because it's really useless to do it every cycle
|
||||
info.UpdateTimeTracker(t_diff);
|
||||
info.UpdateTimeTracker(diff);
|
||||
if (info.getTimeTracker().Passed())
|
||||
{
|
||||
if (!grid.GetWorldObjectCountInNGrid<Player>() && !m.ActiveObjectsNearGrid(grid))
|
||||
if (!grid.GetWorldObjectCountInNGrid<Player>() && !map.ActiveObjectsNearGrid(grid))
|
||||
{
|
||||
ObjectGridStoper worker;
|
||||
TypeContainerVisitor<ObjectGridStoper, GridTypeMapContainer> visitor(worker);
|
||||
grid.VisitAllGrids(visitor);
|
||||
grid.SetGridState(GRID_STATE_IDLE);
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to IDLE state", grid.getX(), grid.getY(), m.GetId());
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to IDLE state", grid.getX(), grid.getY(), map.GetId());
|
||||
}
|
||||
else
|
||||
{
|
||||
m.ResetGridExpiry(grid, 0.1f);
|
||||
}
|
||||
map.ResetGridExpiry(grid, 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
void IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32) const
|
||||
void IdleState::Update(Map& map, NGridType& grid, GridInfo&, uint32) const
|
||||
{
|
||||
m.ResetGridExpiry(grid);
|
||||
map.ResetGridExpiry(grid);
|
||||
grid.SetGridState(GRID_STATE_REMOVAL);
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to REMOVAL state", grid.getX(), grid.getY(), m.GetId());
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to REMOVAL state", grid.getX(), grid.getY(), map.GetId());
|
||||
}
|
||||
|
||||
void RemovalState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 t_diff) const
|
||||
void RemovalState::Update(Map& map, NGridType& grid, GridInfo& info, uint32 diff) const
|
||||
{
|
||||
if (!info.getUnloadLock())
|
||||
{
|
||||
info.UpdateTimeTracker(t_diff);
|
||||
if (info.getTimeTracker().Passed())
|
||||
info.UpdateTimeTracker(diff);
|
||||
if (info.getTimeTracker().Passed() && !map.UnloadGrid(grid, false))
|
||||
{
|
||||
if (!m.UnloadGrid(grid, false))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] for map %u differed unloading due to players or active objects nearby", grid.getX(), grid.getY(), m.GetId());
|
||||
m.ResetGridExpiry(grid);
|
||||
}
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "Grid[%u, %u] for map %u differed unloading due to players or active objects nearby", grid.getX(), grid.getY(), map.GetId());
|
||||
map.ResetGridExpiry(grid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
#ifndef TRINITY_GRIDSTATES_H
|
||||
#define TRINITY_GRIDSTATES_H
|
||||
|
||||
#include "Map.h"
|
||||
#include "Object.h"
|
||||
#include "GridDefines.h"
|
||||
#include "NGrid.h"
|
||||
|
||||
class Map;
|
||||
|
||||
class GridState
|
||||
{
|
||||
@@ -28,44 +30,35 @@ class GridState
|
||||
#ifdef TRINITY_DEBUG
|
||||
#define MAGIC_TESTVAL 0xFBE823BA
|
||||
GridState() { i_Magic = MAGIC_TESTVAL; }
|
||||
bool checkMagic()
|
||||
{
|
||||
if (i_Magic != MAGIC_TESTVAL)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_GENERAL, "!!! GridState: Magic value gone !!!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool checkMagic();
|
||||
void setMagic() { i_Magic = MAGIC_TESTVAL; }
|
||||
unsigned int i_Magic;
|
||||
#endif
|
||||
virtual ~GridState() {};
|
||||
virtual void Update(Map &, NGridType&, GridInfo &, const uint32 t_diff) const = 0;
|
||||
virtual void Update(Map &, NGridType&, GridInfo &, uint32 t_diff) const = 0;
|
||||
};
|
||||
|
||||
class InvalidState : public GridState
|
||||
{
|
||||
public:
|
||||
void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
|
||||
void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
|
||||
};
|
||||
|
||||
class ActiveState : public GridState
|
||||
{
|
||||
public:
|
||||
void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
|
||||
void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
|
||||
};
|
||||
|
||||
class IdleState : public GridState
|
||||
{
|
||||
public:
|
||||
void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
|
||||
void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
|
||||
};
|
||||
|
||||
class RemovalState : public GridState
|
||||
{
|
||||
public:
|
||||
void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
|
||||
void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,14 +19,15 @@
|
||||
#ifndef TRINITY_MAPMANAGER_H
|
||||
#define TRINITY_MAPMANAGER_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
#include "Common.h"
|
||||
#include "Object.h"
|
||||
#include "Map.h"
|
||||
#include "GridStates.h"
|
||||
#include "MapUpdater.h"
|
||||
|
||||
#include <ace/Singleton.h>
|
||||
#include <ace/Thread_Mutex.h>
|
||||
|
||||
|
||||
class Transport;
|
||||
struct TransportCreatureProto;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "ByteBuffer.h"
|
||||
#include "Common.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <ace/Stack_Trace.h>
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
#define _BYTEBUFFER_H
|
||||
|
||||
#include "Define.h"
|
||||
#include "Debugging/Errors.h"
|
||||
#include "Utilities/ByteConverter.h"
|
||||
#include "Errors.h"
|
||||
#include "ByteConverter.h"
|
||||
|
||||
#include <exception>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <cstring>
|
||||
#include <time.h>
|
||||
|
||||
// Root of ByteBuffer exception hierarchy
|
||||
class ByteBufferException : public std::exception
|
||||
|
||||
Reference in New Issue
Block a user