diff --git a/src/chaos.c b/src/chaos.c index 476c36f67..24ee6d0b1 100644 --- a/src/chaos.c +++ b/src/chaos.c @@ -156,20 +156,20 @@ static void chaos(region * r) case 0: mfac = 100; u = - createunit(r, get_monsters(), rng_int() % 8 + 1, - get_race(RC_FIREDRAGON)); + create_unit(r, get_monsters(), rng_int() % 8 + 1, + get_race(RC_FIREDRAGON), 0, NULL, NULL); break; case 1: mfac = 500; u = - createunit(r, get_monsters(), rng_int() % 4 + 1, - get_race(RC_DRAGON)); + create_unit(r, get_monsters(), rng_int() % 4 + 1, + get_race(RC_DRAGON), 0, NULL, NULL); break; default: mfac = 1000; u = - createunit(r, get_monsters(), rng_int() % 2 + 1, - get_race(RC_WYRM)); + create_unit(r, get_monsters(), rng_int() % 2 + 1, + get_race(RC_WYRM), 0, NULL, NULL); break; } if (mfac) diff --git a/src/kernel/config.c b/src/kernel/config.c index 63f05761b..c12c0a2f2 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -957,12 +957,6 @@ int newcontainerid(void) return random_no; } -unit *createunit(region * r, faction * f, int number, const struct race * rc) -{ - assert(rc); - return create_unit(r, f, number, rc, 0, NULL, NULL); -} - bool idle(faction * f) { return (bool)(f ? false : true); @@ -1344,13 +1338,6 @@ int weight(const unit * u) return n; } -void make_undead_unit(unit * u) -{ - free_orders(&u->orders); - name_unit(u); - fset(u, UFL_ISNEW); -} - unsigned int guard_flags(const unit * u) { unsigned int flags = diff --git a/src/kernel/config.h b/src/kernel/config.h index 58aa0e1df..701866d6f 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -104,9 +104,6 @@ extern "C" { int max_magicians(const struct faction * f); int findoption(const char *s, const struct locale *lang); - /* special units */ - void make_undead_unit(struct unit *); - param_t findparam(const char *s, const struct locale *lang); param_t findparam_ex(const char *s, const struct locale * lang); bool isparam(const char *s, const struct locale * lang, param_t param); @@ -131,9 +128,6 @@ extern "C" { int forbiddenid(int id); int newcontainerid(void); - struct unit *createunit(struct region *r, struct faction *f, - int number, const struct race *rc); - void create_unitid(struct unit *u, int id); int getunit(const struct region * r, const struct faction * f, struct unit **uresult); int read_unitid(const struct faction *f, const struct region *r); diff --git a/src/kernel/faction.c b/src/kernel/faction.c index 731d817bb..db317ee8f 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -258,7 +258,7 @@ unit *addplayer(region * r, faction * f) assert(f->units == NULL); set_ursprung(f, 0, r->x, r->y); - u = createunit(r, f, 1, f->race); + u = create_unit(r, f, 1, f->race, 0, NULL, NULL); equip_items(&u->faction->items, get_equipment("new_faction")); equip_unit(u, get_equipment("first_unit")); sprintf(buffer, "first_%s", u_race(u)->_name); diff --git a/src/kernel/teleport.c b/src/kernel/teleport.c index 2fc7794f1..d0f5db424 100644 --- a/src/kernel/teleport.c +++ b/src/kernel/teleport.c @@ -159,8 +159,8 @@ void spawn_braineaters(float chance) /* Neues Monster ? */ if (next-- == 0) { unit *u = - createunit(r, f0, 1 + rng_int() % 10 + rng_int() % 10, - get_race(RC_HIRNTOETER)); + create_unit(r, f0, 1 + rng_int() % 10 + rng_int() % 10, + get_race(RC_HIRNTOETER), 0, NULL, NULL); equip_unit(u, get_equipment("monster_braineater")); next = rng_int() % (int)(chance * 100); diff --git a/src/modules/arena.c b/src/modules/arena.c index ff752a5a4..1ce4763a5 100644 --- a/src/modules/arena.c +++ b/src/modules/arena.c @@ -367,7 +367,7 @@ static void guardian_faction(plane * pl, int id) } if (u) continue; - u = createunit(r, f, 1, get_race(RC_GOBLIN)); + u = create_unit(r, f, 1, get_race(RC_GOBLIN), 0, NULL, NULL); set_string(&u->name, "Igjarjuks Auge"); i_change(&u->items, it_find("roi"), 1); set_order(&u->thisorder, NULL); diff --git a/src/monsters.c b/src/monsters.c index 93242dfa7..8c3f5bcf6 100644 --- a/src/monsters.c +++ b/src/monsters.c @@ -630,7 +630,7 @@ static void recruit_dracoids(unit * dragon, int size) region *r = dragon->region; const struct item *weapon = NULL; order *new_order = NULL; - unit *un = createunit(r, f, size, get_race(RC_DRACOID)); + unit *un = create_unit(r, f, size, get_race(RC_DRACOID), 0, NULL, NULL); fset(un, UFL_ISNEW | UFL_MOVED); @@ -908,7 +908,7 @@ void spawn_dragons(void) unit *u; if (fval(r->terrain, SEA_REGION) && rng_int() % 10000 < 1) { - u = createunit(r, monsters, 1, get_race(RC_SEASERPENT)); + u = create_unit(r, monsters, 1, get_race(RC_SEASERPENT), 0, NULL, NULL); fset(u, UFL_ISNEW | UFL_MOVED); equip_unit(u, get_equipment("monster_seaserpent")); } @@ -918,9 +918,9 @@ void spawn_dragons(void) || r->terrain == newterrain(T_DESERT)) && rng_int() % 10000 < (5 + 100 * chaosfactor(r))) { if (chance(0.80)) { - u = createunit(r, monsters, nrand(60, 20) + 1, get_race(RC_FIREDRAGON)); + u = create_unit(r, monsters, nrand(60, 20) + 1, get_race(RC_FIREDRAGON), 0, NULL, NULL); } else { - u = createunit(r, monsters, nrand(30, 20) + 1, get_race(RC_DRAGON)); + u = create_unit(r, monsters, nrand(30, 20) + 1, get_race(RC_DRAGON), 0, NULL, NULL); } fset(u, UFL_ISNEW | UFL_MOVED); equip_unit(u, get_equipment("monster_dragon")); @@ -983,7 +983,7 @@ void spawn_undead(void) break; } - u = createunit(r, monsters, undead, rc); + u = create_unit(r, monsters, undead, rc, 0, NULL, NULL); fset(u, UFL_ISNEW | UFL_MOVED); if ((rc == get_race(RC_SKELETON) || rc == get_race(RC_ZOMBIE)) && rng_int() % 10 < 4) { diff --git a/src/races/races.h b/src/races/races.h index 94e5633bc..ac75cb75b 100644 --- a/src/races/races.h +++ b/src/races/races.h @@ -15,7 +15,8 @@ extern "C" { #endif - extern void register_races(void); + void register_races(void); + void make_undead_unit(struct unit *); #ifdef __cplusplus } diff --git a/src/races/zombies.c b/src/races/zombies.c index 97a826c3f..ed7ee4e86 100644 --- a/src/races/zombies.c +++ b/src/races/zombies.c @@ -17,6 +17,7 @@ /* kernel includes */ #include +#include #include #include #include @@ -35,6 +36,13 @@ #define age_chance(a,b,p) (_max(0,a-b)*p) +void make_undead_unit(unit * u) +{ + free_orders(&u->orders); + name_unit(u); + fset(u, UFL_ISNEW); +} + void age_undead(unit * u) { region *r = u->region; diff --git a/src/spells.c b/src/spells.c index 913403341..2313cc6f2 100644 --- a/src/spells.c +++ b/src/spells.c @@ -56,6 +56,8 @@ #include #include +#include + /* util includes */ #include #include