diff UI/UIShops.cpp @ 2252:cd80d91b780f

Слияние
author Ritor1
date Wed, 26 Feb 2014 20:10:50 +0600
parents 3cc3a29f073b
children aff7a7b072b7
line wrap: on
line diff
--- a/UI/UIShops.cpp	Wed Feb 26 20:10:43 2014 +0600
+++ b/UI/UIShops.cpp	Wed Feb 26 20:10:50 2014 +0600
@@ -1540,7 +1540,7 @@
         || pMouse->GetCursorPos(&cursor)->x >= 462
         || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) )
           return;
-      if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1], (int)window_SpeakInHouse->ptr_1C) )
+      if ( pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1].MerchandiseTest((int)window_SpeakInHouse->ptr_1C) )
       {
         dword_F8B1E4 = 1;
         pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C);
@@ -1566,7 +1566,7 @@
           item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
           if ( !(item->uAttributes & ITEM_IDENTIFIED) )
           {
-            if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) )
+            if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) )
             {
               if ( pParty->uNumGold >= uPriceItemService )
               {
@@ -1606,7 +1606,7 @@
             uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier);
             if ( item->uAttributes & ITEM_BROKEN )
             {
-              if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) )
+              if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) )
               {
                 if ( pParty->uNumGold >= uPriceItemService )
                 {
@@ -1650,61 +1650,48 @@
       if ( pMapStats->GetMapInfo(pCurrentMapName) )
         a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm;
       party_reputation = pParty->GetPartyReputation();
-      if (pPlayers[uActiveCharacter]->CanSteal())
+      if (pPlayers[uActiveCharacter]->CanSteal() && GetAsyncKeyState(VK_CONTROL))
       {
-        if ( GetAsyncKeyState(VK_CONTROL) )
-        {
           uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(bought_item, a3, party_reputation, 0, &a6);
           if ( !uNumSeconds )
           {
             sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6);
             return;
           }
-        }
       }
-      if ( pParty->uNumGold < uPriceItemService )
+      else if (pParty->uNumGold < uPriceItemService)
       {
-        if ( uNumSeconds != 2 )
-        {
-          if ( uNumSeconds != 1 )
-          {
-            PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
-            ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
-            return;
-          }
-        }
+        PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
+        return;
       }
       v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
       if ( v39 )
       {
         bought_item->SetIdentified();
         memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen));
-        if ( pPlayers[uActiveCharacter]->CanSteal() )
+        if (uNumSeconds != 0)
         {
-          if ( GetAsyncKeyState(VK_CONTROL) )
-          {
-            if ( uNumSeconds == 1 || uNumSeconds == 2 )
-            {
-              pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen();
-              sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6);
-              viewparams->bRedrawGameUI = 1;
-              bought_item->Reset();
-              pRenderer->ClearZBuffer(0, 479);
-              pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
-              return;
-            }
-          }
+          pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen();
+          sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6);
         }
-        dword_F8B1E4 = 1;
-        Party::TakeGold(uPriceItemService);
+        else
+        {
+          dword_F8B1E4 = 1;
+          Party::TakeGold(uPriceItemService);
+        }
         viewparams->bRedrawGameUI = 1;
         bought_item->Reset();
         pRenderer->ClearZBuffer(0, 479);
         pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_75, 0);
         return;
       }
-      pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
-      ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!"
+      else
+      {
+        pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[563], 2); // "Pack is Full!"
+        return;
+      }
       break;
     }
     default:// if click video screen in shop