hedit_save_internally

From: Izham Syah Mahrome (doomvoid@HOTMAIL.COM)
Date: 11/17/02


so far i managed to put in the hedit in oasis2.0 for bpl21 with success. of
course there is only one problem which is why i paste it here :). my hedit
can only create NEW helps but if i try to edit and save the EXISTING ones
it will crash. i dont know why help_table[rnum] = *OLC_HELP(d) wont work.
if there is a solution to this then perhaps i can put out a new modified
snippet of hedit for bpl21 oasis at least.

-------------------------------------
the gdb output....

Nov 15 21:58:43 :: Rnum is 31 of 215 for advance
Nov 15 21:58:43 :: OLC_HELP(d) is ADVANCE
Nov 15 21:58:43 :: Setting value to Zero
Nov 15 21:58:43 :: OLC: Aeon starts editing help for ADVANCE.
Nov 15 21:58:52 :: free help
Nov 15 21:58:52 :: help freed: transfering help table

Nov 15 21:58:52 :: rnum is 31 saving ADVANCE

Program received signal SIGSEGV, Segmentation fault.
0x080b8470 in hedit_save_internally (d=0x82ba220) at hedit.c:113
113     hedit.c: No such file or directory.
        in hedit.c
(gdb) backtrace
#0  0x080b8470 in hedit_save_internally (d=0x82ba220) at hedit.c:113
#1  0x080b87bd in hedit_parse (d=0x82ba220, arg=0xbffff750 "y") at
hedit.c:246
#2  0x08084429 in nanny (d=0x82ba220, arg=0xbffff750 "y") at
interpreter.c:1493
#3  0x080699a6 in game_loop (mother_desc=5) at comm.c:756
#4  0x080690e0 in init_game (port=4100) at comm.c:384
#5  0x08068fd2 in main (argc=2, argv=0xbffffb24) at comm.c:329
#6  0x40068b65 in __libc_start_main (main=0x8068d18 <main>, argc=2,
ubp_av=0xbffffb24, init=0x804926c <_init>,
    fini=0x80b8b4c <_fini>, rtld_fini=0x4000df24 <_dl_fini>,
stack_end=0xbffffb1c) at ../sysdeps/generic/libc-start.c:111
(gdb) step

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) print hedit_save_internally
$1 = {void (struct descriptor_data *)} 0x80b83d8 <hedit_save_internally>



--------------------------------
here lies the problem which i cant find

void hedit_save_internally(struct descriptor_data *d)
{
  int i, rnum;
  struct help_index_element *new_help_table;

  rnum = OLC_ZNUM(d);

  /*
   * Help entry exists exists: free and replace it.
   */
  if (rnum > 0) {
     mudlog(CMP, LVL_BUILDER, TRUE, "free help");
    free_help();
     mudlog(CMP, LVL_BUILDER, TRUE, "help freed");
     mudlog(CMP, LVL_BUILDER, TRUE, "creating new help table: transfering
help table\n");
     mudlog(CMP, LVL_BUILDER, TRUE, "rnum is %d saving %s", rnum, *OLC_HELP
(d));
    help_table[rnum] = *OLC_HELP(d);
     mudlog(CMP, LVL_BUILDER, TRUE, "help table CREATED!!\n");
  } else {   /* Entry doesn't exist, hafta add it. */
    CREATE(new_help_table, struct help_index_element, top_of_helpt + 2);

    /*
     * Insert new entry at the top - why not?
     */

    new_help_table[0] = *(OLC_HELP(d));

    /*
     * Count through help table.
     */
    for (i = 0; i <= top_of_helpt; i++)
      new_help_table[i + 1] = help_table[i];

    /*
     * Copy help table over to new one.
     */
    free(help_table);
    help_table = new_help_table;
    top_of_helpt++;
  }

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT