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-10-01 22:07:45 +0000
committerStijn Buys <ingar@osirion.org>2010-10-01 22:07:45 +0000
commit25af16fac3127523d532d4b4797eec7947ed5a72 (patch)
treee0a1f59452f16c100ceaca3050f0b369d32b6e18 /src/client/inventorylistview.cc
parent8b67219f7de2971114a81c5476dae578ac29e989 (diff)
Initial inventory window
Diffstat (limited to 'src/client/inventorylistview.cc')
-rw-r--r--src/client/inventorylistview.cc33
1 files changed, 11 insertions, 22 deletions
diff --git a/src/client/inventorylistview.cc b/src/client/inventorylistview.cc
index 87cc367..a8d98f3 100644
--- a/src/client/inventorylistview.cc
+++ b/src/client/inventorylistview.cc
@@ -80,8 +80,16 @@ void InventoryListView::set_inventory(core::Inventory *inventory, core::InfoType
emit(EventListViewChanged);
}
-bool InventoryListView::verify_inventory()
+bool InventoryListView::verify() const
{
+ if (!listview_inventory || !listview_infotype) {
+ return true;
+ }
+
+ if (listview_timestamp != listview_inventory->timestamp()) {
+ return false;
+ }
+
for (core::Inventory::Items::const_iterator it = listview_inventory->items().begin(); it != listview_inventory->items().end(); it++) {
core::Item *item = (*it);
if (item->info() && (item->info()->timestamp() > listview_infotimestamp)) {
@@ -93,28 +101,9 @@ bool InventoryListView::verify_inventory()
void InventoryListView::draw()
{
- if (listview_inventory && listview_infotype) {
- // inventory was updated
- if (listview_timestamp != listview_inventory->timestamp()) {
- //con_debug << "CLIENT inventory update from " << listview_timestamp << " to " << listview_inventory->timestamp() << std::endl;
- set_inventory(listview_inventory, listview_infotype);
- // inventory info was updated
- } else if (!verify_inventory()) {
- //con_debug << "CLIENT inventory info update" << std::endl;
- set_inventory(listview_inventory, listview_infotype);
- }
- }
-
- /*
- * DEBUG
- std::ostringstream str;
- if (listview_inventory && listview_infotype) {
- str << listview_timestamp << " " << listview_inventory->timestamp() << " " << listview_infotimestamp;
- } else {
- str << "EMPTY";
+ if (!verify()) {
+ set_inventory(listview_inventory, listview_infotype);
}
- ui::Paint::draw_label(global_location(), size(), font(), str.str() , ui::AlignBottom) ;
- */
ListView::draw();
}