delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/11/21:46:44

From: Satriani <satriani AT NOSPAMthepentagon DOT com>
Newsgroups: comp.os.msdos.djgpp,comp.graphics.algorithms
Subject: Re: struct problem
Date: Tue, 10 Aug 1999 12:58:53 -0700
Organization: Simon Fraser University
Lines: 41
Message-ID: <37B0847D.60A75CAB@NOSPAMthepentagon.com>
References: <A7083B60FEDED7E0 DOT 7F2CBC07CD9B5AB8 DOT 019CE2E485CE12C4 AT lp DOT airnews DOT net> <37AF5947 DOT 66951F05 AT NOSPAMthepentagon DOT com> <8432818566957DB4 DOT DF5776918DB4D437 DOT AD3715803EC19E27 AT lp DOT airnews DOT net>
NNTP-Posting-Host: learningaid.cs.sfu.ca
Mime-Version: 1.0
X-Mailer: Mozilla 4.6 [en] (WinNT; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Try assigning the struct variables within a function, not globally.

GLOBAL:
typedef struct
{
...
}vert_3d;

LOCAL
...
vert3D p000;
p000.x = x;
p000.y = y;
p000.z = z;
...

Matthew Heyman wrote:

> Satriani wrote:
> >
> > Try this instead:
> >
> > vert_3d p000;
> > vert_3d p000 = {0,10,20};
> >
> > OR, assign the vector within a function.
> >
> > Justin
> >
>
> That works now, but when I try to access such variables like in this
> piece of code here...
>
> Zoff = player.pz - p000.z
>
> I get the same problem.  This is inside a function, mind you. The
> player.pz is the players position within the game, using only int.  I
> don't know enough about structs to fix the problem.....
>
> Matthew Heyman

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019