From 9b1fed5643a2447495cf4b43309a23ada7901c03 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Thu, 2 Jan 2014 19:47:56 +0300
Subject: fix itempopup update if old and new item is unknown.

---
 src/gui/popups/itempopup.cpp | 9 ++++++++-
 src/gui/popups/itempopup.h   | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp
index 4e727f9f5..1fd496dec 100644
--- a/src/gui/popups/itempopup.cpp
+++ b/src/gui/popups/itempopup.cpp
@@ -53,6 +53,7 @@ ItemPopup::ItemPopup() :
     mItemType(ITEM_UNUSABLE),
     mIcon(new Icon(this, nullptr)),
     mLastName(),
+    mLastId(0),
     mLastColor(1)
 {
     // Item Name
@@ -112,6 +113,7 @@ void ItemPopup::setItem(const Item *const item, const bool showImage)
     {
         mLastName = ii.getName();
         mLastColor = item->getColor();
+        mLastId = item->getId();
         if (serverVersion > 0)
         {
             mItemName->setCaption(strprintf("%s (+%d), %d", ii.getName(
@@ -132,8 +134,11 @@ void ItemPopup::setItem(const Item *const item, const bool showImage)
 void ItemPopup::setItem(const ItemInfo &item, const unsigned char color,
                         const bool showImage, int id)
 {
-    if (!mIcon || (item.getName() == mLastName && color == mLastColor))
+    if (!mIcon || (item.getName() == mLastName && color == mLastColor
+        && id == mLastId))
+    {
         return;
+    }
 
     if (id == -1)
         id = item.getId();
@@ -167,6 +172,7 @@ void ItemPopup::setItem(const ItemInfo &item, const unsigned char color,
 
     mLastName = item.getName();
     mLastColor = color;
+    mLastId = id;
 
     if (serverVersion > 0)
     {
@@ -267,4 +273,5 @@ void ItemPopup::mouseMoved(gcn::MouseEvent &event)
     setVisible(false);
     mLastName.clear();
     mLastColor = 1;
+    mLastId = 0;
 }
diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h
index 9c9e21f58..ac4683938 100644
--- a/src/gui/popups/itempopup.h
+++ b/src/gui/popups/itempopup.h
@@ -70,6 +70,7 @@ class ItemPopup final : public Popup
         ItemType mItemType;
         Icon *mIcon;
         std::string mLastName;
+        int mLastId;
         unsigned char mLastColor;
 
         void setLabelColor(Label *label, const ItemType type) const;
-- 
cgit v1.2.3-70-g09d2