diff --git a/src/common/attributes/Jamfile b/src/common/attributes/Jamfile index c26c21843..67c12e770 100644 --- a/src/common/attributes/Jamfile +++ b/src/common/attributes/Jamfile @@ -31,7 +31,6 @@ SOURCES = reduceproduction.c synonym.c targetregion.c - ugroup.c viewrange.c variable.c ; diff --git a/src/common/attributes/attributes.c b/src/common/attributes/attributes.c index 9a92af535..582df283e 100644 --- a/src/common/attributes/attributes.c +++ b/src/common/attributes/attributes.c @@ -34,9 +34,6 @@ #include "synonym.h" #include "targetregion.h" #include "variable.h" -#ifdef USE_UGROUPS -# include "ugroup.h" -#endif #ifdef AT_OPTION # include "option.h" #endif @@ -81,9 +78,6 @@ init_attributes(void) init_moved(); #ifdef AT_OPTION init_option(); -#endif -#ifdef USE_UGROUPS - init_ugroup(); #endif init_variable(); #ifdef WDW_PYRAMID diff --git a/src/common/attributes/attributes.vcproj b/src/common/attributes/attributes.vcproj index 423a84092..fe5c77756 100644 --- a/src/common/attributes/attributes.vcproj +++ b/src/common/attributes/attributes.vcproj @@ -239,9 +239,6 @@ - - @@ -315,9 +312,6 @@ - - diff --git a/src/common/attributes/ugroup.c b/src/common/attributes/ugroup.c deleted file mode 100644 index 4b59dec18..000000000 --- a/src/common/attributes/ugroup.c +++ /dev/null @@ -1,31 +0,0 @@ -/* vi: set ts=2: - +-------------------+ Christian Schlittchen - | | Enno Rehling - | Eressea PBEM host | Katja Zedel - | (c) 1998 - 2003 | Henning Peters - | | Ingo Wilken - +-------------------+ Stefan Reich - - This program may not be used, modified or distributed - without prior permission by the authors of Eressea. - */ - -#include -#include "eressea.h" -#include "ugroup.h" - -#include - -#ifdef USE_UGROUPS - -attrib_type at_ugroup = { - "ugroup", NULL, NULL, NULL, NULL, NULL, ATF_UNIQUE -}; - -void -init_ugroup(void) -{ - at_register(&at_ugroup); -} - -#endif diff --git a/src/common/attributes/ugroup.h b/src/common/attributes/ugroup.h deleted file mode 100644 index 208943160..000000000 --- a/src/common/attributes/ugroup.h +++ /dev/null @@ -1,26 +0,0 @@ -/* vi: set ts=2: - +-------------------+ Christian Schlittchen - | | Enno Rehling - | Eressea PBEM host | Katja Zedel - | (c) 1998 - 2003 | Henning Peters - | | Ingo Wilken - +-------------------+ Stefan Reich - - This program may not be used, modified or distributed - without prior permission by the authors of Eressea. - */ - -#ifndef H_ATTRIBUTE_UGROUP -#define H_ATTRIBUTE_UGROUP -#ifdef __cplusplus -extern "C" { -#endif - -extern struct attrib_type at_ugroup; -void init_ugroup(void); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 07b1a8cfd..bff7c47bd 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -63,9 +63,6 @@ #include #include /* for volcanoes in emigration (needs a flag) */ #include -#ifdef USE_UGROUPS -# include -#endif /* attributes includes */ #include @@ -4013,11 +4010,6 @@ processorders (void) karma(); #endif -#ifdef USE_UGROUPS - puts(" - Verbände bilden"); - ugroups(); -#endif - puts(" - Einheiten Sortieren"); reorder(); #ifdef ALLIANCEJOIN diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 513e683f5..86d6cee5f 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -65,9 +65,6 @@ #include #include #include -#ifdef USE_UGROUPS -# include -#endif /* util includes */ #include @@ -694,21 +691,8 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode) char marker; int dh; boolean isbattle = (boolean)(mode == see_battle); -#ifdef USE_UGROUPS - ugroup *ug = findugroup(u); -#endif if(u->race == new_race[RC_SPELL]) return; -#ifdef USE_UGROUPS - if(u->faction != f && (isbattle || ug)) { - if(is_ugroupleader(u, ug)) { - rnl(F); - dh = bufunit_ugroupleader(f, u, indent, mode); - } else { - return; - } - } else -#endif { rnl(F); dh = bufunit(f, u, indent, mode); @@ -734,14 +718,6 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode) rparagraph(F, buf, indent, marker); if(!isbattle){ -#ifdef USE_UGROUPS - if(ug) { - int i; - for(i=0; imembers; i++) { - print_curses(F, f, ug->unit_array[i], TYP_UNIT, indent); - } - } else -#endif /* USE_UGROUPS */ print_curses(F, f, u, TYP_UNIT, indent); } diff --git a/src/common/kernel/Jamfile b/src/common/kernel/Jamfile index 18112e215..6fbad0930 100644 --- a/src/common/kernel/Jamfile +++ b/src/common/kernel/Jamfile @@ -41,7 +41,6 @@ SOURCES = spell.c teleport.c terrain.c - ugroup.c unit.c xmlreader.c ; diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 1a7008473..a234e296f 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -395,10 +395,6 @@ const char *keywords[MAXKEYWORDS] = "JIHAD", "GM", "INFO", -#ifdef USE_UGROUPS - "JOINVERBAND", - "LEAVEVERBAND", -#endif "PRAEFIX", "SYNONYM", "PFLANZEN", diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 498ff2370..d0007ff8d 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -180,7 +180,6 @@ struct building_type; #define MIN_VERSION CURSETYPE_VERSION #define REGIONOWNERS_VERSION 400 -#define UGROUPS_VERSION 500 /* nicht aktivieren, nicht fertig */ #ifdef ENEMIES # define RELEASE_VERSION ENEMIES_VERSION @@ -436,10 +435,6 @@ enum { K_SETJIHAD, K_GM, /* perform GM commands */ K_INFO, /* set player-info */ -#ifdef USE_UGROUPS - K_JOINUGROUP, - K_LEAVEUGROUP, -#endif K_PREFIX, K_SYNONYM, K_PLANT, diff --git a/src/common/kernel/faction.h b/src/common/kernel/faction.h index 3dccc3ef0..5a3c326c5 100644 --- a/src/common/kernel/faction.h +++ b/src/common/kernel/faction.h @@ -77,9 +77,6 @@ typedef struct faction { int options; int no_units; int karma; -#ifdef USE_UGROUPS - struct ugroup *ugroups; -#endif #ifdef MSG_LEVELS struct msglevel * msglevels; struct warning * warnings; diff --git a/src/common/kernel/kernel.vcproj b/src/common/kernel/kernel.vcproj index 3ab3e4c9f..aca02b538 100644 --- a/src/common/kernel/kernel.vcproj +++ b/src/common/kernel/kernel.vcproj @@ -292,9 +292,6 @@ - - @@ -404,9 +401,6 @@ - - diff --git a/src/common/kernel/reports.c b/src/common/kernel/reports.c index a71b69172..097529676 100644 --- a/src/common/kernel/reports.c +++ b/src/common/kernel/reports.c @@ -38,10 +38,6 @@ #include #include #include -#ifdef USE_UGROUPS -# include -# include -#endif /* util includes */ #include @@ -301,24 +297,6 @@ bufunit(const faction * f, const unit * u, int indent, int mode) } } } -#ifdef USE_UGROUPS - if (u->faction == f) { - attrib *a = a_find(u->attribs, &at_ugroup); - if (a) { - ugroup *ug = findugroupid(u->faction, a->data.i); - if (is_ugroupleader(u, ug)) { - if (size>1) { - strcpy(bufp++, "*"); - --size; - } - } - rsize = strlcpy(bufp, itoa36(ug->id), size); - if (rsize>size) rsize = size-1; - size -= rsize; - bufp += rsize; - } - } -#endif rsize = strlcpy(bufp, ", ", size); if (rsize>size) rsize = size-1; @@ -657,164 +635,6 @@ bufunit(const faction * f, const unit * u, int indent, int mode) * bekommen, alles andere ist darstellungsteschnisch kompliziert. */ -#ifdef USE_UGROUPS -int -bufunit_ugroupleader(const faction * f, const unit * u, int indent, int mode) -{ - int i, dh; - int getarnt = fval(u, UFL_PARTEITARNUNG); - faction *fv; - const char *pzTmp; - attrib *a_fshidden = NULL; - item * itm; - item * show; - ugroup *ug = findugroup(u); - boolean guards = false; - boolean sieges = false; - boolean itemcloak = false; - static const curse_type * itemcloak_ct = 0; - static boolean init = false; - - if (!init) { - init = true; - itemcloak_ct = ct_find("itemcloak"); - } - if (itemcloak_ct!=NULL) { - itemcloak = curse_active(get_curse(u->attribs, itemcloak_ct)); - } - - if(fspecial(u->faction, FS_HIDDEN)) - a_fshidden = a_find(u->attribs, &at_fshidden); - - strcpy(buf, u->name); - - fv = visible_faction(f, u); - - if (getarnt) { - scat(", "); - scat(LOC(f->locale, "anonymous")); - } else { - scat(", "); - scat(factionname(fv)); - } - - scat(", "); - - for(i = 0; i < ug->members; i++) { - unit *uc = ug->unit_array[i]; - if(uc->faction != f && a_fshidden - && a_fshidden->data.ca[0] == 1 && effskill(uc, SK_STEALTH) >= 6) { - scat("? "); - } else { - icat(uc->number); - scat(" "); - } - pzTmp = get_racename(uc->attribs); - if (pzTmp || u->irace != uc->race) { - if (pzTmp) - scat(pzTmp); - else - scat(racename(f->locale, u, u->irace)); - scat(" ("); - scat(itoa36(uc->no)); - scat("), "); - } else { - scat(racename(f->locale, u, u->race)); - scat(" ("); - scat(itoa36(uc->no)); - scat("), "); - } - if(getguard(uc)) guards = true; - if(usiege(uc)) sieges = true; - } - - if(guards == true) scat(", bewacht die Region"); - - if(sieges == true) { - scat(", belagert "); - for(i = 0; i < ug->members; i++) { - building *b = usiege(ug->unit_array[i]); - if(b) { - scat(buildingname(b)); - scat(", "); - } - } - } - - dh = 0; - show = NULL; - for(i = 0; i < ug->members; i++) { - unit *uc = ug->unit_array[i]; - if (!itemcloak && mode >= see_unit && !(a_fshidden - && a_fshidden->data.ca[1] == 1 && effskill(u, SK_STEALTH) >= 3)) { - for (itm=uc->items;itm;itm=itm->next) { - item *ishow; - const char * ic; - int in; - report_item(u, itm, f, NULL, &ic, &in, false); - if (ic && *ic && in>0) { - for (ishow = show; ishow; ishow=ishow->next) { - const char * sc; - int sn; - if (ishow->type==itm->type) sc=ic; - else report_item(u, ishow, f, NULL, &sc, &sn, false); - if (sc==ic || strcmp(sc, ic)==0) { - ishow->number+=itm->number; - break; - } - } - if (ishow==NULL) { - ishow = i_add(&show, i_new(itm->type, itm->number)); - } - } - } - } - } - for (itm=show; itm; itm=itm->next) { - const char * ic; - int in; - report_item(u, itm, f, &ic, NULL, &in, false); - if (in==0 || ic==NULL) continue; - scat(", "); - - if (!dh) { - sprintf(buf+strlen(buf), "%s: ", LOC(f->locale, "nr_inventory")); - dh = 1; - } - if (in == 1) { - scat(ic); - } else { - icat(in); - scat(" "); - scat(ic); - } - } - if(show) while(show) i_free(i_remove(&show, show)); - - i = 0; - if (u->display && u->display[0]) { - scat("; "); - scat(u->display); - - i = u->display[strlen(u->display) - 1]; - } - if (i != '!' && i != '?' && i != '.') - scat("."); - - dh=0; - if (!getarnt && f && f->allies) { - ally *sf; - - for (sf = f->allies; sf && !dh; sf = sf->next) { - if (sf->status > 0 && sf->status <= HELP_ALL && sf->faction == fv) { - dh = 1; - } - } - } - return dh; -} -#endif - size_t spskill(char * buffer, size_t size, const struct locale * lang, const struct unit * u, skill_t sk, int *dh, int days) { @@ -941,19 +761,7 @@ void spunit(struct strlist ** SP, const struct faction * f, const unit * u, int indent, int mode) { - int dh; -#ifdef USE_UGROUPS - ugroup *ug = findugroup(u); - - if(ug) { - if(is_ugroupleader(u, ug)) { - dh = bufunit_ugroupleader(f, u, indent, mode); - } else { - return; - } - } else -#endif - dh = bufunit(f, u, indent, mode); + int 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 65ce4cd1d..c5247ce96 100644 --- a/src/common/kernel/reports.h +++ b/src/common/kernel/reports.h @@ -101,9 +101,6 @@ extern void register_reporttype(const char * extension, report_fun write, int fl 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 * reportpath(void); extern const char * trailinto(const struct region * r, const struct locale * lang); diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 584ce8e02..1d4cb65e9 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -48,11 +48,6 @@ #include "terrainid.h" /* only for conversion code */ #include "unit.h" -#ifdef USE_UGROUPS -#include "ugroup.h" -#include -#endif - /* attributes includes */ #include @@ -783,39 +778,6 @@ read_laen(struct region * r, int laen) } #endif -#ifdef USE_UGROUPS -void -read_ugroups(FILE *file) -{ - int i; - faction *f; - ugroup *ug; - int fno, ugid, ugmem; - - while(1) { - fno = ri(file); - if(fno == -1) break; - f = findfaction(fno); - while(1) { - ugid = ri(file); - if(ugid == -1) break; - ugmem = ri(file); - ug = malloc(sizeof(ugroup)); - ug->id = ugid; - ug->members = ugmem; - ug->unit_array = malloc(ug->members * sizeof(unit *)); - for(i=0; iunit_array[i] = u; - a_add(&u->attribs, a_new(&at_ugroup))->data.i = ugid; - } - ug->next = f->ugroups; - f->ugroups = ug; - } - } -} -#endif - static void read_alliances(FILE * F) { @@ -890,29 +852,6 @@ write_items(FILE *F, item *ilist) fputs("end ", F); } -#ifdef USE_UGROUPS -void -write_ugroups(FILE *file) -{ - faction *f; - ugroup *ug; - int i; - - for(f=factions; f; f=f->next) if(f->ugroups) { - wi(file, f->no); - for(ug = f->ugroups; ug; ug=ug->next) { - wi(file, ug->id); - wi(file, ug->members); - for(i=0; imembers; i++) { - wi36(file, ug->unit_array[i]->no); - } - } - fputs("-1\n", file); - } - fputs("-1\n", file); -} -#endif - #ifdef USE_PLAYERS static void export_players(const char * path) @@ -1954,9 +1893,6 @@ readgame(const char * filename, int backup) printf("\n"); if (!dirtyload) { read_borders(F); -#ifdef USE_UGROUPS - if (global.data_version >= UGROUPS_VERSION) read_ugroups(F); -#endif } fclose(F); @@ -2162,10 +2098,6 @@ writegame(const char *filename, char quiet) wnl(F); write_borders(F); wnl(F); -#if RELEASE_VERSION >= UGROUPS_VERSION - write_ugroups(F); - wnl(F); -#endif fclose(F); printf("\nOk.\n"); return 0; diff --git a/src/common/kernel/ugroup.c b/src/common/kernel/ugroup.c deleted file mode 100644 index f502b5f66..000000000 --- a/src/common/kernel/ugroup.c +++ /dev/null @@ -1,202 +0,0 @@ -/* vi: set ts=2: - +-------------------+ Christian Schlittchen - | | Enno Rehling - | Eressea PBEM host | Katja Zedel - | (c) 1998 - 2003 | Henning Peters - | | Ingo Wilken - +-------------------+ Stefan Reich - - This program may not be used, modified or distributed - without prior permission by the authors of Eressea. - */ - -#include - -#include "eressea.h" - -/* kernel includes */ -#include "unit.h" -#include "region.h" -#include "faction.h" -#include "ugroup.h" - -/* attributes includes */ -#include - -/* libc includes */ -#include -#include - -/* TODO: - * - Anzeige (CR) - * - Speicherung - * - Evt. NACH (Betrete/Verlasse?) des Leaders vererben auf Members. - * - Routine zur automatischen Aufsplittung. - */ - -/* Nur die erste Einheit in der Liste - (ugroup->unit_array[0] == u) kann NACH ausführen. */ - -#ifdef USE_UGROUPS -boolean -is_ugroupleader(const unit *u, const ugroup *ug) -{ - if(ug->unit_array[0] == u) return true; - return false; -} - -ugroup * -findugroupid(const faction *f, int id) -{ - ugroup *ug; - - for(ug=f->ugroups;ug; ug=ug->next) { - if(ug->id == id) return ug; - } - return NULL; -} - -ugroup * -findugroup(const unit *u) -{ - attrib *a = a_find(u->attribs, &at_ugroup); - if(!a) return NULL; - return findugroupid(u->faction, a->data.i); -} - -static int -ugroupfreeid(const ugroup *ug) -{ - const ugroup *ug2 = ug; - int id = 0; - - while(ug2) { - if(ug2->id == id) { - id++; - ug2 = ug; - } else { - ug2 = ug2->next; - } - } - return id; -} - -ugroup * -createugroup(unit *uleader, unit *umember) -{ - ugroup *ug = calloc(1,sizeof(ugroup)); - - ug->id = ugroupfreeid(uleader->faction->ugroups); - ug->members = 2; - ug->unit_array = malloc(2 * sizeof(unit *)); - ug->unit_array[0] = uleader; - a_add(&uleader->attribs, a_new(&at_ugroup))->data.i = ug->id; - ug->unit_array[1] = umember; - a_add(&umember->attribs, a_new(&at_ugroup))->data.i = ug->id; - ug->next = uleader->faction->ugroups; - uleader->faction->ugroups = ug; - - return ug; -} - -void -join_ugroup(unit *u, strlist *order) -{ - unit *u2; - ugroup *ug; - - u2 = getunit(u->region, u->faction); - if(!u2 || cansee(u->faction, u->region, u2, 0) == false) { - cmistake(u, order->s, 63, MSG_EVENT); - return; - } - if(u2 == u) { - cmistake(u, order->s, 292, MSG_EVENT); - return; - } - if(u2->faction != u->faction) { - cmistake(u, order->s, 293, MSG_EVENT); - return; - } - if(u2->building != u->building || u2->ship != u->ship) { - cmistake(u, order->s, 294, MSG_EVENT); - return; - } - if(a_find(u->attribs, &at_ugroup)) { - cmistake(u, order->s, 290, MSG_EVENT); - return; - } - - ug = findugroup(u2); - - if(ug) { - ug->members++; - ug->unit_array = realloc(ug->unit_array, - ug->members * sizeof(unit *)); - ug->unit_array[ug->members-1] = u; - a_add(&u->attribs, a_new(&at_ugroup))->data.i = ug->id; - } else { - createugroup(u2, u); - } -} - -void -leave_ugroup(unit *u, strlist *order) -{ - attrib *a = a_find(u->attribs, &at_ugroup); - ugroup *ug; - boolean found = false; - int i; - - if(!a) { - cmistake(u, order->s, 286, MSG_EVENT); - return; - } - - ug = findugroupid(u->faction, a->data.i); - for(i=0; imembers; i++) { - if(found == true) { - ug->unit_array[i-1] = ug->unit_array[i]; - } else if(ug->unit_array[i] == u) { - found = true; - } - } - ug->members--; - a_remove(&u->attribs, a); - - if(ug->members == 1) { - a_remove(&ug->unit_array[0]->attribs, a); - free(ug->unit_array); - removelist(&u->faction->ugroups, ug); - } else { - ug->unit_array = realloc(ug->unit_array, - ug->members * sizeof(unit *)); - } -} - -void -ugroups(void) -{ - region *r; - unit *u; - strlist *o; - - for(r=regions; r; r=r->next) { - for(u=r->units; u; u=u->next) { - for(o = u->orders; o; o=o->next) { - if(igetkeyword(o->s, u->faction->locale) == K_LEAVEUGROUP) { - leave_ugroup(u, o); - } - } - } - for(u=r->units; u; u=u->next) { - for(o = u->orders; o; o=o->next) { - if(igetkeyword(o->s, u->faction->locale) == K_JOINUGROUP) { - join_ugroup(u, o); - } - } - } - } -} - -#endif /* USE_UGROUPS */ diff --git a/src/common/kernel/ugroup.h b/src/common/kernel/ugroup.h deleted file mode 100644 index ecae3ba61..000000000 --- a/src/common/kernel/ugroup.h +++ /dev/null @@ -1,39 +0,0 @@ -/* vi: set ts=2: - +-------------------+ Christian Schlittchen - | | Enno Rehling - | Eressea PBEM host | Katja Zedel - | (c) 1998 - 2003 | Henning Peters - | | Ingo Wilken - +-------------------+ Stefan Reich - - This program may not be used, modified or distributed - without prior permission by the authors of Eressea. - */ - -#ifndef UGROUP_H -#define UGROUP_H -#ifdef __cplusplus -extern "C" { -#endif - -/* Globale Liste ugroups. - Bei jeder unit u->ugroup zeigt auf aktuelle Gruppe. - Gruppen mit members <= 1 werden vor den Reports - aufgelöst. */ - -typedef struct ugroup { - struct ugroup *next; - int id; - int members; - struct unit **unit_array; -} ugroup; - -boolean is_ugroupleader(const struct unit *u, const struct ugroup *ug); -ugroup *findugroupid(const struct faction *f, int id); -ugroup *findugroup(const struct unit *u); -void ugroups(void); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/eressea/eressea-lua.vcproj b/src/eressea/eressea-lua.vcproj index 9e8d2ce25..d3aa26248 100644 --- a/src/eressea/eressea-lua.vcproj +++ b/src/eressea/eressea-lua.vcproj @@ -364,28 +364,6 @@ - - - - - - - - - - - - - -