From 14b97de93020e783d2f144b5c0104d9aeb04dadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 10 Mar 2015 23:23:13 -0300 Subject: [PATCH] Cache the generation of active action trees for action points. This sensibly cuts down the execution of action conditions. --- addons/interact_menu/functions/fnc_renderBaseMenu.sqf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf index 7ff430fa08..e3a8a0c9a4 100644 --- a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -58,8 +58,14 @@ if ((_sPos select 1) < safeZoneY || (_sPos select 1) > safeZoneY + safeZon // Collect active tree -// @todo: cache activeActionTree? -_activeActionTree = ([_object, _baseAction] call FUNC(collectActiveActionTree)); +private "_uid"; +_uid = format [QGVAR(ATCache_%1), (_actionData select 7) select 0]; +_activeActionTree = [ + [_object, _baseAction], + DFUNC(collectActiveActionTree), + _object, _uid, 0.2 + ] call EFUNC(common,cachedCall); + // Check if there's something left for rendering if (count _activeActionTree == 0) exitWith {false};