Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Internal SUB_Null

| Inside3d Forums Forum Index -> Engine Programming

View previous topic :: View next topic
Author | Message
--- | ---
Urre Joined: 05 Nov 2004 Posts: 1073 Location: Sweden |

Posted: Tue Dec 11, 2007 11:34 am Post subject: 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.
_________________
Look out for Twigboy

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Tue Dec 11, 2007 11:54 am Post subject: |

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 |

Urre Joined: 05 Nov 2004 Posts: 1073 Location: Sweden |

Posted: Tue Dec 11, 2007 3:30 pm Post subject: |

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
But yes, your point makes sense, it's a bug for most people.
_________________
Look out for Twigboy

Back to top |

Display posts from previous:

| 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