making read_newfactions() a little less picky, and giving default passwords. I hope.

This commit is contained in:
Enno Rehling 2005-12-11 15:09:57 +00:00
parent bbcc80643a
commit 5cf53c332a
1 changed files with 11 additions and 9 deletions

View File

@ -189,17 +189,19 @@ read_newfactions(const char * filename)
faction * f; faction * f;
char race[20], email[64], lang[8], password[16]; char race[20], email[64], lang[8], password[16];
newfaction *nf, **nfi; newfaction *nf, **nfi;
int bonus, subscription; int bonus = 0, subscription = 0;
int alliance = 0; int alliance = 0;
if (alliances!=NULL) { if (fgets(buf, sizeof(buf), F)==NULL) break;
/* email;race;locale;startbonus;subscription;alliance */
if (fscanf(F, "%s %s %s %d %d %s %d", email, race, lang, &bonus, email[0] = '\0';
&subscription, password, &alliance)<=0) break; password[0] = '\0';
} else {
/* email;race;locale;startbonus;subscription */ sscanf(buf, "%s %s %s %d %d %s %d", email, race, lang, &bonus, &subscription, password, &alliance);
if (fscanf(F, "%s %s %s %d %d %s", email, race, lang, &bonus, if (email[0]=='\0') break;
&subscription, password)<=0) break; if (password[0]=='\0') {
strcpy(password, itoa36(rand()));
strcat(password, itoa36(rand()));
} }
for (f=factions;f;f=f->next) { for (f=factions;f;f=f->next) {
if (strcmp(f->email, email)==0 && f->subscription && f->age<MINAGE_MULTI) break; if (strcmp(f->email, email)==0 && f->subscription && f->age<MINAGE_MULTI) break;