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
38
src/laws.c
38
src/laws.c
|
@ -183,30 +183,36 @@ static void dumbeffect(unit *u) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void astral_crumble(unit *u) {
|
||||||
|
item **itemp = &u->items;
|
||||||
|
while (*itemp) {
|
||||||
|
item *itm = *itemp;
|
||||||
|
if ((itm->type->flags & ITF_NOTLOST) == 0) {
|
||||||
|
if (itm->type->flags & (ITF_BIG | ITF_ANIMAL | ITF_CURSED)) {
|
||||||
|
ADDMSG(&u->faction->msgs, msg_message("itemcrumble",
|
||||||
|
"unit region item amount",
|
||||||
|
u, u->region, itm->type->rtype, itm->number));
|
||||||
|
i_free(i_remove(itemp, itm));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itemp = &itm->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void age_unit(region * r, unit * u)
|
static void age_unit(region * r, unit * u)
|
||||||
{
|
{
|
||||||
const race *rc = u_race(u);
|
const race *rc = u_race(u);
|
||||||
|
|
||||||
dumbeffect(u);
|
|
||||||
++u->age;
|
++u->age;
|
||||||
if (u->number > 0 && rc->age_unit) {
|
if (u->number > 0 && rc->age_unit) {
|
||||||
rc->age_unit(u);
|
rc->age_unit(u);
|
||||||
}
|
}
|
||||||
if (u->region && is_astral(u->region)) {
|
if (u->attribs) {
|
||||||
item **itemp = &u->items;
|
dumbeffect(u);
|
||||||
while (*itemp) {
|
}
|
||||||
item *itm = *itemp;
|
if (u->items && u->region && is_astral(u->region)) {
|
||||||
if ((itm->type->flags & ITF_NOTLOST) == 0) {
|
astral_crumble(u);
|
||||||
if (itm->type->flags & (ITF_BIG | ITF_ANIMAL | ITF_CURSED)) {
|
|
||||||
ADDMSG(&u->faction->msgs, msg_message("itemcrumble",
|
|
||||||
"unit region item amount",
|
|
||||||
u, u->region, itm->type->rtype, itm->number));
|
|
||||||
i_free(i_remove(itemp, itm));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
itemp = &itm->next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue