diff --git a/src/common/attributes/attributes.c b/src/common/attributes/attributes.c index da795f288..6c0ffcde7 100644 --- a/src/common/attributes/attributes.c +++ b/src/common/attributes/attributes.c @@ -28,7 +28,9 @@ #include "overrideroads.h" #include "otherfaction.h" #include "racename.h" -#include "ugroup.h" +#ifdef USE_UGROUPS +# include "ugroup.h" +#endif #ifdef AT_OPTION # include "option.h" #endif @@ -64,5 +66,7 @@ init_attributes(void) #ifdef AT_OPTION init_option(); #endif +#ifdef USE_UGROUPS init_ugroup(); +#endif } diff --git a/src/common/attributes/ugroup.c b/src/common/attributes/ugroup.c index d471b03e7..d45efc1c4 100644 --- a/src/common/attributes/ugroup.c +++ b/src/common/attributes/ugroup.c @@ -8,13 +8,16 @@ This program may not be used, modified or distributed without prior permission by the authors of Eressea. - $Id: ugroup.c,v 1.1 2001/04/28 12:03:12 corwin Exp $ + $Id: ugroup.c,v 1.2 2001/04/29 19:27:41 enno Exp $ */ #include #include "ugroup.h" + #include +#ifdef USE_UGROUPS + attrib_type at_ugroup = { "ugroup", NULL, NULL, NULL, NULL, NULL, ATF_UNIQUE }; @@ -24,3 +27,5 @@ init_ugroup(void) { at_register(&at_ugroup); } + +#endif diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 1be549d64..716fe3094 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -58,8 +58,9 @@ #include #include #include -#include - +#ifdef USE_UGROUPS +# include +#endif /* attributes includes */ #include @@ -3035,8 +3036,10 @@ processorders (void) puts(" - Jihads setzen"); set_jihad(); +#ifdef USE_UGROUPS puts(" - Verbände bilden"); ugroups(); +#endif puts(" - Einheiten Sortieren"); reorder(); diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 67c3b744f..487881d5b 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -58,7 +58,9 @@ #include #include #include -#include +#ifdef USE_UGROUPS +# include +#endif /* util includes */ #include @@ -682,10 +684,12 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode) strlist *S; int dh; boolean isbattle = (boolean)(mode == see_battle); +#ifdef USE_UGROUPS ugroup *ug = findugroup(u); - +#endif if(u->race == RC_SPELL) return; +#ifdef USE_UGROUPS if(isbattle || ug) { if(is_ugroupleader(u, ug)) { rnl(F); @@ -693,23 +697,27 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode) } else { return; } - } else { + } else +#endif + { rnl(F); dh = bufunit(f, u, indent, mode); } rparagraph(F, buf, indent, (char) ((u->faction == f) ? '*' : (dh ? '+' : '-'))); if(!isbattle){ +#ifdef USE_UGROUPS if(ug) { int i; for(i=0; imembers; i++) { print_curses(F, u, TYP_UNIT, ug->unit_array[i]->attribs, (u->faction == f)? 1 : 0, indent); } - } else { - print_curses(F, u, TYP_UNIT, u->attribs, (u->faction == f)? 1 : 0, indent); - } + } else +#endif /* USE_UGROUPS */ + print_curses(F, u, TYP_UNIT, u->attribs, (u->faction == f)? 1 : 0, indent); } +#ifdef USE_UGROUPS if(ug) { int i; for(i=0; imembers; i++) { @@ -720,14 +728,14 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode) } } } - } else { + } else +#endif if (mode==see_unit && u->faction == f && u->botschaften) { for (S = u->botschaften; S; S = S->next) { rnl(F); rparagraph(F, S->s, indent, 0); } } - } } static void diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 23c109a5d..f161d4101 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -204,8 +204,10 @@ const char *keywords[MAXKEYWORDS] = "JIHAD", "GM", "INFO", +#ifdef USE_UGROUPS "JOINVERBAND", "LEAVEVERBAND" +#endif }; const char *report_options[MAX_MSG] = diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 0b8fd8487..f37ca8b10 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -412,8 +412,10 @@ enum { K_SETJIHAD, K_GM, /* perform GM commands */ K_INFO, /* set player-info */ +#ifdef USE_UGROUPS K_JOINUGROUP, K_LEAVEUGROUP, +#endif MAXKEYWORDS, NOKEYWORD = (keyword_t) - 1 }; diff --git a/src/common/kernel/faction.h b/src/common/kernel/faction.h index 1a1656c6c..43ff5787c 100644 --- a/src/common/kernel/faction.h +++ b/src/common/kernel/faction.h @@ -41,7 +41,9 @@ typedef struct faction { int options; int no_units; int karma; +#ifdef USE_UGROUPS struct ugroup *ugroups; +#endif struct warning * warnings; struct msglevel * msglevels; struct ally *allies; diff --git a/src/common/kernel/reports.c b/src/common/kernel/reports.c index eb5e8c271..f1dd71b9b 100644 --- a/src/common/kernel/reports.c +++ b/src/common/kernel/reports.c @@ -32,7 +32,9 @@ #include "ship.h" #include "race.h" #include "magic.h" -#include "ugroup.h" +#ifdef USE_UGROUPS +# include "ugroup.h" +#endif /* util includes */ #include @@ -440,7 +442,8 @@ bufunit(const faction * f, const unit * u, int indent, int mode) * bekommen, alles andere ist darstellungsteschnisch kompliziert. */ -int +#ifdef USE_UGROUPS + int bufunit_ugroupleader(const faction * f, const unit * u, int indent, int mode) { int i, dh; @@ -587,7 +590,7 @@ bufunit_ugroupleader(const faction * f, const unit * u, int indent, int mode) } return dh; } - +#endif void spskill(const struct locale * lang, const struct unit * u, skill_t sk, int *dh, int days) @@ -656,6 +659,7 @@ spunit(struct strlist ** SP, const struct faction * f, const unit * u, int inden int mode) { int dh; +#ifdef USE_UGROUPS ugroup *ug = findugroup(u); if(ug) { @@ -664,9 +668,9 @@ spunit(struct strlist ** SP, const struct faction * f, const unit * u, int inden } else { return; } - } else { + } else +#endif dh = bufunit(f, u, indent, mode); - } lparagraph(SP, buf, indent, (char) ((u->faction == f) ? '*' : (dh ? '+' : '-'))); } diff --git a/src/common/kernel/reports.h b/src/common/kernel/reports.h index f44b2b344..e60daf151 100644 --- a/src/common/kernel/reports.h +++ b/src/common/kernel/reports.h @@ -107,7 +107,9 @@ extern int months_per_year; extern void report_item(const struct unit * owner, const struct item * i, const struct faction * viewer, const char ** name, const char ** basename, int * number, boolean singular); extern void report_building(FILE *F, const struct region * r, const struct building * b, const struct faction * f, int mode); extern int bufunit(const struct faction * f, const struct unit * u, int indent, int mode); +#ifdef USE_UGROUPS extern int bufunit_ugroupleader(const struct faction * f, const struct unit * u, int indent, int mode); +#endif extern const char *neue_gebiete[]; extern const char *coasts[]; diff --git a/src/common/kernel/ugroup.c b/src/common/kernel/ugroup.c index 99dd93c17..74c30ebd9 100644 --- a/src/common/kernel/ugroup.c +++ b/src/common/kernel/ugroup.c @@ -8,17 +8,22 @@ This program may not be used, modified or distributed without prior permission by the authors of Eressea. - $Id: ugroup.c,v 1.2 2001/04/28 15:39:13 corwin Exp $ + $Id: ugroup.c,v 1.3 2001/04/29 19:27:42 enno Exp $ */ #include #include "eressea.h" + +/* kernel includes */ #include "unit.h" #include "region.h" #include "faction.h" -#include +#include "ugroup.h" + +/* attributes includes */ #include +/* libc includes */ #include /* TODO: @@ -31,15 +36,16 @@ /* Nur die erste Einheit in der Liste (ugroup->unit_array[0] == u) kann NACH ausführen. */ +#ifdef USE_UGROUPS boolean -is_ugroupleader(unit *u, ugroup *ug) +is_ugroupleader(const unit *u, const ugroup *ug) { if(ug->unit_array[0] == u) return true; return false; } ugroup * -findugroupid(faction *f, int id) +findugroupid(const faction *f, int id) { ugroup *ug; @@ -50,7 +56,7 @@ findugroupid(faction *f, int id) } ugroup * -findugroup(unit *u) +findugroup(const unit *u) { attrib *a = a_find(u->attribs, &at_ugroup); if(!a) return NULL; @@ -58,12 +64,10 @@ findugroup(unit *u) } static int -ugroupfreeid(ugroup *ug) +ugroupfreeid(const ugroup *ug) { - ugroup *ug2; + const ugroup *ug2 = ug; int id = 0; - - ug2 = ug; while(ug2) { if(ug2->id == id) { @@ -194,3 +198,4 @@ ugroups(void) } } +#endif /* USE_UGROUPS */ diff --git a/src/common/kernel/ugroup.h b/src/common/kernel/ugroup.h index 508cd1cad..0d0e6a6a3 100644 --- a/src/common/kernel/ugroup.h +++ b/src/common/kernel/ugroup.h @@ -8,7 +8,7 @@ This program may not be used, modified or distributed without prior permission by the authors of Eressea. - $Id: ugroup.h,v 1.2 2001/04/28 15:39:13 corwin Exp $ + $Id: ugroup.h,v 1.3 2001/04/29 19:27:42 enno Exp $ */ #ifndef UGROUP_H @@ -26,8 +26,8 @@ typedef struct ugroup { struct unit **unit_array; } ugroup; -boolean is_ugroupleader(struct unit *u, struct ugroup *ug); -ugroup *findugroup(struct unit *u); +boolean is_ugroupleader(const struct unit *u, const struct ugroup *ug); +ugroup *findugroup(const struct unit *u); void ugroups(void); #endif