MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / FindBindingConflict

Method FindBindingConflict

engine/Poseidon/Input/InputSubsystem.cpp:1113–1142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1111 mouse.Save(MouseCfgPath());
1112}
1113
1114UserAction InputSubsystem::FindBindingConflict(int packedCode, UserAction excludeAction, int excludeSlot,
1115 int modifier) const
1116{
1117 if (packedCode < 0)
1118 return UAN;
1119 const int contextIdx = static_cast<int>(context_);
1120 if (contextIdx < 0 || contextIdx >= kNumContexts)
1121 return UAN;
1122
1123 const InputProfile& profile = profiles_[contextIdx];
1124 for (int i = 0; i < UAN; i++)
1125 {
1126 const auto& bindings = profile.GetBindingEntries(static_cast<UserAction>(i));
1127 for (int j = 0; j < static_cast<int>(bindings.size()); j++)
1128 {
1129 const InputBinding& binding = bindings[j];
1130 if (binding.code.toLegacy() != packedCode)
1131 continue;
1132 int slotMod = binding.modifier.valid() ? binding.modifier.toLegacy() : -1;
1133 // Conflict only when both code AND modifier match — so
1134 // "Ctrl+W" and bare "W" coexist as distinct bindings.
1135 if (slotMod != modifier)
1136 continue;
1137 if ((UserAction)i == excludeAction && (excludeSlot < 0 || j == excludeSlot))
1138 continue;
1139 return (UserAction)i;
1140 }
1141 }
1142 return UAN;
1143}
1144
1145void InputSubsystem::ResetCategoryDefaults(ControlsCategory cat)

Callers 2

Calls 3

sizeMethod · 0.80
toLegacyMethod · 0.80
validMethod · 0.45

Tested by

no test coverage detected