| 672 | } |
| 673 | |
| 674 | bool ConfigManager::loadEquipements(const std::string& fileName) |
| 675 | { |
| 676 | OD_LOG_INF("Load weapon definition file: " + fileName); |
| 677 | std::stringstream defFile; |
| 678 | if(!Helper::readFileWithoutComments(fileName, defFile)) |
| 679 | { |
| 680 | OD_LOG_ERR("Couldn't read " + fileName); |
| 681 | return false; |
| 682 | } |
| 683 | |
| 684 | std::string nextParam; |
| 685 | // Read in the creature class descriptions |
| 686 | defFile >> nextParam; |
| 687 | if (nextParam != "[EquipmentDefinitions]") |
| 688 | { |
| 689 | OD_LOG_ERR("Invalid weapon start format. Line was " + nextParam); |
| 690 | return false; |
| 691 | } |
| 692 | |
| 693 | while(defFile.good()) |
| 694 | { |
| 695 | if(!(defFile >> nextParam)) |
| 696 | break; |
| 697 | |
| 698 | if (nextParam == "[/EquipmentDefinitions]") |
| 699 | break; |
| 700 | |
| 701 | if (nextParam == "[/Equipment]") |
| 702 | continue; |
| 703 | |
| 704 | if (nextParam != "[Equipment]") |
| 705 | { |
| 706 | OD_LOG_ERR("Invalid Weapon definition format. Line was " + nextParam); |
| 707 | return false; |
| 708 | } |
| 709 | |
| 710 | // Load the definition |
| 711 | Weapon* weapon = Weapon::load(defFile); |
| 712 | if (weapon == nullptr) |
| 713 | { |
| 714 | OD_LOG_ERR("Invalid Weapon definition format"); |
| 715 | return false; |
| 716 | } |
| 717 | mWeapons.push_back(weapon); |
| 718 | } |
| 719 | |
| 720 | return true; |
| 721 | } |
| 722 | |
| 723 | bool ConfigManager::loadSpawnConditions(const std::string& fileName) |
| 724 | { |
nothing calls this directly
no test coverage detected