From 78520fb9bf57fe50cb6fa90dee3fedc6afe23ca9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 18 May 2008 08:21:00 +0000 Subject: [PATCH] is_monsters() test for skeletons & al --- src/common/gamecode/laws.c | 2 +- src/common/modules/gmcmd.c | 2 +- src/common/races/zombies.c | 48 +++++++++++++++++++------------------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index 747d616d4..66766e552 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -1132,7 +1132,7 @@ ally_cmd(unit * u, struct order * ord) skip_token(); f = getfaction(); - if (f == 0 || f->no == 0) { + if (is_monsters(f)) { cmistake(u, ord, 66, MSG_EVENT); return 0; } diff --git a/src/common/modules/gmcmd.c b/src/common/modules/gmcmd.c index cb063a56c..e46f9c4a3 100644 --- a/src/common/modules/gmcmd.c +++ b/src/common/modules/gmcmd.c @@ -73,7 +73,7 @@ write_permissions(const attrib * a, struct storage * store) static int read_permissions(attrib * at, struct storage * store) { - attrib * attr; + attrib * attr = NULL; a_read(store, &attr); at->data.v = attr; return AT_READ_OK; diff --git a/src/common/races/zombies.c b/src/common/races/zombies.c index a23cc3fc2..3d5c0ca8b 100644 --- a/src/common/races/zombies.c +++ b/src/common/races/zombies.c @@ -60,39 +60,39 @@ age_undead(unit *u) void age_skeleton(unit *u) { - if (u->faction->no == 0 && rng_int()%100 < age_chance(u->age, 27, 1)) { - int n = max(1,u->number/2); - double q = (double) u->hp / (double) (unit_max_hp(u) * u->number); - u->race = new_race[RC_SKELETON_LORD]; - u->irace = new_race[RC_SKELETON_LORD]; - scale_number(u,n); - u->hp = (int) (unit_max_hp(u) * u->number * q); - } + if (is_monsters(u->faction) && rng_int()%100 < age_chance(u->age, 27, 1)) { + int n = max(1,u->number/2); + double q = (double) u->hp / (double) (unit_max_hp(u) * u->number); + u->race = new_race[RC_SKELETON_LORD]; + u->irace = new_race[RC_SKELETON_LORD]; + scale_number(u,n); + u->hp = (int) (unit_max_hp(u) * u->number * q); + } } void age_zombie(unit *u) { - if (u->faction->no == 0 && rng_int()%100 < age_chance(u->age, 27, 1)) { - int n = max(1,u->number/2); - double q = (double) u->hp / (double) (unit_max_hp(u) * u->number); - u->race = new_race[RC_ZOMBIE_LORD]; - u->irace = new_race[RC_ZOMBIE_LORD]; - scale_number(u,n); - u->hp = (int) (unit_max_hp(u) * u->number * q); - } + if (is_monsters(u->faction) && rng_int()%100 < age_chance(u->age, 27, 1)) { + int n = max(1,u->number/2); + double q = (double) u->hp / (double) (unit_max_hp(u) * u->number); + u->race = new_race[RC_ZOMBIE_LORD]; + u->irace = new_race[RC_ZOMBIE_LORD]; + scale_number(u,n); + u->hp = (int) (unit_max_hp(u) * u->number * q); + } } void age_ghoul(unit *u) { - if (u->faction->no == 0 && rng_int()%100 < age_chance(u->age, 27, 1)) { - int n = max(1,u->number/2); - double q = (double) u->hp / (double) (unit_max_hp(u) * u->number); - u->race = new_race[RC_GHOUL_LORD]; - u->irace = new_race[RC_GHOUL_LORD]; - scale_number(u,n); - u->hp = (int) (unit_max_hp(u) * u->number * q); - } + if (is_monsters(u->faction) && rng_int()%100 < age_chance(u->age, 27, 1)) { + int n = max(1,u->number/2); + double q = (double) u->hp / (double) (unit_max_hp(u) * u->number); + u->race = new_race[RC_GHOUL_LORD]; + u->irace = new_race[RC_GHOUL_LORD]; + scale_number(u,n); + u->hp = (int) (unit_max_hp(u) * u->number * q); + } }