| 48 | } |
| 49 | |
| 50 | void DifficultyPanel::populateFromObjective(const Objective& obj) |
| 51 | { |
| 52 | // De-serialise the difficulty level string |
| 53 | std::vector<std::string> parts; |
| 54 | string::split(parts, obj.difficultyLevels, " "); |
| 55 | |
| 56 | // Set the "applies to all difficulty" toggle |
| 57 | _allLevels->SetValue(obj.difficultyLevels.empty()); |
| 58 | |
| 59 | // Set all levels to deactivated |
| 60 | for (std::size_t i = 0; i < _toggles.size(); i++) |
| 61 | { |
| 62 | // See if this level appears in the difficulty string, if yes => toggled |
| 63 | _toggles[i]->SetValue( |
| 64 | std::find(parts.begin(), parts.end(), string::to_string(i)) != parts.end() |
| 65 | ); |
| 66 | } |
| 67 | |
| 68 | updateSensitivity(); |
| 69 | } |
| 70 | |
| 71 | void DifficultyPanel::updateSensitivity() |
| 72 | { |