2012-05-23 21:42:14 +02:00
|
|
|
/*
|
2015-01-30 22:10:29 +01:00
|
|
|
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
2015-01-30 20:37:14 +01:00
|
|
|
Katja Zedel <katze@felidae.kn-bremen.de
|
|
|
|
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
2012-05-23 21:42:14 +02:00
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef H_KRNL_SPELLBOOK_H
|
|
|
|
#define H_KRNL_SPELLBOOK_H
|
|
|
|
|
2018-05-05 07:38:11 +02:00
|
|
|
#include "spell.h"
|
|
|
|
|
2012-05-23 21:42:14 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-11-14 01:22:50 +01:00
|
|
|
struct storage;
|
|
|
|
struct gamedata;
|
2017-01-26 17:41:21 +01:00
|
|
|
struct selist;
|
2012-05-23 21:42:14 +02:00
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
typedef struct spellbook_entry {
|
2018-05-05 07:38:11 +02:00
|
|
|
spellref spref;
|
2015-01-30 20:37:14 +01:00
|
|
|
int level;
|
|
|
|
} spellbook_entry;
|
2012-05-23 21:42:14 +02:00
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
typedef struct spellbook
|
|
|
|
{
|
|
|
|
char * name;
|
2017-01-26 17:41:21 +01:00
|
|
|
struct selist * spells;
|
2015-01-30 20:37:14 +01:00
|
|
|
} spellbook;
|
2012-05-23 21:42:14 +02:00
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
spellbook * create_spellbook(const char * name);
|
2012-05-23 21:42:14 +02:00
|
|
|
|
2016-11-14 01:22:50 +01:00
|
|
|
void read_spellbook(struct spellbook **bookp, struct gamedata *data, int(*get_level)(const struct spell * sp, void *), void * cbdata);
|
|
|
|
void write_spellbook(const struct spellbook *book, struct storage *store);
|
|
|
|
|
2017-02-02 20:08:04 +01:00
|
|
|
void spellbook_add(spellbook *sbp, struct spell *sp, int level);
|
2018-05-05 07:38:11 +02:00
|
|
|
void spellbook_addref(spellbook *sb, const char *name, int level);
|
2015-01-30 20:37:14 +01:00
|
|
|
int spellbook_foreach(spellbook *sb, int(*callback)(spellbook_entry *, void *), void * data);
|
|
|
|
void spellbook_clear(spellbook *sb);
|
2017-02-02 20:08:04 +01:00
|
|
|
spellbook_entry * spellbook_get(spellbook *sb, const struct spell *sp);
|
2012-05-23 21:42:14 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|