From 0730fc3924dd4e04efbe51287d1d69850404d05f Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 31 Jan 2016 19:53:45 -0500 Subject: bump version to 0.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 --- src/verb.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/verb.h (limited to 'src/verb.h') 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 . + */ + +#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); -- cgit v1.1