From aeda0730df97c7789c66f44177ee3720a5a3a76a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 29 Sep 2002 18:26:07 +0000 Subject: [PATCH] Aussetzen von newfactions mit Allianzen --- src/mapper/autoseed.c | 6 ++++++ src/mapper/autoseed.h | 3 +++ src/mapper/map_partei.c | 27 +++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/src/mapper/autoseed.c b/src/mapper/autoseed.c index 74506c1c9..aa8d51357 100644 --- a/src/mapper/autoseed.c +++ b/src/mapper/autoseed.c @@ -258,6 +258,9 @@ autoseed(struct regionlist * rlist) unit * u; while (*nfp!=nf) nfp=&(*nfp)->next; u = addplayer(seeds[i].region, nf->email, nf->password, nf->race, nf->lang); +#ifdef ALLIANCES + u->faction->alliance = nf->allies; +#endif ++numnewbies; *nfp = nf->next; free(nf); @@ -355,6 +358,9 @@ mkisland(int nsize) terraform(r, preferred_terrain(nextf->race)); ++isize; u = addplayer(r, nextf->email, nextf->password, nextf->race, nextf->lang); +#ifdef ALLIANCES + u->faction->alliance = nextf->allies; +#endif /* remove duplicate email addresses */ nfp=&newfactions; diff --git a/src/mapper/autoseed.h b/src/mapper/autoseed.h index 4827a4f7d..f9493ab78 100644 --- a/src/mapper/autoseed.h +++ b/src/mapper/autoseed.h @@ -24,6 +24,9 @@ typedef struct newfaction { const struct race * race; int bonus; boolean oldregions; +#ifdef ALLIANCES + struct alliance * allies; +#endif } newfaction; extern newfaction * newfactions; diff --git a/src/mapper/map_partei.c b/src/mapper/map_partei.c index 46484b3f2..562954f04 100644 --- a/src/mapper/map_partei.c +++ b/src/mapper/map_partei.c @@ -31,6 +31,9 @@ #include #include +/* modules */ +#include + /* util includes */ #include #include @@ -285,6 +288,9 @@ seed_dropouts(void) newfaction * nf = *nfp; if (nf->race==drop->race && !nf->bonus) { unit * u = addplayer(r, nf->email, nf->password, nf->race, nf->lang); +#ifdef ALLIANCES + u->faction->alliance = nf->allies; +#endif ++numnewbies; if (nf->bonus) give_latestart_bonus(r, u, nf->bonus); found=true; @@ -312,8 +318,14 @@ read_newfactions(const char * filename) char race[20], email[64], lang[8], password[16]; newfaction *nf; int bonus; +#ifdef ALLIANCES + int alliance; + /* email;race;locale;startbonus;alliance */ + if (fscanf(F, "%s %s %s %d %s %d", email, race, lang, &bonus, password, &alliance)<=0) break; +#else /* email;race;locale;startbonus */ if (fscanf(F, "%s %s %s %d %s", email, race, lang, &bonus, password)<=0) break; +#endif while (f) { if (strcmp(f->email, email)==0 && f->age==0) { break; @@ -329,6 +341,17 @@ read_newfactions(const char * filename) nf->email = strdup(email); nf->password = strdup(password); nf->race = rc_find(race); +#ifdef ALLIANCES + { + struct alliance * al = findalliance(alliance); + if (al==NULL) { + char zText[64]; + sprintf(zText, "Allianz %d", alliance); + al = makealliance(alliance, zText); + } + nf->allies = al; + } +#endif if (nf->race==NULL) nf->race = findrace(race, default_locale); nf->lang = find_locale(lang); nf->bonus = bonus; @@ -354,7 +377,11 @@ select_newfaction(const struct race * rc) while (player) { if (rc==NULL || player->race==rc) { char str[80]; +#ifdef ALLIANCES + snprintf(str, 70, "%s %d %s %s", player->bonus?"!":" ", player->allies?player->allies->id:0, locale_string(default_locale, rc_name(player->race, 0)), player->email); +#else snprintf(str, 70, "%s %s %s", player->bonus?"!":" ", locale_string(default_locale, rc_name(player->race, 0)), player->email); +#endif insert_selection(iinsert, prev, strdup(str), (void*)player); prev = *iinsert; iinsert = &prev->next;