From 3f1c591196f5c25d773c9fcdaf9296fe377b2abe Mon Sep 17 00:00:00 2001 From: Peter Slattery Date: Tue, 26 Mar 2024 16:00:50 -0700 Subject: [PATCH] Reverting prior change to map_loose_match --- code/custom/4coder_command_map.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/code/custom/4coder_command_map.cpp b/code/custom/4coder_command_map.cpp index 2d3ba16a..d151df15 100644 --- a/code/custom/4coder_command_map.cpp +++ b/code/custom/4coder_command_map.cpp @@ -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; }