Author Topic: Combat.fos - chance to hit.  (Read 2469 times)

Combat.fos - chance to hit.
« on: December 28, 2015, 01:04:27 am »
What was the reason for this code:
https://github.com/rotators/fo2238/blob/master/Server/scripts/combat.fos#L275-L304
being copy-pasted about 12 times instead of making it as a function like GetChanceToHit() with necessary parameters?
As combat scripts are called very frequently would it have noticeable impact on performance?

Offline Slowhand

  • Go for the eyes, Boo! Go for the eyes!
Re: Combat.fos - chance to hit.
« Reply #1 on: December 28, 2015, 07:11:02 am »
What was the reason for this code:
https://github.com/rotators/fo2238/blob/master/Server/scripts/combat.fos#L275-L304
being copy-pasted about 12 times instead of making it as a function like GetChanceToHit() with necessary parameters?
As combat scripts are called very frequently would it have noticeable impact on performance?

On the comment it says:
Quote
// +++ the following is to be copypasted many times, in fact it should be an inline function but AngelScript won't allow that... Yet

Inline functions work like: the code they have, is not compiled to a separate function call, but it copy/pasted as it is at compilation time. Basically like a #define () macro function. I can only think of performance issues for the reason that function being copy pasted all over the place.

Maybe a rotator can divulge the truth ^^