diff UI/UIShops.cpp @ 2246:0be4f17b7986

shop stealing cleaned up a bit
author Grumpy7
date Wed, 26 Feb 2014 01:14:18 +0100
parents a9fa57fda3ae
children 8c5855b842dc
line wrap: on
line diff
--- a/UI/UIShops.cpp	Sun Feb 23 18:44:01 2014 +0100
+++ b/UI/UIShops.cpp	Wed Feb 26 01:14:18 2014 +0100
@@ -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)) && pParty->uNumGold < uPriceItemService) 
       {
-        if ( GetAsyncKeyState(VK_CONTROL) )
-        {
+        PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)2);
+        ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
+        return;
+      }
+      if (pPlayers[uActiveCharacter]->CanSteal() && 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 )
-      {
-        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;
-          }
-        }
       }
       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