X-ROUTED: Wed, 24 Feb 1999 15:40:40 -0500 X-TCP-IDENTITY: Ultima Message-ID: <36D46320.114420E4@game-master.com> Date: Wed, 24 Feb 1999 15:37:53 -0500 From: Kevin Lang/Ultima Organization: StormTech SoftWare X-Mailer: Mozilla 4.05 [en] (Win95; I) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: Help References: <36D162CB DOT E5B730A6 AT game-master DOT com> <36D2009E DOT E256EFBD AT cartsys DOT com> Content-Type: multipart/mixed; boundary="------------F878D9B5000B0E3E8E50A537" Reply-To: djgpp AT delorie DOT com This is a multi-part message in MIME format. --------------F878D9B5000B0E3E8E50A537 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Nate Eldredge wrote: > Kevin Lang/Ultima wrote: > > > > Can anyone tell me if what I am doing is right? > > > > Because I am getting "converting pointer from integer without cast" > > warnings but I don't know what I am doing wrong. > > It's helpful if you can post the complete error message, including the > line number and refer it to the appropriate source line. It's also > better to post short sources, like this one, as plain text instead of > zip. I had to unzip and feed it to my compiler to reproduce your error > message, and it took a little work as I am on Linux and your source > contains "#ifndef DJGPP / #error". sorry :-) > > > Now. > > For reference, the complete error is: > > iso_load.c: In function `load_tile_map': > iso_load.c:47: warning: passing arg 1 of `pack_fread' makes pointer from > integer without a cast yes > > > which refers to source line > > pack_fread(iso_map->tile_map[((iy<<(iso_map->ysize))+ix)].attributes,sizeof(int),level_data); > > (Hope line wrap doesn't screw it up too much.) Relevant declarations: > > typedef struct TILE { > int attributes; // 32 bits for attributes > char tile; // which tile to draw > char lighting; // 0-255 > char z; // z modifies the y axis on a 1:1 ratio > int unused; > } TILE; > > typedef struct ISO_MAP { > int x,y,z; // Starting position of player > char name[32]; // Name of map > int xsize,ysize; // Size of map. > int unused1,unused2; > TILE *tile_map; > } ISO_MAP; > > ISO_MAP *iso_map; > > The first argument of `pack_fread' is supposed to be `void *', but the > compiler thinks it's an integer. Let's have a look. > > 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 -> ? > > > HTH > -- > > Nate Eldredge > nate AT cartsys DOT com -- -=šUltimaš=- WWW: http://www.game-master.com/ultima/ EMAIL: mailto:ultimaATgame-masterDOTcom (anti-spam) ICQ: 12919201 Member and founder of StormTech SoftWare, visit our page today! --------------F878D9B5000B0E3E8E50A537 Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Kevin Lang Content-Disposition: attachment; filename="vcard.vcf" begin: vcard fn: Kevin Lang n: Lang;Kevin org: StormTech SoftWare adr: ;;;;Quebec;;Canada email;internet: ultima AT game-master DOT com x-mozilla-cpt: ;0 x-mozilla-html: TRUE version: 2.1 end: vcard --------------F878D9B5000B0E3E8E50A537--