Merge branch 'develop' of github.com:ennorehling/eressea into develop

This commit is contained in:
Enno Rehling 2016-09-07 20:48:16 +02:00
commit 144fcbef58
2 changed files with 6 additions and 3 deletions

View File

@ -230,7 +230,9 @@ void equipment_done(void) {
equipment *eq = *eqp;
*eqp = eq->next;
free(eq->name);
spellbook_clear(eq->spellbook);
if (eq->spellbook) {
spellbook_clear(eq->spellbook);
}
// TODO: items, subsets
free(eq);
}

View File

@ -20,7 +20,7 @@ void test_equipment(CuTest * tc)
spell *sp;
sc_mage * mage;
test_cleanup();
test_setup();
test_create_race("human");
enable_skill(SK_MAGIC, true);
it_horses = test_create_itemtype("horse");
@ -36,7 +36,7 @@ void test_equipment(CuTest * tc)
equipment_setskill(eq, SK_MAGIC, "5");
equipment_addspell(eq, sp, 1);
u = test_create_unit(test_create_faction(0), 0);
u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
equip_unit_mask(u, eq, EQUIP_ALL);
CuAssertIntEquals(tc, 1, i_get(u->items, it_horses));
CuAssertIntEquals(tc, 5, get_level(u, SK_MAGIC));
@ -45,6 +45,7 @@ void test_equipment(CuTest * tc)
CuAssertPtrNotNull(tc, mage);
CuAssertPtrNotNull(tc, mage->spellbook);
CuAssertTrue(tc, u_hasspell(u, sp));
test_cleanup();
}
CuSuite *get_equipment_suite(void)