changeset 2335:6e3ca612f132

int -> uint
author Ritor1
date Wed, 02 Apr 2014 22:05:35 +0600
parents ddb803517a48
children d6887ee81068
files AudioPlayer.cpp Mouse.cpp NPC.cpp PaletteManager.cpp Texture.cpp UI/UIHouses.cpp Vis.cpp stru9.cpp
diffstat 8 files changed, 27 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Wed Apr 02 21:05:19 2014 +0600
+++ b/AudioPlayer.cpp	Wed Apr 02 22:05:35 2014 +0600
@@ -1788,7 +1788,7 @@
   }
 
 //LABEL_37:
-  for (uint i = 0; i < uMixerChannels; ++i)
+  for (int i = 0; i < uMixerChannels; ++i)
   {
     if (AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Done)
     {
@@ -1797,7 +1797,7 @@
     }
   }
 
-  for (uint i = 0; i < uMixerChannels; ++i)
+  for (int i = 0; i < uMixerChannels; ++i)
   {
     if (pMixerChannels[i].source_pid <= 0)
       continue;
@@ -2590,7 +2590,7 @@
     //{
       //v8 = this->p3DSamples;
       //while ( 1 )
-      for ( uint i = 0; i < this->uNum3DSamples; ++i )
+      for ( int i = 0; i < this->uNum3DSamples; ++i )
       {
         v9 = (void *)AIL_allocate_3D_sample_handle(this->h3DSoundProvider);
         this->p3DSamples[i].hSample = v9;
--- a/Mouse.cpp	Wed Apr 02 21:05:19 2014 +0600
+++ b/Mouse.cpp	Wed Apr 02 22:05:35 2014 +0600
@@ -306,8 +306,8 @@
     return;
   //пишем на экран курсор с вещью
   ushort* pSrc = pCursorBitmap3_sysmembits_16bit;
-  for (uint y = uCursorWithItemY; y < uCursorWithItemZ; ++y)
-    for (uint x = uCursorWithItemX; x < uCursorWithItemW; ++x)
+  for (int y = uCursorWithItemY; y < uCursorWithItemZ; ++y)
+    for (int x = uCursorWithItemX; x < uCursorWithItemW; ++x)
       //pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + x] = *pSrc++;
         pRenderer->WritePixel16(x, y, *pSrc++);
 }
--- a/NPC.cpp	Wed Apr 02 21:05:19 2014 +0600
+++ b/NPC.cpp	Wed Apr 02 22:05:35 2014 +0600
@@ -912,7 +912,7 @@
     {
       int rangeBottom = 0;
       int rangeTop = 0;
-      for ( int i = 0; i < this->uNumNPCNames[genderId]; ++i )
+      for ( uint i = 0; i < this->uNumNPCNames[genderId]; ++i )
       {
         if (tolower(this->pNPCNames[i][genderId][0]))
         {
@@ -946,7 +946,7 @@
     if ( bNoNPCHiring == 1 )
         return 0;
 
-    for (int i=0; i<pNPCStats->uNumNewNPCs; ++i )
+    for (uint i=0; i<pNPCStats->uNumNewNPCs; ++i )
         {
         if ( pNPCStats->pNewNPCData[i].uProfession == uProfession && 
             (pNPCStats->pNewNPCData[i].uFlags & 0x80) )
@@ -1543,7 +1543,7 @@
   {
     __debugbreak();  // probably hirelings found in buildings, not present in MM7, changed "pCurrentNPCInfo->uProfession - 1" to "pCurrentNPCInfo->uProfession", have to check in other versions whether it's ok
     pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].uHirePrice;
-    if ( pParty->uNumGold < pPrice )
+    if ( pParty->uNumGold < (unsigned int)pPrice )
     {
       ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
       dialogue_show_profession_details = false;
@@ -1602,26 +1602,20 @@
   if ( pPlayers[uActiveCharacter]->CanAct() )
   {
     if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits, dword_F8B1AC_award_bit_number) )
-    {
       return pNPCTopics[dialogue_base+13].pText;
-    }
     else
     {
-      if ( gold_transaction_amount <= pParty->uNumGold )
+      if ( (unsigned int)gold_transaction_amount <= pParty->uNumGold )
       {
         contract_approved = 1;
         return pNPCTopics[pEventCode + dialogue_base].pText;
       }
       else
-      {
         return pNPCTopics[dialogue_base+14].pText; 
-      }
     }
   }
   else
-  {
     return pNPCTopics[dialogue_base+12].pText; 
-  }
 }
 //----- (004B40E6) --------------------------------------------------------
 void NPCHireableDialogPrepare()
--- a/PaletteManager.cpp	Wed Apr 02 21:05:19 2014 +0600
+++ b/PaletteManager.cpp	Wed Apr 02 22:05:35 2014 +0600
@@ -749,7 +749,7 @@
   //char v11; // [sp+19h] [bp-387h]@17
   //char v12[766]; // [sp+1Ah] [bp-386h]@17
   char Source[32]; // [sp+360h] [bp-40h]@4
-  PaletteManager *v15; // [sp+380h] [bp-20h]@1
+  //PaletteManager *v15; // [sp+380h] [bp-20h]@1
   float v16; // [sp+384h] [bp-1Ch]@7
   int v17; // [sp+388h] [bp-18h]@6
   float v18; // [sp+38Ch] [bp-14h]@7
@@ -758,7 +758,7 @@
   float a6; // [sp+398h] [bp-8h]@7
   float a3; // [sp+39Ch] [bp-4h]@7
 
-  v15 = this;
+  //v15 = this;
   v2 = (unsigned int *)&this->pPaletteIDs[1];
   result = 1;
   while ( *v2 != uPaletteID )
@@ -787,9 +787,7 @@
           RGB2HSV(&v16, &v18, a1, a2a, a3, &a6);
           v5 = a6 * 1.1;
           if ( v5 >= 0.0 && v5 >= 1.0 )
-          {
             v5 = 1.0;
-          }
           else
           {
             if ( v5 < 0.0 )
@@ -798,9 +796,7 @@
           a6 = v5;
           v6 = v18 * 0.64999998;
           if ( v6 >= 0.0 && v6 >= 1.0 )
-          {
             v6 = 1.0;
-          }
           else
           {
             if ( v6 < 0.0 )
@@ -818,12 +814,10 @@
         }
         while ( v4 < 768 );
         tex.Release();
-        result = v15->MakeBasePaletteLut(uPaletteID, v10);
+        result = this->MakeBasePaletteLut(uPaletteID, v10);
       }
       else
-      {
         result = 0;
-      }
       return result;
     }
   }
@@ -851,8 +845,6 @@
     if (pPaletteIDs[i] == idx)
       return i;
 
-
-
       v6 = (int)&pPaletteIDs[1];
       v7 = 1;
       while ( *(int *)v6 )
--- a/Texture.cpp	Wed Apr 02 21:05:19 2014 +0600
+++ b/Texture.cpp	Wed Apr 02 22:05:35 2014 +0600
@@ -1585,8 +1585,8 @@
       {
         if ( !_stricmp((&Str1)[4 * v9], "New") )
         {
-          v10 = (int)&v2->pTextures[v2->sNumTextures].uFlags;
-          *(char *)v10 |= 2u;
+          //v10 = (int)&v2->pTextures[v2->sNumTextures].uFlags;
+          v2->pTextures[v2->sNumTextures].uFlags |= 2;
         }
       }
       ++v2->sNumTextures;
--- a/UI/UIHouses.cpp	Wed Apr 02 21:05:19 2014 +0600
+++ b/UI/UIHouses.cpp	Wed Apr 02 22:05:35 2014 +0600
@@ -957,7 +957,7 @@
 
   }
 
-  for (uint i = 0; i < uNumDialogueNPCPortraits; ++i)
+  for (int i = 0; i < uNumDialogueNPCPortraits; ++i)
   {
    
     char icon_name[128];
--- a/Vis.cpp	Wed Apr 02 21:05:19 2014 +0600
+++ b/Vis.cpp	Wed Apr 02 22:05:35 2014 +0600
@@ -134,7 +134,7 @@
     {
       if (v13 == -1)
         v13 = i;
-      else  if ((unsigned int)pBillboardRenderList[billboard->sParentBillboardID].sZValue < 
+      else  if (pBillboardRenderList[billboard->sParentBillboardID].sZValue < 
                   pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].sParentBillboardID].sZValue)
         v13 = i;
     }
@@ -152,7 +152,7 @@
   float max_x = -FLT_MAX;
   //thisb = -3.4028235e38;
   float max_y = -FLT_MAX;
-  for (uint i = 0; i < num_vertices; ++i)
+  for (int i = 0; i < num_vertices; ++i)
   {
     //v9 = a1;
     //do
@@ -366,7 +366,7 @@
   if (!pOutdoor)
     return;
 
-  for (uint i = 0; i < pOutdoor->uNumBModels; ++i)
+  for (int i = 0; i < pOutdoor->uNumBModels; ++i)
   {
     int reachable;
     if (!IsBModelVisible(i, &reachable))
@@ -375,7 +375,7 @@
       continue;
 
     BSPModel* bmodel = &pOutdoor->pBModels[i];
-    for (uint j = 0; j < bmodel->uNumFaces; ++j)
+    for (int j = 0; j < bmodel->uNumFaces; ++j)
     {
       ODMFace* face = &bmodel->pFaces[j];
       if (is_part_of_selection(face, filter))
@@ -614,7 +614,7 @@
   v6 = intersect_face_vertex_coords_list_b[0] >= b;
   if (v5 <= 0)
     return false;
-  for ( uint i = 0; i < v5; ++i )
+  for ( int i = 0; i < v5; ++i )
   {
     if ( v16 >= 2 )
       break;
@@ -1267,7 +1267,7 @@
 //----- (004C06F8) --------------------------------------------------------
 void Vis::PickBillboards_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter)
 {
-  for (int i = 0; i < pRenderer->uNumBillboardsToDraw; ++i)
+  for (uint i = 0; i < pRenderer->uNumBillboardsToDraw; ++i)
   {
     RenderBillboardD3D* d3d_billboard = &pRenderer->pBillboardRenderListD3D[i];
 
@@ -1572,7 +1572,7 @@
 //----- (004C0DEA) --------------------------------------------------------
 void Vis::PickOutdoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter)
 {
-  for (uint i = 0; i < pOutdoor->uNumBModels; ++i)
+  for (int i = 0; i < pOutdoor->uNumBModels; ++i)
   {
     int v17;
     if (!IsBModelVisible(i, &v17))
@@ -1581,7 +1581,7 @@
       continue;
 
     BSPModel* bmodel = &pOutdoor->pBModels[i];
-    for (uint j = 0; j < bmodel->uNumFaces; ++j)
+    for (int j = 0; j < bmodel->uNumFaces; ++j)
     {
       //ODMFace* face = &bmodel->pFaces[j];
 
--- a/stru9.cpp	Wed Apr 02 21:05:19 2014 +0600
+++ b/stru9.cpp	Wed Apr 02 22:05:35 2014 +0600
@@ -310,9 +310,7 @@
           v10 = (float)0.0;
       }
       else
-      {
         v10 = 1.0;
-      }
     }
     else
     {
@@ -326,9 +324,7 @@
           v10 = (float)1.0;
       }
       else
-      {
         v10 = 0.0;
-      }
     }
     result = (bool)a5;
     a5->vWorldPosition.x = (a2->vWorldPosition.x - v6->vWorldPosition.x) * v10 + v6->vWorldPosition.x;
@@ -336,20 +332,15 @@
     a5->vWorldPosition.z = (a2->vWorldPosition.z - v6->vWorldPosition.z) * v10 + v6->vWorldPosition.z;
     a5->u = (a2->u - v6->u) * v10 + v6->u;
     a5->v = (a2->v - v6->v) * v10 + v6->v;
-    goto LABEL_15;
+    return 1;
   }
   v13 = v8 < 0.0;
   v14 = 0;
   v15 = v8 == 0.0;
-  BYTE1(result) = HIBYTE(v9);
+ // BYTE1(result) = HIBYTE(v9);
   if ( v8 < 0.0 )
-  {
-LABEL_15:
-    LOBYTE(result) = 1;
-    return result;
-  }
-  LOBYTE(result) = 0;
-  return result;
+    return 1;
+  return 0;
 }
 // AE3398: using guessed type char static_init_flag__AE3388_bit1__AE3378_bit2;