diff Player.cpp @ 2025:4000f8184c29

EVENT_Substract fix
author Ritor1
date Sun, 17 Nov 2013 01:14:58 +0600
parents 30c2b575d25c
children da35dc35d635
line wrap: on
line diff
--- a/Player.cpp	Sat Nov 16 00:02:24 2013 +0600
+++ b/Player.cpp	Sun Nov 17 01:14:58 2013 +0600
@@ -6602,12 +6602,27 @@
       this->PlaySound(SPEECH_96, 0);
       return;
     case VAR_PlayerItemInHands:
+      for ( uint i = 0; i < 16; ++i )
+      {
+        int id_ = this->pEquipment.pIndices[i];
+        if ( id_ > 0 )
+        {
+          if ( this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID == pValue )
+          {
+            this->pEquipment.pIndices[i] = 0;
+          }
+        }
+      }
       for (int i = 0; i < 126; i++)
       {
-        if ( this->pInventoryItemList[pInventoryMatrix[i]].uItemID == pValue )
+        int id_ = this->pInventoryMatrix[i];
+        if ( id_ > 0 )
         {
-          RemoveItemAtInventoryIndex(i);
-          return;
+          if ( this->pInventoryItemList[id_ - 1].uItemID == pValue )
+          {
+            RemoveItemAtInventoryIndex(i);
+            return;
+          }
         }
       }
       if ( pParty->pPickedItem.uItemID == pValue )