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>2010-09-25 13:01:26 +0000
committerStijn Buys <ingar@osirion.org>2010-09-25 13:01:26 +0000
commitaeef4449ce3c1bdc531fb90699fef68bd48ca644 (patch)
tree969c2ec24f382a6a75e01b1b3315dd9fe8f26d46 /src/core/item.cc
parent158706fac974527436a3167cfa94a7ea82070d41 (diff)
trading bugfixes: corrects client side screen update issues
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)