From 40dbe2b0cb108ac3efce74406d8ea11f5b6f0aef Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 17 Jun 2016 21:49:31 +0200 Subject: [PATCH] delete old healing effects on read remove obsolete effect-handling from battle.c --- src/alchemy.c | 4 ++++ src/battle.c | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/alchemy.c b/src/alchemy.c index 5419be4ee..5e369a3e1 100644 --- a/src/alchemy.c +++ b/src/alchemy.c @@ -318,6 +318,10 @@ static int a_readeffect(attrib * a, void *owner, struct gamedata *data) if (rtype == NULL || rtype->ptype == NULL || power <= 0) { 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->value = power; return AT_READ_OK; diff --git a/src/battle.c b/src/battle.c index 422271bbc..217f73c34 100644 --- a/src/battle.c +++ b/src/battle.c @@ -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 ((get_effect(du, oldpotiontype[P_HEAL]) || i_get(du->items, oldpotiontype[P_HEAL]->itype) > 0)) { - if (get_effect(du, oldpotiontype[P_HEAL])) - change_effect(du, oldpotiontype[P_HEAL], -1); - else - i_change(&du->items, oldpotiontype[P_HEAL]->itype, -1); + if (i_get(du->items, oldpotiontype[P_HEAL]->itype) > 0) { + i_change(&du->items, oldpotiontype[P_HEAL]->itype, -1); message *m = msg_message("battle::potionsave", "unit", du); message_faction(b, du->faction, m); msg_release(m);