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

Method reload

plugins/dm.stimresponse/StimTypes.cpp:91–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void StimTypes::reload()
92{
93 _stimTypes.clear();
94 _listStore->Clear();
95
96 // Find all the relevant nodes
97 xml::NodeList stimNodes = GlobalGameManager().currentGame()->getLocalXPath(RKEY_STIM_DEFINITIONS);
98
99 for (std::size_t i = 0; i < stimNodes.size(); ++i)
100 {
101 // Add the new stim type
102 add(string::convert<int>(stimNodes[i].getAttributeValue("id")),
103 stimNodes[i].getAttributeValue("name"),
104 stimNodes[i].getAttributeValue("caption"),
105 stimNodes[i].getAttributeValue("description"),
106 stimNodes[i].getAttributeValue("icon"),
107 false // non-custom stim
108 );
109 }
110
111 // Load the custom stims from the storage entity
112 std::string storageEClass = game::current::getValue<std::string>(GKEY_STORAGE_ECLASS);
113 Entity* storageEntity = findEntityByClass(storageEClass);
114
115 if (storageEntity != NULL)
116 {
117 // Visit each keyvalue
118 storageEntity->forEachKeyValue([&](const std::string& key, const std::string& value)
119 {
120 visitKeyValue(key, value);
121 });
122 }
123}
124
125void StimTypes::save()
126{

Callers 3

reloadStimTypesMethod · 0.80
reloadStimTypesMethod · 0.80
ShowModalMethod · 0.80

Calls 9

addFunction · 0.85
findEntityByClassFunction · 0.85
getLocalXPathMethod · 0.80
clearMethod · 0.45
ClearMethod · 0.45
currentGameMethod · 0.45
sizeMethod · 0.45
getAttributeValueMethod · 0.45
forEachKeyValueMethod · 0.45

Tested by

no test coverage detected