forked from github/server
parent
24552613c8
commit
2ef753bd16
|
@ -43,37 +43,6 @@ static region *tpregion(const region * r)
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
region_list *astralregions(const region * r, bool(*valid) (const region *))
|
|
||||||
{
|
|
||||||
region_list *rlist = NULL;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
assert(is_astral(r));
|
|
||||||
if (!is_astral(r)) {
|
|
||||||
log_error("astralregions was called with a non-astral region.\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
r = r_astral_to_standard(r);
|
|
||||||
if (r == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (x = -TP_RADIUS; x <= +TP_RADIUS; ++x) {
|
|
||||||
for (y = -TP_RADIUS; y <= +TP_RADIUS; ++y) {
|
|
||||||
region *rn;
|
|
||||||
int dist = koor_distance(0, 0, x, y);
|
|
||||||
int nx = r->x + x, ny = r->y + y;
|
|
||||||
|
|
||||||
if (dist > TP_RADIUS)
|
|
||||||
continue;
|
|
||||||
pnormalize(&nx, &ny, rplane(r));
|
|
||||||
rn = findregion(nx, ny);
|
|
||||||
if (rn != NULL && (valid == NULL || valid(rn)))
|
|
||||||
add_regionlist(&rlist, rn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rlist;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_astralregions(const region * r, bool(*valid) (const region *), region *result[])
|
int get_astralregions(const region * r, bool(*valid) (const region *), region *result[])
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,8 +16,6 @@ extern "C" {
|
||||||
|
|
||||||
struct region *r_standard_to_astral(const struct region *r);
|
struct region *r_standard_to_astral(const struct region *r);
|
||||||
struct region *r_astral_to_standard(const struct region *);
|
struct region *r_astral_to_standard(const struct region *);
|
||||||
struct region_list *astralregions(const struct region *rastral,
|
|
||||||
bool(*valid) (const struct region *));
|
|
||||||
struct region_list *all_in_range(const struct region *r, int n,
|
struct region_list *all_in_range(const struct region *r, int n,
|
||||||
bool(*valid) (const struct region *));
|
bool(*valid) (const struct region *));
|
||||||
bool inhabitable(const struct region *r);
|
bool inhabitable(const struct region *r);
|
||||||
|
|
Loading…
Reference in New Issue