From a175c842324e72020dda51883ec8f8d053b4a451 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 8 Oct 2017 09:10:41 +0200 Subject: [PATCH] =?UTF-8?q?create=5Fmage=20sollte=20ein=20existierendes=20?= =?UTF-8?q?at=5Fmage=20nicht=20=C3=BCberschreiben,=20nur=20evtl.=20aktuali?= =?UTF-8?q?sieren.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/magic.c | 8 +++----- src/study.c | 5 +---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/magic.c b/src/magic.c index 7ec220875..f83e31a7d 100644 --- a/src/magic.c +++ b/src/magic.c @@ -488,12 +488,10 @@ sc_mage *create_mage(unit * u, magic_t mtyp) attrib *a; a = a_find(u->attribs, &at_mage); - if (a != NULL) { - a_remove(&u->attribs, a); + if (a == NULL) { + a = a_add(&u->attribs, a_new(&at_mage)); } - a = a_add(&u->attribs, a_new(&at_mage)); - mage = a->data.v; - + mage = (sc_mage *)a->data.v; mage->magietyp = mtyp; return mage; } diff --git a/src/study.c b/src/study.c index 88550fc30..9d37a7648 100644 --- a/src/study.c +++ b/src/study.c @@ -613,8 +613,6 @@ int study_cmd(unit * u, order * ord) /* Vertraute zaehlen nicht zu den Magiern einer Partei, * koennen aber nur Graue Magie lernen */ mtyp = M_GRAY; - if (!is_mage(u)) - create_mage(u, mtyp); } else if (!has_skill(u, SK_MAGIC)) { int mmax = skill_limit(u->faction, SK_MAGIC); @@ -654,8 +652,7 @@ int study_cmd(unit * u, order * ord) u->faction->magiegebiet = mtyp; } } - if (!is_mage(u)) - create_mage(u, mtyp); + create_mage(u, mtyp); } else { /* ist schon ein Magier und kein Vertrauter */