Exemplo n.º 1
0
int moveCardOntoAnother(card_t *card, card_t *onto) {
  cardstack_t *dest = onto->stack;
  printf("onto LAIN %d %d\n", dest->type == LAIN, dest->type);
  printf("card LAIN %d %d\n", card->stack->type == LAIN, card->stack->type);
  printf("isUp %d\n",isUp(card));
  printf("isOnTop %d\n",isOnTop(onto));
  printf("isOkOn %d\n",isOkOn(card,onto));
  if ((dest->type == LAIN) && isUp(card) && isOnTop(onto) && isOkOn(card,onto)) {
    move_onto(card,dest);
    return SUCCESS;
  } else {
    return FAILURE;
  }
}
Exemplo n.º 2
0
int moveCardOntoAnother(card_t *card, card_t *onto) {
  cardstack_t *dest = onto->stack;
  if ((dest->type == LAIN) && isUp(card) && isOnTop(onto) && isOkOn(card,onto)) {
    move_onto(card,dest);
    return SUCCESS;
  } else {
    return FAILURE;
  }
}
Exemplo n.º 3
0
void Task::activateRaiseOrIconify()
{
    if ( !isActive() || isIconified() ) {
        activate();
    } else if ( !isOnTop() ) {
       raise();
    } else {
       iconify();
    }
}
Exemplo n.º 4
0
int makeArenaPlay(card_t *card, arena_t *arena) {

  cardstack_t *stack = card->stack;

  if (isOnTop(card) && (arenaTake(card,arena) == SUCCESS)) {
    pop(stack);
    if (stack->type == LAIN && is_empty(stack) && !is_empty(stack->feed)) {
      feed(stack);
    }
    return SUCCESS;
  } else {
    return FAILURE;
  }
}
Exemplo n.º 5
0
void StateManager::draw()
{
    if (isStateStackEmpty() == false) {
        mStatesMap.at(mCurrentStateIdentifier)->draw();
        //Iterate through all the states and find the one that's to be drawed over
        StateStack::iterator iteratorEnd = mStatesMap.end();
        for (StateStack::iterator iterator = mStatesMap.begin(); iterator != iteratorEnd; iterator++) {
            auto found = iterator->second.get();
            if (found->isOnTop()) {
                found->draw();
            }
        }
    }
}
Exemplo n.º 6
0
int Thing::getStackPriority()
{
    if(isGround())
        return 0;
    else if(isGroundBorder())
        return 1;
    else if(isOnBottom())
        return 2;
    else if(isOnTop())
        return 3;
    else if(asCreature())
        return 4;
    else // common items
        return 5;
}
Exemplo n.º 7
0
void Model::print() const {
    std::cout << "Model: ";
    for (const Cube& it : world.cubes) {
        if (isOnTop(it)) {
            Cube current = it;
            while (!isOnBottom(current)) {
                std::cout << IDToName(current);
                current = *getBelow(current);
            }

            std::cout << IDToName(current) << "| ";
        }
    }

    if (invalidInterpretation.get()) {
        std::cout << ", ";
        invalidInterpretation->print();
    }
}
Exemplo n.º 8
0
int isUp(card_t *c) {
  return (c->stack->type == LAIN) || (isOnTop(c) && (c->stack->type == DISCARD));
}