diff mm7_1.cpp @ 244:bb9e946cbcbf

cleaning, ring fixed
author zipi
date Sun, 17 Feb 2013 23:59:30 +0000
parents a6a8fa73b4ec
children 37dcbe8f3cca
line wrap: on
line diff
--- a/mm7_1.cpp	Sun Feb 17 23:40:46 2013 +0000
+++ b/mm7_1.cpp	Sun Feb 17 23:59:30 2013 +0000
@@ -5655,64 +5655,66 @@
     && (v2 = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID)) != 0 )
   {
     memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v2-1], &pParty->pPickedItem, 0x24u);
+	pMouse->RemoveHoldingItem();
   }
   else
   {
     v12 = 0;
     v3 = pParty->pPlayers;
-    while ( 1 )
+	while ( v3 <= &pParty->pPlayers[3] )
     {
       v4 = v3->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID);
       if ( v4 )
-        break;
-      ++v12;
+	  {
+		memcpy(&pParty->pPlayers[v12].pInventoryItems[v4], &pParty->pPickedItem, 0x24u);
+		pMouse->RemoveHoldingItem();
+		break;
+	  }
+	  ++v12;
       ++v3;
-      if ( (signed int)v3 >= (signed int)pParty->pHirelings )
-        goto LABEL_10;
-    }
-    memcpy(&pParty->pPlayers[v12].spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4 + 5], &pParty->pPickedItem, 0x24u);
-    pMouse->RemoveHoldingItem();
-LABEL_10:
-    if ( v12 != 4 )
-      goto LABEL_18;
-    v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
-    v6 = 0;
-    a1.uItemType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
-    if ( (signed int)pObjectList->uNumObjects <= 0 )
-    {
-LABEL_15:
-      LOWORD(v6) = 0;
-    }
-    else
-    {
-      v7 = (char *)&pObjectList->pObjects->uObjectID;
-      while ( v5 != *(short *)v7 )
-      {
-        ++v6;
-        v7 += 56;
-        if ( v6 >= (signed int)pObjectList->uNumObjects )
-          goto LABEL_15;
-      }
-    }
-    a1.field_58 = 4;
-    a1.uObjectDescID = v6;
-    a1.vPosition.y = pParty->vPosition.y;
-    a1.vPosition.x = pParty->vPosition.x;
-    a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
-    a1.uSoundID = 0;
-    a1.uFacing = 0;
-    a1.uAttributes = 8;
-    v8 = pIndoor->GetSector(
-           pParty->vPosition.x,
-           pParty->vPosition.y,
-           pParty->sEyelevel + pParty->vPosition.z);
-    a1.uSpriteFrameID = 0;
-    a1.uSectorID = v8;
-    memcpy(&a1.stru_24, &pParty->pPickedItem, sizeof(a1.stru_24));
-    a1.Create(pParty->sRotationY, 184, 200, 0);
-  }
-  pMouse->RemoveHoldingItem();
-LABEL_18:
+    }
+    if ( v12 == 4 )
+	{
+		v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
+		v6 = 0;
+		a1.uItemType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
+		if ( (signed int)pObjectList->uNumObjects <= 0 )
+		{
+		  LOWORD(v6) = 0;
+		}
+		else
+		{
+		  v7 = (char *)&pObjectList->pObjects->uObjectID;
+		  while ( v5 != *(short *)v7 )
+		  {
+			++v6;
+			v7 += 56;
+			if ( v6 >= (signed int)pObjectList->uNumObjects )
+			{
+				LOWORD(v6) = 0;
+				break;
+			}
+		  }
+		}
+		a1.field_58 = 4;
+		a1.uObjectDescID = v6;
+		a1.vPosition.y = pParty->vPosition.y;
+		a1.vPosition.x = pParty->vPosition.x;
+		a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z;
+		a1.uSoundID = 0;
+		a1.uFacing = 0;
+		a1.uAttributes = 8;
+		v8 = pIndoor->GetSector(
+			   pParty->vPosition.x,
+			   pParty->vPosition.y,
+			   pParty->sEyelevel + pParty->vPosition.z);
+		a1.uSpriteFrameID = 0;
+		a1.uSectorID = v8;
+		memcpy(&a1.stru_24, &pParty->pPickedItem, sizeof(a1.stru_24));
+		a1.Create(pParty->sRotationY, 184, 200, 0);
+		pMouse->RemoveHoldingItem();
+	}
+  }
   if ( !v11 )
   {
     v1->Release();