try giving new factions a name

This commit is contained in:
Enno Rehling 2017-08-07 18:58:39 +02:00
parent aae1095c00
commit 2aab736b59
1 changed files with 14 additions and 2 deletions

View File

@ -886,8 +886,20 @@ static void seed_player(state *st, const newfaction *player) {
pnormalize(&nx, &ny, st->cursor.pl);
r = findregion(nx, ny);
if (r) {
addplayer(r, addfaction(player->email, player->password, player->race,
player->lang, player->subscription));
const char *at = strchr(player->email, '@');
faction *f;
addplayer(r, f = addfaction(player->email, player->password,
player->race, player->lang,
player->subscription));
if (at) {
char fname[64];
size_t len = at - player->email;
if (len>4 && len<sizeof(fname)) {
memcpy(fname, player->email, len);
fname[len]=0;
faction_setname(f, fname);
}
}
}
}
}