FOnline Development > Questions and Answers

Combat.fos - chance to hit.

(1/1)

mojuk:
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?

Slowhand:

--- Quote from: mojuk 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?

--- End quote ---

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
--- End quote ---

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 ^^

Navigation

[0] Message Index

Go to full version