Esempio n. 1
0
TCOD_path_t map_computepath(point *origin, point *dest)
{
	//printf("origin %f, %f\n", origin->x, origin->y);
	//printf("dest %f, %f\n", dest->x, dest->y);
	// diagonal cost is sqrt(2)
	TCOD_path_t path = TCOD_path_new_using_map(tcod_map, 1.41f);
	TCOD_path_compute(path, origin->x, origin->y, dest->x, dest->y);

	/*
	bool is_possible = TCOD_path_compute(path, origin->x, origin->y, dest->x, dest->y);
	printf("is_possible: %d\n", is_possible);
	printf("path steps: %d\n", TCOD_path_size(path));
	for (int i = 0; i < TCOD_path_size(path); ++i) {
		int x, y;
		TCOD_path_get(path, i, &x, &y);
		printf("step %d: %d, %d\n", i + 1, x, y);
	}
	*/
	return path;
}
Esempio n. 2
0
TCODPath::TCODPath(const TCODMap *map, float diagonalCost) {
	data=(void *)TCOD_path_new_using_map(map->data,diagonalCost);
}