Advertising
- Something
- Monday, February 13th, 2017 at 9:12:51pm UTC
- struct struct1_s
- {
- float f1;
- float f2;
- float f3;
- vector vec;
- };
- struct struct2_s
- {
- vector vec;
- float f1;
- float f2;
- float f3;
- };
- .union merged
- {
- struct1_s struct1;
- struct2_s struct2;
- };
- void TestCollapse() =
- {
- entity e = spawn();
- e.struct1.f1 = 1;
- e.struct1.f2 = 2;
- e.struct1.f3 = 3;
- e.struct1.vec = '4 5 6';
- DUMP_FLOAT( e.struct1.f1 )
- DUMP_FLOAT( e.struct1.f2 )
- DUMP_FLOAT( e.struct1.f3 )
- DUMP_VEC( e.struct1.vec )
- e.struct2.f1 = 1;
- e.struct2.f2 = 2;
- e.struct2.f3 = 3;
- e.struct2.vec = '4 5 6';
- DUMP_FLOAT( e.struct2.f1 )
- DUMP_FLOAT( e.struct2.f2 )
- DUMP_FLOAT( e.struct2.f3 )
- DUMP_VEC( e.struct2.vec )
- }
- /*
- output:
- e.struct1.f1 = 1
- e.struct1.f2 = 2
- e.struct1.f3 = 3
- e.struct1.vec = ' 4.0 5.0 6.0'
- e.struct2.f1 = 1
- e.struct2.f2 = 2
- e.struct2.f3 = 3
- e.struct2.vec = ' 4.0 5.0 6.0'
- */
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.