int LoadFullASE(char *filename, BOOL ShouldLoadTextures,CTextureManager *TextureManager,unsigned int numVertex,unsigned int numFace, CVertex *Vertex, CFace *Face, float *tu, float *tv);
class CMap
{
public:
unsigned int numVertex;
unsigned int numFace;
CVertex *Vertex;
CFace *Face;
float *tu;
float *tv;
void LoadFile(char *file);
}
void CMap::Loadfile(char *file)
{
LoadFullASE(filename,1,&TextureManager,numVertex,numFace,Vertex,Face,tu,tv);
}
Would those Variables in CMap, get changed. Im trying to make them be able to changed by LoadFullASE. Know How??
Thanks yall, later,
[source]
Will these Variables be changed?
If I had a function:
Yes they will be changed if the LoadFullASE function actually changes them, but you are passing the class''s variables through the function.
=======================================
A man with no head is still a man.
A head with no man is plain freaky.
=======================================
A man with no head is still a man.
A head with no man is plain freaky.
Are you sure, exactly how I wrote it, if The function is changing those Variables, then they will be changed Forever?. It seems that when the function ends, that the variables are the same, 0, even though the function clearly sets them, I dont get it?
int LoadFullASE(char *filename, BOOL ShouldLoadTextures,CTextureManager *TextureManager,unsigned int numVertex,unsigned int numFace, CVertex *Vertex, CFace *Face, float *tu, float *tv); [/source]No. They won't be changed. You'll be able to change the things POINTED by the pointers, but not the pointers themself.If you want to change them, just add the & operator before each argument you want to change.If you do :[source]void function( int & a, int b){ a = 1; b = 1;}void main(){ int a = 0; int b = 0; function( a, b); cout<<"a:"<<a<<endl; cout<<"b:"<<b<<endl;}
You'll get :
a:1
b:0
Edited by - Prosper/LOADED on July 23, 2000 11:33:36 PM
Edited by - Prosper/LOADED on July 23, 2000 11:34:34 PM
When I put the & sign, I get a million errors. Whats up. I get errors on the, Face, Vertex, tu, tv. All the ones were they are an Array. How could I change:
void Changer(float *hi)
{
hi[0] = 34;
hi[1] = 32;
}
How would I changed that function and call that function so that hi gets changed?
PS: What the hell does the & sign actually do?
void Changer(float *hi)
{
hi[0] = 34;
hi[1] = 32;
}
How would I changed that function and call that function so that hi gets changed?
PS: What the hell does the & sign actually do?
The code works for an int value, but what about a pointer to a list of class''s?, how would I do it?
um, of course they won''t be changed in your function, when you pass them like...
void blah(int a);
that''s passing the value of whatever
int bigBadInteger=1;
blah(bigBadInteger);
''a'' in blah is going to equal one and has no connection to bigBadInteger.
with they way you''re doing, the pointers you''re passing should change though. just not numVertex and numFace unless i misread.
void blah(int a);
that''s passing the value of whatever
int bigBadInteger=1;
blah(bigBadInteger);
''a'' in blah is going to equal one and has no connection to bigBadInteger.
Use..void blah(int &a);blah(bigBadInteger);OR..void blah(int *a);blah(&bigBadInteger);
with they way you''re doing, the pointers you''re passing should change though. just not numVertex and numFace unless i misread.
-werdup-
btw.. the '&' sign passes a reference or in other words it passes the address of the variable (a pointer to it if that helps it make any more sense).
if you have:
int a;
where address of a == 00000000 (where it's stored in mem)
and the value of a == 10 (the value the variable holds)
a == 10
&a == 00000000
get it?
Edited by - shmaLbus on July 24, 2000 10:57:23 AM
if you have:
int a;
where address of a == 00000000 (where it's stored in mem)
and the value of a == 10 (the value the variable holds)
a == 10
&a == 00000000
get it?
Edited by - shmaLbus on July 24, 2000 10:57:23 AM
-werdup-
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement