forked from github/server
rename: spellbook_clear is more accurate
This commit is contained in:
parent
b8d8bac9ae
commit
6cb4322c1d
4 changed files with 8 additions and 4 deletions
|
@ -288,7 +288,8 @@ void destroyfaction(faction * f)
|
||||||
return;
|
return;
|
||||||
fset(f, FFL_QUIT);
|
fset(f, FFL_QUIT);
|
||||||
|
|
||||||
spellbook_free(f->spellbook);
|
spellbook_clear(f->spellbook);
|
||||||
|
free(f->spellbook);
|
||||||
f->spellbook = 0;
|
f->spellbook = 0;
|
||||||
|
|
||||||
while (f->battles) {
|
while (f->battles) {
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "spellbook.h"
|
#include "spellbook.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
spellbook * create_spellbook(const char * name)
|
spellbook * create_spellbook(const char * name)
|
||||||
{
|
{
|
||||||
spellbook *result = (spellbook *)malloc(sizeof(spellbook));
|
spellbook *result = (spellbook *)malloc(sizeof(spellbook));
|
||||||
|
@ -24,7 +26,7 @@ void spellbook_add(spellbook *sb, struct spell * sp, int level)
|
||||||
ql_push(&sb->spells, sbe);
|
ql_push(&sb->spells, sbe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spellbook_free(spellbook *sb)
|
void spellbook_clear(spellbook *sb)
|
||||||
{
|
{
|
||||||
quicklist *ql;
|
quicklist *ql;
|
||||||
int qi;
|
int qi;
|
||||||
|
|
|
@ -41,7 +41,7 @@ spellbook * create_spellbook(const char * name);
|
||||||
|
|
||||||
void spellbook_add(spellbook *sbp, struct spell * sp, int level);
|
void spellbook_add(spellbook *sbp, struct spell * sp, int level);
|
||||||
int spellbook_foreach(spellbook *sb, int (*callback)(spellbook_entry *, void *), void * data);
|
int spellbook_foreach(spellbook *sb, int (*callback)(spellbook_entry *, void *), void * data);
|
||||||
void spellbook_free(spellbook *sb);
|
void spellbook_clear(spellbook *sb);
|
||||||
spellbook_entry * spellbook_get(spellbook *sb, struct spell * sp);
|
spellbook_entry * spellbook_get(spellbook *sb, struct spell * sp);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -51,7 +51,8 @@ void test_named_spellbooks(CuTest * tc)
|
||||||
spellbook_foreach(sb, count_spell_cb, &counter);
|
spellbook_foreach(sb, count_spell_cb, &counter);
|
||||||
CuAssertIntEquals(tc, 1, counter);
|
CuAssertIntEquals(tc, 1, counter);
|
||||||
#endif
|
#endif
|
||||||
spellbook_free(sb);
|
spellbook_clear(sb);
|
||||||
|
free(sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
CuSuite *get_spellbook_suite(void)
|
CuSuite *get_spellbook_suite(void)
|
||||||
|
|
Loading…
Reference in a new issue