Re: Mob name pointers

From: Jeremy Elson (jelson@blaze.cs.jhu.edu)
Date: 05/31/95


> > > If this is what is actually happening, could someone point out where in 
> > > the code I could modify so when I alter one mob's name, all of them 
> > > will not.
> > 
> > I'd suggest waiting unil J. Elson finishes OLC... you'd have o copy the 
> > mob into a new one and change it's name... only way it'd work, as far as 
> > I been able to tell.
> > 

> I see, just as I thought..  It would seem that the whole struct char_data 
> * mob is a pointer pointing to mob_proto[x].  If this is so, then why 
> when you change the integers, all of the mobs don't change if mob is a 
> pointer itself?.

Err, no, that's not true.  If the entire mob was a pointer to the prototype,
nothing would work.  When you killed one Cityguard the rest of them would
die too!

A copy of all the data is made for each mob, but the *string data* is not
copied deeply; i.e., the pointers are duplicated instead of the strings
themselves being duplicated.  The short answer is that yes, all mobs share
strings, but they don't share anything else.

Jeremy



This archive was generated by hypermail 2b30 : 12/07/00 PST