| 1003 | } |
| 1004 | |
| 1005 | void 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 | |
| 1045 | void CreatureDefinition::loadCreatureSkills(std::stringstream& defFile, CreatureDefinition* creatureDef) |
| 1046 | { |