| 09-17-2009, 03:51 PM | #1 |
I wanted to use StatusEvents in order to clean datas automatically (in fact call a .release method) when an unit is removed of the game. If i can automatically link the instance of a struct to an unit, i can't link also the struct "type" by itself. Also, sadly, function interfaces don't seem to work with struct methods (static or not). It would be great if we can have a struct "type" as an unique integer. If i'm not enough clear i will give a concrete piece of code. |
| 09-17-2009, 03:57 PM | #2 |
only way is to make them extend a interface and then do : x.getType() or was it x.getTypeId() ? |
| 09-17-2009, 04:25 PM | #3 |
I've been thinking about this idea for a while: A module that would automatically create an instance of the implementing struct per unit in the game. The struct would be created when the unit is created, and destroyed with the unit is destroyed. It would provide a method to retrieve an instance's unit, and a static method to retrieve a unit's instance. The module would, however, prevent you from declaring your own constructor. It's possible to create it, but it would require some TriggerEvaluate sorcery unless Vex finally makes static methods work with function interfaces. If a bunch of people think this is the greatest idea ever I might create it, but if no one will use it I probably won't bother. |
| 09-17-2009, 04:43 PM | #4 |
Extend it to an interface will make all things slower. If only (static) method worked with function interface. |
