Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/item.cc')
-rw-r--r--src/core/item.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/item.cc b/src/core/item.cc
index e9d9f65..8ab4784 100644
--- a/src/core/item.cc
+++ b/src/core/item.cc
@@ -14,12 +14,17 @@ namespace core
/* ---- class Item ------------------------------------------------- */
+// Note: initializing the timestamp with 1 instead of 0 is a small hack
+// since cient-side inventory timestamps are initialized at 0, setting
+// the item timestamp to 0 would prevent the client from updating
+// the trade window the first time it is opened on a base
+
Item::Item(const Info *info)
{
item_info = info;
item_amount = 0;
item_price = info->price();
- set_timestamp(game() ? game()->timestamp() : 0);
+ set_timestamp(game() ? game()->timestamp() : 1);
}
Item::~Item()
@@ -31,25 +36,25 @@ Item::~Item()
void Item::set_amount(const long amount)
{
item_amount = amount;
- set_timestamp(game() ? game()->timestamp() : 0);
+ set_timestamp(game() ? game()->timestamp() : 1);
}
void Item::inc_amount(const long amount)
{
item_amount += amount;
- set_timestamp(game() ? game()->timestamp() : 0);
+ set_timestamp(game() ? game()->timestamp() : 1);
}
void Item::dec_amount(const long amount)
{
item_amount -= amount;
- set_timestamp(game() ? game()->timestamp() : 0);
+ set_timestamp(game() ? game()->timestamp() : 1);
}
void Item::set_price(const long price)
{
item_price = price;
- set_timestamp(game() ? game()->timestamp() : 0);
+ set_timestamp(game() ? game()->timestamp() : 1);
}
void Item::set_timestamp(const unsigned long timestamp)