示例#1
0
void wmsPopNotifyFlags()
{
   if(theNotifyFlagsStack.empty())
   {
      return;
   }
   theNotifyFlags = theNotifyFlagsStack.top();
   theNotifyFlagsStack.pop();
}
示例#2
0
        int PopExpListValueCount()
        {
            if (exp_list_value_count_.empty())
                return 0;

            int result = exp_list_value_count_.top();
            exp_list_value_count_.pop();
            return result;
        }
示例#3
0
文件: main.cpp 项目: codders/soylent
void reset()
{
	while(!VIEWSTACK.empty()) {
		VIEWSTACK.pop();
	}

	WORLDVIEW = new ViewBox(W,H,0,0);
	VIEWSTACK.push(*WORLDVIEW);
}
示例#4
0
container convertStackToContainer(std::stack<uint32_t>& stack) {
    container result;
    do {
        result.push_back(stack.top());
        stack.pop();
    } while(not stack.empty());
    std::reverse(result.begin(), result.end());
    return result;
}
示例#5
0
 Pla&
 step ()
   {
     REQUIRE (!scopes_.empty() && scopes_.top());
     Pla& pos = *scopes_.top();
     ++scopes_.top();
     scopes_.push(index_.getReferrers(pos.getID()));
     return pos;
   }
示例#6
0
bool CameraManager::update(float dt)
{
	static std::stack<int> precedingBehaviors;

	if ( dt == 0 ) return false;

	mTransScale = mTransSpeed  * dt;
	mRotScale   = mRotateSpeed * dt;

	ctx.mCurrTruck  = BeamFactory::getSingleton().getCurrentTruck();
	ctx.mDt         = dt;
	ctx.mRotScale   = Degree(mRotScale);
	ctx.mTransScale = mTransScale;
	ctx.fovInternal = Degree(FSETTING("FOV Internal", 75.0f));
	ctx.fovExternal = Degree(FSETTING("FOV External", 60.0f));

	if ( currentBehaviorID < CAMERA_BEHAVIOR_END && INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_CHANGE) )
	{
		switchToNextBehavior(false);
	}

	if ( INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_FREE_MODE_FIX) )
	{
		toggleBehavior(CAMERA_BEHAVIOR_FIXED);
	}

	if ( INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_FREE_MODE) )
	{
		toggleBehavior(CAMERA_BEHAVIOR_FREE);
	}

	if ( !ctx.mCurrTruck && hasActiveVehicleBehavior() )
	{
		precedingBehaviors.push(currentBehaviorID);
		switchBehavior(CAMERA_BEHAVIOR_CHARACTER);
	} else if ( ctx.mCurrTruck && hasActiveCharacterBehavior() )
	{
		if ( !precedingBehaviors.empty() )
		{
			switchBehavior(precedingBehaviors.top(), false);
			precedingBehaviors.pop();
		} else
		{
			switchBehavior(CAMERA_BEHAVIOR_VEHICLE);
		}
	}

	if ( currentBehavior )
	{
		currentBehavior->update(ctx);
	} else
	{
		switchBehavior(CAMERA_BEHAVIOR_CHARACTER);
	}

	return true;
}
示例#7
0
void glScissorPop()
{
	if(!scissorStack.empty())
	{
		Recti scissor = scissorStack.top();
		scissorStack.pop();
		glScissor(scissor.min[0], scissor.min[1], scissor.max[0] - scissor.min[0] + 1, scissor.max[1] - scissor.min[1] + 1);
	}
}
示例#8
0
 void pop() {
     if (s.empty())  {
         return;
     }
     if (min.top() == s.top()) {
         min.pop();
     }
     s.pop();
 }
示例#9
0
void PrintStack(std::stack<int> stackIn)
{
	while(!stackIn.empty())
	{
		std::cout << stackIn.top() << " ";
		stackIn.pop();
	}
	std::cout << "\n";
}
示例#10
0
jmp_buf* catch_point()
{
  if ( catch_points.empty() ) {
    fprintf(stderr, "Fatal internal error: Exception stack underflow\n");
    exit(1);
  }

  return catch_points.top();
}
示例#11
0
void printstack(std::stack<frac*> s )
{
	std::cout<<"stack:"<<std::endl;
	while(!s.empty())
	{
		s.top()->display();
		s.pop();
	}
}
示例#12
0
// Note: empties the passed stack
std::vector<int> toIndexPath(std::stack<maze_point> path, int mazeSize) {
	std::vector<int> indexPath;
	indexPath.reserve(path.size());
	while (!path.empty()) {
		indexPath.push_back(path.top().position.getIndex(mazeSize));
		path.pop();
	}
	return indexPath;
}
示例#13
0
void reverse_stack(std::stack<T>& st)
{
	if(!st.empty())
	{
		T top = st.top();
		st.pop();
		reverse_stack(st);
		add_to_stack_bottom(st, top);
	}
}
示例#14
0
void ReverseStack(std::stack<int>& stack)
{
	if (!stack.empty() )
	{
		int top = stack.top();
		stack.pop();
		ReverseStack(stack);
		addtobottom(stack,top);
	}
}
示例#15
0
 void pop()
 {
     if (elements.empty()) {
         return;
     }
     if (elements.top() == mins.top()) {
         mins.pop();
     }
     elements.pop();
 }
示例#16
0
template<typename T> void Add_Bottom(std::stack<T>& stk, T val) {
  if(stk.empty())
    stk.push(val);
  else {
    T t = stk.top();
    stk.pop();
    Add_Bottom(stk, val);
    stk.push(t);
  }
}
示例#17
0
	/// reduce stack by given amount n
	void reduce_stack(std::size_t n) {
		if (n <= 0) return;
		std::string reduced_value = "";
		for (std::size_t i = 0; i < n && !stack_.empty(); ++i) {
			reduced_value = stack_.top() + reduced_value;
			stack_.pop();
		}
		stack_.push(reduced_value);
		state_.parameters.push_back(reduced_value);
	}
示例#18
0
//This method is used to catch if there are either more opening or closing braces
//PRE: stack, line number
//POST: none
void AST::catchUnequalBracesException(std::stack<std::string>& bracesStack, unsigned i){
	try{
		if(bracesStack.empty()){
			throw i + 1;
		}
	}catch(unsigned int e){
		std::cout<<"ERROR IN SOURCE CODE, TOO MANY CLOSING BRACES FROM LINE NO:"<<e<<std::endl;
		std::terminate();
	}
}
int getMaximumPriority(std::stack<letter*> _tray) {
    int mp = -1;
    
    while (!_tray.empty()) {
        int tp = _tray.top()->getPriority();
        if (tp > mp) mp = tp;
        _tray.pop();
    }
    return mp;
}
 std::shared_ptr<T> pop()
 {
     std::lock_guard<std::mutex> lock(m_);
     if (data_.empty()) {
         throw empty_stack();
     }
     std::shared_ptr<T> const res(std::make_shared<T>(data_.top()));
     data_.pop();
     return res;
 }
示例#21
0
  std::pair<int, int> nexttotop(std::stack<std::pair<int, int> > s){
	  std::pair<int, int> topofStack = s.top();
	  s.pop();
	  if (!s.empty())
	  {
	  std::pair<int, int> toret = s.top();
	  s.push(topofStack);
	  return toret;
  }
}
示例#22
0
void undo()
{
  using namespace std;
  if(!undo_stack.empty())
  {
    redo_stack.push(s);
    s = undo_stack.top();
    undo_stack.pop();
  }
}
示例#23
0
void redo()
{
  using namespace std;
  if(!redo_stack.empty())
  {
    undo_stack.push(s);
    s = redo_stack.top();
    redo_stack.pop();
  }
}
示例#24
0
    void Pop()
    {
    if(!pilhaadd.empty()){
        while(!pilhaadd.empty())
        {
            pilhatmp.push(pilhaadd.top());
            pilhaadd.pop();
        }

        pilhatmp.pop();

        while(!pilhatmp.empty())
        {
            pilhaadd.push(pilhatmp.top());
            pilhatmp.pop();
        }

        }
    }
示例#25
0
//---------------------------------------------------------------------
// ゲーム板を初期化する
//---------------------------------------------------------------------
LRESULT OnGameInit(HWND hwnd, WPARAM wParam, LPARAM lParam) {
	while (!g_gameStack.empty())
		g_gameStack.pop();

	g_game.InitCells();

	InvalidateRect(hwnd, NULL, TRUE);

	return 0;
}
示例#26
0
 /** @return the next smallest number */
 int next() {
     if(cur != NULL && cur->right != NULL){
         getLeftPath(cur->right); 
     }
     if(!s.empty()){
         cur = s.top();
         s.pop();
     }
     return cur->val;
 }
 void pop(T& value) throw(threadsafe_stack_empty)
 {
     std::lock_guard<TT> lock(m);
     if (data.empty())
     {
         throw threadsafe_stack_empty("Stack is empty!");
     }
     value = std::move_if_noexcept(data.top());
     data.pop();
 }
void reverse(std::stack<int> s)
{
	if(s.empty())
		return;

	int top = s.top();
	s.pop();
	push_to_bottom(s, top);
	reverse(s);
}
示例#29
0
void popStackSetMap(std::stack<Ptr>& s, HashMap& map, const Ptr& cur) {
	auto s_top = s.top();
	s.pop();
	if (s.empty()) {
		map[s_top] = { nullptr, cur };
	}
	else {
		map[s_top] = { s.top(), cur };
	}
}
示例#30
0
 ObjectHandle::ObjectHandle()
 {
   if (freedHandles.empty()) {
     i32.ID    = nextFreeLocalID++;
     i32.owner = 0;
   } else {
     i64 = freedHandles.top();
     freedHandles.pop();
   }
 }