From 90ec28fed379101293591ddb68657fb158723b4c Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 16 Aug 2014 13:33:47 +0200 Subject: [PATCH] fix missing monster factions. --- src/kernel/faction.c | 11 +++++++++-- src/kernel/unit.c | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/kernel/faction.c b/src/kernel/faction.c index 9e61df9e3..e271de6c7 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -126,6 +126,14 @@ faction *get_monsters(void) /* shit! */ 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) { fset(monsters, FFL_NPC | FFL_NOIDLEOUT); } @@ -203,8 +211,7 @@ faction *addfaction(const char *email, const char *password, faction *f = calloc(sizeof(faction), 1); char buf[128]; - assert(frace); - + assert(frace || !"cannot create a faction that has no race"); if (set_email(&f->email, email) != 0) { log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), email); } diff --git a/src/kernel/unit.c b/src/kernel/unit.c index 716852651..967ff5db5 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -890,6 +890,7 @@ void move_unit(unit * u, region * r, unit ** ulist) { assert(u && r); + assert(u->faction || !"this unit is dead"); if (u->region == r) return; if (!ulist)