| 04-21-2008, 12:43 PM | #1 |
JASS:function doAB takes A x returns nothing if (x.getTypeId()==B.typeid) then set B(x).Real=45.5 endif endfunction here we get the types by knowing which struct was declared. But is there a way to automatically get these structs? example typecasting them using "x.getTypeId()" only: JASS:function doAB takes A x returns nothing set typecast(x.getTypeId).Real=45.5 endfunction |
| 04-21-2008, 12:46 PM | #2 |
You could just use B directly in the function since it looks like you are making it specifically for it. |
| 04-21-2008, 06:16 PM | #3 |
no... im not. cus B was just an example struct. B is an example struct of structs declared by users. So it can be B,C,D,K,HJJ,SD or watever. |
| 04-21-2008, 07:57 PM | #4 |
the question here would be, how is the compiler supposed to know? |
| 04-22-2008, 11:11 AM | #5 |
well for each struct tat extends another u can store a typeid for the compiler to recognise which struct it is. Im not really sure how u did the extends. But when u can compare x.getTypeId and B.typeid. and u can even use interface to create a struct using a typeid. How can the interface know which struct to create? cant it be done the same way here? hmm... jass is so gay. making things so hard :P |
| 04-22-2008, 11:58 AM | #6 |
Are you sure what you want to do isn't doable with initial values? Also, interfaces work in game time, not compile time. |
| 04-22-2008, 05:52 PM | #7 |
yes i am sure :P so now i need to think of another way tat makes it easy for the user and at same time work at initial |
