diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 7f69e6400..9000093e1 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -1231,7 +1231,7 @@ quit(void) age = calloc(turn+1, sizeof(int)); for (f = factions; f; f = f->next) if (f->no != MONSTER_FACTION) { #if REMOVENMRNEWBIE - if(!fval(f, FL_NOIDLEOUT) && f!=) { + if(!fval(f, FL_NOIDLEOUT)) { if (f->age>=0 && f->age <= turn) ++age[f->age]; if (f->age == 2 || f->age == 3) { if (f->lastorders == turn - 2) { diff --git a/src/common/kernel/alliance.c b/src/common/kernel/alliance.c index 194b28ec7..0aacacf7d 100644 --- a/src/common/kernel/alliance.c +++ b/src/common/kernel/alliance.c @@ -13,6 +13,7 @@ #include #include #include "alliance.h" +#ifdef ALLIANCES #include "command.h" /* kernel includes */ @@ -275,3 +276,4 @@ alliancevictory(void) } } } +#endif diff --git a/src/common/kernel/alliance.h b/src/common/kernel/alliance.h index e25a58358..15dcf0357 100644 --- a/src/common/kernel/alliance.h +++ b/src/common/kernel/alliance.h @@ -11,7 +11,7 @@ * This program may not be used, modified or distributed without * prior permission by the authors of Eressea. */ - +#ifdef ALLIANCES struct plane; struct attrib; struct unit; @@ -38,3 +38,4 @@ extern void alliancekick(void); extern void alliancevictory(void); /* execute commands */ +#endif diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index 3c83c9ad6..65bec91b4 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -340,13 +340,12 @@ allysfm(const side * s, const faction * f, int mode) return alliedfaction(s->battle->plane, s->bf->faction, f, mode); } #else -extern int alliance(const ally * sf, const faction * f, int mode); static int allysfm(const side * s, const faction * f, int mode) { if (s->bf->faction==f) return true; - if (s->group) return alliance(s->group->allies, f, mode); - return alliance(s->bf->faction->allies, f, mode); + if (s->group) return alliedgroup(s->battle->plane, s->bf->faction, s->group->allies, f, mode); + return alliedfaction(s->battle->plane, s->bf->faction, f, mode); } #endif diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index c66c92117..5828c5507 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -726,17 +726,6 @@ unit_has_cursed_item(unit *u) return false; } -static int -alliance(const ally * sf, const faction * f, int mode) -{ - while (sf) { - if (sf->faction == f) - return sf->status & mode; - sf = sf->next; - } - return 0; -} - static int autoalliance(const plane * pl, const faction * sf, const faction * f2) { @@ -757,13 +746,33 @@ autoalliance(const plane * pl, const faction * sf, const faction * f2) return mode; } +static int +alliance(const ally * sf, const faction * f, int mode) +{ + int nmode = 0; + while (sf) { + if (sf->faction == f) { + nmode = sf->status & mode; + break; + } + sf = sf->next; + } + return nmode; +} + +int +alliedgroup(const struct plane * pl, const struct faction * f, const struct ally * sf, const struct faction * f2, int mode) +{ + return alliance(sf, f, mode) | (mode & autoalliance(pl, f, f2)); +} + int alliedfaction(const struct plane * pl, const faction * sf, const faction * f2, int mode) { #ifdef ALLIANCES if (sf->alliance!=f2->alliance) return 0; #endif - return alliance(sf->allies, f2, mode) | (mode & autoalliance(pl, sf, f2)); + return alliedgroup(pl, sf, sf->allies, f2, mode); } /* Die Gruppe von Einheit u hat helfe zu f2 gesetzt. */ @@ -786,7 +795,7 @@ alliedunit(const unit * u, const faction * f2, int mode) sf = u->faction->allies; a = a_find(u->attribs, &at_group); if (a!=NULL) sf = ((group*)a->data.v)->allies; - return alliance(sf, f2, mode) | automode; + return alliance(sf, f2, mode) | (mode & autoalliance(pl, u->faction, f2)); } boolean diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index d5e1e8838..33972ad83 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -1017,6 +1017,7 @@ int read_unitid(const struct faction * f, const struct region * r); extern int alliedunit(const struct unit * u, const struct faction * f2, int mode); extern int alliedfaction(const struct plane * pl, const struct faction * f, const struct faction * f2, int mode); +extern int alliedgroup(const struct plane * pl, const struct faction * f, const struct ally * sf, const struct faction * f2, int mode); struct faction *findfaction(int n); struct faction *findfaction_unique_id(int unique_id); diff --git a/src/common/modules/alliance.c b/src/common/modules/alliance.c index 194b28ec7..0aacacf7d 100644 --- a/src/common/modules/alliance.c +++ b/src/common/modules/alliance.c @@ -13,6 +13,7 @@ #include #include #include "alliance.h" +#ifdef ALLIANCES #include "command.h" /* kernel includes */ @@ -275,3 +276,4 @@ alliancevictory(void) } } } +#endif diff --git a/src/common/modules/alliance.h b/src/common/modules/alliance.h index e25a58358..15dcf0357 100644 --- a/src/common/modules/alliance.h +++ b/src/common/modules/alliance.h @@ -11,7 +11,7 @@ * This program may not be used, modified or distributed without * prior permission by the authors of Eressea. */ - +#ifdef ALLIANCES struct plane; struct attrib; struct unit; @@ -38,3 +38,4 @@ extern void alliancekick(void); extern void alliancevictory(void); /* execute commands */ +#endif diff --git a/src/mapper/map_partei.c b/src/mapper/map_partei.c index 5c95f1ccf..46484b3f2 100644 --- a/src/mapper/map_partei.c +++ b/src/mapper/map_partei.c @@ -452,8 +452,8 @@ NeuePartei(region * r) } i = 0; q = 0; y++; wmove(win, y, 4); - while(locales[i] != NULL) { - sprintf(buf, "%d=%s; ", i, locales[i]); + while(localenames[i] != NULL) { + sprintf(buf, "%d=%s; ", i, localenames[i]); q += strlen(buf); if (q > SX - 20) { q = strlen(buf); @@ -471,7 +471,7 @@ NeuePartei(region * r) delwin(win); return; } - lang = find_locale(locales[locale_nr]); + lang = find_locale(localenames[locale_nr]); delwin(win); }