comparison 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
comparison
equal deleted inserted replaced
1865:e622546c8f0c 1868:351b4ff10ac1
748 sMana = 0; 748 sMana = 0;
749 break; 749 break;
750 case Condition_Zombie: 750 case Condition_Zombie:
751 if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead()) 751 if ( classType == PLAYER_CLASS_LICH || IsEradicated() || IsZombie() || !IsDead())
752 return; 752 return;
753 memset(&pConditions[0], 0, sizeof(pConditions)); 753 pConditions.fill(0);
754 sHealth = GetMaxHealth(); 754 sHealth = GetMaxHealth();
755 sMana = 0; 755 sMana = 0;
756 player_sex = 0; 756 player_sex = 0;
757 uPrevFace = uCurrentFace; 757 uPrevFace = uCurrentFace;
758 uPrevVoiceID = uVoiceID; 758 uPrevVoiceID = uVoiceID;
1238 1238
1239 //----- (0048C6AF) -------------------------------------------------------- 1239 //----- (0048C6AF) --------------------------------------------------------
1240 Player::Player() 1240 Player::Player()
1241 { 1241 {
1242 memset(&pEquipment, 0, sizeof(PlayerEquipment)); 1242 memset(&pEquipment, 0, sizeof(PlayerEquipment));
1243 memset(pInventoryMatrix.data(), 0, 126 * sizeof(int)); 1243 pInventoryMatrix.fill(0);
1244 for (uint i = 0; i < 126; ++i) 1244 for (uint i = 0; i < 126; ++i)
1245 pInventoryItemList[i].Reset(); 1245 pInventoryItemList[i].Reset();
1246 for (uint i = 0; i < 12; ++i) 1246 for (uint i = 0; i < 12; ++i)
1247 pEquippedItems[i].Reset(); 1247 pEquippedItems[i].Reset();
1248 1248
1258 } 1258 }
1259 1259
1260 pName[0] = 0; 1260 pName[0] = 0;
1261 uCurrentFace = 0; 1261 uCurrentFace = 0;
1262 uVoiceID = 0; 1262 uVoiceID = 0;
1263 memset(pConditions.data(), 0, 20 * sizeof(__int64)); 1263 pConditions.fill(0);
1264 1264
1265 field_BB = 0; 1265 field_BB = 0;
1266 1266
1267 uMight = uMightBonus = 0; 1267 uMight = uMightBonus = 0;
1268 uIntelligence = uIntelligenceBonus = 0; 1268 uIntelligence = uIntelligenceBonus = 0;
1325 1325
1326 uNumDivineInterventionCastsThisDay = 0; 1326 uNumDivineInterventionCastsThisDay = 0;
1327 uNumArmageddonCasts = 0; 1327 uNumArmageddonCasts = 0;
1328 uNumFireSpikeCasts = 0; 1328 uNumFireSpikeCasts = 0;
1329 1329
1330 memset(field_1988, 0, 49 * sizeof(int)); 1330 memset(field_1988, 0, sizeof(field_1988));
1331 memset(playerEventBits, 0, 64 * sizeof(char)); 1331 memset(playerEventBits, 0, sizeof(playerEventBits));
1332 1332
1333 field_E0 = 0; 1333 field_E0 = 0;
1334 field_E4 = 0; 1334 field_E4 = 0;
1335 field_E8 = 0; 1335 field_E8 = 0;
1336 field_EC = 0; 1336 field_EC = 0;
3908 uIntelligenceBonus = 0; 3908 uIntelligenceBonus = 0;
3909 uMightBonus = 0; 3909 uMightBonus = 0;
3910 uLevel = 1; 3910 uLevel = 1;
3911 uExperience = 251 + rand() % 100; 3911 uExperience = 251 + rand() % 100;
3912 uBirthYear = 1147 - rand() % 6; 3912 uBirthYear = 1147 - rand() % 6;
3913 memset(pActiveSkills.data(), 0, sizeof(pActiveSkills)); 3913 pActiveSkills.fill(0);
3914 memset(_achieved_awards_bits, 0, 64); 3914 memset(_achieved_awards_bits, 0, sizeof(_achieved_awards_bits));
3915 memset(&spellbook, 0, sizeof(PlayerSpells)); 3915 memset(&spellbook, 0, sizeof(spellbook));
3916 3916
3917 for (uint i = 0; i < 37; ++i) 3917 for (uint i = 0; i < 37; ++i)
3918 { 3918 {
3919 if (pSkillAvailabilityPerClass[classType / 4][i] != 2) 3919 if (pSkillAvailabilityPerClass[classType / 4][i] != 2)
3920 continue; 3920 continue;
4489 break; 4489 break;
4490 case 252://Divine Restoration 4490 case 252://Divine Restoration
4491 v30 = playerAffected->pConditions[Condition_Dead]; 4491 v30 = playerAffected->pConditions[Condition_Dead];
4492 v32 = playerAffected->pConditions[Condition_Pertified]; 4492 v32 = playerAffected->pConditions[Condition_Pertified];
4493 v34 = playerAffected->pConditions[Condition_Eradicated]; 4493 v34 = playerAffected->pConditions[Condition_Eradicated];
4494 memset(&playerAffected->pConditions,0,sizeof(pConditions)); 4494 pConditions.fill(0);
4495 playerAffected->pConditions[Condition_Dead] = v30; 4495 playerAffected->pConditions[Condition_Dead] = v30;
4496 playerAffected->pConditions[Condition_Pertified] = v32; 4496 playerAffected->pConditions[Condition_Pertified] = v32;
4497 playerAffected->pConditions[Condition_Eradicated] = v34; 4497 playerAffected->pConditions[Condition_Eradicated] = v34;
4498 playerAffected->PlaySound(SPEECH_36, 0); 4498 playerAffected->PlaySound(SPEECH_36, 0);
4499 break; 4499 break;
5735 case VAR_Eradicated: 5735 case VAR_Eradicated:
5736 this->SetCondition(Condition_Eradicated, 1); 5736 this->SetCondition(Condition_Eradicated, 1);
5737 PlayAwardSound_Anim(); 5737 PlayAwardSound_Anim();
5738 return; 5738 return;
5739 case VAR_MajorCondition: 5739 case VAR_MajorCondition:
5740 memset(this, 0, 0xA0u); 5740 pConditions.fill(0);
5741 PlayAwardSound_Anim(); 5741 PlayAwardSound_Anim();
5742 return; 5742 return;
5743 case VAR_AutoNotes: 5743 case VAR_AutoNotes:
5744 if ( !_449B57_test_bit(pParty->_autonote_bits, var_value) && pAutonoteTxt[var_value-1].pText ) 5744 if ( !_449B57_test_bit(pParty->_autonote_bits, var_value) && pAutonoteTxt[var_value-1].pText )
5745 { 5745 {
6331 case VAR_Eradicated: 6331 case VAR_Eradicated:
6332 this->SetCondition(Condition_Eradicated, 1); 6332 this->SetCondition(Condition_Eradicated, 1);
6333 PlayAwardSound_Anim97(); 6333 PlayAwardSound_Anim97();
6334 return; 6334 return;
6335 case VAR_MajorCondition : 6335 case VAR_MajorCondition :
6336 memset(this, 0, 0xA0u); 6336 pConditions.fill(0);
6337 PlayAwardSound_Anim97(); 6337 PlayAwardSound_Anim97();
6338 return; 6338 return;
6339 case VAR_AutoNotes: 6339 case VAR_AutoNotes:
6340 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText ) 6340 if ( !_449B57_test_bit(pParty->_autonote_bits, val) && pAutonoteTxt[val].pText )
6341 { 6341 {
7024 { 7024 {
7025 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; 7025 LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu;
7026 } 7026 }
7027 } 7027 }
7028 if ( pParty->pHirelings[0].uProfession == pValue ) 7028 if ( pParty->pHirelings[0].uProfession == pValue )
7029 memset(pParty->pHirelings.data(), 0, sizeof(NPCData)); 7029 memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
7030 if ( pParty->pHirelings[1].uProfession == pValue ) 7030 if ( pParty->pHirelings[1].uProfession == pValue )
7031 memset(&pParty->pHirelings[1], 0, sizeof(NPCData)); 7031 memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
7032 pParty->hirelingScrollPosition = 0; 7032 pParty->hirelingScrollPosition = 0;
7033 pParty->CountHirelings(); 7033 pParty->CountHirelings();
7034 return; 7034 return;