[LONG] OasisOLC v2.0 Fix and Beautification

From: Tony Robbins (tonyr@pacific101.com)
Date: 04/28/99


I hope your mailer doesn't wrap at 80 characters, because some of this will
wrap ugly.  -K.

Couple more things I found in OasisOLC.  There was an oedit crash stemmed
from the function oedit_setup_existing():

OasisOLCv2.0 (pre3) - oedit_setup_existing():
  /*
   * 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);

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.

The fix I chose:
  /*
   * Copy all strings over.
   */
  if (obj_proto[real_num].name && *obj_proto[real_num].name)
    obj->name = str_dup(obj_proto[real_num].name);
  else
    obj->name = str_dup("no aliases defined");

  if (obj_proto[real_num].short_description &&
*obj_proto[real_num].short_description)
    obj->short_description = str_dup(obj_proto[real_num].short_description);
  else
    obj->short_description = str_dup("an unfinished object");

  if (obj_proto[real_num].description && *obj_proto[real_num].description)
    obj->description = str_dup(obj_proto[real_num].description);
  else
    obj->description = str_dup("An unfinished object is lying here [report
to an administrator].");

  if (obj_proto[real_num].action_description &&
*obj_proto[real_num].action_description)
    obj->action_description =
str_dup(obj_proto[real_num].action_description);
  else
    obj->action_description = str_dup("");

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.

Anyway, now for the actual topic of my message:

Now that my OasisOLC v2.0 functions without crashing, I was annoyed at its
logging format.  When you save a zone (mobiles, objects, etc...), it logs:

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.

Apr 28 17:45:21 :: GenOLC: 'world/mob/40.mob' saved, 174 bytes written.

Gotta love that single slash.  :)

Anyway, that's it for now.  Good work all...

-K.


     +------------------------------------------------------------+
     | 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