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/world.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/world.h')
| -rw-r--r-- | src/world.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/world.h b/src/world.h new file mode 100644 index 0000000..5d9ccae --- /dev/null +++ b/src/world.h @@ -0,0 +1,61 @@ +/* + * NetCosm - a MUD server + * Copyright (C) 2016 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#include "globals.h" + +#include "obj.h" +#include "room.h" +#include "verb.h" + +/* the world module MUST define all of the following: */ + +/* verb classes */ +extern const struct verb_class_t netcosm_verb_classes[]; +extern const size_t netcosm_verb_classes_sz; + +/* object classes */ +extern const struct obj_class_t netcosm_obj_classes[]; +extern const size_t netcosm_obj_classes_sz; + +/* rooms */ +extern const struct roomdata_t netcosm_world[]; +extern const size_t netcosm_world_sz; + +extern const char *netcosm_world_name; + +/*** loads the world into RAM for the first time, resets the game state ***/ +void world_init(const struct roomdata_t *data, size_t sz, const char *name); + +void world_save(const char *fname); + +/* loads the world from disk */ +bool world_load(const char *fname, const struct roomdata_t *data, size_t data_sz, const char *world_name); + +/** verbs **/ +bool world_verb_add(struct verb_t*); +bool world_verb_del(struct verb_t*); + +/* gets the map of verbs */ +void *world_verb_map(void); + +void world_free(void); + +/* this goes in world_ and not room_ */ +struct room_t *room_get(room_id id); |