Re: [NEWBIE] Taking in arguements (I'm slow)

From: Leonardo Herrera (leonardo.herrera@mercantil.com)
Date: 03/01/01


dave mquackquadart wrote:
>
> >To be very frank... although pseudo code is good, if you show us
> >your actual code...
>
> Heres what I have, and whenever I put in an arguement it crashes.
[...]

> if (*arg)
[...]

Probably I'm missing something, but it seems like you are asking for
"arg" and then not using it. Also, you have the following block in
your code:

--------------------------------------------------------------------
if (GET_MEM_USED(ch, found_level) == GET_MEM_AVAILABLE(ch, found_level))
{
  sprintf(buf, "Your mind is too full.");
} else
  /* take up the used slot and add to the skill, + 1 percent */
  SET_MEM_USED(ch, found_level-1, (GET_MEM_USED(ch, found_level-1)+1));
send_to_char(buf, ch);
--------------------------------------------------------------------

If the condition fails, you are going to send_to_char the "buf"
variable uninitialized (since it is global, probably not unitialized
but with unpredictable contents). The use of "{" and "}" looks like
a mistake, too.

Will be helpful if you show us the GET_MEM_USED, GET_MEM_AVAILABLE and
SET_MEM_USED functions (or macros) and if you explain what are
you trying to do with this function (Also, the name of these macros
sounds like memory management instead of a spell memorization system
to me).

Regards,
--
Leonardo Herrera
mailto:leonardo.herrera@mercantil.com

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST