aboutsummaryrefslogtreecommitdiff
path: root/src/world.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/world.h')
-rw-r--r--src/world.h61
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);