diff mm7_2.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 1eed3e0ab666
children fd3bea473c0c 0d6c7ff3cddd
line wrap: on
line diff
--- a/mm7_2.cpp	Sat Jun 08 21:47:29 2013 +0200
+++ b/mm7_2.cpp	Sun Jun 09 00:30:48 2013 +0200
@@ -880,7 +880,7 @@
         do
         {
           HouseNPCData[v2 + 7] = (NPCData *)window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2],
-                                              0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v2, 0, byte_591180[v2], 0, 0, 0);
+                                              0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v2, 0, byte_591180[v2].data(), 0, 0, 0);
           v1 = uNumDialogueNPCPortraits;
           ++v2;
           //v3 += 100;
@@ -1085,8 +1085,8 @@
       uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(bought_item->GetValue(), p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
       uNumSeconds = 0;
       a3 = 0;
-      if ( pMapStats->GetMapInfo(pCurrentMapName) )
-        a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)]._steal_perm;
+      if ( pMapStats->GetMapInfo(pCurrentMapName.data()) )
+        a3 = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName.data())]._steal_perm;
       party_reputation = GetPartyReputation();
       if (pPlayers[uActiveCharacter]->CanSteal())
       {
@@ -1285,13 +1285,13 @@
   {
 	v4 = pClassNames[v3->classType];
     v5 = v3->GetBaseLevel();
-	sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[129], i->pName, v5, v4);
+	sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], i->pName, v5, v4);
     pWindow.DrawTitleText(
       pFont,
       1u,
       v20 * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46,
       1u,
-      pTmpBuf,
+      pTmpBuf.data(),
       3u);
 	v23 += i->uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8));
     ++v20;
@@ -1302,7 +1302,7 @@
   v23 = (signed __int64)v23 / v19;
   v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xCu, 0);
   pWindow.DrawTitleText(pFont, 1u, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1u, v6, 0);
-  strcpy(pTmpBuf, pGlobalTXT_LocalizationStrings[37]);
+  strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);
   v7 = pGlobalTXT_LocalizationStrings[56];
   if ( v17 != 1 )
     v7 = pGlobalTXT_LocalizationStrings[57];
@@ -1312,11 +1312,11 @@
   v9 = pGlobalTXT_LocalizationStrings[245];
   if ( v14 != 1 )
     v9 = pGlobalTXT_LocalizationStrings[132];
-  sprintf(pTmpBuf2, " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
-  strcat(pTmpBuf, pTmpBuf2);
-  pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf, 3u);
-  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[94], v23);
-  pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight, 1u, pTmpBuf, 3u);
+  sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
+  strcat(pTmpBuf.data(), pTmpBuf2.data());
+  pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf.data(), 3u);
+  sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23);
+  pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight, 1u, pTmpBuf.data(), 3u);
   BYTE1(dword_6BE364_game_settings_1) |= 0x40u;
   pRenderer->EndScene();
   pRenderer->Present();
@@ -5108,7 +5108,7 @@
   char Drive[4]; // [sp+408h] [bp-8h]@1
   int DstBuf; // [sp+40Ch] [bp-4h]@2
 
-  strcpy(a1, pCurrentMapName);
+  strcpy(a1, pCurrentMapName.data());
   _splitpath(a1, Drive, Dir, Filename, Ext);
   sprintf(a1, "levels\\%s%s", Filename, ".lod");
   v0 = fopen(a1, "rb");
@@ -5222,7 +5222,7 @@
   pGameLoadingUI_ProgressBar->Reset(0x1Bu);
   pSoundList->_4A9D79(0);
   uCurrentlyLoadedLevelType = (LEVEL_TYPE)2;
-  ODM_LoadAndInitialize(pCurrentMapName, v3);
+  ODM_LoadAndInitialize(pCurrentMapName.data(), v3);
   if ( !v2 )
     TeleportToStartingPoint(uLevel_StartingPointType);
   viewparams->_443365();
@@ -5264,7 +5264,7 @@
   //v1 = 0;
   dword_5C6DF8 = 1;
   pNPCStats->uNewlNPCBufPos = 0;
-  v19 = pMapStats->GetMapInfo(pCurrentMapName);
+  v19 = pMapStats->GetMapInfo(pCurrentMapName.data());
 
   //v15 = 0;
   for (uint i = 0; i < uNumActors; ++i)
@@ -5491,7 +5491,7 @@
   ofn.lCustData = 0;
   ofn.lpfnHook = 0;
   ofn.lpTemplateName = 0;
-  ofn.lpstrFileTitle = pTmpBuf;
+  ofn.lpstrFileTitle = pTmpBuf.data();
 }
 
 //----- (004627B7) --------------------------------------------------------
@@ -6845,7 +6845,7 @@
 //----- (00464839) --------------------------------------------------------
 char __cdecl Is_out15odm_underwater()
 {
-  return _stricmp(pCurrentMapName, "out15.odm") == 0;
+  return _stricmp(pCurrentMapName.data(), "out15.odm") == 0;
 }
 
 //----- (00464851) --------------------------------------------------------
@@ -6872,12 +6872,12 @@
   ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
   pDecalBuilder->Reset(0);
   pGameLoadingUI_ProgressBar->Initialize((GUIProgressBar::Type)v2);
-  strcpy(Str1, pCurrentMapName);
+  strcpy(Str1, pCurrentMapName.data());
   v3 = strtok(Str1, ".");
   strcpy(Str1, v3);
   Level_LoadEvtAndStr(Str1);
   LoadLevel_InitializeLevelEvt();
-  strcpy(Str1, pCurrentMapName);
+  strcpy(Str1, pCurrentMapName.data());
   _strrev(Str1);
   strtok(Str1, ".");
   _strrev(Str1);
@@ -6885,11 +6885,11 @@
   for (uint i = 0; i < 1000; ++i)
     pSpriteObjects[i].uObjectDescID = 0;
 
-  v5 = pMapStats->GetMapInfo(pCurrentMapName);
+  v5 = pMapStats->GetMapInfo(pCurrentMapName.data());
   bUnderwater = 0;
   uLevelMapStatsID = v5;
   pGame->uFlags2 &= 0xFFFFFFF7u;
-  if ( !_stricmp(pCurrentMapName, "out15.odm") )
+  if ( !_stricmp(pCurrentMapName.data(), "out15.odm") )
   {
     bUnderwater = 1;
     pGame->uFlags2 |= 8u;
@@ -6901,7 +6901,7 @@
     PrepareToLoadBLV(v9);
   pAudioPlayer->SetMapEAX();
   sub_461103();
-  if ( !_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv") )
+  if ( !_stricmp(pCurrentMapName.data(), "d11.blv") || !_stricmp(pCurrentMapName.data(), "d10.blv") )
   {
     //spawning grounds & good analogue - no loot & exp from monsters
 
@@ -7910,8 +7910,8 @@
   for (uint i = 0; i < 5; ++i)
     for (uint j = 0; j < 6; ++j)
     {
-      sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", i, j);
-      remove(pTmpBuf);
+      sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j);
+      remove(pTmpBuf.data());
     }
 
   Initialize_GamesLOD_NewLOD();
@@ -8156,7 +8156,7 @@
           pParty->Reset();
           pOtherOverlayList->Reset();
 
-          strcpy(pCurrentMapName, pStartingMapName);
+          strcpy(pCurrentMapName.data(), pStartingMapName.data());
           pParty->CreateDefaultParty(0);
           PlayerCreationUI_Initialize();
           if ( PlayerCreationUI_Loop() )
@@ -8212,7 +8212,7 @@
             break;
           }
           _chdir("..\\");
-          strcpy(pCurrentMapName, ofn.lpstrFileTitle);
+          strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle);
           pMouse->Activate(1);
         }
 //LABEL_48:
@@ -8306,17 +8306,17 @@
 
   wchar_t pStartingMapNameW[1024];
   GetPrivateProfileStringW(L"file", L"startmap", L"out01.odm", pStartingMapNameW, 0x20u, pIniFilename);
-  sprintf(pStartingMapName, "%S", pStartingMapNameW);
+  sprintf(pStartingMapName.data(), "%S", pStartingMapNameW);
 
   v9 = 0;
-  if ( strlen(pStartingMapName) )
+  if ( strlen(pStartingMapName.data()) )
   {
     do
     {
       if ( pStartingMapName[v9] == 32 )
         pStartingMapName[v9] = 0;
       ++v9;
-      v2 = strlen(pStartingMapName);
+      v2 = strlen(pStartingMapName.data());
     }
     while ( v9 < v2 );
   }
@@ -8355,7 +8355,7 @@
 
   wchar_t pDefaultSkyTextureW[1024];
   GetPrivateProfileStringW(L"textures", L"sky", L"plansky1", pDefaultSkyTextureW, 0x10u, pIniFilename);
-  sprintf(pDefaultSkyTexture, "%S", pDefaultSkyTextureW);
+  sprintf(pDefaultSkyTexture.data(), "%S", pDefaultSkyTextureW);
 
   wchar_t pDefaultGroundTextureW[1024];
   GetPrivateProfileStringW(L"textures", L"default", L"dirt", pDefaultGroundTextureW, 0x10u, pIniFilename);
@@ -8371,7 +8371,7 @@
   flt_6BE3AC_debug_recmod1_x_1_6 = flt_6BE3A4_debug_recmod1 * 1.666666666666667;
 
   v3 = 0;
-  if ( strlen(pDefaultSkyTexture) )
+  if ( strlen(pDefaultSkyTexture.data()) )
   {
     do
     {
@@ -8379,7 +8379,7 @@
         pDefaultSkyTexture[v3] = 0;
       ++v3;
     }
-    while ( v3 < strlen(pDefaultSkyTexture) );
+    while ( v3 < strlen(pDefaultSkyTexture.data()) );
   }
   v4 = 0;
   if ( strlen(pDefaultGroundTexture) )
@@ -8469,11 +8469,11 @@
   va_start(va, Format);
   if ( !pRenderer->bWindowMode )
     pRenderer->ChangeBetweenWinFullscreenModes();
-  vsprintf(pTmpBuf, Format, va);
+  vsprintf(pTmpBuf.data(), Format, va);
   if ( pMouse )
     pMouse->Activate(0);
   ClipCursor(0);
-  MessageBoxA(0, pTmpBuf, "Error", 0x30u);
+  MessageBoxA(0, pTmpBuf.data(), "Error", 0x30u);
   Game_DeinitializeAndTerminate(1);
 }
 
@@ -8651,8 +8651,8 @@
   a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
   v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName;
   v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  sprintf(pTmpBuf, format_4E2D80, v2, v1);
-  a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
+  sprintf(pTmpBuf.data(), format_4E2D80, v2, v1);
+  a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u);
   a1.DrawText(
            pFontSmallnum,
            1,
@@ -9324,8 +9324,8 @@
         if ( pParty->pPickedItem.uItemID )
           return 1;
         v24 = (int)pItemsTable->pItems[v20].pUnidentifiedName;
-        sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24);
-        ShowStatusBarString(pTmpBuf2, 2u);
+        sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v24);
+        ShowStatusBarString(pTmpBuf2.data(), 2u);
         if ( v19->uItemID == 506 )
           _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u);
         if ( v19->uItemID == 455 )
@@ -9365,7 +9365,7 @@
               if ( v16 )
               {
                 pParty->uFlags |= 2u;
-                strcpy(byte_5B0938, v16);
+                strcpy(byte_5B0938.data(), v16);
                 sub_4451A8_press_any_key(0, 0, 0);
               }
             }
@@ -9777,7 +9777,7 @@
 LABEL_18:
   if ( !((unsigned __int8)(v11 ^ v12) | v10) )
   {
-    v14 = dword_720020_zvalues;
+    v14 = dword_720020_zvalues.data();
     v15 = 1;
     do
     {
@@ -9922,7 +9922,7 @@
     || pParty->vPosition.y < -22528
     || pParty->vPosition.y > 22528 )
   {
-    strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
+    strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data());
     v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 32);
     if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 )
     {