Re: [CODE] RE-STRING

From: Skylar (skylar@ifconfig.intserv.com)
Date: 10/13/96


On Sun, 13 Oct 1996, Søren Peter skou wrote:

> hum, Now I'm toying around with a restring command, but err.. apperantly
> I can't make it. Anyone with an idea how to make it?? as it is now i
> change ALL items.. not what I want :)

Most things in circle which have multiple strings which are exactly the same
share a common pointer to a single character string - saving oodles of ram.
Because of this, if you fiddle the pointed at text, everything which uses it
will also be fiddled.  If you use str_dup() to duplicate the text you want
attached to whatever it is you're stringing, it will automagically allocate
enough space for your new string, and point to it - leaving the original
string which (most likely) has a lot of things pointing to it, untouched.
i.e. This should work fine for you, in place of however you were trying to
copy your data into the "strung" field...

obj->short_description = str_dup(arg);


On a side note - has anyone considered prototyping rooms?  I've done some
experiments with using a basic description based on sector_type for rooms
which have no description (none allocated) and ended up saving enough mem
to boost my test mud up to a little over 10k rooms, using only 4 and a half
megs of ram... some interesting possibilities for people doing up monsterous
grid-format or cube-format worlds...


-Sky

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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