Posted By: Puppeteer
Strukt vars and vectors - 08/14/09 12:36
This doesnt work...
Why?
typedef struct
{
var testvar;
} teststrukt;
function test(VECTOR* testvec, teststrukt* bla)
{
(bla->testvar)=testvec[1];
}
Thank you =)
EDIT:
(bla->testvar)=testvec.y;
works
Posted By: Bunsen
Re: Strukt vars and vectors - 08/17/09 08:34
Hello Puppeteer,
"testvec[1]" means the second element of type "VECTOR" within an array of vectors.
You can't assign the content of a "VECTOR" struct (size = sizeof(VECTOR))
to a var typ (size = sizeof(var)).
Posted By: EvilSOB
Re: Strukt vars and vectors - 08/17/09 08:43
Vectors are no longer an array of vars, they are just structurally like one.
You MUST use x,y,z with Vectors in lite-c
BUT, you MIGHT be able to do it with (untested)
(bla->testvar)=((var*)testvec)[1];
if you REALLY want to add the extra typing....
You may also be able to use
function test(var* testvec, teststrukt* bla)
...
If the function isnt "overload"ed.
Neither of these ideas are tested.