| 89 | } |
| 90 | |
| 91 | void 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 | |
| 125 | void StimTypes::save() |
| 126 | { |
no test coverage detected