From 5cf53c332a36f39749cfc2a597a773947681ce05 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 11 Dec 2005 15:09:57 +0000 Subject: [PATCH] making read_newfactions() a little less picky, and giving default passwords. I hope. --- src/common/modules/autoseed.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/common/modules/autoseed.c b/src/common/modules/autoseed.c index 380e15407..964b2e9da 100644 --- a/src/common/modules/autoseed.c +++ b/src/common/modules/autoseed.c @@ -189,17 +189,19 @@ read_newfactions(const char * filename) faction * f; char race[20], email[64], lang[8], password[16]; newfaction *nf, **nfi; - int bonus, subscription; + int bonus = 0, subscription = 0; int alliance = 0; - if (alliances!=NULL) { - /* email;race;locale;startbonus;subscription;alliance */ - if (fscanf(F, "%s %s %s %d %d %s %d", email, race, lang, &bonus, - &subscription, password, &alliance)<=0) break; - } else { - /* email;race;locale;startbonus;subscription */ - if (fscanf(F, "%s %s %s %d %d %s", email, race, lang, &bonus, - &subscription, password)<=0) break; + if (fgets(buf, sizeof(buf), F)==NULL) break; + + email[0] = '\0'; + password[0] = '\0'; + + sscanf(buf, "%s %s %s %d %d %s %d", email, race, lang, &bonus, &subscription, password, &alliance); + if (email[0]=='\0') break; + if (password[0]=='\0') { + strcpy(password, itoa36(rand())); + strcat(password, itoa36(rand())); } for (f=factions;f;f=f->next) { if (strcmp(f->email, email)==0 && f->subscription && f->age