From 770285c464bf06132ce4c4e4d39abba12349f530 Mon Sep 17 00:00:00 2001 From: Nauzhror Date: Thu, 18 Jan 2018 11:59:25 -0500 Subject: [PATCH] Fixed add_to_lookup_table (#37) * Added %log%, and made %send%, %echo%, etc. not force capitalization. * Fixed Previous Commit * Really fixed this time. * Fixed look 2.mail Also reverted CMMAND_TERMS, was increased in previous commit when it didn't need to be due to the removed of marena. * Fixed add_to_lookup_table Fixed as per Welcor https://www.tbamud.com/forum/2-general/4307-crash-bug-need-assistance-with-gdb?start=20#7390 --- src/dg_scripts.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dg_scripts.c b/src/dg_scripts.c index b60e14b..de948bd 100644 --- a/src/dg_scripts.c +++ b/src/dg_scripts.c @@ -3004,9 +3004,15 @@ void add_to_lookup_table(long uid, void *c) int bucket = (int) (uid & (BUCKET_COUNT - 1)); struct lookup_table_t *lt = &lookup_table[bucket]; - for (;lt->next; lt = lt->next) - if (lt->c == c && lt->uid == uid) { - log ("Add_to_lookup failed. Already there. (uid = %ld)", uid); + if (lt && lt->uid == uid) { + log("add_to_lookup updating existing value for uid=%ld (%p -> %p)", uid, lt->c, c); + lt->c = c; + return; + } + + for (;lt && lt->next; lt = lt->next) + if (lt->next->uid == uid) { + log("add_to_lookup updating existing value for uid=%ld (%p -> %p)", uid, lt->next->c, c); return; }