示例#1
0
文件: actors.c 项目: witheld9/Torch
int walkActor(character *actor, int dx, int dy) {
	int currentDx = -1, currentDy = -1;
	
	if (!isPositionWalkable(dx, dy)) {
		printf("Invalid pathing destination: %i, %i\n", dx, dy);
		
		return 0;
	}
	
	if (TCOD_path_size(actor->path)) {
		TCOD_path_get_destination(actor->path, &currentDx, &currentDy);
		
		if (dx == currentDx && dy == currentDy) {
			return 1;
		}
	}
	
	if (!TCOD_path_compute(actor->path, actor->x, actor->y, dx, dy)) {
		//printf("Invalid path!\n");

		return 0;
	}

	return 1;
}
示例#2
0
文件: path.cpp 项目: smarmy/HellRogue
void TCODPath::getDestination(int *x,int *y) const {
	TCOD_path_get_destination(data,x,y);
}