aboutsummaryrefslogtreecommitdiff
path: root/src/verb.h
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2016-01-31 19:53:45 -0500
committerFranklin Wei <frankhwei536@gmail.com>2016-01-31 19:53:45 -0500
commit0730fc3924dd4e04efbe51287d1d69850404d05f (patch)
tree495d79d0dc26e39c9065c6ceb7d16b9a3e76561d /src/verb.h
parent8405274a91e3652ee98a423608a8496ead1edc05 (diff)
downloadnetcosm-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/verb.h')
-rw-r--r--src/verb.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/verb.h b/src/verb.h
new file mode 100644
index 0000000..cdfbe98
--- /dev/null
+++ b/src/verb.h
@@ -0,0 +1,55 @@
+/*
+ * 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 "room.h"
+
+/* the verb API is modeled after that of obj_*, this allows for
+ * dynamic creation/deletion of verbs, but is also easily
+ * serializable.
+ *
+ * so, all verbs are part of a verb class, which has all of its
+ * callbacks.
+ */
+
+struct verb_t;
+struct verb_class_t {
+ const char *class_name;
+
+ void (*hook_exec)(struct verb_t*, char *args, user_t *user);
+};
+
+struct verb_t {
+ char *name;
+
+ struct verb_class_t *class;
+};
+
+struct verb_t *verb_new(const char *class);
+
+void verb_write(int fd, struct verb_t*);
+
+struct verb_t *verb_read(int fd);
+
+void verb_free(void *verb);
+
+/* free the verb_ module's internal data structures */
+void verb_shutdown(void);