diff Player.cpp @ 1683:96d567a7d15f

moving OnInventoryLeftClick to Player::
author Grumpy7
date Fri, 20 Sep 2013 10:34:07 +0200
parents 3c451fd02fcf
children f84b8b2a875c
line wrap: on
line diff
--- a/Player.cpp	Fri Sep 20 10:23:54 2013 +0200
+++ b/Player.cpp	Fri Sep 20 10:34:07 2013 +0200
@@ -7794,9 +7794,8 @@
   }
 }
 //----- (00421EA6) --------------------------------------------------------
-void  OnInventoryLeftClick()
-{
-  Player *v0; // ebx@1
+void Player::OnInventoryLeftClick()
+{
   signed int v2; // ecx@2
   int v3; // eax@2
   int invMatrixIndex; // eax@2
@@ -7810,7 +7809,6 @@
   unsigned int pY; // [sp+3Ch] [bp-Ch]@2
   unsigned int pX; // [sp+40h] [bp-8h]@2
 
-  v0 = pPlayers[uActiveCharacter];
   if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )
   {
     pMouse->GetClickPos(&pX, &pY);
@@ -7824,14 +7822,14 @@
       {
         if ( _50C9A0_IsEnchantingInProgress )
         {
-          v6 = v0->GetItemIDAtInventoryIndex(&invMatrixIndex);
+          v6 = this->GetItemIDAtInventoryIndex(&invMatrixIndex);
           if ( v6 )
           {
             *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu;
             *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1;
             *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1;
             *((short *)pGUIWindow_Settings->ptr_1C + 3) = invMatrixIndex;
-            ptr_50C9A4_ItemToEnchant = &v0->pInventoryItemList[v6-1];
+            ptr_50C9A4_ItemToEnchant = &this->pInventoryItemList[v6-1];
             _50C9A0_IsEnchantingInProgress = 0;
             if ( pMessageQueue_50CBD0->uNumMessages )
               pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -7845,15 +7843,15 @@
         if ( ptr_50C9A4_ItemToEnchant )
           return;
         pickedItemId = pParty->pPickedItem.uItemID;
-        invItemIndex = v0->GetItemIDAtInventoryIndex(&invMatrixIndex);
+        invItemIndex = this->GetItemIDAtInventoryIndex(&invMatrixIndex);
         if (!pickedItemId)
         {
           if ( !invItemIndex )
             return;
           else
           {
-            memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[invItemIndex-1], sizeof(pParty->pPickedItem));
-            v0->RemoveItemAtInventoryIndex(invMatrixIndex);
+            memcpy(&pParty->pPickedItem, &this->pInventoryItemList[invItemIndex-1], sizeof(pParty->pPickedItem));
+            this->RemoveItemAtInventoryIndex(invMatrixIndex);
             v9 = pParty->pPickedItem.uItemID;
             pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName);
             return;
@@ -7863,16 +7861,16 @@
         {
           if ( invItemIndex )
           {
-            ItemGen* invItemPtr = &v0->pInventoryItemList[invItemIndex-1];
+            ItemGen* invItemPtr = &this->pInventoryItemList[invItemIndex-1];
             memcpy(&tmpItem, invItemPtr, sizeof(tmpItem));
-            v0->RemoveItemAtInventoryIndex(invMatrixIndex);
-            int emptyIndex = v0->AddItem2(invMatrixIndex, &pParty->pPickedItem);
+            this->RemoveItemAtInventoryIndex(invMatrixIndex);
+            int emptyIndex = this->AddItem2(invMatrixIndex, &pParty->pPickedItem);
             if ( !emptyIndex )
             {
-              emptyIndex = v0->AddItem2(-1, &pParty->pPickedItem);
+              emptyIndex = this->AddItem2(-1, &pParty->pPickedItem);
               if ( !emptyIndex )
               {
-                v0->PutItemArInventoryIndex(tmpItem.uItemID, invItemIndex - 1, invMatrixIndex);
+                this->PutItemArInventoryIndex(tmpItem.uItemID, invItemIndex - 1, invMatrixIndex);
                 memcpy(invItemPtr, &tmpItem, sizeof(ItemGen));
                 return;
               }
@@ -7884,17 +7882,17 @@
           }
           else
           {
-            v10 = v0->AddItem(invMatrixIndex, pickedItemId);
+            v10 = this->AddItem(invMatrixIndex, pickedItemId);
             if ( v10 )
             {
-              memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen));
+              memcpy(&this->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen));
               pMouse->RemoveHoldingItem();
               return;
             }
-            v10 = v0->AddItem(-1, pickedItemId);
+            v10 = this->AddItem(-1, pickedItemId);
             if ( v10 )
             {
-              memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen));
+              memcpy(&this->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen));
               pMouse->RemoveHoldingItem();
               return;
             }