Internal SUB_Null
Internal SUB_Null
Would it break things if engines had an internal SUB_Null function for non-existent functions? Currently it results in a qc crash. It would just be nice if I didn't have to have SUB_Nulls on non-used function-fields for certain entities, which all share code which calls all the functions.
I was once a Quake modder
What do you actually mean by this? That if a function is set to null and the qc tries calling it, it is ignored?
Remember that there is a difference between SUB_Null and true null.
In fteqcc, you can use __NULL__ to specify a fully null function. Alternativly, world.touch typically works too. :)
If you do use true null, you can do if(ent.blah) ent.blah(); each time its required.
Typically code that does call null functions is a certain bug. Something wasn't throught through, or some such, so warning/erroring makes most sense. Admittedly in your code it may be more awkward, but in regular qc code, its probably a good thing that engines moan. At least using SUB_Null shows that you've thought about that field. Having some shared initialisation function (aka root constructor) on the entities which share the code might be a handy design choice.
Remember that there is a difference between SUB_Null and true null.
In fteqcc, you can use __NULL__ to specify a fully null function. Alternativly, world.touch typically works too. :)
If you do use true null, you can do if(ent.blah) ent.blah(); each time its required.
Typically code that does call null functions is a certain bug. Something wasn't throught through, or some such, so warning/erroring makes most sense. Admittedly in your code it may be more awkward, but in regular qc code, its probably a good thing that engines moan. At least using SUB_Null shows that you've thought about that field. Having some shared initialisation function (aka root constructor) on the entities which share the code might be a handy design choice.