From c16a56c39f76bc6bda54607f5ca6a8142f554462 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 26 May 2015 22:29:42 -0400 Subject: [PATCH] Start implementing the world of the vm --- source/world.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 source/world.c diff --git a/source/world.c b/source/world.c new file mode 100644 index 0000000..de7f18b --- /dev/null +++ b/source/world.c @@ -0,0 +1,32 @@ +/** + @file world.c.c + @brief See header for details + */ +//#include "world.h" + +#include "map.h" + +typedef struct { + map_t* parent; + map_t* self; + uint8_t data[]; +} object_t; + +void object_free(void* obj) +{ + object_t* object = (object_t*)obj; + if (object->parent) + mem_release(object->parent); + if (object->self) + mem_release(object->self); +} + +object_t* object_clone(object_t* parent) +{ + object_t* obj = (object_t*)mem_allocate(sizeof(object_t), &object_free); + obj->parent = (NULL == parent) ? NULL : mem_retain(parent->self); + obj->self = map_new(NULL, NULL); + return obj; +} + + -- 2.55.0