コード例 #1
0
ファイル: drawbridge_pulley.c プロジェクト: revcozmo/edgar
static void init()
{
	self->takeDamage = self->active == TRUE ? takeDamage : NULL;

	self->action = &entityWait;

	addChain();
}
コード例 #2
0
ファイル: grabber.c プロジェクト: revcozmo/edgar
static void init()
{
	addChain();

	self->dirX = 0;

	self->dirY = 0;

	self->action = &entityWait;
}
コード例 #3
0
ファイル: magnet.c プロジェクト: LibreGames/edgar
static void init()
{
	addChain();

	addRay();

	self->endY = getMapFloor(self->startX, self->startY);

	self->action = &entityWait;
}
コード例 #4
0
ファイル: chaintable.c プロジェクト: lamby/pkg-swi-prolog
status
addChainTable(ChainTable ct, Any name, Any value)
{ Chain ch;

  if ( (ch = getMemberHashTable((HashTable) ct, name)) )
    addChain(ch, value);
  else
    appendHashTable((HashTable) ct, name, newObject(ClassChain, value, EAV));

  succeed;
}
コード例 #5
0
void RainbowTable::generateChain() {
    Chain chain;
    unsigned password;

    password = chainsGenerator.generateRandomPassword();
    sprintf(chain.head, "%u", password);
    chainsGenerator.generateChain(&chain);

    //printf("chain %i, head: %s, tail: %s \n",
    //i, chain.head, chain.tail);

    if (!findChain(chain.head, chain.tail)) {
        addChain(chain.head, chain.tail);
    }
}
コード例 #6
0
ファイル: scale.c プロジェクト: LibreGames/edgar
static void init()
{
	EntityList *list;
	EntityList *l;
	Entity *e;

	if (strlen(self->objectiveName) == 0)
	{
		showErrorAndExit("Scale at %d %d has no name", (int)self->x, (int)self->y);
	}

	list = getEntitiesByObjectiveName(self->objectiveName);

	for (l=list->next;l!=NULL;l=l->next)
	{
		e = l->entity;

		if (e != self)
		{
			self->target = e;

			break;
		}
	}

	freeEntityList(list);

	if (self->target == NULL)
	{
		showErrorAndExit("Scale could not find partner %s", self->objectiveName);
	}

	self->targetY = self->startY + (self->endY - self->startY) / 2;

	addChain();

	self->mental = getMapCeiling(self->x, self->y);

	self->action = &entityWait;
}
コード例 #7
0
ファイル: config.c プロジェクト: XVilka/coreboot
static void start(void *data, const char *el, const char **attr)
{
	int i;
	struct userdata *d = (struct userdata *)data;

	for (i = 0; states[i].element != NULL; i++) {
		if (d->state != states[i].pstate)
			continue;

		if (!strcmp(el, states[i].element)) {
			d->state = states[i].state;
			break;
		}
	}

	if (states[i].element == NULL)
		die("E: Unknown element %s\n", el);

	if (d->state == STATE_PAYLOAD)
		d->payload = addPayload(d->config, attr);

	if (d->state == STATE_PAYLOAD_CHAIN)
		d->chain = addChain(d->config, d->payload);
}
コード例 #8
0
ファイル: chainNet.c プロジェクト: elmargb/kentUtils
void chainNet(char *chainFile, char *tSizes, char *qSizes, 
	char *tNet, char *qNet)
/* chainNet - Make alignment nets out of chains. */
{
struct lineFile *lf = lineFileOpen(chainFile, TRUE);
struct hash *qHash, *tHash;
struct chrom *qChromList, *tChromList, *tChrom, *qChrom;
struct chain *chain;
double lastScore = -1;
struct lm *lm = lmInit(0);
struct rbTreeNode **rbStack;
FILE *tNetFile = mustOpen(tNet, "w");
FILE *qNetFile = mustOpen(qNet, "w");


lmAllocArray(lm, rbStack, 256);
makeChroms(qSizes, lm, rbStack, &qHash, &qChromList);
makeChroms(tSizes, lm, rbStack, &tHash, &tChromList);
verbose(1, "Got %d chroms in %s, %d in %s\n", slCount(tChromList), tSizes,
       slCount(qChromList), qSizes);
lineFileSetMetaDataOutput(lf, tNetFile);
lineFileSetMetaDataOutput(lf, qNetFile);

/* Loop through chain file building up net. */
while ((chain = chainRead(lf)) != NULL)
    {
    /* Make sure that input is really sorted. */
    if (lastScore >= 0 && chain->score > lastScore)
        errAbort("%s must be sorted in order of score", chainFile);
    lastScore = chain->score;

    if (chain->score < minScore) 
	{
    	break;
	}
    verbose(2, "chain %f (%d els) %s %d-%d %c %s %d-%d\n", 
	    chain->score, slCount(chain->blockList), 
	    chain->tName, chain->tStart, chain->tEnd, 
	    chain->qStrand, chain->qName, chain->qStart, chain->qEnd);
    qChrom = hashMustFindVal(qHash, chain->qName);
    if (qChrom->size != chain->qSize)
        errAbort("%s is %d in %s but %d in %s", chain->qName, 
		chain->qSize, chainFile,
		qChrom->size, qSizes);
    tChrom = hashMustFindVal(tHash, chain->tName);
    if (tChrom->size != chain->tSize)
        errAbort("%s is %d in %s but %d in %s", chain->tName, 
		chain->tSize, chainFile,
		tChrom->size, tSizes);
    if (!inclQuery(chain))
        verbose(2, "skipping chain on query %s\n", chain->qName);
    else
        {
        addChain(qChrom, tChrom, chain);
        verbose(2, "%s has %d inserts, %s has %d\n", tChrom->name, 
                tChrom->spaces->n, qChrom->name, qChrom->spaces->n);
        }
    }
/* Build up other side of fills.  It's just for historical 
 * reasons this is not done during the main build up.   
 * It's a little less efficient this way, but to change it
 * some hard reverse strand issues would have to be juggled. */
verbose(1, "Finishing nets\n");
finishNet(qChromList, TRUE);
finishNet(tChromList, FALSE);

/* Write out basic net files. */
verbose(1, "writing %s\n", tNet);
outputNetSide(tChromList, tNetFile, FALSE);
verbose(1, "writing %s\n", qNet);
outputNetSide(qChromList, qNetFile, TRUE);

/* prevent SIGPIPE in preceding process if input is a pipe, consume remainder
 * of input file since we stop before EOF. */
if (isPipe(lf->fd))
    {
    char *line;
    while(lineFileNext(lf, &line, NULL))
        continue;
    }
lineFileClose(&lf);

if (verboseLevel() > 1)
    printMem(stderr);
}