From e22d44e708d37923dcb57fd382e38b12bbc10a75 Mon Sep 17 00:00:00 2001 From: Ibrahim Zidan Date: Wed, 18 Sep 2019 16:25:35 +0200 Subject: Rewrite of itemdb_searchname_array and itemdb_searchname_array_sub Rewrote item name checks in both functions to be more readable Changed flag to be enum item_name_search_flag and made itemdb_searchname_array_sub respect flag given to parent function Corrected item count returned by parent function when dbmap search is performed Fixed a memory violation caused by the old code when dbmap search is performed Fixed dbmap searching having static array size which did not adhire to the size passed to the function Signed-off-by: Ibrahim Zidan --- src/map/atcommand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/map/atcommand.c') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 22969606d..b3e5a1f12 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -3559,7 +3559,7 @@ ACMD(idsearch) safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,77), item_name); // Search results for '%s' (name: id): clif->message(fd, atcmd_output); - match = itemdb->search_name_array(item_array, MAX_SEARCH, item_name, 0); + match = itemdb->search_name_array(item_array, MAX_SEARCH, item_name, IT_SEARCH_NAME_PARTIAL); if (match > MAX_SEARCH) { safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,269), MAX_SEARCH, match); clif->message(fd, atcmd_output); @@ -7441,7 +7441,7 @@ ACMD(iteminfo) return false; } if ((item_array[0] = itemdb->exists(atoi(message))) == NULL) - count = itemdb->search_name_array(item_array, MAX_SEARCH, message, 0); + count = itemdb->search_name_array(item_array, MAX_SEARCH, message, IT_SEARCH_NAME_PARTIAL); if (!count) { clif->message(fd, msg_fd(fd,19)); // Invalid item ID or name. @@ -7492,7 +7492,7 @@ ACMD(whodrops) return false; } if ((item_array[0] = itemdb->exists(atoi(message))) == NULL) - count = itemdb->search_name_array(item_array, MAX_SEARCH, message, 0); + count = itemdb->search_name_array(item_array, MAX_SEARCH, message, IT_SEARCH_NAME_PARTIAL); if (!count) { clif->message(fd, msg_fd(fd,19)); // Invalid item ID or name. -- cgit v1.2.3-60-g2f50