TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ActiveState Class Reference

#include <GridStates.h>

Public Member Functions

void Update (Map &, NGridType &, GridInfo &, uint32 t_diff) const override
 
- Public Member Functions inherited from GridState
virtual ~GridState ()
 

Member Function Documentation

void ActiveState::Update ( Map map,
NGridType grid,
GridInfo info,
uint32  t_diff 
) const
overridevirtual

Implements GridState.

27 {
28  // Only check grid activity every (grid_expiry/10) ms, because it's really useless to do it every cycle
29  info.UpdateTimeTracker(diff);
30  if (info.getTimeTracker().Passed())
31  {
32  if (!grid.GetWorldObjectCountInNGrid<Player>() && !map.ActiveObjectsNearGrid(grid))
33  {
34  ObjectGridStoper worker;
36  grid.VisitAllGrids(visitor);
38  TC_LOG_DEBUG("maps", "Grid[%u, %u] on map %u moved to IDLE state", grid.getX(), grid.getY(), map.GetId());
39  }
40  else
41  map.ResetGridExpiry(grid, 0.1f);
42  }
43 }
void UpdateTimeTracker(time_t diff)
Definition: NGrid.h:50
Definition: TypeContainerVisitor.h:32
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
bool ActiveObjectsNearGrid(NGridType const &ngrid) const
Definition: Map.cpp:2920
uint32 GetWorldObjectCountInNGrid() const
Definition: NGrid.h:174
uint32 GetId(void) const
Definition: Map.h:325
Definition: NGrid.h:65
const TimeTracker & getTimeTracker() const
Definition: NGrid.h:41
Definition: ObjectGridLoader.h:59
void VisitAllGrids(TypeContainerVisitor< T, TypeMapContainer< TT > > &visitor)
Definition: NGrid.h:146
void SetGridState(grid_state_t s)
Definition: NGrid.h:101
int32 getY() const
Definition: NGrid.h:103
int32 getX() const
Definition: NGrid.h:102
bool Passed() const
Definition: Timer.h:114
void ResetGridExpiry(NGridType &grid, float factor=1) const
Definition: Map.h:319

+ Here is the call graph for this function:


The documentation for this class was generated from the following files: