/***************************************************************************
invitem.h - description
-------------------
begin : Sat Jan 22 2000
copyright : (C) 2000 by Daniel Roberge
email : droberge@uvic.ca
***************************************************************************/
#ifndef _INVITEM_H
#define _INVITEM_H
#define WP_FLAG 0x01
#define AR_FLAG 0x02
#define SH_FLAG 0x04
#define ACC_FLAG 0x08
#define POT_FLAG 0x10
#define TREAS_FLAG 0x20
#define DT_SLASH 0
#define DT_PIERCE 1
#define DT_BLUDGEON 2
#define DT_MISSILE 3
/**Represents any item that can be stored in a character's inventory.
*@author Daniel Roberge
*/
//typedef enum {Weapon,Armour,Shield,Accessory,Potion,Treasure} InventoryType;
typedef unsigned char InventoryType;
class InventoryItem
{
protected:
char *name;
int weight;
bool equippable,useable,breakable;
char flags;
/**Sets all flags contained in arg*/
void setFlag(char arg);
/**Clears all flags contained in arg*/
void clearFlag(char arg);
/**If all flags in arg are set returns true otherwise returns false*/
bool checkFlag(char arg);
public:
InventoryItem(char *,int,bool,bool,bool);
virtual ~InventoryItem();
/**Returns true if you cannot equip or use the item*/
bool isUseless(void) { return ((!equippable) && (!useable)); };
/**Returns true if you can equip the item*/
bool isEquippable(void) { return equippable; };
/**Returns true if you can use the item*/
bool isUseable(void) { return useable; };
/**Returns true if the item can break*/
bool isBreakable(void) { return breakable; };
/**Returns the weight of the item*/
int getWeight(void) { return weight; };
/**Returns the name of the item*/
char *getName(void) { return name; };
/**Returns the type of item as expressed in flag constants*/
virtual InventoryType getType() = 0;
};
//void *NULL = 0;
typedef InventoryItem& RInventoryItem;
typedef InventoryItem* PInventoryItem;
#endif
| Generated by: droberge@magebook.localdomain on Mon Jul 3 13:20:08 200. |