| 721 | } |
| 722 | |
| 723 | bool ConfigManager::loadSpawnConditions(const std::string& fileName) |
| 724 | { |
| 725 | OD_LOG_INF("Load creature spawn conditions file: " + fileName); |
| 726 | std::stringstream defFile; |
| 727 | if(!Helper::readFileWithoutComments(fileName, defFile)) |
| 728 | { |
| 729 | OD_LOG_ERR("Couldn't read " + fileName); |
| 730 | return false; |
| 731 | } |
| 732 | |
| 733 | std::string nextParam; |
| 734 | // Read in the creature class descriptions |
| 735 | defFile >> nextParam; |
| 736 | if (nextParam != "[SpawnConditions]") |
| 737 | { |
| 738 | OD_LOG_ERR("Invalid creature spawn condition start format. Line was " + nextParam); |
| 739 | return false; |
| 740 | } |
| 741 | |
| 742 | while(defFile.good()) |
| 743 | { |
| 744 | if(!(defFile >> nextParam)) |
| 745 | break; |
| 746 | |
| 747 | if (nextParam == "[/SpawnConditions]") |
| 748 | break; |
| 749 | |
| 750 | if (nextParam == "[/SpawnCondition]") |
| 751 | continue; |
| 752 | |
| 753 | if (nextParam == "BaseSpawnPoint") |
| 754 | { |
| 755 | defFile >> nextParam; |
| 756 | mBaseSpawnPoint = Helper::toUInt32(nextParam); |
| 757 | continue; |
| 758 | } |
| 759 | |
| 760 | if (nextParam != "[SpawnCondition]") |
| 761 | { |
| 762 | OD_LOG_ERR("Invalid creature spawn condition format. Line was " + nextParam); |
| 763 | return false; |
| 764 | } |
| 765 | |
| 766 | if(!(defFile >> nextParam)) |
| 767 | break; |
| 768 | if (nextParam != "CreatureClass") |
| 769 | { |
| 770 | OD_LOG_ERR("Invalid creature spawn condition format. Line was " + nextParam); |
| 771 | return false; |
| 772 | } |
| 773 | defFile >> nextParam; |
| 774 | const CreatureDefinition* creatureDefinition = getCreatureDefinition(nextParam); |
| 775 | if(creatureDefinition == nullptr) |
| 776 | { |
| 777 | OD_LOG_ERR("nextParam=" + nextParam); |
| 778 | return false; |
| 779 | } |
| 780 |
nothing calls this directly
no test coverage detected