| 94 | } |
| 95 | |
| 96 | void DifficultyPanel::writeToObjective(Objective& obj) |
| 97 | { |
| 98 | // Set the difficulty to "all levels" per default |
| 99 | obj.difficultyLevels = ""; |
| 100 | |
| 101 | if (!_allLevels->GetValue()) |
| 102 | { |
| 103 | // Not applicable to all difficulty levels, form the string |
| 104 | for (std::size_t i = 0; i < _toggles.size(); i++) |
| 105 | { |
| 106 | // Check each toggle button |
| 107 | if (_toggles[i]->GetValue()) |
| 108 | { |
| 109 | std::string prefix = (!obj.difficultyLevels.empty()) ? " " : ""; |
| 110 | obj.difficultyLevels += prefix + string::to_string(i); |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | } // namespace objectives |