Main Page | Data Structures | File List | Globals

item.h

Go to the documentation of this file.
00001 /* 00002 Copyright 2004 John Tsiombikas <nuclear@siggraph.org> 00003 00004 This file is part of the MUD project by The Lab Software. 00005 00006 MUD is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 MUD is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with MUD; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00023 #ifndef _ITEM_H_ 00024 #define _ITEM_H_ 00025 00026 #include "item_types.h" 00027 #include "combat.h" 00028 00029 /* this is ugly, but helps implement polymorphic behaviour easily */ 00030 #define ITEM_MEMBER_VARS \ 00031 char *name, *desc;\ 00032 enum item_type type;\ 00033 unsigned int weight 00034 00036 struct item { 00037 ITEM_MEMBER_VARS; 00038 }; 00039 00041 struct food { 00042 ITEM_MEMBER_VARS; 00043 int value; 00044 }; 00045 00047 struct drink { 00048 ITEM_MEMBER_VARS; 00049 int value; 00050 }; 00051 00053 struct gear { 00054 ITEM_MEMBER_VARS; 00055 enum gear_type gear_type; 00056 00057 int ac; 00058 }; 00059 00061 struct weapon { 00062 ITEM_MEMBER_VARS; 00063 enum damage_type damage_type; 00064 00065 int range; /* 0 to signify non-ranged weapons */ 00066 int ammo; /* for ranged weapons */ 00067 00068 enum dice damage_dice; 00069 int dice_count; 00070 int magic_bonus; 00071 }; 00072 00074 struct text { 00075 ITEM_MEMBER_VARS; 00076 char *text; 00077 }; 00078 00080 struct container { 00081 ITEM_MEMBER_VARS; 00082 int count, max; 00083 struct item **items; 00084 }; 00085 00086 void set_item_name(struct item *item, const char *name); 00087 void set_item_desc(struct item *item, const char *desc); 00088 void set_text_contents(struct text *text, const char *contents); 00089 00090 void destroy_item(struct item *item); 00091 struct container *create_container(int size); 00092 void destroy_container(struct container *cont); 00093 00094 #endif /* _ITEM_H_ */

Generated on Thu Sep 9 00:52:33 2004 for MUD by doxygen 1.3.8