Re: Memory issues.

Michael Barton <[email protected]>
Newsgroups gmane.games.devel.mud.rom
Message-ID <[email protected]>
> Yeah that whole stack/heap concept is still a little fuzzy to me as I
> never really took a programming course higher than TP in high school :D

You'd be surprised.  I know people with CS degrees who have trouble
with some of these concepts.  Then again, I had a professor with a
doctorate who couldn't type...

>> His function won't allocate anything at boot time.

Well, if you want to be really picky...
Nah I won't.

My do_function works basically the same as what he posted and has
never caused a problem.  I do limit the recursion depth so hopefully I
won't exceed my stack space, just in case a mobprog goes haywire or
something like that.

void do_function (CHAR_DATA *ch, DO_FUN *do_fun, char *argument)
{
    char command_string[MAX_INPUT_LENGTH];
    static int depth = 0;
    if (!ch || !argument || !do_fun)
      return;
    strncpy(command_string, argument, sizeof(command_string));
    depth++;
    if (depth > 50)
      bugf("DO_FUNCTION MAX DEPTH: [%s] %s", ch->name, argument);
    else
      (*do_fun) (ch, command_string);
    depth--;
}

--Palrich.
-- 
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.