diff mm7_4.cpp @ 702:efde64b3e147

sub_4BDAAF clean some Chest pointer fixes
author zipi
date Mon, 18 Mar 2013 20:19:20 +0000
parents d5b16a44d9b3
children ef4d646d738d
line wrap: on
line diff
--- a/mm7_4.cpp	Mon Mar 18 22:53:56 2013 +0400
+++ b/mm7_4.cpp	Mon Mar 18 20:19:20 2013 +0000
@@ -11048,6 +11048,7 @@
   unsigned __int8 v9; // zf@16
   char v10; // sf@16
   unsigned __int8 v11; // of@16
+  bool test;
 
   auto a2 = _2da_idx;
   //v2 = p2DEvents_minus1___00[26 * a2];
@@ -11058,46 +11059,84 @@
   if ( (v2 != 4 || (signed int)v3 < 740 || (signed int)v3 > 771)
     && ((signed int)v3 >= 600 || (signed int)v3 >= 529 && (signed int)v3 <= 599) || a1->Stolen())
     return 0;
-  v6 = v2 - 1;
-  if ( !v6 )
+  switch( p2DEvents[a2 - 1].uType )
+  {
+	case BildingType_WeaponShop:
+		{
+		test = v5 <= 2;
+		break;
+		}
+	case BildingType_ArmorShop:
+		{
+		test = v5 >= 3;
+		break;
+		}
+	case BildingType_MagicShop:
+		{
+		test = pItemsTable->pItems[v4].uSkillType == 38 || v5 == 16;
+		break;
+		}
+	case BildingType_AlchemistShop:
+		{
+		__debugbreak(); // need to test
+		test = v5 == 13 || v5 == 14 || (v5 > 14 && !(v5 != 17 || (signed int)v3 < 740) && v3 != 771);
+		break;
+		}
+	default:
+		{
+		test = 0;
+		break;
+		}
+  }
+
+  return test;
+/*
+  if ( p2DEvents[a2 - 1].uType == 1 )
   {
     v11 = __OFSUB__(v5, 2);
     v9 = v5 == 2;
     v10 = v5 - 2 < 0;
     goto LABEL_23;
   }
-  v7 = v6 - 1;
-  if ( v7 )
-  {
-    v8 = v7 - 1;
-    if ( !v8 )
+  if ( p2DEvents[a2 - 1].uType > 2 )
+  {
+    if ( p2DEvents[a2 - 1].uType == 3 )
     {
       if ( pItemsTable->pItems[v4].uSkillType != 38 )
         return v5 == 16;
       return 1;
     }
-    if ( v8 != 1 || v5 < 13 )
+    if ( p2DEvents[a2 - 1].uType != 4 || v5 < 13 )
       return 0;
-    if ( v5 <= 14 )
-      return 1;
-    if ( v5 != 17 || (signed int)v3 < 740 )
-      return 0;
-    v11 = __OFSUB__(v3, 771);
-    v9 = v3 == 771;
-    v10 = ((v3 - 771) & 0x80000000u) != 0;
+	if ( p2DEvents[a2 - 1].uType == 4)
+	{
+		if ( v5 < 13 )
+		  return 0;
+		if ( v5 <= 14 )
+		  return 1;
+		if ( v5 != 17 || (signed int)v3 < 740 )
+		  return 0;
+		v11 = __OFSUB__(v3, 771);
+		v9 = v3 == 771;
+		v10 = ((v3 - 771) & 0x80000000u) != 0;
 LABEL_23:
-    if ( !((unsigned __int8)(v10 ^ v11) | v9) )
-      return 0;
-    return 1;
-  }
-  if ( v5 >= 3 )
-  {
-    v11 = __OFSUB__(v5, 9);
-    v9 = v5 == 9;
-    v10 = v5 - 9 < 0;
-    goto LABEL_23;
+		if ( !((unsigned __int8)(v10 ^ v11) | v9) )
+		  return 0;
+		return 1;
+	}
+  }
+  if ( p2DEvents[a2 - 1].uType == 2 )
+  {
+	  if ( v5 >= 3 )
+	  {
+		v11 = __OFSUB__(v5, 9);
+		v9 = v5 == 9;
+		v10 = v5 - 9 < 0;
+		goto LABEL_23;
+	  }
   }
   return 0;
+*/
 }