diff mm7_4.cpp @ 1205:8c02e6f74b29

arrays to std::arrays phase 2 - mm7_data.h converted
author Grumpy7
date Sun, 09 Jun 2013 00:30:48 +0200
parents 0dbf6c4dd029
children ab6560001f5b
line wrap: on
line diff
--- a/mm7_4.cpp	Sat Jun 08 21:47:29 2013 +0200
+++ b/mm7_4.cpp	Sun Jun 09 00:30:48 2013 +0200
@@ -795,7 +795,7 @@
   do
   {
     v24 = dword_720F20[v5 / 4];
-    v25 = *(int *)((char *)dword_720F20 + v23);
+    v25 = *(int *)((char *)dword_720F20.data() + v23);
     if ( v24 == v25 )
       goto LABEL_50;
     if ( v25 > a3 + 15 )
@@ -1476,7 +1476,7 @@
   signed int v2; // eax@3
 
   v0 = 0;
-  v1 = ptr_80CA10;
+  v1 = ptr_80CA10.data();
   do
   {
     ++v0;
@@ -2402,7 +2402,7 @@
           v14->ReceiveDamage((signed __int64)v15, DMGT_FIRE);
           if ( pParty->uFlags & 4 )
           {
-            strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[660]);
+            strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);
             GameUI_Footer_TimeLeft = 128;
           }
           goto LABEL_39;
@@ -2431,7 +2431,7 @@
       v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE);
       if ( pParty->uFlags & 0x200 )
       {
-        strcpy(GameUI_Footer_TimedString, pGlobalTXT_LocalizationStrings[661]);
+        strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]);
         GameUI_Footer_TimeLeft = 128;
       }
       ++v16;
@@ -3367,7 +3367,7 @@
   pPlayer = &pParty->pPlayers[v6];
   v59 = TargetColor(255, 255, 155);
   //v61 = pPlayer;
-  memset(pTmpBuf2, 0, sizeof(pTmpBuf2));
+  memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2));
 
   NPCData *npc = nullptr;
   if ( dword_5C35D4 )
@@ -3537,8 +3537,8 @@
           {
             v11 = pGlobalTXT_LocalizationStrings[393];// "daughter"
 _continue_strcat:
-            strcat(pTmpBuf2, v11);
-            dst = strlen(pTmpBuf2);
+            strcat(pTmpBuf2.data(), v11);
+            dst = strlen(pTmpBuf2.data());
             //v64 += 2;
             i += 2;
           }
@@ -3578,7 +3578,7 @@
 
           case 23:
           {
-            v47 = pMapStats->GetMapInfo(pCurrentMapName);
+            v47 = pMapStats->GetMapInfo(pCurrentMapName.data());
             if ( v47 )
               v11 = pMapStats->pInfos[v47].pName;
             else
@@ -3727,7 +3727,7 @@
         }
       }
   }
-  return pTmpBuf2;
+  return pTmpBuf2.data();
 }
 
 //----- (0049B04D) --------------------------------------------------------
@@ -6058,7 +6058,7 @@
   v1 = *_this - 399;
   v2 = (*_this - 400) % 11 + 1;
   v11 = 4 * (*_this - 400) / 11;
-  sprintf(pTmpBuf, "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2);
+  sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2);
   if ( pMouse->GetCursorPos(&a2)->y <= 320 )
     v3 = pMouse->GetCursorPos(&a2)->y + 30;
   else
@@ -6081,13 +6081,13 @@
     v5 = v13;
   if ( v4 > v5 )
     v5 = v4;
-  sprintf(pTmpBuf2, "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
+  sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
     pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431],        // "Normal"
     v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433],        // "Expert"
     v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432],        // "Master"
     v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96],         // "Grand"
     v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc);
-  v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2, &a1, 0, 0);
+  v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0);
   a1.uFrameHeight += v6;
   if ( (signed int)a1.uFrameHeight < 150 )
     a1.uFrameHeight = 150;
@@ -6100,12 +6100,12 @@
   a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
   v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
-  a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0);
+  a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0);
   a1.uFrameZ = a1.uFrameX + 107;
   a1.uFrameWidth = 108;
   a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u);
-  sprintf(pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
-  a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3);
+  sprintf(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
+  a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3);
 }
 
 //----- (004B1784) --------------------------------------------------------
@@ -6130,12 +6130,12 @@
     v4.uFrameX = 483;
     v4.uFrameWidth = 148;
     v4.uFrameZ = 334;
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// 
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], pPlayer->pName, pGlobalTXT_LocalizationStrings[562]);// 
                                                 // "%s is in no condition to %s"
                                                 // "do anything"
     v2 = TargetColor(255, 255, 0x9Bu);
-    v3 = pFontArrus->CalcTextHeight(pTmpBuf, &v4, 0, 0);
-    v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf, 3u);
+    v3 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v4, 0, 0);
+    v4.DrawTitleText(pFontArrus, 0, (212 - v3) / 2 + 101, v2, pTmpBuf.data(), 3u);
     result = 0;
   }
   return result;
@@ -6359,7 +6359,7 @@
   v11 = 0;
   uDialogueType = 84;
   current_npc_text = (char *)pNPCTopics[667].pText;
-  v0 = _4F0882_evt_VAR_PlayerItemInHands_vals;
+  v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data();
   while ( 1 )
   {
     if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0) )
@@ -6822,8 +6822,8 @@
       {
         if ( v31 == v14 )
         {
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//Вы должны достичь звания %s или %s для обучения этому уровню навыка.
-          return pTmpBuf;
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[v10 + 2], pClassNames[v10 + 3]);//Вы должны достичь звания %s или %s для обучения этому уровню навыка.
+          return pTmpBuf.data();
         }
         v25 = pClassNames[v10 + 2];
       }
@@ -6831,14 +6831,14 @@
       {
         if ( v31 != v14 )
         {
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Этот уровень навыка не может быть постигнут классом %s.
-          return pTmpBuf;
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Этот уровень навыка не может быть постигнут классом %s.
+          return pTmpBuf.data();
         }
         v25 = pClassNames[v10 + 3];
       }
     }
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[633], v25);//Вы должны достичь звания %s для обучения этому уровню навыка.
-    return pTmpBuf;
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], v25);//Вы должны достичь звания %s для обучения этому уровню навыка.
+    return pTmpBuf.data();
   }
   if ( !pPlayers[uActiveCharacter]->CanAct() )
     return (char *)pNPCTopics[122].pText;
@@ -7074,20 +7074,20 @@
   contract_approved = 1;
   if ( v34 == 2 )
   {
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],//Получить степень ^Pr[%s] в навыке ^Pr[%s] за ^I[%lu] золот^L[ой;ых;ых]
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Получить степень ^Pr[%s] в навыке ^Pr[%s] за ^I[%lu] золот^L[ой;ых;ых]
               pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Эксперт
-    return pTmpBuf2;
+    return pTmpBuf2.data();
   }
   if ( v34 == 3 )
   {
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
               pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Мастер
-    return pTmpBuf2;
+    return pTmpBuf2.data();
   }
   if ( v34 == 4 )
-    sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[534],
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
               pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Великий Магистр
-  return pTmpBuf2;
+  return pTmpBuf2.data();
 }
 
 //----- (004B29F2) --------------------------------------------------------
@@ -7199,8 +7199,8 @@
     v2 = pTransitionStrings[uHouse_ExitPic];
     if ( !v2 )
     {
-      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[411], v0);
-      v2 = pTmpBuf;
+      sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[411], v0);
+      v2 = pTmpBuf.data();
     }
     v3 = v2;
     v4 = pFontCreate->CalcTextHeight(v2, &a1, 0, 0);
@@ -7215,10 +7215,10 @@
   v7 = TargetColor(0x15u, 0x99u, 0xE9u);
   v8 = v6->uProfession;
   if ( v8 )
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]);
+    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v8]);
   else
-    strcpy(pTmpBuf, v6->pName);
-  a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf, 3u);
+    strcpy(pTmpBuf.data(), v6->pName);
+  a1.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v7, pTmpBuf.data(), 3u);
   if ( !dword_591080 )
   {
     if ( !uDialogueType )
@@ -7292,9 +7292,9 @@
           v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
           v31 = *(int *)v29;
           v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-          sprintfex(pTmpBuf, "\f%05d%s\f%05d", v32, v31, v30);
-          sprintfex(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]);
-          current_npc_text = pTmpBuf2;
+          sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", v32, v31, v30);
+          sprintfex(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]);
+          current_npc_text = pTmpBuf2.data();
           v15 = "";
           goto LABEL_45;
         }
@@ -7335,9 +7335,9 @@
             }
             if ( uDialogueType != 84 )
               goto LABEL_49;
-            sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName);
-            sprintf(pTmpBuf2, current_npc_text, pTmpBuf);
-            current_npc_text = pTmpBuf2;
+            sprintf(pTmpBuf.data(), format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName);
+            sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf);
+            current_npc_text = pTmpBuf2.data();
             goto LABEL_45;
           }
           v21 = v20 - 1;
@@ -7803,11 +7803,11 @@
   {
     pDialogueWindow->Release();
     pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
-    sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
+    sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S], pMapStats->pInfos[uHouse_ExitPic].pName);
     pBtn_ExitCancel = pDialogueWindow->CreateButton(566, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// "Cancel"
-    pBtn_YES        = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF,     1, 'Y', sHouseName, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
-    pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0,  UIMSG_BF, 1u, 0x20u,  sHouseName, 0);
-    pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName, 0);
+    pBtn_YES        = pDialogueWindow->CreateButton(486, 445, 75, 33, 1, 0, UIMSG_BF,     1, 'Y', sHouseName.data(), pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
+    pDialogueWindow->CreateButton( pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63u, 73u, 1, 0,  UIMSG_BF, 1u, 0x20u,  sHouseName.data(), 0);
+    pDialogueWindow->CreateButton(8, 8, 460, 344, 1, 0, UIMSG_BF, 1, 0x59u, sHouseName.data(), 0);
   }
   else
   {
@@ -8388,16 +8388,16 @@
   if ( !v34 )
   {
 LABEL_40:
-    sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
-    strcat(pTmpBuf, "\n \n");
-    strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
+    strcat(pTmpBuf.data(), "\n \n");
+    strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
     v22 = v31;
-    v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v28, 0, 0);
-    v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u);
+    v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v28, 0, 0);
+    v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
     return; 
   }
-  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v32);
-  v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
+  sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v32);
+  v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
   v32 = (149 - v33) / v34;
   if ( (149 - v33) / v34 > 32 )
     v32 = 32;