On Wed, 28 Apr 1999, Tony Robbins wrote: >I hope your mailer doesn't wrap at 80 characters, because some of this will >wrap ugly. -K. My screen ends at 132 characters. :) > /* > * Copy all strings over. > */ > obj->name = str_udup(obj_proto[real_num].name); > obj->short_description = str_udup(obj_proto[real_num].short_description); > obj->description = str_udup(obj_proto[real_num].description); > obj->action_description = str_dup(obj_proto[real_num].action_description); > >The problem: str_dup has problems with null strings, and action >descriptions are often blank. One fix is to make that: > obj->action_description = >str_udup(obj_proto[real_num].action_description); True, it used to be str_udup. That's probably why there is not a NULL check. I suppose most of that could be fixed with copy_object_strings() but that doesn't check for NULL. Hm, they shouldn't happen anyway, I'll just use the function. So the whole thing is reduced to: void oedit_setup_existing(struct descriptor_data *d, int real_num) { struct obj_data *obj; CREATE(obj, struct obj_data, 1); copy_object(obj, &obj_proto[real_num]); OLC_OBJ(d) = obj; OLC_VAL(d) = 0; oedit_disp_menu(d); } >str_udup() appears to be a George-ian (heh) function that checks NULL and >returns "undefined" in cases where the source string is NULL. However, this >is ugly and creates an action description when one is not wanted. action_descriptions are free to be NULL. >Note that I dislike that str_dup(""), but I can't find an alternative at the >moment. This fix permits an empty action description while setting more >descriptive strings than "undefined" in in specific circumstances. I guess >it's individual choice, and George's for the actual distribution. It's a lot easier to use str_udup(). >Apr 28 17:45:21 :: GenOLC: 'world/mob//40.mob' saved, 174 bytes written. > >My problem with that is the double slash. Yes, it doesn't really matter, >but I'm a nitpicker sometimes, and so I went into db.h and changed the >prefix definitions to remove the end slash. This caused some problems at >boot up with it not being able to get to the filename (stock CircleMUD >doesn't add the slash, because it assumes its there in the definition, while >OasisOLC adds one, because it assumes it's not there). I then went into the >stock CircleMUD functions (grep for '%s%s", prefix', minus the apostrophes) >and added my slash manually. Now my logs are prettier. I just removed the / from Oasis. :) -- George Greer | My beta stuff and related information. greerga@circlemud.org | http://www.circlemud.org/~greerga/ +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST