On Thu, 7 May 1998, George wrote: > >void call_timed_dt(struct char_data *ch) > >{ > > struct death_trap_type *dt; > > > > CREATE(dt, struct death_trap_type, 1); > > dt->ch = ch; > > GET_TIMED_DT(ch) = event_create(timed_dt, dt, 4); > > > >} > > CREATE() will zero out the 'dt' structure. Right. > Trying to take 'dt->ch' will give you your NULL reference. Why? dt is now a pointer to a struct containing a single char_data pointer. The memory it points to exists and is useable at this point (assuming the CREATE didn't fail), so assigning dt->ch shouldn't cause problems. I didn't see anything wrong with the rest of the posted code, but the symptom mentioned (dereferenced ch) is a little vague. Since this is something which causes death, make sure there's no way any code tries to access ch after the character is killed. This would be a good time to learn how to use your debugger's single-stepping feature, since it's such a small amount of code to step through. Sam +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST