forked from github/server
Merge branch 'develop' of github.com:ennorehling/eressea into develop
This commit is contained in:
commit
144fcbef58
2 changed files with 6 additions and 3 deletions
|
@ -230,7 +230,9 @@ void equipment_done(void) {
|
||||||
equipment *eq = *eqp;
|
equipment *eq = *eqp;
|
||||||
*eqp = eq->next;
|
*eqp = eq->next;
|
||||||
free(eq->name);
|
free(eq->name);
|
||||||
spellbook_clear(eq->spellbook);
|
if (eq->spellbook) {
|
||||||
|
spellbook_clear(eq->spellbook);
|
||||||
|
}
|
||||||
// TODO: items, subsets
|
// TODO: items, subsets
|
||||||
free(eq);
|
free(eq);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ void test_equipment(CuTest * tc)
|
||||||
spell *sp;
|
spell *sp;
|
||||||
sc_mage * mage;
|
sc_mage * mage;
|
||||||
|
|
||||||
test_cleanup();
|
test_setup();
|
||||||
test_create_race("human");
|
test_create_race("human");
|
||||||
enable_skill(SK_MAGIC, true);
|
enable_skill(SK_MAGIC, true);
|
||||||
it_horses = test_create_itemtype("horse");
|
it_horses = test_create_itemtype("horse");
|
||||||
|
@ -36,7 +36,7 @@ void test_equipment(CuTest * tc)
|
||||||
equipment_setskill(eq, SK_MAGIC, "5");
|
equipment_setskill(eq, SK_MAGIC, "5");
|
||||||
equipment_addspell(eq, sp, 1);
|
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);
|
equip_unit_mask(u, eq, EQUIP_ALL);
|
||||||
CuAssertIntEquals(tc, 1, i_get(u->items, it_horses));
|
CuAssertIntEquals(tc, 1, i_get(u->items, it_horses));
|
||||||
CuAssertIntEquals(tc, 5, get_level(u, SK_MAGIC));
|
CuAssertIntEquals(tc, 5, get_level(u, SK_MAGIC));
|
||||||
|
@ -45,6 +45,7 @@ void test_equipment(CuTest * tc)
|
||||||
CuAssertPtrNotNull(tc, mage);
|
CuAssertPtrNotNull(tc, mage);
|
||||||
CuAssertPtrNotNull(tc, mage->spellbook);
|
CuAssertPtrNotNull(tc, mage->spellbook);
|
||||||
CuAssertTrue(tc, u_hasspell(u, sp));
|
CuAssertTrue(tc, u_hasspell(u, sp));
|
||||||
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
CuSuite *get_equipment_suite(void)
|
CuSuite *get_equipment_suite(void)
|
||||||
|
|
Loading…
Reference in a new issue