Dantin wrote:
> Heres the compiler warnings:
>
> arena.c: In function `do_startwar':
> arena.c:55: warning: implicit declaration of function `atoi'
> arena.c:90: warning: implicit declaration of function `do_wartalk'
> arena.c: In function `do_war':
> arena.c:142: warning: implicit declaration of function `do_look'
>
>
> Heres something probably so simple. I'm just overlooking it. In this
> Arena.c I have a function do_wartalk and do_look. do_wartalk is
initialized
> like this:
>
> do_wartalk(buf);
As a function prototype, this is *way* wrong, unless 'buf' is a typedef.
What you probably need is something more like:
void do_wartalk(char *buf); -or however your function is declared.
> also do_look like this:
> do_look(ch,"auto")
Same thing here, if you were calling do_look from a routine, this would
probably be all good, but as a prototype, you'd need something like:
void do_look(CHAR_DATA *ch, const char *buf); or whatnot.
Look at how the function is declared at the beginning of the function,
and just copy that line, remove the { and put a ; on the end. Also, if
the functions are used in more than one file, it may be helpful to put
it in a header file, such as arena.h, where you could just #include it
into other files as needed.
>
> How can I make it to where the compiler doesn't whine about it.
> Also I've been trying to get the atoi error to disappear.. The code looks
> like this:
>
> void do_startwar(CHAR_DATA *ch, char *argument)
> {
> char buf[MAX_STRING_LENGTH];
> char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
> char arg3[MAX_INPUT_LENGTH];
> DESCRIPTOR_DATA *d;
>
> argument = one_argument(argument, arg1);
> argument = one_argument(argument, arg2);
> argument = one_argument(argument, arg3);
> if (arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0')
> {
> send_to_char("{BSyntax{W: {Bstartwar {Y<{Wtype{Y> <{Mmin_level{Y>
> <{Mmax_level{Y>{x\n\r", ch);
> return;
> }
>
> if (atoi(arg1) < 1 || atoi(arg1) > 2)
> {
> send_to_char("{CThe type either has to be {W1{C, or
{W2{C.{x\n\r", ch);
> return;
> }
>
> if (atoi(arg2) <= 0 || atoi(arg2) > 250)
> {
> send_to_char("{CLevel must be between {W1 {Cand {W250{C.{x\n\r", ch);
> return;
> }
>
> if (atoi(arg3) <= 0 || atoi(arg3) > 250)
> {
> send_to_char("{CLevel must be between {W1 {Cand {W250{C.{x\n\r", ch);
> return;
> }
>
> if (atoi(arg3) < atoi(arg2))
> {
> send_to_char("{CMax level must be greater than the min level.{x\n\r",
> ch);
> return;
> }
>
> Any help is appretiated..
>
> Dantin
>
>
You may want to pick yourself up a good book on C programming. I'd
suggest something like Jamsa's C/C++ Programmers Bible.. a good 1000+
page book of how things work, simple and advanced. Or if you are new to
programming, any of the For Dummies or in 24 hours or in 7 days books
would be fine also.
--
Kevin