forked from github/server
config cleanup contd.
createunit => create_unit, everywhere. make_undead_unit in zombies.c
This commit is contained in:
parent
4bb65873da
commit
901c70efd9
12
src/chaos.c
12
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)
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void register_races(void);
|
||||
void register_races(void);
|
||||
void make_undead_unit(struct unit *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
/* kernel includes */
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/region.h>
|
||||
|
@ -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;
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
#include <kernel/xmlreader.h>
|
||||
#include <kernel/version.h>
|
||||
|
||||
#include <races/races.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/base36.h>
|
||||
|
|
Loading…
Reference in New Issue