bugfixes eressea-compilierbarkeit

This commit is contained in:
Enno Rehling 2002-09-02 21:10:53 +00:00
parent 4e54590d98
commit b53a5cc7d1
9 changed files with 37 additions and 22 deletions

View File

@ -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) {

View File

@ -13,6 +13,7 @@
#include <config.h>
#include <eressea.h>
#include "alliance.h"
#ifdef ALLIANCES
#include "command.h"
/* kernel includes */
@ -275,3 +276,4 @@ alliancevictory(void)
}
}
}
#endif

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -13,6 +13,7 @@
#include <config.h>
#include <eressea.h>
#include "alliance.h"
#ifdef ALLIANCES
#include "command.h"
/* kernel includes */
@ -275,3 +276,4 @@ alliancevictory(void)
}
}
}
#endif

View File

@ -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

View File

@ -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);
}