fix NOTLOST items lost in battle

This commit is contained in:
Steffen Mecke 2018-09-12 09:41:18 +02:00 committed by Enno Rehling
parent 6a9cea219c
commit 5455037dbc
1 changed files with 15 additions and 18 deletions

View File

@ -1123,26 +1123,23 @@ static bool survives(fighter *af, troop dt, battle *b) {
}
static void destroy_items(troop dt) {
unit *du = dt.fighter->unit;
unit *du = dt.fighter->unit;
item **pitm;
item **pitm;
for (pitm = &du->items; *pitm;) {
item *itm = *pitm;
const item_type *itype = itm->type;
if (!(itype->flags & ITF_CURSED) && dt.index < itm->number) {
/* 25% Grundchance, das ein Item kaputtgeht. */
if (rng_int() % 4 < 1) {
i_change(pitm, itype, -1);
}
if (*pitm == itm) {
pitm = &itm->next;
}
}
else {
pitm = &itm->next;
}
}
for (pitm = &du->items; *pitm;) {
item *itm = *pitm;
const item_type *itype = itm->type;
if (!(itype->flags & (ITF_CURSED | ITF_NOTLOST)) && dt.index < itm->number) {
/* 25% Grundchance, dass ein Item kaputtgeht. */
if (rng_int() % 4 < 1) {
i_change(pitm, itype, -1);
}
}
if (*pitm == itm) {
pitm = &itm->next;
}
}
}
static void calculate_defense_type(troop at, troop dt, int type, bool missile,