On 2/25/98 6:04 PM, ;P (siv@CYBERENET.NET) stated: >i think that a better solution would be to walk back in the help_table to >the first shared entry (they should all be next to eachother), the one >that isn't marked duplicate, and free and replace that one..then walk down >all the duplicates and assign them to the new pointer..i think that if you >don't replace the old pointer with a new one for all of the entries, then >you have a chance of either crashing, or getting duplicate or old entries >written to your help file.. Shouldn't be necessary to run through all the dups, since it saves the edited entry internally, then writes to disk, which only writes the original entry to disk, not dupes, then reboots the help system. Here is a fix: in hedit_save_internally: add char *temp = NULL; at top if (OLC_ZNUM(d) > top_of_helpt) { CREATE(new_help_table, HelpElement, top_of_helpt + 2); for (i = 0; i <= top_of_helpt; i++) new_help_table[i] = help_table[i]; new_help_table[++top_of_helpt] = *OLC_HELP(d); FREE(help_table); help_table = new_help_table; } else { ***** BEGIN FIX temp = help_table[OLC_ZNUM(d)].entry; for (i = 0; i < top_of_helpt; i++) { if (help_table[i].entry == temp) { // if (!help_table[i].duplicate) FREE(help_table[i].entry); help_table[i].entry = OLC_HELP(d)->entry; help_table[i].min_level = OLC_HELP(d)->min_level; } } free(temp); ***** END FIX } What it does is run through the list of help entries, comparing the entry ptrs against the original entry ptr. If a match is found, set its entry to the help's entry, and the level also. Copying the keyword is not necessary (useless actually), and copying the "duplicate" is also useless (harmfull actually). Just for safety's sake, "temp" - the ptr to the original entry, is not freed until the end. It is necessary to use "temp" otherwise once i > OLC_ZNUM(d), old entries will no longer compare properly (because help_table[OLC_ZNUM(d)].entry will now == OLC_HELP(d)->entry) - Chris Jacobson +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST