コード例 #1
0
void move(sworld world_from, int x_from, int y_from, sworld world_to, int x_to,
		int y_to, int worldsize) {
	/*XXX be careful with   SONT&WES*/
	/*
	 If a squirrel/wolf completes a breeding period if he moves it breeds
	 Handle colissions
	 */
	int fromAnimalType;
	sworld fromAuxPos = getPositionStructure(world_from, x_from, y_from, worldsize);
	sworld toAuxPos = getPositionStructure(world_from, x_to, y_to, worldsize);
	sworld toPos = getPositionStructure(world_to, x_to, y_to,worldsize);
	sworld toAnimal;

	/* Ve qual é o tipo de animal para qual se está a mover,
	 * ve primeiro no mapa  (possivelmente) actualizado e so depois no antigo*/
	if (isAnimal(toPos->type)) {
		toAnimal = getPositionStructure(world_to, x_to, y_to, worldsize);
	} else {
		if (isAnimal(toAuxPos->type)) {
			toAnimal = getPositionStructure(world_from, x_to, y_to,worldsize);
		} else {
			/*Não há animal na casa de destino*/
			/*check type and then move*/
			if (fromAuxPos->type == WES)
				setPosition(world_to, x_to, y_to, WOLF, fromAuxPos->breeding_period,
						wolfStarvP, worldsize);
			else {
				setPosition(world_to, x_to, y_to, fromAuxPos->type,
						fromAuxPos->breeding_period, fromAuxPos->starvation_period, worldsize);
			}

			/*check if they have babies*/
			checkBabies(world_from, world_to, toAuxPos, x_from, y_from, worldsize);
			cleanWorldPos(world_from, world_to, x_from, y_from, worldsize);
			return;
		}
	}
	/*Ha animal na casa de destino*/
	/* WOLFS vs WOLFS*/
	/* WOLFS vs SQRLS*/
	fromAnimalType = fromAuxPos->type;
	if (fromAnimalType == WOLF || fromAnimalType == WES) {
		moveWOLFs(world_from, world_to,fromAuxPos, toAnimal, x_from, y_from, x_to, y_to, worldsize);
		/*checkBabies(world_from, world_to, toAuxPos, x_from, y_from);*/
	}
	/*SQRLs vs SQRLs*/
	/*SQRLs vs WOLFS*/
	else {
		if (fromAnimalType == SQRL || fromAnimalType == SONT) {
			moveSQRLs(world_from, world_to,fromAuxPos, toAnimal, x_from, y_from, x_to, y_to, worldsize);
			/*checkBabies(world_from, world_to, toAuxPos, x_from, y_from);*/
		} else {
			printf(
					"[BUG] We have am huge Error we have gosths in our MAP RUN RUN");
		}
	}
}
コード例 #2
0
ファイル: nibbParseImageDir.c プロジェクト: blumroy/kentUtils
void setView(struct imageInfo *image, char *flakyClone, char *flakyStage,
	char *flakyView)
/* Set image->view from view name if it looks good. */
{
if (startsWith("2_", flakyView))
    flakyView += 2;
if (isAllish(flakyView))
    image->view = "mixed";
else if (isAnimal(flakyView))
    image->view = "animal";
else if (isAnterior(flakyView))
    image->view = "anterior";
else if (isBody(flakyView))
    image->view = "whole";
else if (isDorsal(flakyView))
    image->view = "dorsal";
else if (isTail(flakyView))
    image->view = "tail";
else if (isLateral(flakyView))
    image->view = "lateral";
else if (isPosterior(flakyView))
    image->view = "posterior";
else if (isSection(flakyView))
    image->view = "section";
else if (isVentral(flakyView))
    image->view = "ventral";
else if (isVegetal(flakyView))
    image->view = "vegetal";
else if (isHead(flakyView))
    image->view = "head";
}