changeset 1110:cf6cd674c398

bitwise operator ambiguity reduced
author Grumpy7
date Mon, 27 May 2013 23:05:32 +0200
parents a1fd8045ffb1
children 044d65e41250
files Actor.cpp Chest.cpp GUIWindow.cpp Game.cpp Render.cpp UIHouses.cpp Vis.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp
diffstat 10 files changed, 34 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Mon May 27 22:25:27 2013 +0200
+++ b/Actor.cpp	Mon May 27 23:05:32 2013 +0200
@@ -230,16 +230,14 @@
 //----- (0040894B) --------------------------------------------------------
 bool Actor::CanAct()
 {
-  signed int v1; // esi@1
+  bool v1; // esi@1
   bool v2; // edi@2
   unsigned __int16 v3; // ax@6
 
-  v1 = 0;
   v2 = (signed __int64)this->pActorBuffs[5].uExpireTime > 0;// stoned
-  if ( (signed __int64)this->pActorBuffs[6].uExpireTime > 0 )// paralyzed
-    v1 = 1;
+  v1 = (signed __int64)this->pActorBuffs[6].uExpireTime > 0;// paralyzed
   v3 = this->uAIState;
-  return (v2 | v1 | v3 == Dying | v3 == Dead | v3 == Removed | v3 == Summoned | v3 == Disabled) == 0;
+  return (v2 || v1 || v3 == Dying || v3 == Dead || v3 == Removed || v3 == Summoned || v3 == Disabled);
 }
 
 //----- (004089C7) --------------------------------------------------------
--- a/Chest.cpp	Mon May 27 22:25:27 2013 +0200
+++ b/Chest.cpp	Mon May 27 23:05:32 2013 +0200
@@ -340,7 +340,7 @@
     v6 = item_texture->uTextureWidth;
     if ( v6 < 14 )
         v6 = 14;
-    texture_cell_width = (v6 - 14 >> 5) + 1;
+    texture_cell_width = ((v6 - 14) >> 5) + 1;
     v8 = item_texture->uTextureHeight;
     if ( v8 < 14 )
         v8 = 14;
--- a/GUIWindow.cpp	Mon May 27 22:25:27 2013 +0200
+++ b/GUIWindow.cpp	Mon May 27 23:05:32 2013 +0200
@@ -175,7 +175,7 @@
           return result;
         }
       }
-      if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 & v4->uFrameHeight == 480) )
+      if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 && v4->uFrameHeight == 480) )
       {
         --v2;
         if ( v2 >= 0 )
--- a/Game.cpp	Mon May 27 22:25:27 2013 +0200
+++ b/Game.cpp	Mon May 27 23:05:32 2013 +0200
@@ -91,8 +91,8 @@
   }
   else
   {
-    if ( pParty->vPosition.x != pParty->vPrevPosition.x | pParty->sRotationY != pParty->sPrevRotationY | pParty->vPosition.y != pParty->vPrevPosition.y 
-       | pParty->sRotationX != pParty->sPrevRotationX | pParty->vPosition.z != pParty->vPrevPosition.z | pParty->sEyelevel != pParty->sPrevEyelevel )
+    if ( pParty->vPosition.x != pParty->vPrevPosition.x || pParty->sRotationY != pParty->sPrevRotationY || pParty->vPosition.y != pParty->vPrevPosition.y 
+       || pParty->sRotationX != pParty->sPrevRotationX || pParty->vPosition.z != pParty->vPrevPosition.z || pParty->sEyelevel != pParty->sPrevEyelevel )
       pParty->uFlags |= 2u;
     pParty->vPrevPosition.x = pParty->vPosition.x;
     pParty->vPrevPosition.y = pParty->vPosition.y;
--- a/Render.cpp	Mon May 27 22:25:27 2013 +0200
+++ b/Render.cpp	Mon May 27 23:05:32 2013 +0200
@@ -1624,14 +1624,14 @@
         {
           //v93 = v116;
           //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 64) << 9;
-          ptr_801A08[v86].vWorldPosition.x = terrain_76DBC8[v86] - 64 << 9;
+          ptr_801A08[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 64) << 9;
           //*(float *)&pHeight = (double)pHeight;
           ptr_801A08[v86].vWorldPosition.y = v92;
           //v106 = ;
           //v97 = v116;
           ptr_801A08[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86], v116);
           //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 63) << 9;
-          ptr_801A04[v86].vWorldPosition.x = terrain_76DBC8[v86] - 63 << 9;
+          ptr_801A04[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 63) << 9;
           ptr_801A04[v86].vWorldPosition.y = v92;
           //pHeight = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97);
           ptr_801A04[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86] + 1, v116);
--- a/UIHouses.cpp	Mon May 27 22:25:27 2013 +0200
+++ b/UIHouses.cpp	Mon May 27 23:05:32 2013 +0200
@@ -2471,7 +2471,7 @@
       pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
       v36 = LOBYTE(pFontArrus->uFontHeight) - 3;
       v37 = -pDialogueWindow->pNumPresenceButton < 0;
-      if ( !(v37 ^ pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton) )
+      if ( !(v37 ^ (pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton)) )
       {
         do
         {
@@ -2883,7 +2883,7 @@
         pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
         v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
         v20 = -pDialogueWindow->pNumPresenceButton < 0;
-        if ( v20 ^ pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )
+        if ( v20 ^ (pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton ))
         {
           pItemNum = 2;
           pNumString = 0;
@@ -3079,7 +3079,7 @@
       pNumActiveItem = pDialogueWindow->pStartingPosActiveItem;
       v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138;
       v20 = -pDialogueWindow->pNumPresenceButton < 0;
-      if ( v20 ^ pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton )
+      if ( v20 ^ (pNumActiveItem > pNumActiveItem + pDialogueWindow->pNumPresenceButton ))
       {
         pItemNum = 2;
         pNumString = 0;
@@ -3413,7 +3413,7 @@
         v76 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
         v77 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
         v28 = -pDialogueWindow->pNumPresenceButton < 0;
-        if ( v28 ^ pNumActiveItem > v76 )
+        if ( v28 ^ (pNumActiveItem > v76) )
         {
           pItemNum = 2;
           pNumString = 0;
@@ -3613,7 +3613,7 @@
       v26 = pNumActiveItem + pDialogueWindow->pNumPresenceButton;
       v27 = (2 * (87 - (174 - all_text_height) / 2) - all_text_height) / 2 - (174 - all_text_height) / 2 / 2 + 138;
       v28 = -pDialogueWindow->pNumPresenceButton < 0;
-      if ( v28 ^ pNumActiveItem > v26 )
+      if ( v28 ^ (pNumActiveItem > v26) )
       {
         pItemNum = 2;
         pNumString = 0;
@@ -4167,7 +4167,7 @@
       v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138;
       v24 = -pDialogueWindow->pNumPresenceButton < 0;
       pActiveButton = pDialogueWindow->pStartingPosActiveItem;
-      if ( v24 ^ pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
+      if ( v24 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) )
       {
         pNumString = 0;
         do
@@ -5897,7 +5897,7 @@
     v81 = (3 * (58 - (signed int)_this) - all_text_height) / 2 - (174 - all_text_height) / 3 / 2 + 138;
     v20 = -pDialogueWindow->pNumPresenceButton < 0;
     v118 = pDialogueWindow->pStartingPosActiveItem;
-    if ( v20 ^ pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
+    if ( v20 ^ (pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton) )
     {
       v122 = 2;
       pSrtingNum = 0;
--- a/Vis.cpp	Mon May 27 22:25:27 2013 +0200
+++ b/Vis.cpp	Mon May 27 23:05:32 2013 +0200
@@ -638,7 +638,7 @@
   {
     if ( v16 >= 2 )
       break;
-    if ( v6 ^ intersect_face_vertex_coords_list_b[i + 1] >= b )
+    if ( v6 ^ (intersect_face_vertex_coords_list_b[i + 1] >= b) )
     {
       if ( intersect_face_vertex_coords_list_a[i + 1] >= a )
         v10 = 0;
--- a/mm7_3.cpp	Mon May 27 22:25:27 2013 +0200
+++ b/mm7_3.cpp	Mon May 27 23:05:32 2013 +0200
@@ -3546,14 +3546,14 @@
       break;
     v17 = v25;
     v18 = word_720B40_intercepts_zs[v25 + 1];
-    if ( v16 ^ v18 >= v27 )
+    if ( v16 ^ (v18 >= v27) )
     {
       v19 = word_720C10_intercepts_xs[v17 + 1];
       if ( v19 >= v26 )
         v20 = 0;
       else
         v20 = 2;
-      v21 = v20 | word_720C10_intercepts_xs[v17] < v26;
+      v21 = v20 | (word_720C10_intercepts_xs[v17] < v26);
       if ( v21 != 3 )
       {
         if ( !v21
@@ -3684,14 +3684,14 @@
       break;
     v13 = v21;
     v14 = word_7209A0_intercepts_ys_plus_ys[v21 + 1];
-    if ( v12 ^ v14 >= v24 )
+    if ( v12 ^ (v14 >= v24) )
     {
       v15 = word_720A70_intercepts_xs_plus_xs[v13 + 1];
       if ( v15 >= v23 )
         v16 = 0;
       else
         v16 = 2;
-      v17 = v16 | word_720A70_intercepts_xs_plus_xs[v13] < v23;
+      v17 = v16 | (word_720A70_intercepts_xs_plus_xs[v13] < v23);
       if ( v17 != 3 )
       {
         if ( !v17
@@ -11570,7 +11570,7 @@
   int v2; // ebx@1
   char *v3; // esi@1
   int v4; // edi@4
-  int v5; // ecx@4
+  bool v5; // ecx@4
   SpriteFrame *v6; // eax@6
   SpriteFrame *v7; // edi@6
   int v8; // eax@6
@@ -11602,10 +11602,11 @@
       {
         //v4 = result;
         v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320 
-           | pOtherOverlayList->pOverlays[i].field_0 == v2 + 330 | pOtherOverlayList->pOverlays[i].field_0 == v2 + 340 
-           | pOtherOverlayList->pOverlays[i].field_0 == v2 + 350;
+           || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330 
+           || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340 
+           || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350;
         pOtherOverlayList->pOverlays[i].field_0 = v2 + 310;
-        if ( pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 | v5 )
+        if ( pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5 )
         {
           if ( !pOtherOverlayList->pOverlays[i].field_0 )
           {
--- a/mm7_4.cpp	Mon May 27 22:25:27 2013 +0200
+++ b/mm7_4.cpp	Mon May 27 23:05:32 2013 +0200
@@ -284,7 +284,7 @@
             continue;
 
             v14 = word_721460_xs[j + 1] >= x ? 0 : 2;
-            v15 = v14 | word_721460_xs[j] < x;
+            v15 = v14 | (word_721460_xs[j] < x);
 
           if (v15 == 3)
             continue;
@@ -516,7 +516,7 @@
                 if ( v43 != v44 )
                 {
                   v18 = word_721040[i + 1] >= X ? 0 : 2;
-                  v19 = v18 | word_721040[i] < X;
+                  v19 = v18 | (word_721040[i] < X);
                   if ( v19 != 3 )
                   {
                     if ( !v19 )
@@ -722,7 +722,7 @@
                         if ( v34 != v35 )
                         {
                           v13 = word_720DB0_xs[v12 + 1] >= v31 ? 0 : 2;
-                          v14 = v13 | word_720DB0_xs[v12] < v31;
+                          v14 = v13 | (word_720DB0_xs[v12] < v31);
                           if ( v14 != 3 )
                           {
                             if ( !v14
--- a/mm7_5.cpp	Mon May 27 22:25:27 2013 +0200
+++ b/mm7_5.cpp	Mon May 27 23:05:32 2013 +0200
@@ -7119,7 +7119,7 @@
         if ( SHIDWORD(v6->pActorBuffs[6].uExpireTime) >= result
           && (SHIDWORD(v6->pActorBuffs[6].uExpireTime) > result || LODWORD(v6->pActorBuffs[6].uExpireTime) > result) )
           result = 1;
-        if ( !(v13 | result | v6->uAIState == 5 | v6->uAIState == 11 | v6->uAIState == 19) )
+        if ( !(v13 != 0 || result || v6->uAIState == 5 || v6->uAIState == 11 || v6->uAIState == 19) )
         {
           v13 = ai_near_actors_targets_pid[v5];
           memcpy(&v9, Actor::GetDirectionInfo(a1, v13, &a3, 0), sizeof(v9));
@@ -7840,14 +7840,14 @@
       break;
     v20 = v19;
     v21 = dword_4F5CC4_ys[v20 + 2];
-    if ( v18 ^ v21 >= v8 )
+    if ( v18 ^ (v21 >= v8) )
     {
       v22 = dword_4F5D98_xs[v20 + 1];
       if ( v22 >= a4a )
         v23 = 0;
       else
         v23 = 2;
-      v24 = v23 | dword_4F5D98_xs[v20] < a4a;
+      v24 = v23 | (dword_4F5D98_xs[v20] < a4a);
       if ( v24 != 3 )
       {
         if ( !v24
@@ -7975,14 +7975,14 @@
       break;
     v17 = v25;
     v18 = dword_4F5B24_ys[v25 + 2];
-    if ( v16 ^ v18 >= a3 )
+    if ( v16 ^ (v18 >= a3) )
     {
       v19 = dword_4F5BF4_xs[v17 + 2];
       if ( v19 >= a4a )
         v20 = 0;
       else
         v20 = 2;
-      v21 = v20 | dword_4F5BF4_xs[v17 + 1] < a4a;
+      v21 = v20 | (dword_4F5BF4_xs[v17 + 1] < a4a);
       if ( v21 != 3 )
       {
         if ( !v21