From 14c34bf861cda2375a33a667b18fd6bf097e1019 Mon Sep 17 00:00:00 2001 From: LeoCottret <71428793+leoCottret@users.noreply.github.com> Date: Sun, 2 Oct 2022 12:26:01 +0200 Subject: [PATCH 1/5] add exact match debug search and fix duplicated debug key --- data/json/monsters/zed_misc.json | 4 +++- data/json/monsters/zed_soldiers.json | 4 +--- src/debug_menu.cpp | 4 ++-- src/ui.cpp | 12 +++++++++++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/data/json/monsters/zed_misc.json b/data/json/monsters/zed_misc.json index 6b5ebc30fad8..fc6ad3695494 100644 --- a/data/json/monsters/zed_misc.json +++ b/data/json/monsters/zed_misc.json @@ -458,7 +458,9 @@ "vision_day": 50, "vision_night": 4, "harvest": "zombie", - "special_attacks": [ [ "SMASH", 20 ] ], + "special_attacks": [ + [ "LONGSWIPE", 20 ] + ], "death_drops": "mon_zombie_hulk_death_drops", "death_function": [ "NORMAL" ], "fungalize_into": "mon_zombie_fungus", diff --git a/data/json/monsters/zed_soldiers.json b/data/json/monsters/zed_soldiers.json index 74f70107476f..c1b1323b2144 100644 --- a/data/json/monsters/zed_soldiers.json +++ b/data/json/monsters/zed_soldiers.json @@ -269,9 +269,7 @@ "vision_night": 10, "harvest": "zombie_kevlar", "special_attacks": [ - { "id": "slam", "cooldown": 12, "damage_max_instance": [ { "damage_type": "bash", "amount": 35 } ] }, - [ "LONGSWIPE", 20 ], - [ "SMASH", 20 ] + [ "LONGSWIPE", 20 ] ], "death_drops": "mon_zombie_kevlar_death_drops", "death_function": [ "NORMAL" ], diff --git a/src/debug_menu.cpp b/src/debug_menu.cpp index 1dddbffc1aac..39fa09936a50 100644 --- a/src/debug_menu.cpp +++ b/src/debug_menu.cpp @@ -570,8 +570,8 @@ void character_edit_menu( Character &c ) std::vector menu_entries = static_entries; if( !spell_type::get_all().empty() ) { - menu_entries.emplace_back( edit_character::learn_spells, true, 'S', _( "Learn all [S]pells" ) ); - menu_entries.emplace_back( edit_character::level_spells, true, 'L', _( "[L]evel a spell" ) ); + menu_entries.emplace_back( edit_character::learn_spells, true, 'L', _( "[L]earn all Spells" ) ); + menu_entries.emplace_back( edit_character::level_spells, true, 'v', _( "Le[v]el a spell" ) ); } if( p.is_npc() ) { menu_entries.emplace_back( edit_character::mission_add, true, 'm', _( "Add [m]ission" ) ); diff --git a/src/ui.cpp b/src/ui.cpp index 9f75e138a40b..447a5c88aeff 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -222,9 +222,19 @@ void uilist::filterlist() int f = 0; int num_entries = entries.size(); + // check if string begin by " and finish by ". If that's the case, we only return a result if it matches it exactly + bool exactMatchOnly = filter.front() == '\"' && filter.back() == '\"'; + if( exactMatchOnly ) { + filter.erase( std::remove( filter.begin(), filter.end(), '\"' ), filter.end() ); + } + for( int i = 0; i < num_entries; i++ ) { if( filtering ) { - if( ignore_case ) { + if( exactMatchOnly ) { + if( !( entries[i].txt == filter ) ) { + continue; + } + } else if( ignore_case ) { if( !lcmatch( entries[i].txt, filter ) ) { continue; } From 91918407afbae76491a793205b307191adb1b942 Mon Sep 17 00:00:00 2001 From: LeoCottret <71428793+leoCottret@users.noreply.github.com> Date: Sun, 2 Oct 2022 13:57:32 +0200 Subject: [PATCH 2/5] reset hulks values --- data/json/monsters/zed_misc.json | 4 +--- data/json/monsters/zed_soldiers.json | 9 ++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/data/json/monsters/zed_misc.json b/data/json/monsters/zed_misc.json index fc6ad3695494..6b5ebc30fad8 100644 --- a/data/json/monsters/zed_misc.json +++ b/data/json/monsters/zed_misc.json @@ -458,9 +458,7 @@ "vision_day": 50, "vision_night": 4, "harvest": "zombie", - "special_attacks": [ - [ "LONGSWIPE", 20 ] - ], + "special_attacks": [ [ "SMASH", 20 ] ], "death_drops": "mon_zombie_hulk_death_drops", "death_function": [ "NORMAL" ], "fungalize_into": "mon_zombie_fungus", diff --git a/data/json/monsters/zed_soldiers.json b/data/json/monsters/zed_soldiers.json index c1b1323b2144..435b97f4d91f 100644 --- a/data/json/monsters/zed_soldiers.json +++ b/data/json/monsters/zed_soldiers.json @@ -217,8 +217,9 @@ "vision_night": 5, "harvest": "zombie_kevlar", "special_attacks": [ - { "id": "slam", "cooldown": 10, "damage_max_instance": [ { "damage_type": "bash", "amount": 12 } ] }, - [ "SMASH", 30 ] + { "id": "slam", "cooldown": 12, "damage_max_instance": [ { "damage_type": "bash", "amount": 35 } ] }, + [ "LONGSWIPE", 20 ], + [ "SMASH", 20 ] ], "death_drops": "mon_zombie_kevlar_death_drops", "death_function": [ "NORMAL" ], @@ -268,9 +269,7 @@ "vision_day": 35, "vision_night": 10, "harvest": "zombie_kevlar", - "special_attacks": [ - [ "LONGSWIPE", 20 ] - ], + "special_attacks": [ [ "LONGSWIPE", 20 ] ], "death_drops": "mon_zombie_kevlar_death_drops", "death_function": [ "NORMAL" ], "burn_into": "mon_zombie_scorched", From 00792ffda59b49dc8a2a4a5d08af213a92e014c2 Mon Sep 17 00:00:00 2001 From: LeoCottret <71428793+leoCottret@users.noreply.github.com> Date: Sun, 2 Oct 2022 14:04:19 +0200 Subject: [PATCH 3/5] fix reset --- data/json/monsters/zed_soldiers.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/data/json/monsters/zed_soldiers.json b/data/json/monsters/zed_soldiers.json index 435b97f4d91f..74f70107476f 100644 --- a/data/json/monsters/zed_soldiers.json +++ b/data/json/monsters/zed_soldiers.json @@ -217,9 +217,8 @@ "vision_night": 5, "harvest": "zombie_kevlar", "special_attacks": [ - { "id": "slam", "cooldown": 12, "damage_max_instance": [ { "damage_type": "bash", "amount": 35 } ] }, - [ "LONGSWIPE", 20 ], - [ "SMASH", 20 ] + { "id": "slam", "cooldown": 10, "damage_max_instance": [ { "damage_type": "bash", "amount": 12 } ] }, + [ "SMASH", 30 ] ], "death_drops": "mon_zombie_kevlar_death_drops", "death_function": [ "NORMAL" ], @@ -269,7 +268,11 @@ "vision_day": 35, "vision_night": 10, "harvest": "zombie_kevlar", - "special_attacks": [ [ "LONGSWIPE", 20 ] ], + "special_attacks": [ + { "id": "slam", "cooldown": 12, "damage_max_instance": [ { "damage_type": "bash", "amount": 35 } ] }, + [ "LONGSWIPE", 20 ], + [ "SMASH", 20 ] + ], "death_drops": "mon_zombie_kevlar_death_drops", "death_function": [ "NORMAL" ], "burn_into": "mon_zombie_scorched", From fad4861e325d4df3fa45f3fefb1dbc6fa30ab9c6 Mon Sep 17 00:00:00 2001 From: LeoCottret <71428793+leoCottret@users.noreply.github.com> Date: Mon, 3 Oct 2022 20:32:35 +0200 Subject: [PATCH 4/5] add extra check on empty string --- src/ui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui.cpp b/src/ui.cpp index 447a5c88aeff..14851fa873e6 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -223,7 +223,7 @@ void uilist::filterlist() int f = 0; int num_entries = entries.size(); // check if string begin by " and finish by ". If that's the case, we only return a result if it matches it exactly - bool exactMatchOnly = filter.front() == '\"' && filter.back() == '\"'; + bool exactMatchOnly = !filter.empty() && filter.front() == '\"' && filter.back() == '\"'; if( exactMatchOnly ) { filter.erase( std::remove( filter.begin(), filter.end(), '\"' ), filter.end() ); } From fdcba006662ee6fcecdab194a4e387a0d7f25530 Mon Sep 17 00:00:00 2001 From: LeoCottret <71428793+leoCottret@users.noreply.github.com> Date: Wed, 5 Oct 2022 22:51:02 +0200 Subject: [PATCH 5/5] fix case --- src/ui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui.cpp b/src/ui.cpp index 14851fa873e6..0e18873bc737 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -223,14 +223,14 @@ void uilist::filterlist() int f = 0; int num_entries = entries.size(); // check if string begin by " and finish by ". If that's the case, we only return a result if it matches it exactly - bool exactMatchOnly = !filter.empty() && filter.front() == '\"' && filter.back() == '\"'; - if( exactMatchOnly ) { + bool exact_match_only = !filter.empty() && filter.front() == '\"' && filter.back() == '\"'; + if( exact_match_only ) { filter.erase( std::remove( filter.begin(), filter.end(), '\"' ), filter.end() ); } for( int i = 0; i < num_entries; i++ ) { if( filtering ) { - if( exactMatchOnly ) { + if( exact_match_only ) { if( !( entries[i].txt == filter ) ) { continue; }