diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2016-01-31 19:53:45 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2016-01-31 19:53:45 -0500 |
| commit | 0730fc3924dd4e04efbe51287d1d69850404d05f (patch) | |
| tree | 495d79d0dc26e39c9065c6ceb7d16b9a3e76561d /src/obj.h | |
| parent | 8405274a91e3652ee98a423608a8496ead1edc05 (diff) | |
| download | netcosm-0.5.0-rc1.zip netcosm-0.5.0-rc1.tar.gz netcosm-0.5.0-rc1.tar.bz2 netcosm-0.5.0-rc1.tar.xz | |
bump version to 0.5.0-rc10.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
Diffstat (limited to 'src/obj.h')
| -rw-r--r-- | src/obj.h | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 */ |