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, ¤tDx, ¤tDy); 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; }
void walkActorPath(character *actor) { int nx, ny; if (TCOD_path_size(actor->path)) { TCOD_path_walk(actor->path, &nx, &ny, true); moveActor(actor, nx - actor->x, ny - actor->y); } }
int TCODPath::size() const { return TCOD_path_size(data); }