diff Player.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 15ad868d972f
children 96a81634669e
line wrap: on
line diff
--- a/Player.cpp	Sat Jun 08 21:47:29 2013 +0200
+++ b/Player.cpp	Sun Jun 09 00:30:48 2013 +0200
@@ -1431,8 +1431,8 @@
   }
   else
   {
-    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[67], this->pName);
-    ShowStatusBarString(pTmpBuf, 2u);
+    sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[67], this->pName);
+    ShowStatusBarString(pTmpBuf.data(), 2u);
     result = 0;
   }
   return result;
@@ -3444,8 +3444,8 @@
           {
             party_finds_gold(v19, 2);
             v22 = v19;
-            v23 = pTmpBuf2;
-            sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[302], v31->pName, v22);
+            v23 = pTmpBuf2.data();
+            sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], v31->pName, v22);
 LABEL_43:
             ShowStatusBarString(v23, 2u);
             return _steal_perma;
@@ -3493,11 +3493,11 @@
             }
             sub_421B2C_PlaceInInventory_or_DropPickedItem();
             sprintf(
-              pTmpBuf2,
+              pTmpBuf2.data(),
               pGlobalTXT_LocalizationStrings[304],
               v31->pName,
               pItemsTable->pItems[v16].pUnidentifiedName);
-            ShowStatusBarString(pTmpBuf2, 2u);
+            ShowStatusBarString(pTmpBuf2.data(), 2u);
             sub_421B2C_PlaceInInventory_or_DropPickedItem();
             memcpy(&pParty->pPickedItem, &v27, sizeof(pParty->pPickedItem));
             pMouse->SetCursorBitmapFromItemID(v16);
@@ -3508,8 +3508,8 @@
       v26 = (int)v31->pName;
       v25 = pGlobalTXT_LocalizationStrings[377];
     }
-    v23 = pTmpBuf2;
-    sprintfex(pTmpBuf2, v25, v26);
+    v23 = pTmpBuf2.data();
+    sprintfex(pTmpBuf2.data(), v25, v26);
     goto LABEL_43;
   }
   return 0;
@@ -6747,8 +6747,8 @@
         else
             {    
             v68 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
-            ShowStatusBarString(pTmpBuf, 2);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
+            ShowStatusBarString(pTmpBuf.data(), 2);
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
@@ -7039,8 +7039,8 @@
 
         default:
             v68 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
-            ShowStatusBarString(pTmpBuf, 2u);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36], v68);//"%s can not be used that way"
+            ShowStatusBarString(pTmpBuf.data(), 2u);
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
@@ -7083,8 +7083,8 @@
             {
 
             v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68);
-        ShowStatusBarString(pTmpBuf, 2u);
+        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
+        ShowStatusBarString(pTmpBuf.data(), 2u);
         pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
         return;
             }
@@ -7127,16 +7127,16 @@
         if ( v72 )
             {
             v66 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
-            ShowStatusBarString(pTmpBuf, 2u);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[380], v66);//"You already know the %s spell"
+            ShowStatusBarString(pTmpBuf.data(), 2u);
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
         if ( !pParty->pPlayers[player_num-1].CanAct() )
             {
             v66 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
-            ShowStatusBarString(pTmpBuf, 2u);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v66);//"That player is %s"
+            ShowStatusBarString(pTmpBuf.data(), 2u);
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             return;
             }
@@ -7156,8 +7156,8 @@
         if ( v16 > v67 || !v17 )
             {
             v22 = pParty->pPickedItem.GetDisplayName();
-            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
-            ShowStatusBarString(pTmpBuf, 2u);
+            sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[381], v22); //"You don't have the skill to learn %s"
+            ShowStatusBarString(pTmpBuf.data(), 2u);
             v3->PlaySound((PlayerSpeech)20, 0);
             return; 
             }
@@ -7203,8 +7203,8 @@
             return;
             }
         v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()];
-        sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[382], v68);
-        ShowStatusBarString(pTmpBuf, 2u);
+        sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[382], v68);
+        ShowStatusBarString(pTmpBuf.data(), 2u);
         pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
         return;
         }
@@ -7221,47 +7221,47 @@
                 {
             case 0:
                 v3->uMight += thisa;
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 1:
                 v3->uIntelligence += thisa;
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 2:
                 v3->uWillpower += thisa;
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 3:
                 v3->uEndurance += thisa;
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 4:
                 v3->uAccuracy += thisa;
-               sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+               sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 5:
                 v3->uSpeed += thisa;
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 6:
                 v3->uLuck += thisa;
-               sprintf(pTmpBuf, "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
+               sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent"	
                 break;
             case 7:
                 party_finds_gold(1000 * thisa, 0);
-                sprintf(pTmpBuf, "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
+                sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold"
                 break;
             case 8:
                 Party::GiveFood(5 * thisa); 
-                sprintf(pTmpBuf, "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
+                sprintf(pTmpBuf.data(), "+%u %s",5 * thisa , pGlobalTXT_LocalizationStrings[653]);//"Food"
                 break;
             case 9u:
                 v3->uSkillPoints += 2 * thisa;
-                sprintf(pTmpBuf, "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
+                sprintf(pTmpBuf.data(), "+%u %s", 2 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_SKILL_POINTS]);
                 break;
             case 10:
                 v3->uExperience += 2500 * thisa;
-                sprintf(pTmpBuf, "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
+                sprintf(pTmpBuf.data(), "+%u %s", 2500 * thisa, pGlobalTXT_LocalizationStrings[LOCSTR_EXPIRIENCE]);
                 break;
             case 11:
                 v8 = rand() % 6;
@@ -7292,11 +7292,11 @@
                     v13 = pGlobalTXT_LocalizationStrings[29];
                     break;
                     }
-                sprintf(pTmpBuf, "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);
+                sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v13, pGlobalTXT_LocalizationStrings[121]);
                 break;
 
                 }
-            ShowStatusBarString(pTmpBuf, 2u);
+            ShowStatusBarString(pTmpBuf.data(), 2u);
             pMouse->RemoveHoldingItem();
             pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, player_num - 1);
             v3->PlaySound(SPEECH_93, 0);
@@ -7355,8 +7355,8 @@
                 {
    
                 v68 = pParty->pPickedItem.GetDisplayName();
-                sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
-                ShowStatusBarString(pTmpBuf, 2u);
+                sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[36],v68);//"%s can not be used that way"
+                ShowStatusBarString(pTmpBuf.data(), 2u);
                 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
                 return;
                 }
@@ -8047,15 +8047,15 @@
         case VAR_RandomGold:
           v6 = rand() % var_value + 1;
           Party::SetGold(v6);
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold
-          ShowStatusBarString(pTmpBuf, 2u);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold
+          ShowStatusBarString(pTmpBuf.data(), 2u);
           GameUI_DrawFoodAndGold();
           return;
         case VAR_RandomFood:
           v7 = rand() % var_value + 1;
           Party::SetFood(v7);
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food
-          ShowStatusBarString(pTmpBuf, 2u);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food
+          ShowStatusBarString(pTmpBuf.data(), 2u);
           GameUI_DrawFoodAndGold();
           goto LABEL_124;
         case VAR_Sex:
@@ -8481,8 +8481,8 @@
                 val = 1;
               v7 = rand() % val + 1;
               Party::GiveFood(v7);
-              sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food
-              ShowStatusBarString(pTmpBuf, 2u);
+              sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], v7);// You find %lu food
+              ShowStatusBarString(pTmpBuf.data(), 2u);
               GameUI_DrawFoodAndGold();
               goto _play_sound;
             case VAR_Sex:
@@ -8611,8 +8611,8 @@
               goto LABEL_82;
             case VAR_FixedFood:
               Party::GiveFood(val);
-              sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[502], val);
-              ShowStatusBarString(pTmpBuf, 2u);
+              sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[502], val);
+              ShowStatusBarString(pTmpBuf.data(), 2u);
               if ( pParty->uNumFoodRations > 0xFFFF )
                 Party::SetFood(0xFFFFu);
               goto _play_sound;
@@ -9121,8 +9121,8 @@
           if ( v6 > pParty->uNumGold )
             v6 = pParty->uNumGold;
           Party::TakeGold(v6);
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[503], v6);
-          ShowStatusBarString(pTmpBuf, 2);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[503], v6);
+          ShowStatusBarString(pTmpBuf.data(), 2);
           GameUI_DrawFoodAndGold();
           return result;
         case VAR_RandomFood:
@@ -9130,8 +9130,8 @@
           if ( v7 > pParty->uNumFoodRations )
             v7 = pParty->uNumFoodRations;
           Party::TakeFood(v7);
-          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[504], v7);
-          ShowStatusBarString(pTmpBuf, 2u);
+          sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7);
+          ShowStatusBarString(pTmpBuf.data(), 2u);
           GameUI_DrawFoodAndGold();
           pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4);
           v8 = 8 * v4 + 400;