示例#1
0
void Sensor::checkBroken() {
	if(!isDisabled()) { //se não está bloqueado
		if(isBroken()) { //se estiver avariado
			if(getBrokenFor() == 10) setBroken(false); //ao fim de 10 iterações, volta a estar activo
			else incrementBrokenFor(); //senão, incrementa por um as iterações de há quanto temp está bloquado
		}
	}
}
示例#2
0
void	hObj::derefine()
{
	assert(isBroken());
	//return typeSpecyfic_.derefine_(*this);
	for(uTind i(0); i < typeSpecyfic_.nSons_; ++i) {
		sons(i)=0;
	}
	nMyClassSons_=0;
}
示例#3
0
BoolArray closeLines(const BoolArray &image) {
    // Fill in single pixels gaps in lines.
    BoolArray temp=image;
    for (BoolArray::const_iterator i=image.begin(); i!=image.end(); ++i) {
        if (isBroken(image,i.coord())) {
            temp[i.coord()]=1;
        }
    }
    return temp;
}
示例#4
0
String LinkFile::describe() const
{
    DENG2_GUARD(this);

    if (!isBroken())
    {
        DENG2_GUARD_FOR(target(), G);
        return "link to " + target().description();
    }
    return "broken link";
}
void Queue::freezeEof(AddressType& Address) {
  assert(Address <= kMaxEofAddress && "WASM stream too big to process");
  if (EofFrozen && Address != EofPtr->getEobAddress()) {
    fail();
    Address = 0;
  }
  // This call zero-fills pages if writing hasn't reached Address yet.
  PageCursor Cursor(this);
  writeToPage(Address, 0, Cursor);
  EofPtr->setEobAddress(Address);
  EofFrozen = true;
  if (!isBroken(Cursor)) {
    Cursor.setMaxAddress(Address);
    // TODO(karlschimpf): If adding threads, make this update thread safe.
    // If any pages exist after Cursor, remove them.
    LastPage = Cursor.CurPage;
    if (Cursor.CurPage->Next)
      Cursor.CurPage->Next.reset();
  }
}
示例#6
0
int Item::considerState(int price)
{
	if (cursed && cursedKnown) {
		price /= 2;
	}
	if (levelKnown) {
		if (level > 0) {
			price *= (level + 1);
			if (isBroken()) {
				price /= 2;
			}
		}
		else if (level < 0) {
			price /= (1 - level);
		}
	}
	if (price < 1) {
		price = 1;
	}

	return price;
}
示例#7
0
void handleInvokeReply(RemoteOpHeader *h, Node srv, Stream str)
{
  State *state;

  anticipateGC(64 * 1024 + 2 * StreamLength(str));
  state = (State *)OIDFetch(h->ss);
  if (ISNIL(state) || !RESDNT(state->firstThing)) {
    /*
     * We probably gc'd this state because we couldn't find any references
     * to it.  Find it and send it this reply.
     */
    Stream newstr;
    RewindStream(str);
    newstr = StealStream(str);
    findAndSendTo(h->ss, newstr);
  } else {
    TRACE(rinvoke, 3, ("InvokeReply received"));

    assert(!ISNIL(state));
    assert(RESDNT(state->firstThing));
    assert(ISetMember(allProcesses, (int)state));

    TRACE(process, 5, ("Resetting nsoid in state %#x", state));
    state->nsoid = nooid;
    state->nstoid = nooid;
    if (h->status) {
      TRACE(rinvoke, 0, ("Obsolete remote invocation return code"));
      h->option1 = 2;
    }
    if (h->option1) {
      /*
       * We are supposed to propagate a failure.
       */
      TRACE(rinvoke, 1, ("Remote invocation raised %s",
			 h->option1 == 1 ? "failure" :
			 h->option1 == 2 ? "unavailable" :
			 "unknown"));
      if (!findHandler(state, h->option1 - 1, (Object)JNIL)) {
	if (!debugInteractively) {
	  state = processDone(state, h->option1);
	} else {
	  char buf[80];
	  sprintf(buf, "Remote invocation raised %s",
		  h->option1 == 1 ? "failure" :
		  h->option1 == 2 ? "unavailable" :
		  "unknown");
	  if (debug(state, buf)) {
	    /*
	     * debug returns 1 when we shouldn't run the state no more.
	     */
	    state = 0;
	  }
	}
      }
      if (state) makeReady(state);
    } else if (RESDNT(state->op->flags) &&
	       BROKEN(state->op->flags) && isBroken(state->op)) {
      if (returnToBrokenObject(state)) {
	/* nothing to do */
      } else {
	makeReady(state);
      }
    } else {
      extractNVars(str, -1, (int *)state->sp, &state->ep, &state->et, srv);
      makeReady(state);
    }
  }
  TRACE(rinvoke, 4, ("Invoke return handled"));
  inhibit_gc--;
}