MCPcopy Create free account
hub / github.com/cuberite/cuberite / Initialize

Method Initialize

src/MonsterConfig.cpp:55–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54
55void cMonsterConfig::Initialize()
56{
57 cIniFile MonstersIniFile;
58
59 if (!MonstersIniFile.ReadFile("monsters.ini"))
60 {
61 LOGWARNING("%s: Cannot read monsters.ini file, monster attributes not available", __FUNCTION__);
62 return;
63 }
64
65 for (int i = (int)MonstersIniFile.GetNumKeys(); i >= 0; i--)
66 {
67 sAttributesStruct Attributes;
68 AString Name = MonstersIniFile.GetKeyName(i);
69 Attributes.m_Name = Name;
70 Attributes.m_AttackDamage = MonstersIniFile.GetValueI(Name, "AttackDamage", 0);
71 Attributes.m_AttackRange = MonstersIniFile.GetValueI(Name, "AttackRange", 0);
72 Attributes.m_SightDistance = MonstersIniFile.GetValueI(Name, "SightDistance", 0);
73 Attributes.m_AttackRate = MonstersIniFile.GetValueF(Name, "AttackRate", 0);
74 Attributes.m_MaxHealth = MonstersIniFile.GetValueI(Name, "MaxHealth", 1);
75 m_pState->AttributesList.push_front(Attributes);
76 } // for i - SplitList[]
77}
78
79
80

Callers

nothing calls this directly

Calls 5

ReadFileMethod · 0.80
GetNumKeysMethod · 0.80
GetKeyNameMethod · 0.80
GetValueIMethod · 0.80
GetValueFMethod · 0.80

Tested by

no test coverage detected