Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-10-15 17:19:14 +0000
committerStijn Buys <ingar@osirion.org>2012-10-15 17:19:14 +0000
commitf7213c6e0ddf5f02df6d7e29d538adbdb38b1217 (patch)
tree3277a0e71420ab4aa1fcf2976806bbad0d2ca3e3 /src/core/item.h
parent9554f5be113b7f5d697a2eb8e782f70d6911be19 (diff)
Added support for item::Unique flag and Item::dirty().
Diffstat (limited to 'src/core/item.h')
-rw-r--r--src/core/item.h53
1 files changed, 45 insertions, 8 deletions
diff --git a/src/core/item.h b/src/core/item.h
index 98d5813..6c99270 100644
--- a/src/core/item.h
+++ b/src/core/item.h
@@ -19,7 +19,7 @@ namespace core
class Item
{
public:
- enum Flags {Tradeable = 1};
+ enum Flags {Tradeable = 1, Unique = 2};
Item(const Info *info);
@@ -36,29 +36,45 @@ public:
inline long amount() const { return item_amount; }
/**
- * @brief information card
+ * @brief information record
*/
inline const Info *info() const { return item_info; }
-
+ /**
+ * @brief price
+ */
inline const long price() const {
return item_price;
}
+ /**
+ * @brief server timestamp
+ */
inline const unsigned long timestamp() const {
return item_timestamp;
}
- /// item flags
+ /**
+ * @brief item flags
+ */
inline const unsigned int flags() const {
return item_flags;
}
- /// returns true of a flag is set
+ /**
+ * @brief returns true of a flag is set
+ */
inline const bool has_flag(const Flags flag) const {
return ((item_flags & (unsigned int) flag) == (unsigned int) flag);
}
+ /**
+ * @brief return true if the dirty flag is set
+ * */
+ inline const bool dirty() const {
+ return item_dirty;
+ }
+
/* ---- mutators ----------------------------------------------- */
/**
@@ -66,22 +82,41 @@ public:
*/
void set_amount(const long amount);
+ /**
+ * @brief increase associated amount
+ */
void inc_amount(const long amount);
+ /**
+ * @brief decrease associated amount
+ */
void dec_amount(const long amount);
+ /**
+ * @brief set associated price
+ */
void set_price(const long price);
- /// set flag
+ /**
+ * @brief set item flag
+ */
inline void set_flag(Flags flag) {
item_flags |= flag;
}
- /// unset flag
+ /**
+ * @brief unset item flag
+ */
inline void unset_flag(Flags flag) {
item_flags &= ~flag;
}
- void set_dirty();
+
+ /**
+ * @brief set the dirty flag
+ * */
+ inline void set_dirty(const bool dirty = true) {
+ item_dirty = true;
+ }
/* ---- serializers -------------------------------------------- */
@@ -99,6 +134,8 @@ private:
unsigned long item_timestamp;
unsigned int item_flags;
+
+ bool item_dirty;
};
} // namespace core