diff options
author | Stijn Buys <ingar@osirion.org> | 2010-10-26 21:08:12 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-10-26 21:08:12 +0000 |
commit | 75c6db097b990e58b4b2585580a89561c838d923 (patch) | |
tree | 8c913bdc531ea9a76dcaa9e10a65763f95fa55e4 /src/core/item.h | |
parent | 23c7d2c11170ee8736673e82a88e87a3d2e538f7 (diff) |
updated network protocol version to 20, implemented invemtory depletion, unified depletion with keepalive
Diffstat (limited to 'src/core/item.h')
-rw-r--r-- | src/core/item.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/core/item.h b/src/core/item.h index 0e9e167..ac3188d 100644 --- a/src/core/item.h +++ b/src/core/item.h @@ -19,6 +19,8 @@ namespace core class Item { public: + enum Flags {Tradeable = 1}; + Item(const Info *info); /// copy constructor @@ -46,7 +48,17 @@ public: inline const unsigned long timestamp() const { return item_timestamp; } - + + /// item flags + inline const unsigned int flags() const { + return item_flags; + } + + /// returns true of a flag is set + inline const bool flag_is_set(const Flags flag) const { + return ((item_flags & (unsigned int)flag) == (unsigned int)flag); + } + /* ---- mutators ----------------------------------------------- */ /** @@ -59,7 +71,16 @@ public: void dec_amount(const long amount); void set_price(const long price); - + + /// set flag + inline void set_flag(Flags flag) { + item_flags |= flag; + } + + /// unset flag + inline void unset_flag(Flags flag) { + item_flags &= ~flag; + } void set_dirty(); /* ---- serializers -------------------------------------------- */ @@ -76,6 +97,8 @@ private: long item_amount; unsigned long item_timestamp; + + unsigned int item_flags; }; } // namespace core |