MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / updated

Method updated

source/game/StarInput.cpp:235–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235void Input::BindEntry::updated() {
236 auto config = Root::singleton().configuration();
237
238 JsonArray array;
239 for (auto const& bind : customBinds)
240 array.emplace_back(bindToJson(bind));
241
242 if (!config->get(InputBindingConfigRoot).isType(Json::Type::Object))
243 config->set(InputBindingConfigRoot, JsonObject());
244
245 String path = strf("{}.{}", InputBindingConfigRoot, category->id);
246 if (!config->getPath(path).isType(Json::Type::Object)) {
247 config->setPath(path, JsonObject{
248 { id, std::move(array) }
249 });
250 }
251 else {
252 path = strf("{}.{}", path, id);
253 config->setPath(path, array);
254 }
255
256 Input::singleton().rebuildMappings();
257}
258
259Input::BindRef::BindRef(BindEntry& bindEntry, KeyBind& keyBind) {
260 entry = &bindEntry;

Callers 2

resetBindsMethod · 0.45
setBindsMethod · 0.45

Calls 10

singletonClass · 0.85
strfFunction · 0.85
configurationMethod · 0.80
rebuildMappingsMethod · 0.80
emplace_backMethod · 0.45
isTypeMethod · 0.45
getMethod · 0.45
setMethod · 0.45
getPathMethod · 0.45
setPathMethod · 0.45

Tested by

no test coverage detected