forked from github/server
refactoring for readability
This commit is contained in:
parent
9ff04ec6db
commit
7db82ba21e
1 changed files with 22 additions and 16 deletions
26
src/laws.c
26
src/laws.c
|
@ -183,16 +183,7 @@ static void dumbeffect(unit *u) {
|
|||
}
|
||||
}
|
||||
|
||||
static void age_unit(region * r, unit * u)
|
||||
{
|
||||
const race *rc = u_race(u);
|
||||
|
||||
dumbeffect(u);
|
||||
++u->age;
|
||||
if (u->number > 0 && rc->age_unit) {
|
||||
rc->age_unit(u);
|
||||
}
|
||||
if (u->region && is_astral(u->region)) {
|
||||
static void astral_crumble(unit *u) {
|
||||
item **itemp = &u->items;
|
||||
while (*itemp) {
|
||||
item *itm = *itemp;
|
||||
|
@ -208,6 +199,21 @@ static void age_unit(region * r, unit * u)
|
|||
itemp = &itm->next;
|
||||
}
|
||||
}
|
||||
|
||||
static void age_unit(region * r, unit * u)
|
||||
{
|
||||
const race *rc = u_race(u);
|
||||
|
||||
++u->age;
|
||||
if (u->number > 0 && rc->age_unit) {
|
||||
rc->age_unit(u);
|
||||
}
|
||||
if (u->attribs) {
|
||||
dumbeffect(u);
|
||||
}
|
||||
if (u->items && u->region && is_astral(u->region)) {
|
||||
astral_crumble(u);
|
||||
}
|
||||
}
|
||||
|
||||
static void live(region * r)
|
||||
|
|
Loading…
Reference in a new issue