MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / populateFromObjective

Method populateFromObjective

plugins/dm.objectives/DifficultyPanel.cpp:50–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void 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
71void DifficultyPanel::updateSensitivity()
72{

Callers 1

Calls 8

splitFunction · 0.85
findFunction · 0.50
to_stringFunction · 0.50
SetValueMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected