Inside3D!
     

Internal SUB_Null

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Tue Dec 11, 2007 11:34 am    Post subject: Internal SUB_Null Reply with quote

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.
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Tue Dec 11, 2007 11:54 am    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Tue Dec 11, 2007 3:30 pm    Post subject: Reply with quote

Spike wrote:
Having some shared initialisation function (aka root constructor) on the entities which share the code might be a handy design choice.


I was hoping to be able to skip such things Sad

But yes, your point makes sense, it's a bug for most people.
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group