summaryrefslogtreecommitdiffstats
path: root/source/MonsterConfig.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2013-11-24 15:19:41 +0100
committerAlexander Harkness <bearbin@gmail.com>2013-11-24 15:19:41 +0100
commit675b4aa878f16291ce33fced48a2bc7425f635ae (patch)
tree409914df27a98f65adf866da669429c4de141b6f /source/MonsterConfig.cpp
parentLineBlockTracer: Using the coord-based block faces. (diff)
downloadcuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar
cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.gz
cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.bz2
cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.lz
cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.xz
cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.tar.zst
cuberite-675b4aa878f16291ce33fced48a2bc7425f635ae.zip
Diffstat (limited to 'source/MonsterConfig.cpp')
-rw-r--r--source/MonsterConfig.cpp104
1 files changed, 0 insertions, 104 deletions
diff --git a/source/MonsterConfig.cpp b/source/MonsterConfig.cpp
deleted file mode 100644
index a5a1ebd49..000000000
--- a/source/MonsterConfig.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "MonsterConfig.h"
-#include "Mobs/Monster.h"
-#include "../iniFile/iniFile.h"
-//#include <cstdio>
-
-
-
-
-
-struct cMonsterConfig::sAttributesStruct
-{
- AString m_Name;
- double m_SightDistance;
- double m_AttackDamage;
- double m_AttackRange;
- double m_AttackRate;
- int m_MaxHealth;
-};
-
-
-
-
-
-struct cMonsterConfig::sMonsterConfigState
-{
- AString MonsterTypes;
- std::list< sAttributesStruct > AttributesList;
-};
-
-
-
-
-
-cMonsterConfig::cMonsterConfig(void)
- : m_pState( new sMonsterConfigState )
-{
- Initialize();
-}
-
-
-
-
-
-cMonsterConfig::~cMonsterConfig()
-{
- delete m_pState;
-}
-
-
-
-
-
-void cMonsterConfig::Initialize()
-{
- cIniFile MonstersIniFile;
-
- if (!MonstersIniFile.ReadFile("monsters.ini"))
- {
- LOGWARNING("%s: Cannot read monsters.ini file, monster attributes not available", __FUNCTION__);
- return;
- }
-
- for (int i = (int)MonstersIniFile.GetNumKeys(); i >= 0; i--)
- {
- sAttributesStruct Attributes;
- AString Name = MonstersIniFile.GetKeyName(i);
- Attributes.m_Name = Name;
- Attributes.m_AttackDamage = MonstersIniFile.GetValueF(Name, "AttackDamage", 0);
- Attributes.m_AttackRange = MonstersIniFile.GetValueF(Name, "AttackRange", 0);
- Attributes.m_SightDistance = MonstersIniFile.GetValueF(Name, "SightDistance", 0);
- Attributes.m_AttackRate = MonstersIniFile.GetValueF(Name, "AttackRate", 0);
- Attributes.m_MaxHealth = MonstersIniFile.GetValueI(Name, "MaxHealth", 1);
- m_pState->AttributesList.push_front(Attributes);
- } // for i - SplitList[]
-}
-
-
-
-
-
-void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Name)
-{
- std::list<sAttributesStruct>::const_iterator itr;
- for (itr = m_pState->AttributesList.begin(); itr != m_pState->AttributesList.end(); ++itr)
- {
- if (itr->m_Name.compare(a_Name) == 0)
- {
- a_Monster->SetAttackDamage ((float)itr->m_AttackDamage);
- a_Monster->SetAttackRange ((float)itr->m_AttackRange);
- a_Monster->SetSightDistance((float)itr->m_SightDistance);
- a_Monster->SetAttackRate ((int)itr->m_AttackRate);
- a_Monster->SetMaxHealth (itr->m_MaxHealth);
- return;
- }
- } // for itr - m_pState->AttributesList[]
-}
-
-
-
-
-