#include "field_of_view.h" /* build_fov_map() */
#include "hardcoded_strings.h" /* s */
#include "things.h" /* Thing, ThingType, get_player(), own_thing(),
- * set_thing_position(), get_thing_type()
+ * set_thing_position(), get_thing_type(),
+ * free_things_in_memory()
*/
#include "map.h" /* is_passable() */
#include "yx_uint8.h" /* mv_yx_in_dir(), yx_uint8_cmp() */
hitted->fov_map = NULL;
free(hitted->mem_map);
hitted->mem_map = NULL;
+ free_things_in_memory(hitted->t_mem);
+ hitted->t_mem = NULL;
}
update_log(" It dies.");
}
-/* Free ThingsInMemory chain starting at "tm". */
-static void free_things_in_memory(struct ThingInMemory * tm);
-
/* To linked list of NextAndId structs (or rather structs whose start region is
* compatible to it) starting at "start", add newly allocated element of
* "n_size" and an ID that is either "id" or, if "id" is <= UINT8_MAX and >=
-static void free_things_in_memory(struct ThingInMemory * tm)
-{
- if (!tm)
- {
- return;
- }
- free_things_in_memory(tm->next);
- free(tm);
-}
-
-
-
static struct NextAndId * add_to_struct_list(size_t n_size, uint8_t start_id,
int16_t id, uint8_t struct_id,
struct NextAndId ** start)
+extern void free_things_in_memory(struct ThingInMemory * tm)
+{
+ if (!tm)
+ {
+ return;
+ }
+ free_things_in_memory(tm->next);
+ free(tm);
+}
+
+
+
extern struct ThingAction * get_thing_action(uint8_t id)
{
struct ThingAction * ta = world.thing_actions;
extern void add_thing_to_memory_map(struct Thing * t, uint8_t type,
uint8_t y, uint8_t x);
-/* Free ThingAction/ThingType/Thing chain starting at "ta"/"tt"/"t". */
+/* Free ThingAction / ThingType / Thing / ThingInMemory chain starting at "ta" /
+ * "tt" / "t" / "tm".
+ */
extern void free_thing_actions(struct ThingAction * ta);
extern void free_thing_types(struct ThingType * tt);
extern void free_things(struct Thing * t);
+extern void free_things_in_memory(struct ThingInMemory * tm);
/* Return pointer to ThingAction/ThingType of "id", or NULL if none found. */
extern struct ThingAction * get_thing_action(uint8_t id);