From 0730fc3924dd4e04efbe51287d1d69850404d05f Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 31 Jan 2016 19:53:45 -0500 Subject: bump version to 0.5.0-rc1 * implements objects using reference counts rather than copying * implements both room-local and global verbs * refactors the world_* functions into a separate module * numerous other changes --- src/obj.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/obj.h') diff --git a/src/obj.h b/src/obj.h index 240b4a9..ff26399 100644 --- a/src/obj.h +++ b/src/obj.h @@ -52,9 +52,8 @@ struct obj_class_t { * NULL: can drop */ bool (*hook_drop)(struct object_t*, user_t *user); - void* (*hook_clone)(void*); /* clone the user data pointer */ - void (*hook_destroy)(struct object_t*); - const char* (*hook_desc)(struct object_t*, user_t*); + void (*hook_destroy)(struct object_t*); // free resources + const char* (*hook_desc)(struct object_t*, user_t*); // get object description }; struct object_t { @@ -64,6 +63,8 @@ struct object_t { bool list; + unsigned refcount; + void *userdata; }; @@ -76,10 +77,11 @@ void obj_write(int fd, struct object_t *obj); /* deserialize an object */ struct object_t *obj_read(int fd); -/* make a duplicate of an object - * used for "moving" an object */ +/* this used to actually make a duplicate of an object... + * now it just increments its reference count */ struct object_t *obj_dup(struct object_t *obj); +/* this only frees the object if its reference count is zero */ void obj_free(void*); /* shut down the obj_* module */ -- cgit v1.1