diff options
author | Ibrahim Zidan <brahem@aotsw.com> | 2019-09-18 16:25:35 +0200 |
---|---|---|
committer | Ibrahim Zidan <brahem@aotsw.com> | 2019-09-19 17:51:43 +0200 |
commit | e22d44e708d37923dcb57fd382e38b12bbc10a75 (patch) | |
tree | e15200b67e1538f3b36c28e1987fda7389d8b50a /src/map/atcommand.c | |
parent | 6dbabae7003990369d1c9ce965c3c4409c879499 (diff) | |
download | hercules-e22d44e708d37923dcb57fd382e38b12bbc10a75.tar.gz hercules-e22d44e708d37923dcb57fd382e38b12bbc10a75.tar.bz2 hercules-e22d44e708d37923dcb57fd382e38b12bbc10a75.tar.xz hercules-e22d44e708d37923dcb57fd382e38b12bbc10a75.zip |
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 <brahem@aotsw.com>
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 6 |
1 files changed, 3 insertions, 3 deletions
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. |