diff options
author | Stijn Buys <ingar@osirion.org> | 2010-09-22 21:32:34 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-09-22 21:32:34 +0000 |
commit | a6f9773c358dd7d091ff64cbda504ab8d8066dd3 (patch) | |
tree | 226e23c4656957e908623ccda9d3d1c50240a0b4 /src/core/item.h | |
parent | bbb43d1c15f2858573f5abb595aa62f8224e4d76 (diff) |
full trading support for networked games
Diffstat (limited to 'src/core/item.h')
-rw-r--r-- | src/core/item.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/core/item.h b/src/core/item.h index 9c17dc9..e4e8507 100644 --- a/src/core/item.h +++ b/src/core/item.h @@ -39,24 +39,40 @@ public: inline const long price() const { return item_price; } + + inline const unsigned long timestamp() const { + return item_timestamp; + } /* ---- mutators ----------------------------------------------- */ /** * @brief set associated amount */ - void set_amount(const long amount); + void set_amount(const long amount); + + void inc_amount(const long amount); + + void dec_amount(const long amount); - void inc_amount(const long amount); + void set_price(const long price); - void dec_amount(const long amount); + void set_dirty(); + + /* ---- serializers -------------------------------------------- */ - void set_price(const long price); + void serialize_server_update(std::ostream & os) const; + + void receive_server_update(std::istream &is); private: + void set_timestamp(const unsigned long timestamp); + const Info *item_info; long item_price; long item_amount; + + unsigned long item_timestamp; }; } // namespace core |