-
Notifications
You must be signed in to change notification settings - Fork 737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explosives - Optimize interactEH function #6406
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is a perf improvement you might aswell go crazy overkill :D
} else { | ||
// Prevent Rare Error when ending mission with interact key down: | ||
if (isNull ace_player) exitWith {}; | ||
if (isNull ACE_player) exitWith {}; | ||
private _player = ACE_player; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accessing global variable is slower than local. So swap the order of the isNull and _player and reuse _player maybe.
//If player moved >5 meters from last pos, then rescan | ||
if (((getPosASL ace_player) distance _setPosition) > 5) then { | ||
// Rescan if player has moved more than 5 meters from last position | ||
if (_playerPos distance _setPosition > 5) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
distanceSqr? But I don't think that makes enough difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might as well 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it from public Yes to No, because I don't see any reason why this function would be a public function. |
* Optimize explosives interactEH * Use local player variable and distanceSqr
When merged this pull request will:
interactEH
function (various minor improvements but mainlycreateVehicleLocal [0, 0, 0]
)Performance results for
ace_explosives_interactEH_counter
: