ally_add is now module-private

This commit is contained in:
Enno Rehling 2018-10-26 22:16:34 +02:00
parent 1e8c7224a4
commit 2e076aab1e
2 changed files with 13 additions and 14 deletions

View File

@ -25,6 +25,19 @@ typedef struct ally {
int status; int status;
} ally; } ally;
static ally * ally_add(ally **al_p, struct faction *f) {
ally * al;
while (*al_p) {
al = *al_p;
if (f && al->faction == f) return al;
al_p = &al->next;
}
al = (ally *)calloc(1, sizeof(ally));
al->faction = f;
*al_p = al;
return al;
}
void allies_free(ally *al) void allies_free(ally *al)
{ {
while (al) { while (al) {
@ -99,19 +112,6 @@ ally * ally_find(ally *al, const struct faction *f) {
return 0; return 0;
} }
ally * ally_add(ally **al_p, struct faction *f) {
ally * al;
while (*al_p) {
al = *al_p;
if (f && al->faction == f) return al;
al_p = &al->next;
}
al = (ally *)calloc(1, sizeof(ally));
al->faction = f;
*al_p = al;
return al;
}
static int ally_flag(const char *s, int help_mask) static int ally_flag(const char *s, int help_mask)
{ {
if ((help_mask & HELP_MONEY) && strcmp(s, "money") == 0) if ((help_mask & HELP_MONEY) && strcmp(s, "money") == 0)

View File

@ -42,7 +42,6 @@ extern "C" {
struct ally* ally_find(struct ally*al, const struct faction *f); struct ally* ally_find(struct ally*al, const struct faction *f);
void ally_set(struct ally**al_p, struct faction *f, int status); void ally_set(struct ally**al_p, struct faction *f, int status);
int ally_get(struct ally *al, const struct faction *f); int ally_get(struct ally *al, const struct faction *f);
struct ally* ally_add(struct ally**al_p, struct faction *f);
int AllianceAuto(void); /* flags that allied factions get automatically */ int AllianceAuto(void); /* flags that allied factions get automatically */
int HelpMask(void); /* flags restricted to allied factions */ int HelpMask(void); /* flags restricted to allied factions */