forked from github/server
code prettyfication
This commit is contained in:
parent
ec9e7bf833
commit
9802eecd79
|
@ -101,7 +101,7 @@ get_followers(unit * target, region * r, const region_list * route_end,
|
||||||
if (fval(uf, UFL_FOLLOWING) && !fval(uf, UFL_NOTMOVING)) {
|
if (fval(uf, UFL_FOLLOWING) && !fval(uf, UFL_NOTMOVING)) {
|
||||||
const attrib *a = a_findc(uf->attribs, &at_follow);
|
const attrib *a = a_findc(uf->attribs, &at_follow);
|
||||||
if (a && a->data.v == target) {
|
if (a && a->data.v == target) {
|
||||||
follower *fnew = malloc(sizeof(follower));
|
follower *fnew = (follower *)malloc(sizeof(follower));
|
||||||
fnew->uf = uf;
|
fnew->uf = uf;
|
||||||
fnew->ut = target;
|
fnew->ut = target;
|
||||||
fnew->route_end = route_end;
|
fnew->route_end = route_end;
|
||||||
|
|
|
@ -1243,7 +1243,7 @@ static report_type *report_types;
|
||||||
|
|
||||||
void register_reporttype(const char *extension, report_fun write, int flag)
|
void register_reporttype(const char *extension, report_fun write, int flag)
|
||||||
{
|
{
|
||||||
report_type *type = malloc(sizeof(report_type));
|
report_type *type = (report_type *)malloc(sizeof(report_type));
|
||||||
type->extension = extension;
|
type->extension = extension;
|
||||||
type->write = write;
|
type->write = write;
|
||||||
type->flag = flag;
|
type->flag = flag;
|
||||||
|
@ -1259,7 +1259,8 @@ static region_list *get_regions_distance(region * root, int radius)
|
||||||
fset(root, RF_MARK);
|
fset(root, RF_MARK);
|
||||||
while (*rp) {
|
while (*rp) {
|
||||||
region_list *r = *rp;
|
region_list *r = *rp;
|
||||||
direction_t d;
|
int d;
|
||||||
|
|
||||||
rp = &r->next;
|
rp = &r->next;
|
||||||
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
||||||
region *rn = rconnect(r->data, d);
|
region *rn = rconnect(r->data, d);
|
||||||
|
@ -1277,7 +1278,7 @@ static region_list *get_regions_distance(region * root, int radius)
|
||||||
|
|
||||||
static void view_default(struct seen_region **seen, region * r, faction * f)
|
static void view_default(struct seen_region **seen, region * r, faction * f)
|
||||||
{
|
{
|
||||||
direction_t dir;
|
int dir;
|
||||||
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
||||||
region *r2 = rconnect(r, dir);
|
region *r2 = rconnect(r, dir);
|
||||||
if (r2) {
|
if (r2) {
|
||||||
|
@ -1295,9 +1296,12 @@ static void view_default(struct seen_region **seen, region * r, faction * f)
|
||||||
|
|
||||||
static void view_neighbours(struct seen_region **seen, region * r, faction * f)
|
static void view_neighbours(struct seen_region **seen, region * r, faction * f)
|
||||||
{
|
{
|
||||||
direction_t dir;
|
int d;
|
||||||
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
region * nb[MAXDIRECTIONS];
|
||||||
region *r2 = rconnect(r, dir);
|
|
||||||
|
get_neighbours(r, nb);
|
||||||
|
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
||||||
|
region *r2 = nb[d];
|
||||||
if (r2) {
|
if (r2) {
|
||||||
connection *b = get_borders(r, r2);
|
connection *b = get_borders(r, r2);
|
||||||
while (b) {
|
while (b) {
|
||||||
|
@ -1308,7 +1312,7 @@ static void view_neighbours(struct seen_region **seen, region * r, faction * f)
|
||||||
if (!b) {
|
if (!b) {
|
||||||
if (add_seen(seen, r2, see_far, false)) {
|
if (add_seen(seen, r2, see_far, false)) {
|
||||||
if (!(fval(r2->terrain, FORBIDDEN_REGION))) {
|
if (!(fval(r2->terrain, FORBIDDEN_REGION))) {
|
||||||
direction_t dir;
|
int dir;
|
||||||
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
||||||
region *r3 = rconnect(r2, dir);
|
region *r3 = rconnect(r2, dir);
|
||||||
if (r3) {
|
if (r3) {
|
||||||
|
@ -1333,10 +1337,13 @@ static void
|
||||||
recurse_regatta(struct seen_region **seen, region * center, region * r,
|
recurse_regatta(struct seen_region **seen, region * center, region * r,
|
||||||
faction * f, int maxdist)
|
faction * f, int maxdist)
|
||||||
{
|
{
|
||||||
direction_t dir;
|
int d;
|
||||||
int dist = distance(center, r);
|
int dist = distance(center, r);
|
||||||
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
region * nb[MAXDIRECTIONS];
|
||||||
region *r2 = rconnect(r, dir);
|
|
||||||
|
get_neighbours(r, nb);
|
||||||
|
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
||||||
|
region *r2 = nb[d];
|
||||||
if (r2) {
|
if (r2) {
|
||||||
int ndist = distance(center, r2);
|
int ndist = distance(center, r2);
|
||||||
if (ndist > dist && fval(r2->terrain, SEA_REGION)) {
|
if (ndist > dist && fval(r2->terrain, SEA_REGION)) {
|
||||||
|
|
Loading…
Reference in New Issue