| 523 | } |
| 524 | |
| 525 | void 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 | |
| 549 | void Input::reload() {; |
| 550 | m_bindCategories.clear(); |
no test coverage detected