diff mm7_2.cpp @ 436:4a42c2f97aa2

some itemgen crashes fixed
author Gloval
date Sun, 24 Feb 2013 10:13:00 +0400
parents 137c59c3dbc4
children 17c90e543e28
line wrap: on
line diff
--- a/mm7_2.cpp	Sun Feb 24 03:07:03 2013 +0200
+++ b/mm7_2.cpp	Sun Feb 24 10:13:00 2013 +0400
@@ -7911,9 +7911,9 @@
   v4 = rand();
   v34 = 0;
   v5 = v4 % 100;
-  v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14;
-  v7 = (unsigned __int8)byte_4E8168[v6 + 16];
-  v8 = (unsigned __int8)byte_4E8168[v6 + 17];
+ // v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14;
+  v7 = (unsigned __int8)byte_4E8168[v3->uIndex-1][2*v2->Treasure_prob];
+  v8 = (unsigned __int8)byte_4E8168[v3->uIndex-1][2*v2->Treasure_prob+1];
   v32 = v5;
   v33 = v7;
   v9 = rand();
@@ -8089,8 +8089,8 @@
       if ( (v3->uItemID & 0x80000000u) == 0 )
         goto LABEL_56;
       v4 = rand() % 5 + 1;
-      v5 = (unsigned __int8)byte_4E8168[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2];
-      v6 = (unsigned __int8)byte_4E8168[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3];
+      v5 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2];
+      v6 = (unsigned __int8)byte_4E8168[abs((int)v3->uItemID)-1][2*v2->Treasure_prob+1];//[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3];
       v7 = rand();
       v8 = v6 - v5 + 1;
       v9 = v5 + v7 % v8;