From e7739867df82c8c598d6d66b632a51e33364b2fa Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 19 Sep 2016 03:55:12 +0200 Subject: [PATCH] use curse_type caching in att_modification --- src/kernel/unit.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kernel/unit.c b/src/kernel/unit.c index f0636b681..08f9314f3 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -1279,8 +1279,12 @@ static int att_modification(const unit * u, skill_t sk) if (u->attribs) { curse *c; - const curse_type *skillmod_ct = ct_find("skillmod"); - const curse_type *worse_ct = ct_find("worse"); + static int cache; + static const curse_type *skillmod_ct, *worse_ct; + if (ct_changed(&cache)) { + skillmod_ct = ct_find("skillmod"); + worse_ct = ct_find("worse"); + } c = get_curse(u->attribs, worse_ct); if (c != NULL) result += curse_geteffect(c);