Stop using player email to set faction name.

This commit is contained in:
Enno Rehling 2018-09-13 16:16:32 +02:00
parent d6e8b38724
commit a876a60b68
5 changed files with 25 additions and 35 deletions

View File

@ -487,6 +487,7 @@ static void test_recruit_insect(CuTest *tc) {
test_setup(); test_setup();
test_create_calendar(); test_create_calendar();
test_create_terrain("desert", -1);
f = test_create_faction(test_create_race("insect")); f = test_create_faction(test_create_race("insect"));
u = test_create_unit(f, test_create_region(0, 0, NULL)); u = test_create_unit(f, test_create_region(0, 0, NULL));
u->thisorder = create_order(K_RECRUIT, f->locale, "%d", 1); u->thisorder = create_order(K_RECRUIT, f->locale, "%d", 1);

View File

@ -932,20 +932,10 @@ static void seed_player(state *st, const newfaction *player) {
pnormalize(&nx, &ny, st->cursor.pl); pnormalize(&nx, &ny, st->cursor.pl);
r = findregion(nx, ny); r = findregion(nx, ny);
if (r) { if (r) {
const char *at = strchr(player->email, '@');
faction *f; faction *f;
addplayer(r, f = addfaction(player->email, player->password, addplayer(r, f = addfaction(player->email, player->password,
player->race, player->lang, player->race, player->lang,
player->subscription)); 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);
}
}
} }
} }
} }

View File

@ -30,7 +30,6 @@
void age_firedragon(struct unit *u); void age_firedragon(struct unit *u);
void age_dragon(struct unit *u); void age_dragon(struct unit *u);
void age_undead(struct unit *u);
void age_skeleton(struct unit *u); void age_skeleton(struct unit *u);
void age_zombie(struct unit *u); void age_zombie(struct unit *u);
void age_ghoul(struct unit *u); void age_ghoul(struct unit *u);
@ -81,7 +80,6 @@ void equip_newunits(struct unit *u)
void register_races(void) void register_races(void)
{ {
/* function age for race->age() */ /* function age for race->age() */
register_function((pf_generic)age_undead, "age_undead");
register_function((pf_generic)age_skeleton, "age_skeleton"); register_function((pf_generic)age_skeleton, "age_skeleton");
register_function((pf_generic)age_zombie, "age_zombie"); register_function((pf_generic)age_zombie, "age_zombie");
register_function((pf_generic)age_ghoul, "age_ghoul"); register_function((pf_generic)age_ghoul, "age_ghoul");

View File

@ -40,29 +40,6 @@ void make_undead_unit(unit * u)
u->flags |= UFL_ISNEW; u->flags |= UFL_ISNEW;
} }
void age_undead(unit * u)
{
region *r = u->region;
/* untote, die einer partei angehoeren, koennen sich
* absplitten, anstatt sich zu vermehren. monster
* untote vermehren sich nur noch */
if (u->number > UNDEAD_MIN && !is_monsters(u->faction)
&& rng_int() % 100 < UNDEAD_BREAKUP) {
int m, n = 0;
unit *u2;
for (m = u->number; m; m--) {
if (rng_int() % 100 < UNDEAD_BREAKUP_FRACTION)
++n;
}
u2 = create_unit(r, get_monsters(), 0, get_race(RC_UNDEAD), 0, NULL, u);
make_undead_unit(u2);
transfermen(u, u2, u->number - n);
}
}
void age_skeleton(unit * u) void age_skeleton(unit * u)
{ {
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) { if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {

View File

@ -13,6 +13,7 @@
#include <kernel/plane.h> #include <kernel/plane.h>
#include <kernel/region.h> #include <kernel/region.h>
#include <kernel/terrain.h> #include <kernel/terrain.h>
#include <kernel/terrainid.h>
#include <kernel/item.h> #include <kernel/item.h>
#include <kernel/unit.h> #include <kernel/unit.h>
#include <kernel/order.h> #include <kernel/order.h>
@ -238,6 +239,29 @@ static void test_reset(void) {
free_spellbooks(); free_spellbooks();
free_prefixes(); free_prefixes();
mt_clear(); mt_clear();
/*
for (i = 0; i != MAXTERRAINS; ++i) {
int flags = 0;
if (i == T_FIREWALL) {
flags |= FORBIDDEN_REGION;
} else {
flags = FLY_INTO | WALK_INTO;
if (i == T_OCEAN) {
flags |= SEA_REGION | SWIM_INTO;
}
else {
flags |= LAND_REGION;
if (i == T_PLAIN) {
flags |= CAVALRY_REGION | FOREST_REGION;
}
else if (i == T_GLACIER || i == T_ICEBERG || i == T_ICEBERG_SLEEP) {
flags |= ARCTIC_REGION;
}
}
}
test_create_terrain(terrainnames[i], flags);
}
*/
for (i = 0; i != MAXSKILLS; ++i) { for (i = 0; i != MAXSKILLS; ++i) {
enable_skill(i, true); enable_skill(i, true);
} }