fix missing monster factions.

This commit is contained in:
Enno Rehling 2014-08-16 13:33:47 +02:00
parent fa52bb4192
commit 90ec28fed3
2 changed files with 10 additions and 2 deletions

View File

@ -126,6 +126,14 @@ faction *get_monsters(void)
/* shit! */ /* shit! */
monsters = findfaction(666); monsters = findfaction(666);
} }
if (!monsters) {
const race *rc = rc_find("dragon");
faction *f = addfaction("noreply@eressea.de", NULL, rc, NULL, 0);
renumber_faction(f, 666);
faction_setname(f, "Monster");
f->options = 0;
monsters = f;
}
if (monsters) { if (monsters) {
fset(monsters, FFL_NPC | FFL_NOIDLEOUT); fset(monsters, FFL_NPC | FFL_NOIDLEOUT);
} }
@ -203,8 +211,7 @@ faction *addfaction(const char *email, const char *password,
faction *f = calloc(sizeof(faction), 1); faction *f = calloc(sizeof(faction), 1);
char buf[128]; char buf[128];
assert(frace); assert(frace || !"cannot create a faction that has no race");
if (set_email(&f->email, email) != 0) { if (set_email(&f->email, email) != 0) {
log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), email); log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), email);
} }

View File

@ -890,6 +890,7 @@ void move_unit(unit * u, region * r, unit ** ulist)
{ {
assert(u && r); assert(u && r);
assert(u->faction || !"this unit is dead");
if (u->region == r) if (u->region == r)
return; return;
if (!ulist) if (!ulist)