delete old healing effects on read

remove obsolete effect-handling from battle.c
This commit is contained in:
Enno Rehling 2016-06-17 21:49:31 +02:00
parent e6907f570e
commit 40dbe2b0cb
2 changed files with 6 additions and 5 deletions

View File

@ -318,6 +318,10 @@ static int a_readeffect(attrib * a, void *owner, struct gamedata *data)
if (rtype == NULL || rtype->ptype == NULL || power <= 0) { if (rtype == NULL || rtype->ptype == NULL || power <= 0) {
return AT_READ_FAIL; return AT_READ_FAIL;
} }
if (rtype->ptype==oldpotiontype[P_HEAL]) {
// healing potions used to have long-term effects
return AT_READ_FAIL;
}
edata->type = rtype->ptype; edata->type = rtype->ptype;
edata->value = power; edata->value = power;
return AT_READ_OK; return AT_READ_OK;

View File

@ -1323,11 +1323,8 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
} }
if (oldpotiontype[P_HEAL] && !fval(&df->person[dt.index], FL_HEALING_USED)) { if (oldpotiontype[P_HEAL] && !fval(&df->person[dt.index], FL_HEALING_USED)) {
if ((get_effect(du, oldpotiontype[P_HEAL]) || i_get(du->items, oldpotiontype[P_HEAL]->itype) > 0)) { if (i_get(du->items, oldpotiontype[P_HEAL]->itype) > 0) {
if (get_effect(du, oldpotiontype[P_HEAL])) i_change(&du->items, oldpotiontype[P_HEAL]->itype, -1);
change_effect(du, oldpotiontype[P_HEAL], -1);
else
i_change(&du->items, oldpotiontype[P_HEAL]->itype, -1);
message *m = msg_message("battle::potionsave", "unit", du); message *m = msg_message("battle::potionsave", "unit", du);
message_faction(b, du->faction, m); message_faction(b, du->faction, m);
msg_release(m); msg_release(m);