indentation

This commit is contained in:
Enno Rehling 2008-02-29 00:26:19 +00:00
parent 92b79a1914
commit 1fb793509c

View file

@ -29,13 +29,13 @@
void void
write_of(const struct attrib * a, FILE* F) write_of(const struct attrib * a, FILE* F)
{ {
const faction * f = (faction*)a->data.v; const faction * f = (faction*)a->data.v;
fprintf(F, "%d ", f->no); fprintf(F, "%d ", f->no);
} }
int int
read_of(struct attrib * a, FILE* F) /* return 1 on success, 0 if attrib needs removal */ read_of(struct attrib * a, FILE* F) /* return 1 on success, 0 if attrib needs removal */
{ {
int of, result; int of, result;
result = fscanf(F, "%d", &of); result = fscanf(F, "%d", &of);
if (result<0) return result; if (result<0) return result;
@ -45,39 +45,39 @@ read_of(struct attrib * a, FILE* F) /* return 1 on success, 0 if attrib needs re
} }
attrib_type at_otherfaction = { attrib_type at_otherfaction = {
"otherfaction", NULL, NULL, NULL, write_of, read_of, ATF_UNIQUE "otherfaction", NULL, NULL, NULL, write_of, read_of, ATF_UNIQUE
}; };
struct faction * struct faction *
get_otherfaction(const struct attrib * a) get_otherfaction(const struct attrib * a)
{ {
return (faction*)(a->data.v); return (faction*)(a->data.v);
} }
struct attrib * struct attrib *
make_otherfaction(struct faction * f) make_otherfaction(struct faction * f)
{ {
attrib * a = a_new(&at_otherfaction); attrib * a = a_new(&at_otherfaction);
a->data.v = (void*)f; a->data.v = (void*)f;
return a; return a;
} }
void void
init_otherfaction(void) init_otherfaction(void)
{ {
at_register(&at_otherfaction); at_register(&at_otherfaction);
} }
faction * faction *
visible_faction(const faction *f, const unit * u) visible_faction(const faction *f, const unit * u)
{ {
if (!alliedunit(u, f, HELP_FSTEALTH)) { if (!alliedunit(u, f, HELP_FSTEALTH)) {
attrib *a = a_find(u->attribs, &at_otherfaction); attrib *a = a_find(u->attribs, &at_otherfaction);
if (a) { if (a) {
faction *fv = get_otherfaction(a); faction *fv = get_otherfaction(a);
assert (fv != NULL); /* fv should never be NULL! */ assert (fv != NULL); /* fv should never be NULL! */
return fv; return fv;
} }
} }
return u->faction; return u->faction;
} }