00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef __cplusplus
00024
00025 # ifndef OGS_CORE_ITEM_H
00026 # define OGS_CORE_ITEM_H
00027
00028 # include <string>
00029
00030 # include <ogs/support/Attachable.h>
00031 # include <ogs/core/Entity.h>
00032 # include <ogs/core/Namespace.h>
00033
00034 OGS_BEGIN_CORE_NAMESPACE
00035
00041 class Item: public Entity, public ogs::support::Attachable {
00042 public:
00047 typedef double Worth;
00048
00052 typedef std::string Material;
00053
00058 typedef unsigned Hardness;
00059
00064 typedef double Thickness;
00065
00070 typedef Entity::Health Density;
00071
00072 virtual bool attachObject (Object& object);
00073 virtual bool detachObject ();
00074 Object* getObject () const;
00075
00076 Worth getWorth () const;
00077 void setWorth (Worth worth);
00078
00079 virtual ~Item () = 0;
00080
00081 protected:
00082 Item (Entity::Weight weight = 0.0,
00083 Size::Type size = Size::MEDIUM,
00084 Worth worth = 0.0);
00085
00086 virtual bool canEquip (const Object& object) const;
00087
00088 private:
00089 Worth _worth;
00090 Material _material;
00091 Hardness _hardness;
00092 Thickness _thickness;
00093 Density _density;
00094 Object* _object;
00095 };
00096
00104 inline bool
00105 Item::detachObject () {
00106 this->_object = NULL;
00107 return (true);
00108 }
00109
00118 inline bool
00119 Item::canEquip (const Object& object) const {
00120 return (false);
00121 }
00122
00130 inline ogs::support::Object*
00131 Item::getObject () const {
00132 return (this->_object);
00133 }
00134
00140 inline Item::Worth
00141 Item::getWorth () const {
00142 return (this->_worth);
00143 }
00144
00145 inline Item::~Item () { }
00146
00147 OGS_END_CORE_NAMESPACE
00148
00149 # endif
00150
00151 #endif
00152