eliminate region_list usage from the monster pathfinder

This commit is contained in:
Enno Rehling 2011-04-25 22:20:01 -07:00
parent 9802eecd79
commit dbd338c284
3 changed files with 7 additions and 6 deletions

View File

@ -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 {

View File

@ -18,6 +18,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <platform.h>
#include <kernel/config.h>
#include <util/quicklist.h>
#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 */

View File

@ -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);