MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / loadXPTable

Method loadXPTable

source/entities/CreatureDefinition.cpp:1005–1043  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1003}
1004
1005void CreatureDefinition::loadXPTable(std::stringstream& defFile, CreatureDefinition* creatureDef)
1006{
1007 if (creatureDef == nullptr)
1008 {
1009 OD_LOG_ERR("Cannot load null creature def");
1010 return;
1011 }
1012
1013 std::string nextParam;
1014 bool exit = false;
1015
1016 // The XP index
1017 unsigned int i = 0;
1018
1019 while (defFile.good())
1020 {
1021 if (exit)
1022 break;
1023
1024 if(!(defFile >> nextParam))
1025 break;
1026
1027 if (nextParam == "[/XP]" || nextParam == "[/Stats]" ||
1028 nextParam == "[/Creature]" || nextParam == "[/Creatures]")
1029 {
1030 exit = true;
1031 break;
1032 }
1033
1034 // Ignore values after the max level
1035 if (i >= MAX_LEVEL - 1)
1036 {
1037 OD_LOG_ERR("creatureDef=" + creatureDef->getClassName() + ", i=" + Helper::toString(i < MAX_LEVEL - 1));
1038 continue;
1039 }
1040
1041 creatureDef->mXPTable[i++] = Helper::toDouble(nextParam);
1042 }
1043}
1044
1045void CreatureDefinition::loadCreatureSkills(std::stringstream& defFile, CreatureDefinition* creatureDef)
1046{

Callers

nothing calls this directly

Calls 2

toDoubleFunction · 0.85
toStringFunction · 0.50

Tested by

no test coverage detected