forked from github/server
- Passwort in newfactions Datei wird übernommen für Server
This commit is contained in:
parent
373606a362
commit
8f24c104cb
|
@ -236,7 +236,7 @@ destroyfaction(faction * f)
|
||||||
static void
|
static void
|
||||||
restart(unit *u, const race * rc)
|
restart(unit *u, const race * rc)
|
||||||
{
|
{
|
||||||
faction *f = addplayer(u->region, u->faction->email, rc, u->faction->locale)->faction;
|
faction *f = addplayer(u->region, u->faction->email, u->faction->passw, rc, u->faction->locale)->faction;
|
||||||
unit * nu = f->units;
|
unit * nu = f->units;
|
||||||
strlist ** o=&u->orders;
|
strlist ** o=&u->orders;
|
||||||
|
|
||||||
|
|
|
@ -82,20 +82,23 @@ unused_faction_id(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
unit *
|
unit *
|
||||||
addplayer(region *r, const char *email, const struct race * frace, const locale *loc)
|
addplayer(region *r, const char *email, const char * password, const struct race * frace, const locale *loc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unit *u;
|
unit *u;
|
||||||
faction *f;
|
faction *f;
|
||||||
|
|
||||||
assert(frace != new_race[RC_ORC]);
|
assert(frace != new_race[RC_ORC]);
|
||||||
f = calloc(sizeof(faction), 1);
|
f = calloc(sizeof(faction), 1);
|
||||||
|
|
||||||
set_string(&f->email, email);
|
set_string(&f->email, email);
|
||||||
|
|
||||||
for (i = 0; i < 6; i++) buf[i] = (char) (97 + rand() % 26); buf[i] = 0;
|
|
||||||
set_string(&f->passw, buf);
|
|
||||||
|
|
||||||
|
if (password) {
|
||||||
|
set_string(&f->passw, password);
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < 6; i++) buf[i] = (char) (97 + rand() % 26); buf[i] = 0;
|
||||||
|
set_string(&f->passw, buf);
|
||||||
|
}
|
||||||
for (i = 0; i < 6; i++) buf[i] = (char) (97 + rand() % 26); buf[i] = 0;
|
for (i = 0; i < 6; i++) buf[i] = (char) (97 + rand() % 26); buf[i] = 0;
|
||||||
set_string(&f->override, buf);
|
set_string(&f->override, buf);
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ typedef struct faction_list {
|
||||||
extern const struct unit * random_unit_in_faction(const struct faction *f);
|
extern const struct unit * random_unit_in_faction(const struct faction *f);
|
||||||
extern const char * factionname(const struct faction * f);
|
extern const char * factionname(const struct faction * f);
|
||||||
extern void * resolve_faction(void * data);
|
extern void * resolve_faction(void * data);
|
||||||
extern struct unit * addplayer(struct region *r, const char *email, const struct race * frace, const struct locale *loc);
|
extern struct unit * addplayer(struct region *r, const char *email, const char* password, const struct race * frace, const struct locale *loc);
|
||||||
extern boolean checkpasswd(const faction * f, const char * passwd);
|
extern boolean checkpasswd(const faction * f, const char * passwd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -254,8 +254,9 @@ autoseed(struct regionlist * rlist)
|
||||||
newfaction * nf = seeds[i].player;
|
newfaction * nf = seeds[i].player;
|
||||||
if (nf) {
|
if (nf) {
|
||||||
newfaction ** nfp = &newfactions;
|
newfaction ** nfp = &newfactions;
|
||||||
|
unit * u;
|
||||||
while (*nfp!=nf) nfp=&(*nfp)->next;
|
while (*nfp!=nf) nfp=&(*nfp)->next;
|
||||||
addplayer(seeds[i].region, nf->email, nf->race, nf->lang);
|
u = addplayer(seeds[i].region, nf->email, nf->password, nf->race, nf->lang);
|
||||||
++numnewbies;
|
++numnewbies;
|
||||||
*nfp = nf->next;
|
*nfp = nf->next;
|
||||||
free(nf);
|
free(nf);
|
||||||
|
@ -306,8 +307,9 @@ mkisland(int nsize)
|
||||||
assert(r->terrain==T_OCEAN);
|
assert(r->terrain==T_OCEAN);
|
||||||
if (rand() % REGIONS_PER_FACTION == 0) {
|
if (rand() % REGIONS_PER_FACTION == 0) {
|
||||||
newfaction ** nfp, * nextf = newfactions;
|
newfaction ** nfp, * nextf = newfactions;
|
||||||
|
unit * u;
|
||||||
terraform(r, preferred_terrain(nextf->race));
|
terraform(r, preferred_terrain(nextf->race));
|
||||||
addplayer(r, nextf->email, nextf->race, nextf->lang);
|
u = addplayer(r, nextf->email, nextf->password, nextf->race, nextf->lang);
|
||||||
|
|
||||||
/* remove duplicate email addresses */
|
/* remove duplicate email addresses */
|
||||||
nfp=&newfactions;
|
nfp=&newfactions;
|
||||||
|
|
|
@ -18,7 +18,8 @@ struct newfaction;
|
||||||
|
|
||||||
typedef struct newfaction {
|
typedef struct newfaction {
|
||||||
struct newfaction * next;
|
struct newfaction * next;
|
||||||
const char * email;
|
char * email;
|
||||||
|
char * password;
|
||||||
const struct locale * lang;
|
const struct locale * lang;
|
||||||
const struct race * race;
|
const struct race * race;
|
||||||
int bonus;
|
int bonus;
|
||||||
|
|
|
@ -282,7 +282,7 @@ seed_dropouts(void)
|
||||||
if (u==NULL) while (*nfp) {
|
if (u==NULL) while (*nfp) {
|
||||||
newfaction * nf = *nfp;
|
newfaction * nf = *nfp;
|
||||||
if (nf->race==drop->race && !nf->bonus) {
|
if (nf->race==drop->race && !nf->bonus) {
|
||||||
unit * u = addplayer(r, nf->email, nf->race, nf->lang);
|
unit * u = addplayer(r, nf->email, nf->password, nf->race, nf->lang);
|
||||||
++numnewbies;
|
++numnewbies;
|
||||||
if (nf->bonus) give_latestart_bonus(r, u, nf->bonus);
|
if (nf->bonus) give_latestart_bonus(r, u, nf->bonus);
|
||||||
found=true;
|
found=true;
|
||||||
|
@ -307,11 +307,11 @@ read_newfactions(const char * filename)
|
||||||
if (F==NULL) return;
|
if (F==NULL) return;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
faction * f = factions;
|
faction * f = factions;
|
||||||
char race[20], email[64], lang[8];
|
char race[20], email[64], lang[8], password[8];
|
||||||
newfaction *nf;
|
newfaction *nf;
|
||||||
int bonus;
|
int bonus;
|
||||||
/* email;race;locale;startbonus */
|
/* email;race;locale;startbonus */
|
||||||
if (fscanf(F, "%s %s %s %d", email, race, lang, &bonus)<=0) break;
|
if (fscanf(F, "%s %s %s %d %s", email, race, lang, &bonus, password)<=0) break;
|
||||||
while (f) {
|
while (f) {
|
||||||
if (strcmp(f->email, email)==0 && f->age==0) {
|
if (strcmp(f->email, email)==0 && f->age==0) {
|
||||||
break;
|
break;
|
||||||
|
@ -325,6 +325,7 @@ read_newfactions(const char * filename)
|
||||||
if (nf) continue;
|
if (nf) continue;
|
||||||
nf = calloc(sizeof(newfaction), 1);
|
nf = calloc(sizeof(newfaction), 1);
|
||||||
nf->email = strdup(email);
|
nf->email = strdup(email);
|
||||||
|
nf->password = strdup(password);
|
||||||
nf->race = rc_find(race);
|
nf->race = rc_find(race);
|
||||||
if (nf->race==NULL) nf->race = findrace(race, default_locale);
|
if (nf->race==NULL) nf->race = findrace(race, default_locale);
|
||||||
nf->lang = find_locale(lang);
|
nf->lang = find_locale(lang);
|
||||||
|
@ -373,6 +374,7 @@ NeuePartei(region * r)
|
||||||
const struct race * frace;
|
const struct race * frace;
|
||||||
int late;
|
int late;
|
||||||
unit *u;
|
unit *u;
|
||||||
|
const char * passwd = NULL;
|
||||||
int locale_nr;
|
int locale_nr;
|
||||||
faction * f;
|
faction * f;
|
||||||
|
|
||||||
|
@ -387,6 +389,7 @@ NeuePartei(region * r)
|
||||||
frace = nf->race;
|
frace = nf->race;
|
||||||
late = nf->bonus;
|
late = nf->bonus;
|
||||||
lang = nf->lang;
|
lang = nf->lang;
|
||||||
|
passwd = nf->password;
|
||||||
strcpy(email, nf->email);
|
strcpy(email, nf->email);
|
||||||
if (late) {
|
if (late) {
|
||||||
WINDOW *win = openwin(SX - 10, 3, "< Neue Partei einfügen >");
|
WINDOW *win = openwin(SX - 10, 3, "< Neue Partei einfügen >");
|
||||||
|
@ -482,7 +485,7 @@ NeuePartei(region * r)
|
||||||
else nfp = &nf->next;
|
else nfp = &nf->next;
|
||||||
}
|
}
|
||||||
modified = 1;
|
modified = 1;
|
||||||
u = addplayer(r, email, frace, lang);
|
u = addplayer(r, email, passwd, frace, lang);
|
||||||
++numnewbies;
|
++numnewbies;
|
||||||
|
|
||||||
if(late) give_latestart_bonus(r, u, late);
|
if(late) give_latestart_bonus(r, u, late);
|
||||||
|
|
|
@ -322,37 +322,6 @@ crwritemap(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
readfactions(void)
|
|
||||||
{
|
|
||||||
FILE * F = fopen("factions.txt", "r");
|
|
||||||
|
|
||||||
locale * german = find_locale("de");
|
|
||||||
while (!feof(F)) {
|
|
||||||
int x, y;
|
|
||||||
region * r;
|
|
||||||
unit * u;
|
|
||||||
const race * rc;
|
|
||||||
locale * lang;
|
|
||||||
char email[64];
|
|
||||||
char racename[32];
|
|
||||||
char langname[32];
|
|
||||||
fscanf(F, "%d %d %s %s %s\n", &x, &y, langname, racename, email);
|
|
||||||
|
|
||||||
rc = findrace(racename, german);
|
|
||||||
r = findregion(x, y);
|
|
||||||
lang = find_locale(langname);
|
|
||||||
assert(rc && r && lang);
|
|
||||||
u = addplayer(r, email, rc, lang);
|
|
||||||
++numnewbies;
|
|
||||||
assert(u);
|
|
||||||
i_change(&u->items, finditemtype("stein", german), 30);
|
|
||||||
i_change(&u->items, finditemtype("holz", german), 30);
|
|
||||||
}
|
|
||||||
fclose(F);
|
|
||||||
modified = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
newbie_region(region * r)
|
newbie_region(region * r)
|
||||||
{
|
{
|
||||||
|
@ -838,9 +807,6 @@ movearound(int rx, int ry) {
|
||||||
DisplayRegList(1);
|
DisplayRegList(1);
|
||||||
ch = 999999;
|
ch = 999999;
|
||||||
break;
|
break;
|
||||||
case 18: /* ctrl-r*/
|
|
||||||
readfactions();
|
|
||||||
break;
|
|
||||||
case 23: /* ctrl-w*/
|
case 23: /* ctrl-w*/
|
||||||
crwritemap();
|
crwritemap();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue