Mail Archives: djgpp/1999/02/24/20:50:08.1
Kevin Lang/Ultima wrote:
>
> Nate Eldredge wrote:
>
> > iso_map->tile_map[((iy<<(iso_map->ysize))+ix)].attributes
> >
> > Actually, it's quite simple. You can see that TILE.attributes is indeed
> > an `int', so the compiler is quite justified.
> >
> > I assume what you want to do is read the contents of the `attributes'
> > member from the packfile. `pack_fread' wants its first arg to be a
> > pointer to the buffer into which to read. Therefore, all you need to do
> > is take the address of this horrible expression (with the `&' operator)
> > and pass that.
>
> Yes I sortof figured this out a little while after :-)But I don't get why I should use the .
> operator instead of ->
>
> You are supposed to use -> when you are using a pointer to a struct right?
> But tile_map is also a pointer to a struct, so how come the compiler wants me to put a . instead
> of ->
`tile_map' is a pointer, correct. However, `tile_map[nnn]' is not; it
is one of the elements of `tile_map', which is an array. Each of these
elements *is* a struct and not a pointer.
It may help to know that `p[x]' is equivalent to `*(p+x)'.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -