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

Method rebuildMappings

source/game/StarInput.cpp:525–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

523}
524
525void Input::rebuildMappings() {
526 reset(true);
527 m_bindMappings.clear();
528
529 for (auto& category : m_bindCategories) {
530 for (auto& pair : category.second.entries) {
531 auto& entry = pair.second;
532 for (auto& bind : entry.customBinds) {
533 if (auto keyBind = bind.ptr<KeyBind>())
534 m_bindMappings[keyBind->key].emplace_back(entry, *keyBind);
535 if (auto mouseBind = bind.ptr<MouseBind>())
536 m_bindMappings[mouseBind->button].emplace_back(entry, *mouseBind);
537 if (auto controllerBind = bind.ptr<ControllerBind>())
538 m_bindMappings[controllerBind->button].emplace_back(entry);
539 }
540 }
541 }
542
543 for (auto& pair : m_bindMappings) {
544 pair.second.sort([](BindRef const& a, BindRef const& b)
545 { return a.priority > b.priority; });
546 }
547}
548
549void Input::reload() {;
550 m_bindCategories.clear();

Callers 1

updatedMethod · 0.80

Calls 3

clearMethod · 0.45
emplace_backMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected