diff options
Diffstat (limited to 'src/userdb.c')
| -rw-r--r-- | src/userdb.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/userdb.c b/src/userdb.c index 0ebe159..14e9fd8 100644 --- a/src/userdb.c +++ b/src/userdb.c @@ -26,6 +26,7 @@ #include "server.h" #include "server_reqs.h" #include "userdb.h" +#include "world.h" static void *map = NULL; static char *db_file = NULL; @@ -101,6 +102,10 @@ void userdb_init(const char *file) } } + /* now we read in the world module's data, if possible */ + if(netcosm_read_userdata_cb) + data->userdata = netcosm_read_userdata_cb(fd); + hash_insert(map, data->username, data); } @@ -124,8 +129,10 @@ bool userdb_write(const char *file) if(!user) break; + /* dump structure */ write(fd, user, sizeof(*user)); + /* now go back and write what the pointers are pointing at */ size_t n_objects; if(user->objects) n_objects = obj_count_noalias(user->objects); @@ -158,6 +165,12 @@ bool userdb_write(const char *file) } } } + + /* write world module's data, if possible */ + if(netcosm_write_userdata_cb) + { + netcosm_write_userdata_cb(fd, user->userdata); + } } close(fd); |