Mercurial > mm7
diff Player.h @ 1361:b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
author | Grumpy7 |
---|---|
date | Sun, 14 Jul 2013 23:22:43 +0200 |
parents | 06926081358f |
children | d6cf8ead9242 |
line wrap: on
line diff
--- a/Player.h Sat Jul 13 21:36:35 2013 +0200 +++ b/Player.h Sun Jul 14 23:22:43 2013 +0200 @@ -1,6 +1,7 @@ #pragma once #include "Items.h" #include "Spells.h" +#include "Conditions.h" @@ -446,28 +447,6 @@ #pragma pack(push, 1) struct Player { -enum Condition: unsigned __int32 - { - Condition_Cursed = 0, - Condition_Weak = 1, - Condition_Sleep = 2, - Condition_Fear = 3, - Condition_Drunk = 4, - Condition_Insane = 5, - Condition_Poison1 = 6, - Condition_Disease1 = 7, - Condition_Poison2 = 8, - Condition_Disease2 = 9, - Condition_Poison3 = 10, - Condition_Disease3 = 11, - Condition_Paralyzed = 12, - Condition_Unconcious = 13, - Condition_Dead = 14, - Condition_Pertified = 15, - Condition_Eradicated = 16, - Condition_Zombie = 17, - Condition_Good = 18 - }; Player(); @@ -570,7 +549,7 @@ bool CanAct(); bool CanSteal(); bool CanEquip_RaceAndAlignmentCheck(unsigned int uItemID); - int SetCondition(unsigned int uConditionIdx, int a3); + void SetCondition(unsigned int uConditionIdx, int a3); bool ProfessionOrGuildFlagsCorrect(unsigned int uClass, int a3); void PlaySound(PlayerSpeech speech, int a3); void PlayEmotion(CHARACTER_EXPRESSION_ID expression, int a3); @@ -595,31 +574,36 @@ void DrawPlayerBuffAnimBasedOnCondition(int currPlayerId); void EquipBody(ITEM_EQUIP_TYPE uEquipType); - inline bool Weak() {return pConditions[Condition_Weak] != 0;} - inline bool Dead() {return pConditions[Condition_Dead] != 0;} - inline bool Eradicated() {return pConditions[Condition_Eradicated] != 0;} - inline bool Zombie() {return pConditions[Condition_Zombie] != 0;} - inline bool Cursed() {return pConditions[Condition_Cursed] != 0;} - inline bool Pertified() {return pConditions[Condition_Pertified] != 0;} + bool Weak(); + bool Dead(); + bool Eradicated(); + bool Zombie(); + bool Cursed(); + bool Pertified(); + bool Unconcious(); - inline void SetCursed(bool state) {pConditions[Condition_Cursed] = state;} - inline void SetWeak(bool state) {pConditions[Condition_Weak] = state;} - inline void SetAsleep(bool state) {pConditions[Condition_Sleep] = state;} - inline void SetAfraid(bool state) {pConditions[Condition_Fear] = state;} - inline void SetDrunk(bool state) {pConditions[Condition_Drunk] = state;} - inline void SetInsane(bool state) {pConditions[Condition_Insane] = state;} - inline void SetPoison1(bool state) {pConditions[Condition_Poison1] = state;} - inline void SetDisease1(bool state) {pConditions[Condition_Disease1] = state;} - inline void SetPoison2(bool state) {pConditions[Condition_Poison2] = state;} - inline void SetDisease2(bool state) {pConditions[Condition_Disease2] = state;} - inline void SetPoison3(bool state) {pConditions[Condition_Poison3] = state;} - inline void SetDisease3(bool state) {pConditions[Condition_Disease3] = state;} - inline void SetParalyzed(bool state) {pConditions[Condition_Paralyzed] = state;} - inline void SetUnconcious(bool state) {pConditions[Condition_Unconcious] = state;} - inline void SetDead(bool state) {pConditions[Condition_Dead] = state;} - inline void SetPertified(bool state) {pConditions[Condition_Pertified] = state;} - inline void SetEradicated(bool state) {pConditions[Condition_Eradicated] = state;} - inline void SetZombie(bool state) {pConditions[Condition_Zombie] = state;} + void SetCursed(bool state); + void SetWeak(bool state); + void SetAsleep(bool state); + void SetAfraid(bool state); + void SetDrunk(bool state); + void SetInsane(bool state); + void SetPoison1(bool state); + void SetDisease1(bool state); + void SetPoison2(bool state); + void SetDisease2(bool state); + void SetPoison3(bool state); + void SetDisease3(bool state); + void SetParalyzed(bool state); + void SetUnconcious(bool state); + void SetDead(bool state); + void SetPertified(bool state); + void SetEradicated(bool state); + void SetZombie(bool state); + + void SetCondWeakWithBlockCheck (int blockable); + void SetCondInsaneWithBlockCheck (int blockable); + void SetCondDeadWithBlockCheck (int blockable); inline bool IsRaceHuman() {return GetRace() == CHARACTER_RACE_HUMAN;} inline bool IsRaceDwarf() {return GetRace() == CHARACTER_RACE_DWARF;}