Re: [newbie]

From: Isak Styf (isasty-6@student.luth.se)
Date: 10/09/96


mud@mamma-mu.campus.luth.se wrote:
> 
> Sorry to have to post this message but this function is driving me nuts..
>
> --
>     14  int get_zone_rnum(int vnum)
>     15  {
>     16    extern int top_of_zone_table;
>     17    extern struct zone_data *zone_table;
                                    ^^^^^^^^^^^^
>     18
>     19    char buf[150];
>     20    int i;
>     21
>     22    for (i = 0; i <= top_of_zone_table; i++)
>     23      if (zone_table[i].number == vnum)
                              ^^^
>     24        return i;
>     25
>     26    sprintf(buf, "get_zone_rnum called w/ invalid vnum (%d)", vnum);
>     27    log(buf);
>     28    return 0;
>     29  }
> --
> and these are the errors I get...
> 
> utils.c: In function `get_zone_rnum':
> utils.c:23: arithmetic on pointer to an incomplete type
> utils.c:23: dereferencing pointer to incomplete type
> 
> If someone could point out the error to me it would be very appreciated..
> 
> /Berzerk the brain-dead..

Jupp, it is very basic. In fact so basic that i failed to find the
problem the first time i looked over the code.

The problem is this. On line 17 you declare zone_table as being a
pointer to an extern struct. However, you arent using the correct
operand ( -> ) to extract data from that pointer on line 23. Instead you
use the operand . which is used when you want to extract data from
objects of structs.
The correct code would be :
	23	if (zone_table[i]->number == vnum)

It might also be that zone_table is defined as an array or something in
the code ( Remember that CircleMUD is jam packed with arrays ). However,
in any case, that operand error has got to be fixed.

If you dont get the point, you can contact me at my student mail account
since it seems we are going to the same university =)

The reason i write this response in english is purely because of that i
cc this to the CircleMUD mailing list.

C U:

	Isak Styf	D1A Lulea University
	isasty-6@student.luth.se
	oxygen@ludd.luth.se

*************************************************************************
    No Microsoft Products were used in the production of this message
*************************************************************************

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