From fa729ba9726872b06ec9aef337241262005a1cf4 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 31 Aug 2016 09:26:48 +0200 Subject: [PATCH] fix mac build with clang 7.3 --- src/kernel/race.c | 2 +- src/kernel/race.test.c | 9 +++++++++ src/spells.c | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/kernel/race.c b/src/kernel/race.c index be9f2ab68..2c22f6c09 100644 --- a/src/kernel/race.c +++ b/src/kernel/race.c @@ -155,7 +155,7 @@ static race *rc_find_i(const char *name) const char *rname = name; race *rc = races; - while (rc && !strcmp(rname, rc->_name) == 0) { + while (rc && strcmp(rname, rc->_name) != 0) { rc = rc->next; } if (!rc && strcmp(name, "uruk") == 0) { diff --git a/src/kernel/race.test.c b/src/kernel/race.test.c index aa37093d4..e8bbfcf29 100644 --- a/src/kernel/race.test.c +++ b/src/kernel/race.test.c @@ -41,11 +41,20 @@ static void test_rc_defaults(CuTest *tc) { test_cleanup(); } +static void test_rc_find(CuTest *tc) { + race *rc; + test_cleanup(); + rc = test_create_race("hungryhippos"); + CuAssertPtrEquals(tc, rc, (void *)rc_find("hungryhippos")); + test_cleanup(); +} + CuSuite *get_race_suite(void) { CuSuite *suite = CuSuiteNew(); SUITE_ADD_TEST(suite, test_rc_name); SUITE_ADD_TEST(suite, test_rc_defaults); + SUITE_ADD_TEST(suite, test_rc_find); return suite; } diff --git a/src/spells.c b/src/spells.c index 1da440df2..e455f7395 100644 --- a/src/spells.c +++ b/src/spells.c @@ -5354,7 +5354,7 @@ int sp_leaveastral(castorder * co) u = pa->param[n]->data.u; if (!ucontact(u, mage)) { - if (power > 10 && !pa->param[n]->flag == TARGET_RESISTS + if (power > 10 && !(pa->param[n]->flag == TARGET_RESISTS) && can_survive(u, rt)) { ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "feedback_no_contact_no_resist", "target", u));