Reverting prior change to map_loose_match

This commit is contained in:
Peter Slattery 2024-03-26 16:00:50 -07:00
parent f1d6ac0e53
commit 3f1c591196
1 changed files with 8 additions and 15 deletions

View File

@ -210,17 +210,16 @@ map_strict_match(Input_Modifier_Set *binding_mod_set, Input_Modifier_Set *event_
return(result);
}
function i32
function b32
map_loose_match(Input_Modifier_Set *binding_mod_set, Input_Modifier_Set *event_mod_set){
i32 result = 0;
b32 result = true;
i32 binding_mod_count = binding_mod_set->count;
Key_Code *binding_mods = binding_mod_set->mods;
for (i32 i = 0; i < binding_mod_count; i += 1){
if (!has_modifier(event_mod_set, binding_mods[i])){
result = 0;
result = false;
break;
}
result += 1;
}
return(result);
}
@ -299,21 +298,15 @@ map_get_binding_non_recursive(Command_Map *map, Input_Event *event, Binding_Matc
}break;
case BindingMatchRule_Loose:
{
i32 best_match = 0;
for (SNode *node = list->first;
node != 0;
node = node->next){
node != 0;
node = node->next){
Command_Modified_Binding *mod_binding = CastFromMember(Command_Modified_Binding, order_node, node);
Input_Modifier_Set *binding_mod_set = &mod_binding->mods;
i32 match = map_loose_match(binding_mod_set, breakdown.mod_set);
if (match && match > best_match) {
printf("Upgrading Best Match\n");
best_match = match;
if (map_loose_match(binding_mod_set, breakdown.mod_set)){
result = mod_binding->binding;
}
}
if (best_match != 0) {
goto done;
goto done;
}
}
}break;
}