forked from github/server
eliminate region_list usage from the monster pathfinder
This commit is contained in:
parent
9802eecd79
commit
dbd338c284
|
@ -1761,7 +1761,7 @@ void do_combatmagic(battle * b, combatmagic_t was)
|
||||||
if (power <= 0) { /* Effekt von Antimagie */
|
if (power <= 0) { /* Effekt von Antimagie */
|
||||||
report_failed_spell(b, mage, sp);
|
report_failed_spell(b, mage, sp);
|
||||||
pay_spell(mage, sp, level, 1);
|
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);
|
report_failed_spell(b, mage, sp);
|
||||||
pay_spell(mage, sp, level, 1);
|
pay_spell(mage, sp, level, 1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -18,6 +18,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
|
#include <util/quicklist.h>
|
||||||
#include "pathfinder.h"
|
#include "pathfinder.h"
|
||||||
|
|
||||||
#include "region.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 *))
|
boolean(*allowed) (const struct region *, const struct region *))
|
||||||
{
|
{
|
||||||
region_list *rlist = NULL;
|
quicklist * rlist = NULL;
|
||||||
node *root = new_node(start, 0, NULL);
|
node *root = new_node(start, 0, NULL);
|
||||||
node **end = &root->next;
|
node **end = &root->next;
|
||||||
node *n = root;
|
node *n = root;
|
||||||
|
@ -109,7 +110,7 @@ struct region_list *regions_in_range(struct region *start, int maxdist,
|
||||||
while (n != NULL) {
|
while (n != NULL) {
|
||||||
region *r = n->r;
|
region *r = n->r;
|
||||||
int depth = n->distance + 1;
|
int depth = n->distance + 1;
|
||||||
direction_t d;
|
int d;
|
||||||
|
|
||||||
if (n->distance >= maxdist)
|
if (n->distance >= maxdist)
|
||||||
break;
|
break;
|
||||||
|
@ -123,7 +124,7 @@ struct region_list *regions_in_range(struct region *start, int maxdist,
|
||||||
continue; /* can't go there */
|
continue; /* can't go there */
|
||||||
|
|
||||||
/* add the region to the list of available ones. */
|
/* 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
|
/* make sure we don't go here again, and put the region into the set for
|
||||||
further BFS'ing */
|
further BFS'ing */
|
||||||
|
|
|
@ -39,7 +39,7 @@ extern "C" {
|
||||||
const struct region *target);
|
const struct region *target);
|
||||||
extern boolean allowed_walk(const struct region *src,
|
extern boolean allowed_walk(const struct region *src,
|
||||||
const struct region *target);
|
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 *));
|
boolean(*allowed) (const struct region *, const struct region *));
|
||||||
|
|
||||||
extern void pathfinder_cleanup(void);
|
extern void pathfinder_cleanup(void);
|
||||||
|
|
Loading…
Reference in New Issue