diff GUI/UI/UIPopup.cpp @ 2567:d569340b05ff

Few constants changed into enum values
author a.parshin
date Thu, 21 May 2015 01:50:59 +0200
parents 30eb6dcac768
children d87bfbd3bb3b
line wrap: on
line diff
--- a/GUI/UI/UIPopup.cpp	Wed May 20 21:05:07 2015 +0200
+++ b/GUI/UI/UIPopup.cpp	Thu May 21 01:50:59 2015 +0200
@@ -157,7 +157,7 @@
     inspect_item->SetIdentified();
   v77 = 0;
   if (inspect_item->GetItemEquipType() == EQUIP_GOLD)
-    v77 = inspect_item->uSpecEnchantmentType;
+    v77 = inspect_item->special_enchantment;
   if ( uActiveCharacter )
   {
   //try to identify
@@ -300,8 +300,8 @@
       sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"Power"
     else if ( inspect_item->uEnchantmentType )
       sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->m_enchantmentStrength); //"Special"
-    else  if ( inspect_item->uSpecEnchantmentType )
-      sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement);
+    else  if ( inspect_item->special_enchantment )
+      sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210], pItemsTable->pSpecialEnchantments[inspect_item->special_enchantment-1].pBonusStatement);
     else if ( inspect_item->uNumCharges )
       sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges"
   }
@@ -323,7 +323,7 @@
                                      TEXTURE_16BIT_PALETTE)->uTextureHeight + v81 + 54;
   if ( (signed int)Str > (signed int)iteminfo_window.uFrameHeight )
     iteminfo_window.uFrameHeight = (unsigned int)Str;
-  if ( inspect_item->uAttributes & ITEM_TEMP_BONUS && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
+  if ( inspect_item->uAttributes & ITEM_TEMP_BONUS && (inspect_item->special_enchantment || inspect_item->uEnchantmentType) )
     iteminfo_window.uFrameHeight += LOBYTE(pFontComic->uFontHeight);
   v85 = 0;
   if ( pFontArrus->uFontHeight )
@@ -375,7 +375,7 @@
   }
   else
   {
-    if ( (inspect_item->uAttributes & ITEM_TEMP_BONUS) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
+    if ( (inspect_item->uAttributes & ITEM_TEMP_BONUS) && (inspect_item->special_enchantment || inspect_item->uEnchantmentType) )
     {
       init_summoned_item(&v67, inspect_item->uExpireTime - pParty->uTimePlayed);
       strcpy(pTmpBuf.data(), "Duration:");
@@ -1719,7 +1719,7 @@
       if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE ||
           item->uItemID >= ITEM_ARTIFACT_PUCK ||
           item->IsBroken() ||
-          item->uSpecEnchantmentType ||
+          item->special_enchantment ||
           item->uEnchantmentType ||
           item->GetItemEquipType() >= EQUIP_ARMOUR)  // only melee weapons and bows
       {
@@ -1731,18 +1731,22 @@
       item->UpdateTempBonus(pParty->uTimePlayed);
       if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION)
       {
-        item->uSpecEnchantmentType = 40; // of Slaying
+          item->special_enchantment = ITEM_ENCHANTMENT_40; // of Slaying
         v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128);
       }
       else
       {
-        static int _4E2904_enchantment_by_potion_lut[] =
-        {
-          164, 93, 22,
-          164, 93, 22,
-          11, 5, 13, 7, 59
-        };
-        item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240];
+          static ITEM_ENCHANTMENT _4E2904_enchantment_by_potion_lut[] =
+          {
+              (ITEM_ENCHANTMENT)164, (ITEM_ENCHANTMENT)93, (ITEM_ENCHANTMENT)22,
+              (ITEM_ENCHANTMENT)164, (ITEM_ENCHANTMENT)93, (ITEM_ENCHANTMENT)22,
+              ITEM_ENCHANTMENT_OF_FLAME,
+              ITEM_ENCHANTMENT_OF_FROST,
+              ITEM_ENCHANTMENT_OF_POISON,
+              ITEM_ENCHANTMENT_OF_SPARKS,
+              (ITEM_ENCHANTMENT)59
+          };
+        item->special_enchantment = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240];
         v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128);
       }
 
@@ -1764,33 +1768,36 @@
     pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = alchemy_skill_points + pParty->pPickedItem.GetDamageDice();
     switch ( pParty->pPickedItem.uItemID )
     {
-      case 200:
-      case 201:
-      case 202:
-      case 203:
-      case 204:
-        pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 222;
+    case ITEM_REAGENT_WIDOWSWEEP_BERRIES:
+    case ITEM_REAGENT_CRUSHED_ROSE_PETALS:
+    case ITEM_TROLL_BLOOD:
+    case ITEM_TROLL_RUBY:
+    case ITEM_DRAGON_EYE:
+          pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = ITEM_POTION_CURE_WOUNDS;
         break;
-      case 205:
-      case 206:
-      case 207:
-      case 208:
-      case 209:
-        pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 223;
+
+    case ITEM_PHIMA_ROOT:
+    case ITEM_METEORITE_FRAGMENT:
+    case ITEM_HARPY_FEATHER:
+    case ITEM_MOONSTONE:
+    case ITEM_ELVISH_TOADSTOOL:
+          pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = ITEM_POTION_MAGIC_POTION;
         break;
-      case 210:
-      case 211:
-      case 212:
-      case 213:
-      case 214:
-        pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 224;
+
+    case ITEM_POPPYSNAPS:
+    case ITEM_FAE_DUST:
+    case ITEM_SULFUR:
+    case ITEM_GARNET:
+    case ITEM_DEVIL_ICHOR:
+          pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = ITEM_POTION_CURE_WEAKNESS;
         break;
-      case 215:
-      case 216:
-      case 217:
-      case 218:
-      case 219:
-        pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = 221;
+
+    case ITEM_MUSHROOM:
+    case ITEM_OBSIDIAN:
+    case ITEM_OOZE_ENDOPLASM_VIAL:
+    case ITEM_MERCURY:
+    case ITEM_REAGENT_PHILOSOPHERS_STONE:
+          pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = ITEM_POTION_CATALYST;
         break;
       default:
         break;
@@ -1904,11 +1911,11 @@
     {
       if ( alchemy_skill_points )
       {
-        if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 || pParty->pPickedItem.uItemID == 221 )//catalyst(катализатор)
+          if (pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_CATALYST || pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST)
         {
-          if ( pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == 221 )
+            if (pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID == ITEM_POTION_CATALYST)
             pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID = pParty->pPickedItem.uItemID;
-          if ( pParty->pPickedItem.uItemID == 221 )
+          if (pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST)
             pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType = pParty->pPickedItem.uEnchantmentType;
         }
         else
@@ -1918,7 +1925,7 @@
                                             + pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uEnchantmentType) / 2;
           pPlayers[uActiveCharacter]->SetVariable(VAR_AutoNotes, pItemsTable->potion_note[potion1_id][potion2_id]);
         }
-        int bottle = pPlayers[uActiveCharacter]->AddItem(-1, 220);//бутылка
+          int bottle = pPlayers[uActiveCharacter]->AddItem(-1, ITEM_POTION_BOTTLE);
         if ( bottle )
           pPlayers[uActiveCharacter]->pOwnItems[bottle - 1].uAttributes = ITEM_IDENTIFIED;
         if ( !(pItemsTable->pItems[pPlayers[uActiveCharacter]->pInventoryItemList[item_pid].uItemID].uItemID_Rep_St) )