From 6d542327f908ce69a00f7f9f5ebbe06d1ba7dacd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 26 Jul 2020 21:24:58 +0200 Subject: [PATCH] bug 2660 delayed canibalism monsters now eat each other in randenc. --- src/monsters.c | 17 +++++++++-------- src/monsters.h | 3 ++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/monsters.c b/src/monsters.c index 129c8f76c..bd156238b 100644 --- a/src/monsters.c +++ b/src/monsters.c @@ -205,8 +205,13 @@ void monsters_desert(struct faction *monsters) unit *u; for (u = r->units; u; u = u->next) { - if (u->faction != monsters - && (u_race(u)->flags & RCF_DESERT)) { + if (u->faction == monsters) { + const struct race * rc = u_race(u); + if (rc->splitsize < 10) { + /* hermit-type monsters eat each other */ + monster_cannibalism(u); + } + } else if (u_race(u)->flags & RCF_DESERT) { if (fval(u, UFL_ISNEW)) continue; if (rng_int() % 100 < 5) { @@ -752,7 +757,8 @@ static order *plan_dragon(unit * u) return long_order; } -static void monster_cannibalism(unit *u) { +void monster_cannibalism(unit *u) +{ unit *u2; for (u2 = u->next; u2; u2 = u2->next) { @@ -792,11 +798,6 @@ void plan_monsters(faction * f) } a_removeall(&u->attribs, &at_otherfaction); - if (rc->splitsize < 10) { - /* hermit-type monsters eat each other */ - monster_cannibalism(u); - } - if (skill_enabled(SK_PERCEPTION)) { /* Monster bekommen jede Runde ein paar Tage Wahrnehmung dazu */ produceexp(u, SK_PERCEPTION, u->number); diff --git a/src/monsters.h b/src/monsters.h index d87398c2c..7b3cda142 100644 --- a/src/monsters.h +++ b/src/monsters.h @@ -15,7 +15,8 @@ extern "C" { struct unit *spawn_seaserpent(struct region *r, struct faction *f); void spawn_dragons(void); - void monsters_desert(struct faction *monsters); + void monsters_desert(const struct faction *monsters); + void monster_cannibalism(struct unit *u); void monster_kills_peasants(struct unit *u); void make_zombie(struct unit * u);