[?] Difference between d->character and ch

From: Del (caminturn@earthlink.net)
Date: 06/28/99


Running into a problem, and need some help. Could not find a related archive
topic.


This is the error I am getting, and can not figure out why.

#0  0x80b2622 in edit_setup (d=0x0, number=99) at edit.c:119
119         send_to_char(buf, d->character);
(gdb) print d->character
Cannot access memory at address 0x77c.

What is the difference between using , ch or , d-character..
and when do you know that you can use one or the other?
(Yea, I create stuff and by experiment I learn which one I can use.
 but I never really could figure out why)

------------------------------
I am trying to set up a few functions and it seems I lose info.
This code is not exact! it is this way to give a basic idea whats going on
only.
Hopefully someone will know what is killing me on this and bonk me in the head
to let me know where I am screwing up.

Based off of zedit functions,
I create a basic olc function to start it off (like olc).


at top of file:
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "comm.h"
#include "utils.h"
#include "olc.h"
#include "handler.h"
#include "interpreter.h"
#include "db.h"

ACMD (do_edit)
{
 struct descriptor_data *d;

/* a few checks like */

   if (IS_NPC(ch))
      return;

/* pull the number argument from the input */
number = atoi(buf1);

/* following along zedit */

edit_setup(d, number);
send_to_char("WE GET TO HERE FINE IF send_to_char in edit_setup IS NOT IN THE
CODE", ch);

/ * removed for testing
STATE(d) = CON_EDIT;
*/

return;

}

void edit_setup(struct descriptor_data *d, int number)
{

/* run a few checks that appear to work fine (messages inserted works fine
above) */

send_to_char("MUD WILL NOT COMPILE WITH 'ch' TO IN THIS LINE "
             "ch undeclared (first use of this function)", ch);

send_to_char("MUD WILL CRASH IF I USE THIS LINE, SEE ERROR AT TOP",
d->character);

/* this follows similarly to zedit, cept zedit_setup has no send_to_char */
/* only the call to zedit_disp_menu(d) in which there are , ch)'s */
/* so this is why I am confused, as to why the different d->character and ch
*/
}


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