int& NextStep::
    triggerCall( int& dummy,int timeCurrent )
    {

      sotDEBUGIN(45);

      switch( state )
	{
	case STATE_STOPED: break;
	case STATE_STARTED:
	  {
	    int nextIntoductionTime = timeLastIntroduction+period;
	    if( nextIntoductionTime<=timeCurrent )
	      {
		nextStep( timeCurrent );
		if( NULL!=verbose )
		  {
		    FootPrint & lastStep =  footPrintList.back();
		    (*verbose) << "<T=" << timeCurrent << "> Introduced a new step: ";
		    switch( lastStep.contact )
		      {
		      case CONTACT_LEFT_FOOT: (*verbose) << "LF " ; break;
		      case CONTACT_RIGHT_FOOT: (*verbose) << "RF " ; break;
		      }
		    (*verbose) << lastStep.x << "," << lastStep.y << ","
			       << lastStep.theta << std::endl;
		  }
		introductionCallBack( timeCurrent );
		timeLastIntroduction=timeCurrent;
	      }
	    break;
	  }
	case STATE_STARTING:
	  {
	    starter( timeCurrent );
	    break;
	  }
	case STATE_STOPING:
	  {
	    stoper( timeCurrent );
	    break;
	  }
	};

      sotDEBUGOUT(45);

      return dummy;
    }
Ejemplo n.º 2
0
void ActiveState::Update(Map &m, NGridType &grid, GridInfo & info,
        const uint32 &x, const uint32 &y, const uint32 &t_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);
    if (info.getTimeTracker().Passed()) {
        if (grid.ActiveObjectsInGrid() == 0 && !m.ActiveObjectsNearGrid(x, y)) {
            ObjectGridStoper stoper(grid);
            stoper.StopN();
            grid.SetGridState(GRID_STATE_IDLE);
            sLog->outDebug(LOG_FILTER_MAPS,
                    "Grid[%u, %u] on map %u moved to IDLE state", x, y,
                    m.GetId());
        } else {
            m.ResetGridExpiry(grid, 0.1f);
        }
    }
}
Ejemplo n.º 3
0
void
ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 &x, const uint32 &y, const uint32 &t_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);
    if( info.getTimeTracker().Passed() )
    {
        if( grid.ActiveObjectsInGrid() == 0 && !ObjectAccessor::Instance().PlayersNearGrid(x, y, m.GetId(), m.GetInstanceId()) )
        {
            ObjectGridStoper stoper(grid);
            stoper.StopN();
            grid.SetGridState(GRID_STATE_IDLE);
        }
        else
        {
            m.ResetGridExpiry(grid, 0.1f);
        }
    }
}
Ejemplo n.º 4
0
void
ObjectGridCleaner::Stop(GridType &grid)
{
    TypeContainerVisitor<ObjectGridCleaner, GridTypeMapContainer > stoper(*this);
    grid.Visit(stoper);
}