From 10e4eb4634abedb4e89b924af8d6fa7631059133 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 28 Jul 2013 08:19:54 +0200 Subject: [PATCH] Avoid redundant per-frame calls to getDbProp("UI:VARIABLES:MK_MOVE") --- code/ryzom/client/src/motion/user_controls.cpp | 4 +++- code/ryzom/client/src/motion/user_controls.h | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/motion/user_controls.cpp b/code/ryzom/client/src/motion/user_controls.cpp index b780927e2..794685981 100644 --- a/code/ryzom/client/src/motion/user_controls.cpp +++ b/code/ryzom/client/src/motion/user_controls.cpp @@ -294,7 +294,9 @@ void CUserControls::update() // update camera collision once per frame View.updateCameraCollision(); - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:MK_MOVE")->setValue32(autowalkState()); + NLMISC::CCDBNodeLeaf *node = _UiVarMkMoveDB ? &*_UiVarMkMoveDB + : (_UiVarMkMoveDB = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:MK_MOVE")); + node->setValue32(autowalkState()); }// update // diff --git a/code/ryzom/client/src/motion/user_controls.h b/code/ryzom/client/src/motion/user_controls.h index be1cbaf99..eb4de2020 100644 --- a/code/ryzom/client/src/motion/user_controls.h +++ b/code/ryzom/client/src/motion/user_controls.h @@ -31,6 +31,9 @@ // Std. #include +namespace NLMISC { + class CCDBNodeLeaf; +} /////////// // CLASS // @@ -305,6 +308,8 @@ private: /// when true the next forward action will cancel any moveto bool _NextForwardCancelMoveTo; + + NLMISC::CRefPtr _UiVarMkMoveDB; }; /// User Controls (mouse, keyboard, interfaces, ...)