diff Player.cpp @ 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 a86c60679949
children 1d9e4b50bc7c
line wrap: on
line diff
--- 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;