forked from github/server
Noch einmal die allianz-anzeige überarbeitet.
Da ich die Kernroutine alliedfaction() angefasst habe, muss das gut getestet werden.
This commit is contained in:
parent
58144e3ab5
commit
961a036d19
|
@ -86,6 +86,10 @@ LIB32=link.exe -lib
|
||||||
# PROP Default_Filter "*.h"
|
# PROP Default_Filter "*.h"
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\aggressive.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\attributes.h
|
SOURCE=.\attributes.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -175,6 +179,10 @@ SOURCE=.\viewrange.h
|
||||||
# End Group
|
# End Group
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\aggressive.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\at_movement.c
|
SOURCE=.\at_movement.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -1635,76 +1635,80 @@ order_template(FILE * F, faction * f)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_allies(const faction * f, const ally * sf)
|
show_allies(const faction * f, const ally * allies)
|
||||||
{
|
{
|
||||||
int allierte = 0;
|
int allierte = 0;
|
||||||
int i=0, h, hh = 0;
|
int i=0, h, hh = 0;
|
||||||
int dh = 0;
|
int dh = 0;
|
||||||
const ally * sff;
|
const ally * sf;
|
||||||
for (sff = sf; sff; sff = sff->next) {
|
for (sf = allies; sf; sf = sf->next) {
|
||||||
if (alliedfaction(NULL, f, sf->faction, HELP_ALL) && sff->status > 0 && sff->status <= HELP_ALL) {
|
int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL);
|
||||||
allierte++;
|
#ifdef ALLIANCES
|
||||||
}
|
if (f->alliance!=sf->faction->alliance) continue;
|
||||||
|
#endif
|
||||||
|
if (mode > 0) ++allierte;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (sf) {
|
for (sf = allies; sf; sf = sf->next) {
|
||||||
if (alliedfaction(NULL, f, sf->faction, HELP_ALL) && sf->status > 0) {
|
int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL);
|
||||||
i++;
|
#ifdef ALLIANCES
|
||||||
if (dh) {
|
if (f->alliance!=sf->faction->alliance) continue;
|
||||||
if (i == allierte)
|
#endif
|
||||||
scat(" und ");
|
if (mode <= 0) continue;
|
||||||
else
|
i++;
|
||||||
scat(", ");
|
if (dh) {
|
||||||
}
|
if (i == allierte)
|
||||||
dh = 1;
|
scat(" und ");
|
||||||
hh = 0;
|
else
|
||||||
scat(factionname(sf->faction));
|
scat(", ");
|
||||||
scat(" (");
|
|
||||||
if (sf->status == HELP_ALL) {
|
|
||||||
scat("Alles");
|
|
||||||
} else
|
|
||||||
for (h = 1; h < HELP_ALL; h *= 2) {
|
|
||||||
if ((sf->status & h) == h)
|
|
||||||
switch (h) {
|
|
||||||
case HELP_MONEY:
|
|
||||||
scat("Silber");
|
|
||||||
hh = 1;
|
|
||||||
break;
|
|
||||||
case HELP_FIGHT:
|
|
||||||
if (hh)
|
|
||||||
scat(", ");
|
|
||||||
scat("Kämpfe");
|
|
||||||
hh = 1;
|
|
||||||
break;
|
|
||||||
case HELP_OBSERVE:
|
|
||||||
if (hh)
|
|
||||||
scat(", ");
|
|
||||||
scat("Wahrnehmung");
|
|
||||||
hh = 1;
|
|
||||||
break;
|
|
||||||
case HELP_GIVE:
|
|
||||||
if (hh)
|
|
||||||
scat(", ");
|
|
||||||
scat("Gib");
|
|
||||||
hh = 1;
|
|
||||||
break;
|
|
||||||
case HELP_GUARD:
|
|
||||||
if (hh)
|
|
||||||
scat(", ");
|
|
||||||
scat("Bewache");
|
|
||||||
hh = 1;
|
|
||||||
break;
|
|
||||||
case HELP_FSTEALTH:
|
|
||||||
if (hh)
|
|
||||||
scat(", ");
|
|
||||||
scat("Parteitarnung");
|
|
||||||
hh = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scat(")");
|
|
||||||
}
|
}
|
||||||
sf = sf->next;
|
dh = 1;
|
||||||
|
hh = 0;
|
||||||
|
scat(factionname(sf->faction));
|
||||||
|
scat(" (");
|
||||||
|
if (mode == HELP_ALL) {
|
||||||
|
scat("Alles");
|
||||||
|
} else
|
||||||
|
for (h = 1; h < HELP_ALL; h *= 2) {
|
||||||
|
if ((mode & h) == h)
|
||||||
|
switch (h) {
|
||||||
|
case HELP_MONEY:
|
||||||
|
scat("Silber");
|
||||||
|
hh = 1;
|
||||||
|
break;
|
||||||
|
case HELP_FIGHT:
|
||||||
|
if (hh)
|
||||||
|
scat(", ");
|
||||||
|
scat("Kämpfe");
|
||||||
|
hh = 1;
|
||||||
|
break;
|
||||||
|
case HELP_OBSERVE:
|
||||||
|
if (hh)
|
||||||
|
scat(", ");
|
||||||
|
scat("Wahrnehmung");
|
||||||
|
hh = 1;
|
||||||
|
break;
|
||||||
|
case HELP_GIVE:
|
||||||
|
if (hh)
|
||||||
|
scat(", ");
|
||||||
|
scat("Gib");
|
||||||
|
hh = 1;
|
||||||
|
break;
|
||||||
|
case HELP_GUARD:
|
||||||
|
if (hh)
|
||||||
|
scat(", ");
|
||||||
|
scat("Bewache");
|
||||||
|
hh = 1;
|
||||||
|
break;
|
||||||
|
case HELP_FSTEALTH:
|
||||||
|
if (hh)
|
||||||
|
scat(", ");
|
||||||
|
scat("Parteitarnung");
|
||||||
|
hh = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scat(")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,8 +346,10 @@ allysfm(const side * s, const faction * f, int mode)
|
||||||
static int
|
static int
|
||||||
allysfm(const side * s, const faction * f, int mode)
|
allysfm(const side * s, const faction * f, int mode)
|
||||||
{
|
{
|
||||||
if (s->bf->faction==f) return true;
|
if (s->bf->faction==f) return mode;
|
||||||
if (s->group) return alliedgroup(s->battle->plane, s->bf->faction, s->group->allies, f, mode);
|
if (s->group) {
|
||||||
|
return alliedgroup(s->battle->plane, s->bf->faction, f, s->group->allies, mode);
|
||||||
|
}
|
||||||
return alliedfaction(s->battle->plane, s->bf->faction, f, mode);
|
return alliedfaction(s->battle->plane, s->bf->faction, f, mode);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -738,32 +738,31 @@ autoalliance(const plane * pl, const faction * sf, const faction * f2)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
alliance(const ally * sf, const faction * f, int mode)
|
alliance(const ally * sf, int mode)
|
||||||
{
|
{
|
||||||
int nmode = 0;
|
if (sf==NULL) return 0;
|
||||||
while (sf) {
|
return sf->status & mode;
|
||||||
if (sf->faction == f) {
|
|
||||||
nmode = sf->status & mode;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sf = sf->next;
|
|
||||||
}
|
|
||||||
return nmode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
alliedgroup(const struct plane * pl, const struct faction * f, const struct ally * sf, const struct faction * f2, int mode)
|
alliedgroup(const struct plane * pl, const struct faction * f,
|
||||||
{
|
const struct faction * f2, const struct ally * sf, int mode)
|
||||||
return alliance(sf, f2, mode) | (mode & autoalliance(pl, f, f2));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
alliedfaction(const struct plane * pl, const faction * f, const faction * f2, int mode)
|
|
||||||
{
|
{
|
||||||
#ifdef ALLIANCES
|
#ifdef ALLIANCES
|
||||||
if (f->alliance!=f2->alliance) return 0;
|
if (f->alliance!=f2->alliance) return 0;
|
||||||
#endif
|
#endif
|
||||||
return alliedgroup(pl, f, f->allies, f2, mode);
|
while (sf && sf->faction!=f2) sf=sf->next;
|
||||||
|
if (sf==NULL) {
|
||||||
|
return mode & autoalliance(pl, f, f2);
|
||||||
|
}
|
||||||
|
return alliance(sf, mode) | (mode & autoalliance(pl, f, f2));
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
alliedfaction(const struct plane * pl, const struct faction * f,
|
||||||
|
const struct faction * f2, int mode)
|
||||||
|
{
|
||||||
|
return alliedgroup(pl, f, f2, f->allies, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Die Gruppe von Einheit u hat helfe zu f2 gesetzt. */
|
/* Die Gruppe von Einheit u hat helfe zu f2 gesetzt. */
|
||||||
|
@ -786,7 +785,7 @@ alliedunit(const unit * u, const faction * f2, int mode)
|
||||||
sf = u->faction->allies;
|
sf = u->faction->allies;
|
||||||
a = a_find(u->attribs, &at_group);
|
a = a_find(u->attribs, &at_group);
|
||||||
if (a!=NULL) sf = ((group*)a->data.v)->allies;
|
if (a!=NULL) sf = ((group*)a->data.v)->allies;
|
||||||
return alliance(sf, f2, mode) | (mode & autoalliance(pl, u->faction, f2));
|
return alliance(sf, mode) | (mode & autoalliance(pl, u->faction, f2));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
|
|
@ -1020,8 +1020,11 @@ struct unit *getunit(const struct region * r, const struct faction * f);
|
||||||
int read_unitid(const struct faction * f, const struct region * r);
|
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 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 alliedfaction(const struct plane * pl, const struct faction * f,
|
||||||
extern int alliedgroup(const struct plane * pl, const struct faction * f, const struct ally * sf, const struct faction * f2, int mode);
|
const struct faction * f2, int mode);
|
||||||
|
extern int alliedgroup(const struct plane * pl, const struct faction * f,
|
||||||
|
const struct faction * f2, const struct ally * sf,
|
||||||
|
int mode);
|
||||||
|
|
||||||
struct faction *findfaction(int n);
|
struct faction *findfaction(int n);
|
||||||
struct faction *getfaction(void);
|
struct faction *getfaction(void);
|
||||||
|
|
Loading…
Reference in New Issue