From dbd338c284c63d2aebe134e4f4ec0c64f8717a72 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 25 Apr 2011 22:20:01 -0700 Subject: [PATCH] eliminate region_list usage from the monster pathfinder --- src/kernel/battle.c | 2 +- src/kernel/pathfinder.c | 9 +++++---- src/kernel/pathfinder.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/kernel/battle.c b/src/kernel/battle.c index 5e8e83cda..22781c80d 100644 --- a/src/kernel/battle.c +++ b/src/kernel/battle.c @@ -1761,7 +1761,7 @@ void do_combatmagic(battle * b, combatmagic_t was) if (power <= 0) { /* Effekt von Antimagie */ report_failed_spell(b, mage, sp); pay_spell(mage, sp, level, 1); - } else if (fumble(r, mage, sp, sp->level) == true) { + } else if (fumble(r, mage, sp, sp->level)) { report_failed_spell(b, mage, sp); pay_spell(mage, sp, level, 1); } else { diff --git a/src/kernel/pathfinder.c b/src/kernel/pathfinder.c index 26b4f62db..97cea3b98 100644 --- a/src/kernel/pathfinder.c +++ b/src/kernel/pathfinder.c @@ -18,6 +18,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include +#include #include "pathfinder.h" #include "region.h" @@ -98,10 +99,10 @@ static void free_nodes(node * root) } } -struct region_list *regions_in_range(struct region *start, int maxdist, +struct quicklist *regions_in_range(struct region *start, int maxdist, boolean(*allowed) (const struct region *, const struct region *)) { - region_list *rlist = NULL; + quicklist * rlist = NULL; node *root = new_node(start, 0, NULL); node **end = &root->next; node *n = root; @@ -109,7 +110,7 @@ struct region_list *regions_in_range(struct region *start, int maxdist, while (n != NULL) { region *r = n->r; int depth = n->distance + 1; - direction_t d; + int d; if (n->distance >= maxdist) break; @@ -123,7 +124,7 @@ struct region_list *regions_in_range(struct region *start, int maxdist, continue; /* can't go there */ /* add the region to the list of available ones. */ - add_regionlist(&rlist, rn); + ql_push(&rlist, rn); /* make sure we don't go here again, and put the region into the set for further BFS'ing */ diff --git a/src/kernel/pathfinder.h b/src/kernel/pathfinder.h index 63f50b7d9..ac372dc34 100644 --- a/src/kernel/pathfinder.h +++ b/src/kernel/pathfinder.h @@ -39,7 +39,7 @@ extern "C" { const struct region *target); extern boolean allowed_walk(const struct region *src, const struct region *target); - extern struct region_list *regions_in_range(struct region *src, int maxdist, + extern struct quicklist *regions_in_range(struct region *src, int maxdist, boolean(*allowed) (const struct region *, const struct region *)); extern void pathfinder_cleanup(void);