Core: Fix compile with WITH_COREDEBUG option enabled
This commit is contained in:
1 parent
51287930cb
commit
d7d62e4248
5 files changed
+44
-44
No files matched your search
@@ -18,53 +18,58 @@
|
|||||||
|
|
||||||
#include "GridStates.h"
|
#include "GridStates.h"
|
||||||
#include "GridNotifiers.h"
|
#include "GridNotifiers.h"
|
||||||
#include "Grid.h"
|
|
||||||
#include "Log.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
|
// 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 (info.getTimeTracker().Passed())
|
||||||
{
|
{
|
||||||
if (!grid.GetWorldObjectCountInNGrid<Player>() && !m.ActiveObjectsNearGrid(grid))
|
if (!grid.GetWorldObjectCountInNGrid<Player>() && !map.ActiveObjectsNearGrid(grid))
|
||||||
{
|
{
|
||||||
ObjectGridStoper worker;
|
ObjectGridStoper worker;
|
||||||
TypeContainerVisitor<ObjectGridStoper, GridTypeMapContainer> visitor(worker);
|
TypeContainerVisitor<ObjectGridStoper, GridTypeMapContainer> visitor(worker);
|
||||||
grid.VisitAllGrids(visitor);
|
grid.VisitAllGrids(visitor);
|
||||||
grid.SetGridState(GRID_STATE_IDLE);
|
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
|
else
|
||||||
{
|
map.ResetGridExpiry(grid, 0.1f);
|
||||||
m.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);
|
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())
|
if (!info.getUnloadLock())
|
||||||
{
|
{
|
||||||
info.UpdateTimeTracker(t_diff);
|
info.UpdateTimeTracker(diff);
|
||||||
if (info.getTimeTracker().Passed())
|
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(), map.GetId());
|
||||||
{
|
map.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(), m.GetId());
|
|
||||||
m.ResetGridExpiry(grid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,10 @@
|
|||||||
#ifndef TRINITY_GRIDSTATES_H
|
#ifndef TRINITY_GRIDSTATES_H
|
||||||
#define TRINITY_GRIDSTATES_H
|
#define TRINITY_GRIDSTATES_H
|
||||||
|
|
||||||
#include "Map.h"
|
#include "GridDefines.h"
|
||||||
#include "Object.h"
|
#include "NGrid.h"
|
||||||
|
|
||||||
|
class Map;
|
||||||
|
|
||||||
class GridState
|
class GridState
|
||||||
{
|
{
|
||||||
@@ -28,44 +30,35 @@ class GridState
|
|||||||
#ifdef TRINITY_DEBUG
|
#ifdef TRINITY_DEBUG
|
||||||
#define MAGIC_TESTVAL 0xFBE823BA
|
#define MAGIC_TESTVAL 0xFBE823BA
|
||||||
GridState() { i_Magic = MAGIC_TESTVAL; }
|
GridState() { i_Magic = MAGIC_TESTVAL; }
|
||||||
bool checkMagic()
|
bool checkMagic();
|
||||||
{
|
|
||||||
if (i_Magic != MAGIC_TESTVAL)
|
|
||||||
{
|
|
||||||
sLog->outError(LOG_FILTER_GENERAL, "!!! GridState: Magic value gone !!!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
void setMagic() { i_Magic = MAGIC_TESTVAL; }
|
void setMagic() { i_Magic = MAGIC_TESTVAL; }
|
||||||
unsigned int i_Magic;
|
unsigned int i_Magic;
|
||||||
#endif
|
#endif
|
||||||
virtual ~GridState() {};
|
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
|
class InvalidState : public GridState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
|
void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ActiveState : public GridState
|
class ActiveState : public GridState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
|
void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IdleState : public GridState
|
class IdleState : public GridState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
|
void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RemovalState : public GridState
|
class RemovalState : public GridState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Update(Map &, NGridType &, GridInfo &, const uint32 t_diff) const;
|
void Update(Map &, NGridType &, GridInfo &, uint32 t_diff) const;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -19,14 +19,15 @@
|
|||||||
#ifndef TRINITY_MAPMANAGER_H
|
#ifndef TRINITY_MAPMANAGER_H
|
||||||
#define TRINITY_MAPMANAGER_H
|
#define TRINITY_MAPMANAGER_H
|
||||||
|
|
||||||
#include "Define.h"
|
#include "Object.h"
|
||||||
#include <ace/Singleton.h>
|
|
||||||
#include <ace/Thread_Mutex.h>
|
|
||||||
#include "Common.h"
|
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "GridStates.h"
|
#include "GridStates.h"
|
||||||
#include "MapUpdater.h"
|
#include "MapUpdater.h"
|
||||||
|
|
||||||
|
#include <ace/Singleton.h>
|
||||||
|
#include <ace/Thread_Mutex.h>
|
||||||
|
|
||||||
|
|
||||||
class Transport;
|
class Transport;
|
||||||
struct TransportCreatureProto;
|
struct TransportCreatureProto;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ByteBuffer.h"
|
#include "ByteBuffer.h"
|
||||||
|
#include "Common.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
#include <ace/Stack_Trace.h>
|
#include <ace/Stack_Trace.h>
|
||||||
|
|||||||
@@ -20,16 +20,16 @@
|
|||||||
#define _BYTEBUFFER_H
|
#define _BYTEBUFFER_H
|
||||||
|
|
||||||
#include "Define.h"
|
#include "Define.h"
|
||||||
#include "Debugging/Errors.h"
|
#include "Errors.h"
|
||||||
#include "Utilities/ByteConverter.h"
|
#include "ByteConverter.h"
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
// Root of ByteBuffer exception hierarchy
|
// Root of ByteBuffer exception hierarchy
|
||||||
class ByteBufferException : public std::exception
|
class ByteBufferException : public std::exception
|
||||||
|
|||||||
Reference in new issue
Block a user