diff Items.cpp @ 245:f070b49d40dd

goto cleaning
author zipi
date Mon, 18 Feb 2013 00:39:18 +0000
parents a6a8fa73b4ec
children a672f297c163 640a176c030f
line wrap: on
line diff
--- a/Items.cpp	Sun Feb 17 23:59:30 2013 +0000
+++ b/Items.cpp	Mon Feb 18 00:39:18 2013 +0000
@@ -53,7 +53,6 @@
   UpdateTempBonus(pParty->uTimePlayed);
   if ( v4->uItemID == 501 )
   {
-LABEL_45:
     *v3 = 1;
     v10 = rand();
     v17 = 10;
@@ -73,13 +72,17 @@
     return v9 + 9;
   }
   if ( v4->uItemID == 517 )
-    goto LABEL_36;
+  {
+    v5 = 8;
+    *v3 = v5;
+    return v5;
+  }
   v8 = v4->uAdditionalValue;
   if ( v8 > 46 )
   {
-LABEL_42:
     v5 = 0;
-    goto LABEL_37;
+    *v3 = v5;
+    return v5;
   }
   if ( v8 == 46 )
   {
@@ -113,14 +116,14 @@
           *a3 = 1;
           return v5;
         }
-        goto LABEL_42;
+		v5 = 0;
+		*v3 = v5;
+		return v5;
       }
       *v3 = 2;
       return 12;
     }
-LABEL_36:
     v5 = 8;
-LABEL_37:
     *v3 = v5;
     return v5;
   }
@@ -160,9 +163,18 @@
     return rand() % 7 + 4;
   }
   if ( v8 == 9 )
-    goto LABEL_45;
+  {
+    *v3 = 1;
+    v10 = rand();
+    v17 = 10;
+    return v10 % v17 + 6;
+  }
   if ( v8 != 10 )
-    goto LABEL_42;
+  {
+        v5 = 0;
+    *v3 = v5;
+    return v5;
+  }
   *v3 = 0;
   v7 = 1;
   return GetDiceResult(v7, 6u);
@@ -1673,9 +1685,7 @@
         --v14;
       }
       while ( v14 );
-LABEL_72:
       v4->_bonus_type = v15 * treasure_level;
-      goto LABEL_73;
     }
   }
   else
@@ -1718,10 +1728,9 @@
         --v19;
       }
       while ( v19 );
-      goto LABEL_72;
+      v4->_bonus_type = v15 * treasure_level;
     }
   }
-LABEL_73:
   if ( v4->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION
     && !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, 239) )
     v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST;
@@ -1762,13 +1771,10 @@
     v23 = rand();
     v24 = *(unsigned int *)v22;
     v25 = v23 % 100;
-    if ( v23 % 100 < v24 )
-      goto LABEL_127;
-    if ( !uBonusChanceSpecial[v6] )
+    if ( !uBonusChanceSpecial[v6] && !(v23 % 100 < v24))
         return;
-    if ( v25 < v24 )
+    if ( v25 < v24 || v23 % 100 < v24)
     {
-LABEL_127:
       v26 = rand() % 10;//v5->field_116D8[v5->pItems[v4->uItemID].uEquipType];
       v27 = v4->uItemID;
       v4->_bonus_type = 0;
@@ -1811,14 +1817,24 @@
       {
         case 2:
           if ( !*(unsigned char *)v40 )
-            goto LABEL_117;
+          {
+            v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType);
+            if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) )
+            {
+              v44 = v58;
+              ++v58;
+              *v44 = a2b;
+            }
+            ++a2b;
+			v40 += 28;
+			continue;
+          }
           v41 = *(unsigned char *)v40 == 1;
           break;
         case 3:
           v43 = *(unsigned char *)v40;
           if ( !*(unsigned char *)v40 || v43 == 1 )
           {
-LABEL_117:
             v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType);
             if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) )
             {
@@ -1826,24 +1842,49 @@
               ++v58;
               *v44 = a2b;
             }
-            goto LABEL_119;
+            ++a2b;
+			v40 += 28;
+			continue;
           }
           v41 = v43 == 2;
           break;
         case 4:
           v42 = *(unsigned char *)v40;
           if ( *(unsigned char *)v40 == 1 || v42 == 2 )
-            goto LABEL_117;
+          {
+            v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType);
+            if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) )
+            {
+              v44 = v58;
+              ++v58;
+              *v44 = a2b;
+            }
+            ++a2b;
+			v40 += 28;
+			continue;
+          }
           v41 = v42 == 3;
           break;
         default:
           if ( v6 != 5 )
-            goto LABEL_119;
+		  {
+            ++a2b;
+			v40 += 28;
+			continue;
+		  }
           v41 = *(unsigned char *)v40 == 3;
           break;
       }
       if ( v41 )
-        goto LABEL_117;
+      {
+		v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType);
+		if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) )
+		{
+			v44 = v58;
+			++v58;
+			*v44 = a2b;
+		}
+	  }
 LABEL_119:
       ++a2b;
       v40 += 28;