diff options
| author | Franklin Wei <git@fwei.tk> | 2016-04-16 21:16:44 -0400 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2016-04-16 21:16:44 -0400 |
| commit | a305a931726bc13c604afca1209a656a8fbedc46 (patch) | |
| tree | e8ce29b2354aca21dae1bb1f0b1bc227b34adf17 /src/world.c | |
| parent | cfe28eb7eda17e4a604749fe2f027153a2ac5b6e (diff) | |
| download | netcosm-a305a931726bc13c604afca1209a656a8fbedc46.zip netcosm-a305a931726bc13c604afca1209a656a8fbedc46.tar.gz netcosm-a305a931726bc13c604afca1209a656a8fbedc46.tar.bz2 netcosm-a305a931726bc13c604afca1209a656a8fbedc46.tar.xz | |
allow for modular world loading
Diffstat (limited to 'src/world.c')
| -rw-r--r-- | src/world.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/world.c b/src/world.c index b3bb4b3..d7c3590 100644 --- a/src/world.c +++ b/src/world.c @@ -23,6 +23,20 @@ #include "room.h" #include "world.h" +/* verb classes */ +const struct verb_class_t *netcosm_verb_classes; +size_t netcosm_verb_classes_sz; + +/* object classes */ +const struct obj_class_t *netcosm_obj_classes; +size_t netcosm_obj_classes_sz; + +/* rooms */ +const struct roomdata_t *netcosm_world; +size_t netcosm_world_sz; + +const char *netcosm_world_name; + /* processed world data */ static struct room_t *world; @@ -184,7 +198,10 @@ bool world_load(const char *fname, const struct roomdata_t *data, size_t data_sz read(fd, &world_sz, sizeof(world_sz)); if(world_sz != data_sz) + { + debugf("Incompatible world state.\n"); return false; + } world = calloc(world_sz, sizeof(struct room_t)); @@ -192,10 +209,12 @@ bool world_load(const char *fname, const struct roomdata_t *data, size_t data_sz if(strcmp(name, world_name)) { free(world_name); - debugf("Incompatible world state.\n"); + debugf("Incompatible world state (%s %s).\n", name, world_name); return false; } + debugf("Loading world `%s'.\n", world_name); + obj_set_idcounter(1); size_t n_global_verbs = read_size(fd); |