diff options
Diffstat (limited to 'src/MonsterConfig.cpp')
-rw-r--r-- | src/MonsterConfig.cpp | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/src/MonsterConfig.cpp b/src/MonsterConfig.cpp index 271a72a7f..ee0265eab 100644 --- a/src/MonsterConfig.cpp +++ b/src/MonsterConfig.cpp @@ -12,13 +12,13 @@ struct cMonsterConfig::sAttributesStruct { AString m_Name; - int m_SightDistance; - int m_AttackDamage; - double m_AttackRange; - double m_AttackRate; - double m_MaxHealth; - bool m_IsFireproof; - bool m_BurnsInDaylight; + int m_SightDistance; + int m_AttackDamage; + double m_AttackRange; + double m_AttackRate; + double m_MaxHealth; + bool m_IsFireproof; + bool m_BurnsInDaylight; }; @@ -28,15 +28,15 @@ struct cMonsterConfig::sAttributesStruct struct cMonsterConfig::sMonsterConfigState { AString MonsterTypes; - std::list< sAttributesStruct > AttributesList; + std::list<sAttributesStruct> AttributesList; }; -cMonsterConfig::cMonsterConfig(void) - : m_pState( new sMonsterConfigState) +cMonsterConfig::cMonsterConfig(void) : + m_pState(new sMonsterConfigState) { Initialize(); } @@ -70,12 +70,12 @@ void cMonsterConfig::Initialize() sAttributesStruct Attributes; AString Name = MonstersIniFile.GetKeyName(i); Attributes.m_Name = Name; - Attributes.m_AttackDamage = MonstersIniFile.GetValueI(Name, "AttackDamage", 0); - Attributes.m_AttackRange = MonstersIniFile.GetValueF(Name, "AttackRange", 0); - Attributes.m_SightDistance = MonstersIniFile.GetValueI(Name, "SightDistance", 0); - Attributes.m_AttackRate = MonstersIniFile.GetValueF(Name, "AttackRate", 0); - Attributes.m_MaxHealth = MonstersIniFile.GetValueF(Name, "MaxHealth", 1); - Attributes.m_IsFireproof = MonstersIniFile.GetValueB(Name, "IsFireproof", false); + Attributes.m_AttackDamage = MonstersIniFile.GetValueI(Name, "AttackDamage", 0); + Attributes.m_AttackRange = MonstersIniFile.GetValueF(Name, "AttackRange", 0); + Attributes.m_SightDistance = MonstersIniFile.GetValueI(Name, "SightDistance", 0); + Attributes.m_AttackRate = MonstersIniFile.GetValueF(Name, "AttackRate", 0); + Attributes.m_MaxHealth = MonstersIniFile.GetValueF(Name, "MaxHealth", 1); + Attributes.m_IsFireproof = MonstersIniFile.GetValueB(Name, "IsFireproof", false); Attributes.m_BurnsInDaylight = MonstersIniFile.GetValueB(Name, "BurnsInDaylight", false); m_pState->AttributesList.push_front(Attributes); } // for i - SplitList[] @@ -92,19 +92,14 @@ void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Na { if (itr->m_Name.compare(a_Name) == 0) { - a_Monster->SetAttackDamage (itr->m_AttackDamage); - a_Monster->SetAttackRange (itr->m_AttackRange); - a_Monster->SetSightDistance (itr->m_SightDistance); - a_Monster->SetAttackRate (static_cast<float>(itr->m_AttackRate)); - a_Monster->SetMaxHealth (static_cast<float>(itr->m_MaxHealth)); - a_Monster->SetIsFireproof (itr->m_IsFireproof); + a_Monster->SetAttackDamage(itr->m_AttackDamage); + a_Monster->SetAttackRange(itr->m_AttackRange); + a_Monster->SetSightDistance(itr->m_SightDistance); + a_Monster->SetAttackRate(static_cast<float>(itr->m_AttackRate)); + a_Monster->SetMaxHealth(static_cast<float>(itr->m_MaxHealth)); + a_Monster->SetIsFireproof(itr->m_IsFireproof); a_Monster->SetBurnsInDaylight(itr->m_BurnsInDaylight); return; } } // for itr - m_pState->AttributesList[] } - - - - - |