diff --git a/src/gmtool.c b/src/gmtool.c index fdbfd3faa..e75f22612 100644 --- a/src/gmtool.c +++ b/src/gmtool.c @@ -934,7 +934,8 @@ static void seed_player(state *st, const newfaction *player) { if (r) { const char *at = strchr(player->email, '@'); faction *f; - addplayer(r, f = addfaction(player->email, player->password, + const char *password = player->password ? player->password : itoa36(rng_int()); + addplayer(r, f = addfaction(player->email, password, player->race, player->lang, player->subscription)); if (at) { diff --git a/src/kernel/faction.c b/src/kernel/faction.c index b4dfe51ca..5e6c98602 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -245,6 +245,7 @@ faction *addfaction(const char *email, const char *password, f->alliance_joindate = turn; f->lastorders = turn; f->_alive = true; + f->_password = NULL; f->age = 0; f->race = frace; f->magiegebiet = 0; @@ -252,9 +253,10 @@ faction *addfaction(const char *email, const char *password, f->subscription = subscription; f->flags = FFL_ISNEW|FFL_PWMSG; - if (!password) password = itoa36(rng_int()); - faction_setpassword(f, password_encode(password, PASSWORD_DEFAULT)); - ADDMSG(&f->msgs, msg_message("changepasswd", "value", password)); + if (password) { + faction_setpassword(f, password_encode(password, PASSWORD_DEFAULT)); + ADDMSG(&f->msgs, msg_message("changepasswd", "value", password)); + } f->options = WANT_OPTION(O_REPORT) | WANT_OPTION(O_ZUGVORLAGE) | diff --git a/src/kernel/faction.test.c b/src/kernel/faction.test.c index 37ec70e50..75c455e7d 100644 --- a/src/kernel/faction.test.c +++ b/src/kernel/faction.test.c @@ -112,7 +112,7 @@ static void test_addfaction(CuTest *tc) { test_setup(); rc = rc_get_or_create("human"); lang = test_create_locale(); - f = addfaction("test@eressea.de", "hurrdurr", rc, lang, 1234); + f = addfaction("test@eressea.de", NULL, rc, lang, 1234); CuAssertPtrNotNull(tc, f); CuAssertPtrNotNull(tc, f->name); CuAssertPtrEquals(tc, NULL, (void *)f->units); diff --git a/src/modules/autoseed.c b/src/modules/autoseed.c index 374b6379c..439bf35d1 100644 --- a/src/modules/autoseed.c +++ b/src/modules/autoseed.c @@ -550,13 +550,15 @@ int autoseed(newfaction ** players, int nsize, int max_agediff) newfaction **nfp, *nextf = *players; faction *f; unit *u; + const char * password; isize += REGIONS_PER_FACTION; terraform_region(r, preferred_terrain(nextf->race)); prepare_starting_region(r); ++tsize; assert(r->land && r->units == 0); - u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race, + password = nextf->password ? nextf->password : itoa36(rng_int()); + u = addplayer(r, addfaction(nextf->email, password, nextf->race, nextf->lang, nextf->subscription)); f = u->faction; fset(f, FFL_ISNEW);