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