Possible Iedit Fix (Evaluate Please) + For Sure Iedit Fix

From: Tony Robbins (robbinsw@ucs.orst.edu)
Date: 06/22/00


I couldn't find a fix for Iedit under OasisOLC v2.0, so I tried to diagnose
it myself.  After much trial and error, I came up with:

  (struct obj_data *temp_ptr = NULL) at top of oedit_parse.

  case OEDIT_CONFIRM_SAVESTRING:
    switch (*arg) {
    case 'y':
    case 'Y':
      if(STATE(d) == CON_OEDIT) {
        send_to_char("Saving object to memory.\r\n", d->character);
        oedit_save_internally(d);
        sprintf(buf, "OLC: %s edits obj %d", GET_NAME(d->character),
OLC_NUM(d));
        mudlog(buf, CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)),
TRUE);
        cleanup_olc(d, CLEANUP_STRUCTS);
      } else {  /* case is iedit */
        send_to_char("Commiting iedit changes.\r\n", d->character);
>       temp_ptr = OLC_IEDIT(d);
>       free(temp_ptr);
>       CREATE(OLC_IEDIT(d), struct obj_data, 1);
>       clear_object(OLC_IEDIT(d));
>       copy_object(OLC_IEDIT(d), OLC_OBJ(d));
        /* Was: *(OLC_IEDIT(d)) = *(OLC_OBJ(d));
        /* This also handles the comment left in the file on saving and
freeing the pointer */
        /* copy_object likes to crash without a clear_object first. */
        sprintf(buf, "OLC: %s uses iedit", GET_NAME(d->character));
        mudlog(buf, CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)),
TRUE);
        if (d->character) {
          REMOVE_BIT(PLR_FLAGS(d->character), PLR_WRITING);
          STATE(d) = CON_PLAYING;
          act("$n stops using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
        }
>       cleanup_olc(d, CLEANUP_STRUCTS);
        free(d->olc);
>       return;
      }
>     /* Return was here, OEDIT would like to fall through, though. */
      /* Fall through. */
    case 'n':

It appears to be working (only some quick tests) now, but it seems slow
coming out of the editors, although this might be because I was running it
under GDB.  Anyway, anybody notice anything important I did wrong?

Also, there's another fix you need to do:

In genobj.c, object_update():

  for (obj = object_list; obj; obj = obj->next) {
>   if (obj->item_number != refobj->item_number || OBJ_FLAGGED(obj,
ITEM_UNIQUE_SAVE))
    /* Was: if (obj->item_number != refobj->item_number) */
      continue;

That will keep your unique items from being overwritten if the original is
oeditted.

Alright, please let me know,
-Tony


     +------------------------------------------------------------+
     | 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 : 04/10/01 PDT