diff mm7_2.cpp @ 749:f39fbeb65b28

Fixed bought items not disappearing from Armourer.
author Nomad
date Fri, 22 Mar 2013 23:26:01 +0200
parents daecb0225226
children e13ce1b0930d
line wrap: on
line diff
--- a/mm7_2.cpp	Fri Mar 22 22:36:26 2013 +0200
+++ b/mm7_2.cpp	Fri Mar 22 23:26:01 2013 +0200
@@ -889,12 +889,12 @@
     return;
   pRenderer->ClearZBuffer(0, 479);
   //v3 = dword_F8B198;
-  if ( dialog_menu_id != 1 )
+  if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
   {
 	v8 = window_SpeakInHouse;
   }
   //else
-  if ( dialog_menu_id == 1 )
+  if (dialog_menu_id == HOUSE_DIALOGUE_MAIN)
   {
 	  if ( in_current_building_type == BildingType_Training )
 	  {
@@ -1918,11 +1918,11 @@
   if ( pDialogueNPCCount )
   {
     v0 = dialog_menu_id;
-    if ( dialog_menu_id != 2
-      && dialog_menu_id != 3
-      && dialog_menu_id != 97
-      && dialog_menu_id != 5
-      && dialog_menu_id != 4
+    if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD
+      && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL
+      && dialog_menu_id != HOUSE_DIALOGUE_97
+      && dialog_menu_id != HOUSE_DIALOGUE_SHOP_REPAIR
+      && dialog_menu_id != HOUSE_DIALOGUE_SHOP_IDENTIFY
       && ShopTexture )
     {
       ShopTexture->Release();
@@ -2039,14 +2039,14 @@
   void *v30; // eax@50
   int v31; // ecx@50
   ItemGen *v32; // esi@51
-  float v33; // ST1C_4@53
-  signed int v34; // eax@53
-  int v35; // eax@53
-  bool v36; // eax@53
+  //float v33; // ST1C_4@53
+  //signed int v34; // eax@53
+  //int v35; // eax@53
+  //bool v36; // eax@53
   unsigned int v37; // eax@53
   int v38; // eax@55
   int v39; // eax@63
-  int v40; // eax@64
+  //int v40; // eax@64
   int v41; // edx@66
   int v42; // esi@74
   signed int v43; // ebx@74
@@ -2063,7 +2063,7 @@
   unsigned int v54; // [sp+0h] [bp-B4h]@25
   int v55; // [sp+0h] [bp-B4h]@26
   int v56; // [sp+0h] [bp-B4h]@36
-  POINT v57; // [sp+10h] [bp-A4h]@49
+  //POINT v57; // [sp+10h] [bp-A4h]@49
   //POINT v58; // [sp+18h] [bp-9Ch]@18
   POINT v59; // [sp+20h] [bp-94h]@49
   POINT v60; // [sp+28h] [bp-8Ch]@9
@@ -2079,7 +2079,7 @@
   POINT v70; // [sp+78h] [bp-3Ch]@9
   POINT v71; // [sp+80h] [bp-34h]@31
   POINT v72; // [sp+88h] [bp-2Ch]@10
-  bool v73; // [sp+90h] [bp-24h]@53
+  //bool v73; // [sp+90h] [bp-24h]@53
   int v74; // [sp+94h] [bp-20h]@53
   int a6; // [sp+98h] [bp-1Ch]@57
   int a3; // [sp+9Ch] [bp-18h]@53
@@ -2129,7 +2129,7 @@
 		v21 = p2DEvents[(signed int)v19 - 1].fPriceMultiplier;
 		_this = v20;
 		v22 = v20->GetValue();
-		v23 = v0->_4B8142(v22, v21);
+		v23 = v0->GetBuyingPrice(v22, v21);
 		v80 = v23;
 		GetAsyncKeyState(VK_CONTROL);
 		if ( pParty->uNumGold < v23 )
@@ -2327,15 +2327,15 @@
 		{
 	//LABEL_49:
 		v28 = pMouse->GetCursorPos(&v59);
-		v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF;
+		v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[v28->y]] & 0xFFFF;
 		if ( !v29 )
 			return;
 		v30 = window_SpeakInHouse->ptr_1C;
 		// v31 = 9 * (v29 - 1 + 12 * (int)v30);
-		if ( dialog_menu_id == 2 )
+		if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD)
 		{
-			v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1];
-			_this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1];
+			v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29 - 1];
+			_this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29 - 1];
 		}
 		else
 		{
@@ -2343,23 +2343,23 @@
 			v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
 		}
 		//v33 = p2DEvents_minus1__20[13 * (signed int)v30];
-		v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier;
-		v34 = v32->GetValue();
-		v80 = v0->_4B8142(v34, v33);
-		LOWORD(v35) = GetAsyncKeyState(VK_CONTROL);
-		v74 = v35;
-		v36 = v0->CanSteal();
+		//v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier;
+		//v34 = v32->GetValue();
+		v80 = v0->GetBuyingPrice(v32->GetValue(), p2DEvents[(unsigned int)v30 - 1].fPriceMultiplier);
+		//LOWORD(v35) = GetAsyncKeyState(VK_CONTROL);
+		v74 = GetAsyncKeyState(VK_CONTROL);
+		//v36 = v0->CanSteal();
 		uNumSeconds = 0;
 		a3 = 0;
-		v73 = v36;
+		//v73 = v0->CanSteal();
 		v37 = pMapStats->GetMapInfo(pCurrentMapName);
 		if ( v37 )
 			a3 = pMapStats->pInfos[v37]._steal_perm;
 		v38 = GetPartyReputation();
 		v26 = 1;
-		if ( v73 == 1 )
+		if (v0->CanSteal())
 		{
-			if ( (short)v74 )
+			if ( v74 )
 			{
 			uNumSeconds = v0->StealFromShop(v32, a3, v38, 0, &a6);
 			if ( !uNumSeconds )
@@ -2377,7 +2377,7 @@
 				if ( uNumSeconds != 1 )
 				{
 					PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v24);
-					v9 = pGlobalTXT_LocalizationStrings[155];
+					v9 = pGlobalTXT_LocalizationStrings[155]; // "You don't have enough gold"
 					v54 = 2;
 					ShowStatusBarString(v9, v54);
 					return;
@@ -2388,17 +2388,19 @@
 		if ( v39 )
 		{
 			v32->SetIdentified();
-			v7 = v73 == 1;
-			v40 = (int)((char *)v0 + 36 * v39);
-			memcpy((void *)(v40 + 496), v32, 0x24u);
+			v7 = v0->CanSteal();
+			//v40 = (int)((char *)v0 + 36 * v39);
+            //memcpy((void *)(v40 + 496), v32, 0x24u);
+            memcpy(&v0->pInventoryItems[v39 - 1], v32, sizeof(ItemGen));
 			if ( v7 )
 			{
-				if ( (short)v74 )
+				if ( v74 )
 				{
 					v41 = uNumSeconds;
 					if ( uNumSeconds == 1 || uNumSeconds == 2 )
 					{
-						*(char *)(v40 + 517) |= 1u;
+						//*(char *)(v40 + 517) |= 1u;
+                        v0->pInventoryItems[v39 - 1].SetStolen();
 						sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6);
 						viewparams->bRedrawGameUI = v26;
 						_this->Reset();