changeset 1868:351b4ff10ac1

changed some memsets to fills in player.cpp, party.cpp and changing to sizeof(varName)
author Grumpy7
date Wed, 16 Oct 2013 03:23:03 +0200
parents e622546c8f0c
children bc7a6ee34316
files Party.cpp Player.cpp
diffstat 2 files changed, 22 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/Party.cpp	Mon Oct 14 08:22:12 2013 +0200
+++ b/Party.cpp	Wed Oct 16 03:23:03 2013 +0200
@@ -99,10 +99,10 @@
     uNumDeaths = 0;
     uNumPrisonTerms = 0;
     uNumBountiesCollected = 0;
-    memset(monster_for_hunting_killed.data(), 5, sizeof(__int16));
-    memset(monster_id_for_hunting.data(), 5, sizeof(__int16));
-    memset(_quest_bits, 64, sizeof(__int8));
-    memset(pArcomageWins.data(), 16, sizeof(__int8));
+    monster_for_hunting_killed.fill(0);
+    monster_id_for_hunting.fill(0);
+    memset(_quest_bits, 0, sizeof(_quest_bits));
+    pArcomageWins.fill(0);
     uNumArenaPageWins = 0;
     uNumArenaSquireWins = 0;
     uNumArenaKnightWins = 0;
@@ -174,7 +174,7 @@
   }
 
   if ( playerAlreadyPicked[0] && playerAlreadyPicked[1] && playerAlreadyPicked[2] && playerAlreadyPicked[3] )
-    memset(playerAlreadyPicked.data(), 0, 4u);
+    playerAlreadyPicked.fill(false);
   for (int i = 0; i < 4; i++)
   {
     v6 = &this->pPlayers[i];
@@ -293,7 +293,7 @@
   pHireling1Name[0] = 0;
   pHireling2Name[0] = 0;
   this->hirelingScrollPosition = 0;
-  memset(pHirelings.data(), 0, 2 * sizeof(NPCData));
+  memset(&pHirelings, 0, sizeof(pHirelings));
 
   strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); //Zoltan
   this->pPlayers[0].uPrevFace = 17;
@@ -552,9 +552,9 @@
 
   pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;  // default character ui - stats
   uFlags = 0;
-  memset(_autonote_bits, 0, 26);
-  memset(_quest_bits, 0, 64);
-  memset(pIsArtifactFound.data(), 0, 29);
+  memset(_autonote_bits, 0, sizeof(_autonote_bits));
+  memset(_quest_bits, 0, sizeof(_autonote_bits));
+  pIsArtifactFound.fill(0);
   _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_RED_POTION_ACTIVE, 1);
   _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_SEASHELL_ACTIVE, 1);
   _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_LONGBOW_ACTIVE, 1);
@@ -562,7 +562,7 @@
   _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_LUTE_ACTIVE, 1);
   _449B7E_toggle_bit(_quest_bits, PARTY_QUEST_EMERALD_HAT_ACTIVE, 1);
 
-  memset(PartyTimes._shop_ban_times.data(),0,53*sizeof(__int64));
+  PartyTimes._shop_ban_times.fill(0);
 
   memcpy(pNPCStats->pNewNPCData, pNPCStats->pNPCData, 0x94BCu);
   memcpy(pNPCStats->pGroups_copy, pNPCStats->pGroups, 0x66u);
--- a/Player.cpp	Mon Oct 14 08:22:12 2013 +0200
+++ b/Player.cpp	Wed Oct 16 03:23:03 2013 +0200
@@ -750,7 +750,7 @@
     case Condition_Zombie:
       if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead())
         return;
-      memset(&pConditions[0], 0, sizeof(pConditions));
+      pConditions.fill(0);
       sHealth = GetMaxHealth();
       sMana = 0;
       player_sex = 0;
@@ -1240,7 +1240,7 @@
 Player::Player()
 {  
   memset(&pEquipment, 0, sizeof(PlayerEquipment));
-  memset(pInventoryMatrix.data(), 0, 126 * sizeof(int));
+  pInventoryMatrix.fill(0);
   for (uint i = 0; i < 126; ++i)
     pInventoryItemList[i].Reset();
   for (uint i = 0; i < 12; ++i)
@@ -1260,7 +1260,7 @@
   pName[0] = 0;
   uCurrentFace = 0;
   uVoiceID = 0;
-  memset(pConditions.data(), 0, 20 * sizeof(__int64));
+  pConditions.fill(0);
 
   field_BB = 0;
 
@@ -1327,8 +1327,8 @@
   uNumArmageddonCasts = 0;
   uNumFireSpikeCasts = 0;
 
-  memset(field_1988, 0, 49 * sizeof(int));
-  memset(playerEventBits, 0, 64 * sizeof(char));
+  memset(field_1988, 0, sizeof(field_1988));
+  memset(playerEventBits, 0, sizeof(playerEventBits));
 
   field_E0 = 0;
   field_E4 = 0;
@@ -3910,9 +3910,9 @@
   uLevel = 1;
   uExperience = 251 + rand() % 100;
   uBirthYear = 1147 - rand() % 6;
-  memset(pActiveSkills.data(), 0, sizeof(pActiveSkills));
-  memset(_achieved_awards_bits, 0, 64);
-  memset(&spellbook, 0, sizeof(PlayerSpells));
+  pActiveSkills.fill(0);
+  memset(_achieved_awards_bits, 0, sizeof(_achieved_awards_bits));
+  memset(&spellbook, 0, sizeof(spellbook));
 
   for (uint i = 0; i < 37; ++i)
   {
@@ -4491,7 +4491,7 @@
               v30 = playerAffected->pConditions[Condition_Dead];
               v32 = playerAffected->pConditions[Condition_Pertified];
               v34 = playerAffected->pConditions[Condition_Eradicated];    
-              memset(&playerAffected->pConditions,0,sizeof(pConditions));
+              pConditions.fill(0);
               playerAffected->pConditions[Condition_Dead] = v30;
               playerAffected->pConditions[Condition_Pertified] = v32;
               playerAffected->pConditions[Condition_Eradicated] = v34;
@@ -5737,7 +5737,7 @@
       PlayAwardSound_Anim();
       return;
     case VAR_MajorCondition:
-      memset(this, 0, 0xA0u);
+      pConditions.fill(0);
       PlayAwardSound_Anim();
       return;
     case VAR_AutoNotes:
@@ -6333,7 +6333,7 @@
       PlayAwardSound_Anim97();
       return;
     case VAR_MajorCondition :
-      memset(this, 0, 0xA0u);
+      pConditions.fill(0);
       PlayAwardSound_Anim97();
       return;
     case VAR_AutoNotes:
@@ -7026,7 +7026,7 @@
         }
       }
       if ( pParty->pHirelings[0].uProfession == pValue )
-        memset(pParty->pHirelings.data(), 0, sizeof(NPCData));
+        memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
       if ( pParty->pHirelings[1].uProfession == pValue )
         memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
       pParty->hirelingScrollPosition = 0;