From 2d118078f78607eedd339016f04fba42132c7623 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 1 Aug 2013 23:02:49 +0200 Subject: [PATCH] Merge with default --- code/CMakeModules/PCHSupport.cmake | 17 ++- code/nel/include/nel/gui/interface_link.h | 10 +- code/nel/include/nel/gui/widget_manager.h | 8 +- code/nel/include/nel/misc/cdb_branch.h | 6 + .../src/3d/driver/opengl/driver_opengl.cpp | 8 +- code/nel/src/3d/driver/opengl/driver_opengl.h | 4 +- .../driver/opengl/driver_opengl_texture.cpp | 13 +- code/nel/src/gui/dbgroup_combo_box.cpp | 6 +- code/nel/src/gui/dbgroup_select_number.cpp | 2 + code/nel/src/gui/interface_group.cpp | 3 +- code/nel/src/gui/interface_link.cpp | 123 ++++++++++++++++-- code/nel/src/gui/interface_parser.cpp | 5 +- code/nel/src/gui/link_hack.cpp | 4 + code/nel/src/gui/widget_manager.cpp | 53 ++++++-- code/nel/src/misc/cdb_branch.cpp | 23 ++++ .../data/gamedev/interfaces_v3/config.xml | 15 +-- .../client/data/gamedev/interfaces_v3/map.xml | 4 +- .../data/gamedev/interfaces_v3/outpost.lua | 15 +-- .../data/gamedev/interfaces_v3/outpost.xml | 3 +- code/ryzom/client/src/cdb_synchronised.cpp | 6 +- code/ryzom/client/src/cdb_synchronised.h | 2 + code/ryzom/client/src/cursor_functions.cpp | 4 +- code/ryzom/client/src/entities.cpp | 33 ++++- code/ryzom/client/src/entities.h | 19 +++ code/ryzom/client/src/entity_cl.cpp | 17 ++- code/ryzom/client/src/entity_cl.h | 3 +- .../src/interface_v3/action_handler_misc.cpp | 5 +- .../interface_v3/group_in_scene_user_info.cpp | 113 ++++++++++++---- .../interface_v3/group_in_scene_user_info.h | 5 +- .../src/interface_v3/interface_manager.cpp | 11 +- .../src/interface_v3/interface_manager.h | 3 +- .../src/interface_v3/people_interraction.cpp | 3 +- .../src/interface_v3/sphrase_manager.cpp | 12 +- .../client/src/interface_v3/sphrase_manager.h | 4 + code/ryzom/client/src/main_loop.cpp | 10 +- .../ryzom/client/src/motion/user_controls.cpp | 4 +- code/ryzom/client/src/motion/user_controls.h | 5 + code/ryzom/client/src/net_manager.cpp | 18 ++- code/ryzom/client/src/net_manager.h | 8 ++ code/ryzom/client/src/r2/tool.cpp | 4 +- code/ryzom/client/src/r2/tool.h | 1 + code/ryzom/client/src/weather.cpp | 5 +- code/ryzom/common/src/game_share/crypt.cpp | 20 +-- 43 files changed, 504 insertions(+), 133 deletions(-) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index d444bfa3d..042f6b0cc 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -33,9 +33,9 @@ ENDIF(MSVC) # Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs MACRO(PCH_SET_COMPILE_FLAGS _target) SET(PCH_FLAGS) - SET(PCH_ARCHS) - - SET(FLAGS) + SET(PCH_ARCHS) + SET(_FLAGS) + LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS}) STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD) @@ -81,10 +81,15 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) LIST(APPEND _FLAGS " ${_directory_flags}") LIST(APPEND _FLAGS " ${_directory_definitions}") - STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS}) - # Format definitions - SEPARATE_ARGUMENTS(_FLAGS) + IF(MSVC) + # Fix path with space + SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}") + ELSE(MSVC) + STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS}) + SEPARATE_ARGUMENTS(_FLAGS) + ENDIF(MSVC) + IF(CLANG) # Determining all architectures and get common flags diff --git a/code/nel/include/nel/gui/interface_link.h b/code/nel/include/nel/gui/interface_link.h index ffa6ac0c7..42fb2bbcf 100644 --- a/code/nel/include/nel/gui/interface_link.h +++ b/code/nel/include/nel/gui/interface_link.h @@ -66,6 +66,11 @@ namespace NLGUI */ bool affect(const CInterfaceExprValue &value); }; + struct CCDBTargetInfo + { + NLMISC::CRefPtr Leaf; + std::string LeafName; + }; /// Updates triggered interface links when triggered by the observed branch @@ -85,7 +90,7 @@ namespace NLGUI * If there are no target element, the link is permanent (removed at exit) * NB : The target is not updated during this call. */ - bool init(const std::vector &targets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parent); + bool init(const std::vector &targets, const std::vector &cdbTargets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parent); // force all the links that have been created to update their targets. This can be called when the interface has been loaded, and when the databse entries have been retrieved. static void updateAllLinks(); // force all trigered links to be updated @@ -119,6 +124,7 @@ namespace NLGUI * \return true if all targets are valid */ static bool splitLinkTargets(const std::string &targets, CInterfaceGroup *parentGroup, std::vector &targetsVect); + static bool splitLinkTargetsExt(const std::string &targets, CInterfaceGroup *parentGroup, std::vector &targetsVect, std::vector &cdbTargetsVect); //////////////////////////////////////////////////////////////////////////////////////////////////////// private: friend struct CRemoveTargetPred; @@ -135,12 +141,14 @@ namespace NLGUI typedef std::vector TNodeVect; private: std::vector _Targets; + std::vector _CDBTargets; TNodeVect _ObservedNodes; std::string _Expr; CInterfaceExprNode *_ParseTree; std::string _ActionHandler; std::string _AHParams; std::string _AHCond; + CInterfaceExprNode *_AHCondParsed; CInterfaceGroup *_AHParent; static TLinkList _LinkList; TLinkList::iterator _ListEntry; diff --git a/code/nel/include/nel/gui/widget_manager.h b/code/nel/include/nel/gui/widget_manager.h index 7fedc6240..00723faea 100644 --- a/code/nel/include/nel/gui/widget_manager.h +++ b/code/nel/include/nel/gui/widget_manager.h @@ -444,7 +444,7 @@ namespace NLGUI } float getAlphaRolloverSpeed(); - void resetAlphaRolloverSpeed(); + void resetAlphaRolloverSpeedProps(); void setContainerAlpha( uint8 alpha ); uint8 getContainerAlpha() const { return _ContainerAlpha; } @@ -454,6 +454,7 @@ namespace NLGUI uint8 getGlobalRolloverFactorContainer() const { return _GlobalRolloverFactorContainer; } void updateGlobalAlphas(); + void resetGlobalAlphasProps(); const SInterfaceTimes& getInterfaceTimes() const{ return interfaceTimes; } void updateInterfaceTimes( const SInterfaceTimes × ){ interfaceTimes = times; } @@ -527,6 +528,11 @@ namespace NLGUI NLMISC::CCDBNodeLeaf *_BProp; NLMISC::CCDBNodeLeaf *_AProp; NLMISC::CCDBNodeLeaf *_AlphaRolloverSpeedDB; + + NLMISC::CCDBNodeLeaf *_GlobalContentAlphaDB; + NLMISC::CCDBNodeLeaf *_GlobalContainerAlphaDB; + NLMISC::CCDBNodeLeaf *_GlobalContentRolloverFactorDB; + NLMISC::CCDBNodeLeaf *_GlobalContainerRolloverFactorDB; uint8 _ContainerAlpha; uint8 _GlobalContentAlpha; diff --git a/code/nel/include/nel/misc/cdb_branch.h b/code/nel/include/nel/misc/cdb_branch.h index 11adbac0d..f8a979499 100644 --- a/code/nel/include/nel/misc/cdb_branch.h +++ b/code/nel/include/nel/misc/cdb_branch.h @@ -21,6 +21,8 @@ #include "cdb.h" +#define NL_CDB_OPTIMIZE_PREDICT 1 + namespace NLMISC{ /** @@ -247,6 +249,10 @@ protected: /// called by clear void removeAllBranchObserver(); + +#if NL_CDB_OPTIMIZE_PREDICT + CRefPtr _PredictNode; +#endif }; } diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 830496681..92021c65b 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -1494,7 +1494,10 @@ void CDriverGL::enableUsedTextureMemorySum (bool enable) H_AUTO_OGL(CDriverGL_enableUsedTextureMemorySum ) if (enable) + { nlinfo ("3D: PERFORMANCE INFO: enableUsedTextureMemorySum has been set to true in CDriverGL"); + _TextureUsed.reserve(512); + } _SumTextureMemoryUsed=enable; } @@ -1508,7 +1511,7 @@ uint32 CDriverGL::getUsedTextureMemory() const uint32 memory=0; // For each texture used - set::const_iterator ite=_TextureUsed.begin(); + std::vector::const_iterator ite = _TextureUsed.begin(); while (ite!=_TextureUsed.end()) { // Get the gl texture @@ -1516,7 +1519,8 @@ uint32 CDriverGL::getUsedTextureMemory() const gltext= (*ite); // Sum the memory used by this texture - memory+=gltext->TextureMemory; + if (gltext) + memory+=gltext->TextureMemory; // Next texture ite++; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index 3f0675276..08e950b70 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -196,6 +196,8 @@ public: bool initFrameBufferObject(ITexture * tex); bool activeFrameBufferObject(ITexture * tex); + + std::vector::size_type TextureUsedIdx; }; @@ -1277,7 +1279,7 @@ private: uint32 _NbSetupMaterialCall; uint32 _NbSetupModelMatrixCall; bool _SumTextureMemoryUsed; - std::set _TextureUsed; + std::vector _TextureUsed; uint computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const; // VBHard Lock Profiling diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp index 7ded32b27..96d95bd5d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -79,6 +79,8 @@ CTextureDrvInfosGL::CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it, CDri InitFBO = false; AttachDepthStencil = true; UsePackedDepthStencil = drvGl->supportPackedDepthStencil(); + + TextureUsedIdx = 0; } // *************************************************************************** CTextureDrvInfosGL::~CTextureDrvInfosGL() @@ -91,7 +93,10 @@ CTextureDrvInfosGL::~CTextureDrvInfosGL() _Driver->_AllocatedTextureMemory-= TextureMemory; // release in TextureUsed. - _Driver->_TextureUsed.erase (this); + if (TextureUsedIdx < _Driver->_TextureUsed.size() && _Driver->_TextureUsed[TextureUsedIdx] == this) + { + _Driver->_TextureUsed[TextureUsedIdx] = NULL; + } if(InitFBO) { @@ -1492,7 +1497,11 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex) if (_SumTextureMemoryUsed) { // Insert the pointer of this texture - _TextureUsed.insert (gltext); + if (gltext->TextureUsedIdx >= _TextureUsed.size() || _TextureUsed[gltext->TextureUsedIdx] != gltext) + { + gltext->TextureUsedIdx = _TextureUsed.size(); + _TextureUsed.push_back(gltext); + } } if(tex->isTextureCube()) diff --git a/code/nel/src/gui/dbgroup_combo_box.cpp b/code/nel/src/gui/dbgroup_combo_box.cpp index 83baa93b3..61b8ec3e6 100644 --- a/code/nel/src/gui/dbgroup_combo_box.cpp +++ b/code/nel/src/gui/dbgroup_combo_box.cpp @@ -28,10 +28,12 @@ using namespace std; using namespace NLMISC; -NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box"); - namespace NLGUI { + NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupComboBox, std::string, "combo_box"); + + void force_link_dbgroup_combo_box_cpp() { } + // Compare strings static inline bool lt_text(const std::pair &s1, const std::pair &s2) { diff --git a/code/nel/src/gui/dbgroup_select_number.cpp b/code/nel/src/gui/dbgroup_select_number.cpp index 409bf838f..b3dc2e8f1 100644 --- a/code/nel/src/gui/dbgroup_select_number.cpp +++ b/code/nel/src/gui/dbgroup_select_number.cpp @@ -31,6 +31,8 @@ namespace NLGUI { NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupSelectNumber, std::string, "select_number"); + void force_link_dbgroup_select_number_cpp() { } + // *************************************************************************** CDBGroupSelectNumber::CDBGroupSelectNumber(const TCtorParam ¶m) : CInterfaceGroup(param) diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index f981814ba..4e8919e5c 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -2325,7 +2325,8 @@ namespace NLGUI _LUAOnDbChange[dbList]= newLink; // Init and attach to list of untargeted links std::vector noTargets; - newLink->init(noTargets, NLMISC::toString("depends(%s)", dbList.c_str()), "lua", script, "", this); + std::vector noCdbTargets; + newLink->init(noTargets, noCdbTargets, NLMISC::toString("depends(%s)", dbList.c_str()), "lua", script, "", this); } // ------------------------------------------------------------------------------------------------ diff --git a/code/nel/src/gui/interface_link.cpp b/code/nel/src/gui/interface_link.cpp index d672e9402..282199ee7 100644 --- a/code/nel/src/gui/interface_link.cpp +++ b/code/nel/src/gui/interface_link.cpp @@ -165,6 +165,7 @@ namespace NLGUI _NextTriggeredLink[0] = _NextTriggeredLink[1] = NULL; _Triggered[0] = _Triggered[1] = false; _ParseTree = NULL; + _AHCondParsed = NULL; } //=========================================================== @@ -187,10 +188,13 @@ namespace NLGUI _LinkList.erase(_ListEntry); delete _ParseTree; + _ParseTree = NULL; + delete _AHCondParsed; + _AHCondParsed = NULL; } //=========================================================== - bool CInterfaceLink::init(const std::vector &targets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parentGroup) + bool CInterfaceLink::init(const std::vector &targets, const std::vector &cdbTargets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parentGroup) { CInterfaceExprValue result; // Build the parse tree @@ -236,6 +240,7 @@ namespace NLGUI // There are no target for this link, so, put in a dedicated list to ensure that the link will be destroyed at exit _LinksWithNoTarget.push_back(TLinkSmartPtr(this)); } + _CDBTargets = cdbTargets; // create observers createObservers(_ObservedNodes); @@ -243,7 +248,12 @@ namespace NLGUI // _ActionHandler = actionHandler; _AHParams = ahParams; + nlassert(!_AHCondParsed); _AHCond = ahCond; + if (!ahCond.empty()) + { + _AHCondParsed = CInterfaceExpr::buildExprTree(ahCond); + } _AHParent = parentGroup; return true; } @@ -356,19 +366,47 @@ namespace NLGUI } } } + if (_CDBTargets.size()) + { + CInterfaceExprValue resultCopy = result; + if (resultCopy.toInteger()) + { + sint64 resultValue = resultCopy.getInteger(); + for (uint k = 0; k < _CDBTargets.size(); ++k) + { + NLMISC::CCDBNodeLeaf *node = _CDBTargets[k].Leaf; + if (!node) + { + node = _CDBTargets[k].Leaf = NLGUI::CDBManager::getInstance()->getDbProp(_CDBTargets[k].LeafName, false); + } + if (node) + { + // assuming setvalue64 always works + node->setValue64(resultValue); + } + else + { + nlwarning("CInterfaceLink::update: Node does not exist: '%s'", _CDBTargets[k].LeafName.c_str()); + } + } + } + else + { + nlwarning("CInterfaceLink::update: Result conversion to db target failed"); + } + } // if there's an action handler, execute it if (!_ActionHandler.empty()) { // If there is a condition, test it. - bool launch= true; - if(!_AHCond.empty()) + bool launch = _AHCond.empty(); + if (_AHCondParsed) // todo: maybe makes more sense to make condition also cover target { - launch= false; - CInterfaceExprValue result; - if(CInterfaceExpr::eval(_AHCond, result)) - launch= result.getBool(); + CInterfaceExprValue result; + _AHCondParsed->eval(result); + launch = result.getBool(); } - if(launch) + if (launch) { CAHManager::getInstance()->runActionHandler(_ActionHandler, _AHParent, _AHParams); // do not add any code after this line because this can be deleted !!!! @@ -517,6 +555,11 @@ namespace NLGUI continue; } std::string::size_type lastPos = targetNames[k].find_last_not_of(" "); + if (startPos >= lastPos) + { + nlwarning(" empty target encountered"); + continue; + } if (!splitLinkTarget(targetNames[k].substr(startPos, lastPos - startPos+1), parentGroup, ti.PropertyName, ti.Elem)) { @@ -531,6 +574,70 @@ namespace NLGUI } + // *************************************************************************** + bool CInterfaceLink::splitLinkTargetsExt(const std::string &targets, CInterfaceGroup *parentGroup,std::vector &targetsVect, std::vector &cdbTargetsVect) + { + std::vector targetNames; + NLMISC::splitString(targets, ",", targetNames); + targetsVect.clear(); + targetsVect.reserve(targetNames.size()); + cdbTargetsVect.clear(); // no reserve because less used + bool everythingOk = true; + for (uint k = 0; k < targetNames.size(); ++k) + { + std::string::size_type startPos = targetNames[k].find_first_not_of(" "); + if(startPos == std::string::npos) + { + // todo hulud interface syntax error + nlwarning(" empty target encountered"); + continue; + } + std::string::size_type lastPos = targetNames[k].find_last_not_of(" "); + if (startPos >= (lastPos+1)) + { + nlwarning(" empty target encountered"); + continue; + } + + if (targetNames[k][startPos] == '@') + { + CInterfaceLink::CCDBTargetInfo ti; + ti.LeafName = targetNames[k].substr((startPos+1), (lastPos+1) - (startPos+1)); + // Do not allow Write on SERVER: or LOCAL: + static const std::string dbServer= "SERVER:"; + static const std::string dbLocal= "LOCAL:"; + static const std::string dbLocalR2= "LOCAL:R2"; + if( (0==ti.LeafName.compare(0, dbServer.size(), dbServer)) || + (0==ti.LeafName.compare(0, dbLocal.size(), dbLocal)) + ) + { + if (0!=ti.LeafName.compare(0, dbLocalR2.size(), dbLocalR2)) + { + //nlwarning("You are not allowed to write on 'SERVER:...' or 'LOCAL:...' database"); + nlstop; + return false; + } + } + ti.Leaf = NLGUI::CDBManager::getInstance()->getDbProp(ti.LeafName, false); + cdbTargetsVect.push_back(ti); + } + else + { + CInterfaceLink::CTargetInfo ti; + if (!splitLinkTarget(targetNames[k].substr(startPos, lastPos - startPos+1), parentGroup, ti.PropertyName, ti.Elem)) + { + // todo hulud interface syntax error + nlwarning(" Can't get link target"); + everythingOk = false; + continue; + } + targetsVect.push_back(ti); + } + } + return everythingOk; + } + + //=========================================================== void CInterfaceLink::checkNbRefs() { diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 76f5df1ed..da8bd1e52 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -997,6 +997,7 @@ namespace NLGUI std::vector targets; + std::vector cdbTargets; ptr = (char*) xmlGetProp (cur, (xmlChar*)"target"); std::string target; @@ -1004,7 +1005,7 @@ namespace NLGUI { target = std::string( (const char*)ptr ); if( !editorMode ) - CInterfaceLink::splitLinkTargets(std::string((const char*)ptr), parentGroup, targets); + CInterfaceLink::splitLinkTargetsExt(std::string((const char*)ptr), parentGroup, targets, cdbTargets); } // optional action handler @@ -1022,7 +1023,7 @@ namespace NLGUI if( !editorMode ) { CInterfaceLink *il = new CInterfaceLink; - il->init(targets, expr, action, params, cond, parentGroup); // init will add 'il' in the list of link present in 'elm' + il->init(targets, cdbTargets, expr, action, params, cond, parentGroup); // init will add 'il' in the list of link present in 'elm' } else { diff --git a/code/nel/src/gui/link_hack.cpp b/code/nel/src/gui/link_hack.cpp index 7bc058891..1492012e1 100644 --- a/code/nel/src/gui/link_hack.cpp +++ b/code/nel/src/gui/link_hack.cpp @@ -24,6 +24,8 @@ namespace NLGUI { void ifexprufct_forcelink(); + void force_link_dbgroup_select_number_cpp(); + void force_link_dbgroup_combo_box_cpp(); /// Necessary so the linker doesn't drop the code of these classes from the library void LinkHack() @@ -33,5 +35,7 @@ namespace NLGUI CDBViewQuantity::forceLink(); CViewPointer::forceLink(); ifexprufct_forcelink(); + force_link_dbgroup_select_number_cpp(); + force_link_dbgroup_combo_box_cpp(); } } \ No newline at end of file diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 22839a8cf..7cfe26a3e 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -1035,8 +1035,8 @@ namespace NLGUI setCapturePointerRight(NULL); resetColorProps(); - - _AlphaRolloverSpeedDB = NULL; + resetAlphaRolloverSpeedProps(); + resetGlobalAlphasProps(); activeAnims.clear(); } @@ -1967,10 +1967,18 @@ namespace NLGUI } // Update global color from database - setGlobalColor( NLMISC::CRGBA ( (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R")->getValue32(), - (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G")->getValue32(), - (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B")->getValue32(), - (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A")->getValue32() ) ); + if (!_RProp) + { + _RProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:R"); + _GProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:G"); + _BProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:B"); + _AProp = CDBManager::getInstance()->getDbProp("UI:SAVE:COLOR:A"); + } + setGlobalColor(NLMISC::CRGBA( + (uint8)_RProp->getValue32(), + (uint8)_GProp->getValue32(), + (uint8)_BProp->getValue32(), + (uint8)_AProp->getValue32())); NLMISC::CRGBA c = getGlobalColorForContent(); NLMISC::CRGBA gc = getGlobalColor(); @@ -2965,7 +2973,7 @@ namespace NLGUI return fTmp*fTmp*fTmp; } - void CWidgetManager::resetAlphaRolloverSpeed() + void CWidgetManager::resetAlphaRolloverSpeedProps() { _AlphaRolloverSpeedDB = NULL; } @@ -2981,10 +2989,29 @@ namespace NLGUI void CWidgetManager::updateGlobalAlphas() { - _GlobalContentAlpha = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA")->getValue32(); - _GlobalContainerAlpha = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ALPHA")->getValue32(); - _GlobalRolloverFactorContent = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ROLLOVER_FACTOR")->getValue32(); - _GlobalRolloverFactorContainer = (uint8)CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR")->getValue32(); + if (!_GlobalContentAlphaDB) + { + _GlobalContentAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ALPHA"); + nlassert(_GlobalContentAlphaDB); + _GlobalContainerAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ALPHA"); + nlassert(_GlobalContainerAlphaDB); + _GlobalContentRolloverFactorDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTENT_ROLLOVER_FACTOR"); + nlassert(_GlobalContentRolloverFactorDB); + _GlobalContainerRolloverFactorDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR"); + nlassert(_GlobalContainerRolloverFactorDB); + } + _GlobalContentAlpha = (uint8)_GlobalContentAlphaDB->getValue32(); + _GlobalContainerAlpha = (uint8)_GlobalContainerAlphaDB->getValue32(); + _GlobalRolloverFactorContent = (uint8)_GlobalContentRolloverFactorDB->getValue32(); + _GlobalRolloverFactorContainer = (uint8)_GlobalContainerRolloverFactorDB->getValue32(); + } + + void CWidgetManager::resetGlobalAlphasProps() + { + _GlobalContentAlphaDB = NULL; + _GlobalContainerAlphaDB = NULL; + _GlobalContentRolloverFactorDB = NULL; + _GlobalContainerRolloverFactorDB = NULL; } void CWidgetManager::registerNewScreenSizeHandler( INewScreenSizeHandler *handler ) @@ -3156,6 +3183,8 @@ namespace NLGUI CWidgetManager::CWidgetManager() { + LinkHack(); + CStringShared::createStringMapper(); CReflectableRegister::registerClasses(); @@ -3171,6 +3200,8 @@ namespace NLGUI _LastYContextHelp= -10000; resetColorProps(); + resetAlphaRolloverSpeedProps(); + resetGlobalAlphasProps(); _GlobalColor = NLMISC::CRGBA(255,255,255,255); _GlobalColorForContent = _GlobalColor; diff --git a/code/nel/src/misc/cdb_branch.cpp b/code/nel/src/misc/cdb_branch.cpp index 998ea8cd3..627c1f38b 100644 --- a/code/nel/src/misc/cdb_branch.cpp +++ b/code/nel/src/misc/cdb_branch.cpp @@ -232,6 +232,9 @@ void CCDBNodeBranch::attachChild( ICDBNode * node, string nodeName ) //nldebug ( "CDB: Attaching node" ); _NodesByName.push_back( node ); _Sorted = false; +#if NL_CDB_OPTIMIZE_PREDICT + _PredictNode = node; +#endif } } // attachChild // @@ -799,6 +802,18 @@ public: //----------------------------------------------- ICDBNode *CCDBNodeBranch::find(const std::string &nodeName) { +#if NL_CDB_OPTIMIZE_PREDICT + ICDBNode *predictNode = _PredictNode; + if (predictNode) + { + if (predictNode->getParent() == this + && *predictNode->getName() == nodeName) + { + return predictNode; + } + } +#endif + if (!_Sorted) { _Sorted = true; @@ -812,7 +827,15 @@ ICDBNode *CCDBNodeBranch::find(const std::string &nodeName) else { if (*(*it)->getName() == nodeName) + { +#if NL_CDB_OPTIMIZE_PREDICT + ICDBNode *node = *it; + _PredictNode = node; + return node; +#else return *it; +#endif + } else return NULL; } diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/config.xml b/code/ryzom/client/data/gamedev/interfaces_v3/config.xml index 630ecd4c6..4114143e5 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/config.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/config.xml @@ -2882,15 +2882,12 @@ This MUST follow the Enum MISSION_DESC::TIconId type="bool" value="true" /> - - - + + + diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/map.xml b/code/ryzom/client/data/gamedev/interfaces_v3/map.xml index f84e9841d..bbc3682d5 100644 --- a/code/ryzom/client/data/gamedev/interfaces_v3/map.xml +++ b/code/ryzom/client/data/gamedev/interfaces_v3/map.xml @@ -425,9 +425,7 @@ - + + - + diff --git a/code/ryzom/client/src/cdb_synchronised.cpp b/code/ryzom/client/src/cdb_synchronised.cpp index 08189fdd4..45c57dd55 100644 --- a/code/ryzom/client/src/cdb_synchronised.cpp +++ b/code/ryzom/client/src/cdb_synchronised.cpp @@ -318,7 +318,11 @@ void CCDBSynchronised::writeInitInProgressIntoUIDB() { CInterfaceManager *pIM = CInterfaceManager::getInstance(); if (pIM) - NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CDB_INIT_IN_PROGRESS")->setValueBool(_InitInProgress); + { + NLMISC::CCDBNodeLeaf *node = m_CDBInitInProgressDB ? (&*m_CDBInitInProgressDB) + : &*(m_CDBInitInProgressDB = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CDB_INIT_IN_PROGRESS")); + node->setValueBool(_InitInProgress); + } else nlwarning("InterfaceManager not created"); } diff --git a/code/ryzom/client/src/cdb_synchronised.h b/code/ryzom/client/src/cdb_synchronised.h index 7f8f1fb5e..e5c2f4876 100644 --- a/code/ryzom/client/src/cdb_synchronised.h +++ b/code/ryzom/client/src/cdb_synchronised.h @@ -151,6 +151,8 @@ private: bool allInitPacketReceived() const { return _InitDeltaReceived == 2; } // Classic database + inventory void writeInitInProgressIntoUIDB(); + + NLMISC::CRefPtr m_CDBInitInProgressDB; }; diff --git a/code/ryzom/client/src/cursor_functions.cpp b/code/ryzom/client/src/cursor_functions.cpp index a51877be1..8c3bc3a32 100644 --- a/code/ryzom/client/src/cursor_functions.cpp +++ b/code/ryzom/client/src/cursor_functions.cpp @@ -58,6 +58,7 @@ uint32 MissionRingId = 0; UInstance selectedInstance; const UInstance noSelectedInstance; string selectedInstanceURL; +static NLMISC::CRefPtr s_UserCharFade; /////////////// @@ -273,7 +274,8 @@ void checkUnderCursor() entity= EntitiesMngr.getEntityUnderPos(cursX, cursY, ClientCfg.SelectionDist, isPlayerUnderCursor); // If the mouse is over the player make the player transparent - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false); + CCDBNodeLeaf *pNL = s_UserCharFade ? &*s_UserCharFade + : &*(s_UserCharFade = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false)); if ((pNL != NULL) && (pNL->getValue32() == 1) && UserEntity->selectable()) { // If the nearest entity is the player, hide! diff --git a/code/ryzom/client/src/entities.cpp b/code/ryzom/client/src/entities.cpp index eec5a6b5a..7bc478ce7 100644 --- a/code/ryzom/client/src/entities.cpp +++ b/code/ryzom/client/src/entities.cpp @@ -435,28 +435,47 @@ void CEntityManager::initialize(uint nbMaxEntity) for (i=0; igetDB()->addObserver(&MissionTargetObserver, textId ); + _MissionTargetTitleDB[i][j] = NLGUI::CDBManager::getInstance()->getDbProp(text, false); + nlassert(_MissionTargetTitleDB[i][j]); } // Add an Observer to the Team database for (i=0; igetDB()->addObserver(&TeamUIDObserver, textId ); + _GroupMemberUidDB[i] = NLGUI::CDBManager::getInstance()->getDbProp(text, false); + nlassert(_GroupMemberUidDB[i]); - textId = ICDBNode::CTextId( toString(TEAM_DB_PATH ":%d:NAME", i) ); + text = toString(TEAM_DB_PATH ":%d:NAME", i); + textId = ICDBNode::CTextId(text); NLGUI::CDBManager::getInstance()->getDB()->addObserver(&TeamPresentObserver, textId ); + _GroupMemberNameDB[i] = NLGUI::CDBManager::getInstance()->getDbProp(text, false); + nlassert(_GroupMemberNameDB[i]); } // Add an Observer to the Animal database for (i=0; igetDB()->addObserver(&AnimalUIDObserver, textId ); + std::string text = toString("SERVER:PACK_ANIMAL:BEAST%d:UID", i); + textId = ICDBNode::CTextId(text); + NLGUI::CDBManager::getInstance()->getDB()->addObserver(&AnimalUIDObserver, textId); + _BeastUidDB[i] = NLGUI::CDBManager::getInstance()->getDbProp(text, false); + nlassert(_BeastUidDB[i]); - textId = ICDBNode::CTextId( toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS",i) ); - NLGUI::CDBManager::getInstance()->getDB()->addObserver(&AnimalStatusObserver, textId ); + text = toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS", i); + textId = ICDBNode::CTextId(text); + NLGUI::CDBManager::getInstance()->getDB()->addObserver(&AnimalStatusObserver, textId); + _BeastStatusDB[i] = NLGUI::CDBManager::getInstance()->getDbProp(text, false); + nlassert(_BeastStatusDB[i]); + + text = toString("SERVER:PACK_ANIMAL:BEAST%d:TYPE", i); + _BeastTypeDB[i] = NLGUI::CDBManager::getInstance()->getDbProp(text, false); + nlassert(_BeastTypeDB[i]); } }// initialize // diff --git a/code/ryzom/client/src/entities.h b/code/ryzom/client/src/entities.h index 27551141a..f71240b63 100644 --- a/code/ryzom/client/src/entities.h +++ b/code/ryzom/client/src/entities.h @@ -29,6 +29,9 @@ #include "ground_fx_manager.h" #include "projectile_manager.h" #include "user_entity.h" +// Some constants +#include "game_share/mission_desc.h" +#include "game_share/inventories.h" // Misc. #include "nel/misc/types_nl.h" #include "nel/misc/stream.h" @@ -36,6 +39,7 @@ #include "nel/misc/vector.h" #include "nel/misc/file.h" #include "nel/misc/aabbox.h" +#include "nel/misc/cdb_leaf.h" // 3D #include "nel/3d/u_instance.h" // Std. @@ -149,6 +153,14 @@ private: NL3D::UInstance _LastInstanceUnderPos; + // DB node pointers used to update some entity flags + NLMISC::CRefPtr _MissionTargetTitleDB[MAX_NUM_MISSIONS][MAX_NUM_MISSION_TARGETS]; + NLMISC::CRefPtr _GroupMemberUidDB[8]; // MaxNumPeopleInTeam in people_interaction.h + NLMISC::CRefPtr _GroupMemberNameDB[8]; // MaxNumPeopleInTeam in people_interaction.h + NLMISC::CRefPtr _BeastUidDB[MAX_INVENTORY_ANIMAL]; + NLMISC::CRefPtr _BeastStatusDB[MAX_INVENTORY_ANIMAL]; + NLMISC::CRefPtr _BeastTypeDB[MAX_INVENTORY_ANIMAL]; + ////////////// //// DEBUG /// uint _NbUser; @@ -344,6 +356,13 @@ public: */ void refreshInsceneInterfaceOfFriendNPC(uint slot); + inline NLMISC::CCDBNodeLeaf *getMissionTargetTitleDB(int mission, int target) { return _MissionTargetTitleDB[mission][target]; } + inline NLMISC::CCDBNodeLeaf *getGroupMemberUidDB(int member) { return _GroupMemberUidDB[member]; } + inline NLMISC::CCDBNodeLeaf *getGroupMemberNameDB(int member) { return _GroupMemberNameDB[member]; } + inline NLMISC::CCDBNodeLeaf *getBeastUidDB(int beast) { return _BeastUidDB[beast]; } + inline NLMISC::CCDBNodeLeaf *getBeastStatusDB(int beast) { return _BeastStatusDB[beast]; } + inline NLMISC::CCDBNodeLeaf *getBeastTypeDB(int beast) { return _BeastTypeDB[beast]; } + private: // NB: don't return unselectable entities diff --git a/code/ryzom/client/src/entity_cl.cpp b/code/ryzom/client/src/entity_cl.cpp index 9aef8b1c8..0063c93f4 100644 --- a/code/ryzom/client/src/entity_cl.cpp +++ b/code/ryzom/client/src/entity_cl.cpp @@ -120,6 +120,7 @@ NLMISC::CRGBA CEntityCL::_PvpAllyColor; NLMISC::CRGBA CEntityCL::_GMTitleColor[CHARACTER_TITLE::EndGmTitle - CHARACTER_TITLE::BeginGmTitle + 1]; uint8 CEntityCL::_InvalidGMTitleCode = 0xFF; NLMISC::CRefPtr CEntityCL::_OpacityMinNodeLeaf; +NLMISC::CRefPtr CEntityCL::_ShowReticleLeaf; // Context help @@ -2646,7 +2647,7 @@ void CEntityCL::updateMissionTarget() for (j=0; jgetDbProp("SERVER:MISSIONS:"+toString(i)+":TARGET"+toString(j)+":TITLE", false); + CCDBNodeLeaf *prop = EntitiesMngr.getMissionTargetTitleDB(i, j); // NLGUI::CDBManager::getInstance()->getDbProp("SERVER:MISSIONS:"+toString(i)+":TARGET"+toString(j)+":TITLE", false); if (prop) { _MissionTarget = _NameId == (uint32)prop->getValue32(); @@ -2846,8 +2847,8 @@ void CEntityCL::updateIsInTeam () for (uint i=0; igetDbProp(toString(TEAM_DB_PATH ":%d:UID", i), false); - CCDBNodeLeaf *presentProp = NLGUI::CDBManager::getInstance()->getDbProp(toString(TEAM_DB_PATH ":%d:NAME", i), false); + CCDBNodeLeaf *uidProp = EntitiesMngr.getGroupMemberUidDB(i); + CCDBNodeLeaf *presentProp = EntitiesMngr.getGroupMemberNameDB(i); // If same Entity uid than the one in the Database, ok the entity is in the Player TEAM!! if (uidProp && uidProp->getValue32() == (sint32)dataSetId() && presentProp && presentProp->getValueBool() ) @@ -2876,9 +2877,9 @@ void CEntityCL::updateIsUserAnimal () for (uint i=0; igetDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:UID", i), false); - CCDBNodeLeaf *statusProp = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:STATUS", i), false); - CCDBNodeLeaf *typeProp = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:TYPE", i), false); + CCDBNodeLeaf *uidProp = EntitiesMngr.getBeastUidDB(i); + CCDBNodeLeaf *statusProp = EntitiesMngr.getBeastStatusDB(i); + CCDBNodeLeaf *typeProp = EntitiesMngr.getBeastTypeDB(i); // I must have the same Id, and the animal entry must be ok. if(uidProp && statusProp && typeProp && uidProp->getValue32() == (sint32)dataSetId() && ANIMAL_STATUS::isSpawned((ANIMAL_STATUS::EAnimalStatus)(statusProp->getValue32()) )) @@ -3041,7 +3042,9 @@ void CEntityCL::updateVisiblePostPos(const NLMISC::TTime &/* currentTimeInMs */, bool bShowReticle = true; - CCDBNodeLeaf* node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_RETICLE"); + CCDBNodeLeaf *node = (CCDBNodeLeaf *)_ShowReticleLeaf ? &*_ShowReticleLeaf + : &*(_ShowReticleLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_RETICLE", false)); + if (node) { bShowReticle = node->getValueBool(); diff --git a/code/ryzom/client/src/entity_cl.h b/code/ryzom/client/src/entity_cl.h index 696efc61d..f7a26e03f 100644 --- a/code/ryzom/client/src/entity_cl.h +++ b/code/ryzom/client/src/entity_cl.h @@ -1111,7 +1111,8 @@ protected: // for localSelectBox() computing sint64 _LastLocalSelectBoxComputeTime; - static NLMISC::CRefPtr _OpacityMinNodeLeaf; + static NLMISC::CRefPtr _OpacityMinNodeLeaf; + static NLMISC::CRefPtr _ShowReticleLeaf; protected: /** diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp index 779d58fc4..688c27635 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -425,14 +425,15 @@ class CActionHandlerAddLink : public IActionHandler } std::vector targetsVect; - bool result = CInterfaceLink::splitLinkTargets(targets, parentGroup, targetsVect); + std::vector cdbTargetsVect; + bool result = CInterfaceLink::splitLinkTargetsExt(targets, parentGroup, targetsVect, cdbTargetsVect); if (!result) { nlwarning(" Couldn't parse all links"); } // add the link CInterfaceLink *il = new CInterfaceLink; - il->init(targetsVect, expr, ah, ahparam, ahcond, parentGroup); + il->init(targetsVect, cdbTargetsVect, expr, ah, ahparam, ahcond, parentGroup); CInterfaceManager *im = CInterfaceManager::getInstance(); CWidgetManager::getInstance()->getParser()->addLink(il, id); il->update(); diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index e313c7ae4..76d97c519 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -41,16 +41,77 @@ uint CGroupInSceneUserInfo::_BatLength = 0; CCDBNodeLeaf *CGroupInSceneUserInfo::_Value = NULL; CCDBNodeLeaf *CGroupInSceneUserInfo::_ValueBegin = NULL; CCDBNodeLeaf *CGroupInSceneUserInfo::_ValueEnd = NULL; +NLMISC::CRefPtr CGroupInSceneUserInfo::_GuildIconLeaf[256]; // *************************************************************************** NLMISC_REGISTER_OBJECT(CViewBase, CGroupInSceneUserInfo, std::string, "in_scene_user_info"); REGISTER_UI_CLASS(CGroupInSceneUserInfo) +namespace { + +// Has more entries than actually in config, as not all types have all entries. +class CConfigSaveInsceneDB +{ +public: + void setPrefix(const std::string &prefix) { _DBPrefix = prefix; } + inline NLMISC::CCDBNodeLeaf *getGuildSymbol() { return _GuildSymbol ? (&*_GuildSymbol) : &*(_GuildSymbol = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "GUILD_SYMBOL")); } + inline NLMISC::CCDBNodeLeaf *getName() { return _Name ? (&*_Name) : &*(_Name = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "NAME")); } + inline NLMISC::CCDBNodeLeaf *getTitle() { return _Title ? (&*_Title) : &*(_Title = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "TITLE")); } + inline NLMISC::CCDBNodeLeaf *getRPTags() { return _RPTags ? (&*_RPTags) : &*(_RPTags = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "RPTAGS")); } + inline NLMISC::CCDBNodeLeaf *getGuildName() { return _GuildName ? (&*_GuildName) : &*(_GuildName = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "GUILD_NAME")); } + inline NLMISC::CCDBNodeLeaf *getHP() { return _HP ? (&*_HP) : &*(_HP = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "HP")); } + inline NLMISC::CCDBNodeLeaf *getSta() { return _Sta ? (&*_Sta) : &*(_Sta = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "STA")); } + inline NLMISC::CCDBNodeLeaf *getSap() { return _Sap ? (&*_Sap) : &*(_Sap = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "SAP")); } + inline NLMISC::CCDBNodeLeaf *getFocus() { return _Focus ? (&*_Focus) : &*(_Focus = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "FOCUS")); } + inline NLMISC::CCDBNodeLeaf *getAction() { return _Action ? (&*_Action) : &*(_Action = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "ACTION")); } + inline NLMISC::CCDBNodeLeaf *getMessages() { return _Messages ? (&*_Messages) : &*(_Messages = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "MESSAGES")); } + inline NLMISC::CCDBNodeLeaf *getPvPLogo() { return _PvPLogo ? (&*_PvPLogo) : &*(_PvPLogo = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "PVP_LOGO")); } + inline NLMISC::CCDBNodeLeaf *getNPCName() { return _NPCName ? (&*_NPCName) : &*(_NPCName = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "NPCNAME")); } + inline NLMISC::CCDBNodeLeaf *getNPCTitle() { return _NPCTitle ? (&*_NPCTitle) : &*(_NPCTitle = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "NPCTITLE")); } + inline NLMISC::CCDBNodeLeaf *getMissionIcon() { return _MissionIcon ? (&*_MissionIcon) : &*(_MissionIcon = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "MISSION_ICON")); } + inline NLMISC::CCDBNodeLeaf *getMiniMissionIcon() { return _MiniMissionIcon ? (&*_MiniMissionIcon) : &*(_MiniMissionIcon = NLGUI::CDBManager::getInstance()->getDbProp(_DBPrefix + "MINI_MISSION_ICON")); } +private: + std::string _DBPrefix; + NLMISC::CRefPtr _GuildSymbol; + NLMISC::CRefPtr _Name; + NLMISC::CRefPtr _Title; + NLMISC::CRefPtr _RPTags; + NLMISC::CRefPtr _GuildName; + NLMISC::CRefPtr _HP; + NLMISC::CRefPtr _Sta; + NLMISC::CRefPtr _Sap; + NLMISC::CRefPtr _Focus; + NLMISC::CRefPtr _Action; + NLMISC::CRefPtr _Messages; + NLMISC::CRefPtr _PvPLogo; + NLMISC::CRefPtr _NPCName; + NLMISC::CRefPtr _NPCTitle; + NLMISC::CRefPtr _MissionIcon; + NLMISC::CRefPtr _MiniMissionIcon; +}; + +CConfigSaveInsceneDB _ConfigSaveInsceneDB[4]; // USER/FRIEND/ENEMY/SOURCE +bool _ConfigSaveInsceneDBInit = false; + +#define SAVE_USER 0 +#define SAVE_FRIEND 1 +#define SAVE_ENEMY 2 +#define SAVE_SOURCE 3 + +} CGroupInSceneUserInfo::CGroupInSceneUserInfo(const TCtorParam ¶m) : CGroupInScene(param) { + if (!_ConfigSaveInsceneDBInit) + { + _ConfigSaveInsceneDB[0].setPrefix("UI:SAVE:INSCENE:USER:"); + _ConfigSaveInsceneDB[1].setPrefix("UI:SAVE:INSCENE:FRIEND:"); + _ConfigSaveInsceneDB[2].setPrefix("UI:SAVE:INSCENE:ENEMY:"); + _ConfigSaveInsceneDB[3].setPrefix("UI:SAVE:INSCENE:SOURCE:"); + _ConfigSaveInsceneDBInit = true; + } _Name = NULL; _Title = NULL; _GuildName = NULL; @@ -130,7 +191,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) bool needPvPLogo= false; bool permanentContent = false; bool rpTags = false; - bool displayMissionIcons = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:INSCENE:FRIEND:MISSION_ICON")->getValueBool(); + bool displayMissionIcons = _ConfigSaveInsceneDB[SAVE_FRIEND].getMissionIcon()->getValueBool(); // Names const char *templateName; @@ -156,7 +217,6 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) // Active fields and bars if ( isForageSource ) { - string dbEntry = "UI:SAVE:INSCENE:SOURCE:"; CForageSourceCL *forageSource = static_cast(entity); name = !entityName.empty() /*&& NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"NAME")->getValueBool()*/; @@ -175,32 +235,32 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) } else if(npcFriendAndNeutral) { - string dbEntry; + int dbEntry; getBarSettings( pIM, user, entity->isPlayer(), _friend, dbEntry, bars ); // For RoleMasters, merchants etc... must display name and function, and nothing else for(uint i=0;igetDbProp(dbEntry+"NPCNAME")->getValueBool(); + name= !entityName.empty() && _ConfigSaveInsceneDB[dbEntry].getNPCName()->getValueBool(); symbol= false; - title= !entityTitle.empty() && CDBManager::getInstance()->getDbProp(dbEntry+"NPCTITLE")->getValueBool(); + title= !entityTitle.empty() && _ConfigSaveInsceneDB[dbEntry].getNPCTitle()->getValueBool(); guildName= false; templateName = "in_scene_user_info"; - rpTags = (!entityTag1.empty() || !entityTag2.empty() || !entityTag3.empty() || !entityTag4.empty() ) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"RPTAGS")->getValueBool(); + rpTags = (!entityTag1.empty() || !entityTag2.empty() || !entityTag3.empty() || !entityTag4.empty() ) && _ConfigSaveInsceneDB[dbEntry].getRPTags()->getValueBool(); } else { // Base entry in database - string dbEntry; + int dbEntry; getBarSettings( pIM, user, entity->isPlayer(), _friend, dbEntry, bars ); - name = !entityName.empty() && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"NAME")->getValueBool(); - title = !entityTitle.empty() && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"TITLE")->getValueBool(); - rpTags = (!entityTag1.empty() || !entityTag2.empty() || !entityTag3.empty() || !entityTag4.empty() ) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"RPTAGS")->getValueBool(); + name = !entityName.empty() && _ConfigSaveInsceneDB[dbEntry].getName()->getValueBool(); + title = !entityTitle.empty() && _ConfigSaveInsceneDB[dbEntry].getTitle()->getValueBool(); + rpTags = (!entityTag1.empty() || !entityTag2.empty() || !entityTag3.empty() || !entityTag4.empty() ) && _ConfigSaveInsceneDB[dbEntry].getRPTags()->getValueBool(); // if name is empty but not title, title is displayed as name - if (!title && entityName.empty() && !entityTitle.empty() && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"NAME")->getValueBool()) + if (!title && entityName.empty() && !entityTitle.empty() && _ConfigSaveInsceneDB[dbEntry].getName()->getValueBool()) title = true; templateName = "in_scene_user_info"; // special guild - if(NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"GUILD_SYMBOL")->getValueBool()) + if(_ConfigSaveInsceneDB[dbEntry].getGuildSymbol()->getValueBool()) { // if symbol not still available, wait for one when VP received symbol = (entity->getGuildSymbol() != 0); @@ -211,7 +271,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) symbol= false; needGuildSymbolId = false; } - if(NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"GUILD_NAME")->getValueBool()) + if(_ConfigSaveInsceneDB[dbEntry].getGuildName()->getValueBool()) { // if guild name not still available, wait for one when VP received guildName = (entity->getGuildNameID() != 0); @@ -222,7 +282,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) guildName= false; needGuildNameId= false; } - needPvPLogo = NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"PVP_LOGO")->getValueBool(); + needPvPLogo = _ConfigSaveInsceneDB[dbEntry].getPvPLogo()->getValueBool(); eventFaction = (entity->getEventFactionID() != 0); } @@ -799,9 +859,9 @@ REGISTER_ACTION_HANDLER( CHandlerResetCharacterInScene, "reset_character_in_scen // *************************************************************************** -void CGroupInSceneUserInfo::getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, std::string& dbEntry, bool *bars ) +void CGroupInSceneUserInfo::getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, int &dbEntry, bool *bars ) { - dbEntry = isUser?"UI:SAVE:INSCENE:USER:":isFriend?"UI:SAVE:INSCENE:FRIEND:":"UI:SAVE:INSCENE:ENEMY:"; + dbEntry = isUser?SAVE_USER:isFriend?SAVE_FRIEND:SAVE_ENEMY; // if currently is edition mode, then bars are not displayed if (ClientCfg.R2EDEnabled && R2::isEditionCurrent()) { @@ -813,11 +873,11 @@ void CGroupInSceneUserInfo::getBarSettings( CInterfaceManager* pIM, bool isUser, } else { - bars[HP] = NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"HP")->getValueBool(); - bars[SAP] = (isUser || isFriend) && (isUser || isPlayer) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"SAP")->getValueBool(); - bars[STA] = (isUser || isFriend) && (isUser || isPlayer) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"STA")->getValueBool(); - bars[Focus] = (isUser || isFriend) && (isUser || isPlayer) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"FOCUS")->getValueBool(); - bars[Action] = (isUser) && NLGUI::CDBManager::getInstance()->getDbProp(dbEntry+"ACTION")->getValueBool(); + bars[HP] = _ConfigSaveInsceneDB[dbEntry].getHP()->getValueBool(); + bars[SAP] = (isUser || isFriend) && (isUser || isPlayer) && _ConfigSaveInsceneDB[dbEntry].getSap()->getValueBool(); + bars[STA] = (isUser || isFriend) && (isUser || isPlayer) && _ConfigSaveInsceneDB[dbEntry].getSta()->getValueBool(); + bars[Focus] = (isUser || isFriend) && (isUser || isPlayer) && _ConfigSaveInsceneDB[dbEntry].getFocus()->getValueBool(); + bars[Action] = (isUser) && _ConfigSaveInsceneDB[dbEntry].getAction()->getValueBool(); } } @@ -831,7 +891,7 @@ void CGroupInSceneUserInfo::setLeftGroupActive( bool active ) if ( _Entity->isUser() || _Entity->isForageSource() ) return; - string dbEntry; + int dbEntry; bool barSettings [NumBars]; getBarSettings( CInterfaceManager::getInstance(), _Entity->isUser(), _Entity->isPlayer(), _Entity->isViewedAsFriend(), dbEntry, barSettings ); @@ -943,8 +1003,13 @@ void CGroupInSceneUserInfo::updateDynamicData () if (_Entity->getGuildSymbol() != 0) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - string dbLeaf = "UI:ENTITY:GUILD:"+toString (_Entity->slot())+":ICON"; - NLGUI::CDBManager::getInstance()->getDbProp(dbLeaf)->setValue64(_Entity->getGuildSymbol()); + if (!_GuildIconLeaf[_Entity->slot()]) + { + string dbLeaf = "UI:ENTITY:GUILD:"+toString (_Entity->slot())+":ICON"; + _GuildIconLeaf[_Entity->slot()] = NLGUI::CDBManager::getInstance()->getDbProp(dbLeaf); + } + nlassert(&*_GuildIconLeaf[_Entity->slot()]); + (&*_GuildIconLeaf[_Entity->slot()])->setValue64(_Entity->getGuildSymbol()); } // Set the event faction diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.h b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.h index 4a9dd6ddd..3869a74b1 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.h +++ b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.h @@ -72,7 +72,7 @@ protected: }; /// Fill NumBars elements into bars and set dbEntry - static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, std::string& dbEntry, bool *bars ); + static void getBarSettings( CInterfaceManager* pIM, bool isUser, bool isPlayer, bool isFriend, int &dbEntry, bool *bars ); // The entity (character or forage source) CEntityCL *_Entity; @@ -97,6 +97,9 @@ protected: static NLMISC::CCDBNodeLeaf *_ValueBegin; static NLMISC::CCDBNodeLeaf *_ValueEnd; + // Guild icon leafs + static NLMISC::CRefPtr _GuildIconLeaf[256]; + // Special guild bool _NeedGuildNameId; bool _NeedGuildSymbolId; diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index d352aff91..9d1cb364a 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -511,6 +511,8 @@ CInterfaceManager::CInterfaceManager() _LogState = false; _KeysLoaded = false; CWidgetManager::getInstance()->resetColorProps(); + CWidgetManager::getInstance()->resetAlphaRolloverSpeedProps(); + CWidgetManager::getInstance()->resetGlobalAlphasProps(); _NeutralColor = NULL; _WarningColor = NULL; _ErrorColor = NULL; @@ -1420,8 +1422,9 @@ void CInterfaceManager::uninitInGame1 () _NeutralColor = NULL; _WarningColor = NULL; _ErrorColor = NULL; - CWidgetManager::getInstance()->resetAlphaRolloverSpeed(); CWidgetManager::getInstance()->resetColorProps(); + CWidgetManager::getInstance()->resetAlphaRolloverSpeedProps(); + CWidgetManager::getInstance()->resetGlobalAlphasProps(); #ifdef AJM_DEBUG_TRACK_INTERFACE_GROUPS CInterfaceManager::getInstance()->DebugTrackGroupsDump(); @@ -1978,7 +1981,11 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera) // Update Player characteristics (for Item carac requirement Redifying) nlctassert(CHARACTERISTICS::NUM_CHARACTERISTICS==8); for (uint i=0; igetDbValue32(toString("SERVER:CHARACTER_INFO:CHARACTERISTICS%d:VALUE", i)); + { + NLMISC::CCDBNodeLeaf *node = _CurrentPlayerCharacLeaf[i] ? &*_CurrentPlayerCharacLeaf[i] + : &*(_CurrentPlayerCharacLeaf[i] = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:CHARACTERISTICS%d:VALUE", i), false)); + _CurrentPlayerCharac[i] = node ? node->getValue32() : 0; + } CWidgetManager::getInstance()->drawViews( camera ); diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index 567c07a7b..36bd909e3 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -633,7 +633,8 @@ private: std::vector _EmoteCmds; // Item Carac requirement - sint32 _CurrentPlayerCharac[CHARACTERISTICS::NUM_CHARACTERISTICS]; + sint32 _CurrentPlayerCharac[CHARACTERISTICS::NUM_CHARACTERISTICS]; + NLMISC::CRefPtr _CurrentPlayerCharacLeaf[CHARACTERISTICS::NUM_CHARACTERISTICS]; // observers for copying database branch changes CServerToLocalAutoCopy ServerToLocalAutoCopyInventory; diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index b0a050f29..95b091c22 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -558,7 +558,8 @@ void CPeopleInterraction::createTeamList() { CInterfaceLink *il = new CInterfaceLink; vector targets; - il->init(targets, sExpr, sAction, sParams, sCond, TeamChat->getContainer()); + vector cdbTargets; + il->init(targets, cdbTargets, sExpr, sAction, sParams, sCond, TeamChat->getContainer()); } } diff --git a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp index 8abb66c8c..3d6155d23 100644 --- a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -941,6 +941,8 @@ void CSPhraseManager::reset() CSkillManager *pSM= CSkillManager::getInstance(); pBM->removeBrickLearnedCallback(&_ProgressionUpdate); pSM->removeSkillChangeCallback(&_ProgressionUpdate); + + _TotalMalusEquipLeaf = NULL; } // *************************************************************************** @@ -1122,7 +1124,9 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, // **** Compute Phrase Elements from phrase // get the current action malus (0-100) uint32 totalActionMalus= 0; - CCDBNodeLeaf *actMalus= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false); + CCDBNodeLeaf *actMalus = _TotalMalusEquipLeaf ? &*_TotalMalusEquipLeaf + : &*(_TotalMalusEquipLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false)); + // root brick must not be Power or aura, because Action malus don't apply to them // (ie leave 0 ActionMalus for Aura or Powers if(actMalus && !rootBrick->isSpecialPower()) @@ -1652,7 +1656,8 @@ float CSPhraseManager::getPhraseSumBrickProp(const CSPhraseCom &phrase, uint else if(propId==CSBrickManager::getInstance()->StaPropId && brick->Properties[j].PropId==CSBrickManager::getInstance()->StaWeightFactorId) { CInterfaceManager *im = CInterfaceManager::getInstance(); - uint32 weight = (uint32) NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:DEFAULT_WEIGHT_HANDS")->getValue32() / 10; // weight must be in dg here + if (!_ServerUserDefaultWeightHandsLeaf) _ServerUserDefaultWeightHandsLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:DEFAULT_WEIGHT_HANDS"); + uint32 weight = (uint32)(&*_ServerUserDefaultWeightHandsLeaf)->getValue32() / 10; // weight must be in dg here CDBCtrlSheet *ctrlSheet = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:gestionsets:hands:handr")); if (ctrlSheet) { @@ -4501,7 +4506,8 @@ uint32 CSPhraseManager::getTotalActionMalus(const CSPhraseCom &phrase) const CInterfaceManager *pIM = CInterfaceManager::getInstance(); CSBrickManager *pBM= CSBrickManager::getInstance(); uint32 totalActionMalus= 0; - CCDBNodeLeaf *actMalus= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false); + CCDBNodeLeaf *actMalus = _TotalMalusEquipLeaf ? &*_TotalMalusEquipLeaf + : &*(_TotalMalusEquipLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false)); // root brick must not be Power or aura, because Action malus don't apply to them // (ie leave 0 ActionMalus for Aura or Powers if (!phrase.Bricks.empty()) diff --git a/code/ryzom/client/src/interface_v3/sphrase_manager.h b/code/ryzom/client/src/interface_v3/sphrase_manager.h index b28ff39ed..c14b584ab 100644 --- a/code/ryzom/client/src/interface_v3/sphrase_manager.h +++ b/code/ryzom/client/src/interface_v3/sphrase_manager.h @@ -651,6 +651,10 @@ private: void computePhraseProgression(); void insertProgressionSkillRecurs(SKILLS::ESkills skill, uint32 value, sint *skillReqLevel, std::vector &skillsToInsert); + mutable NLMISC::CRefPtr _TotalMalusEquipLeaf; + + NLMISC::CRefPtr _ServerUserDefaultWeightHandsLeaf; + // @} /// return the skill of the root diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index b273984ff..01336402d 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -290,6 +290,9 @@ CGameContextMenu GameContextMenu; +static CRefPtr s_FpsLeaf; +static CRefPtr s_UiDirectionLeaf; + // Profile /* @@ -1900,7 +1903,8 @@ bool mainLoop() deltaTime = smoothFPS.getSmoothValue (); if (deltaTime > 0.0) { - CCDBNodeLeaf*pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:FPS"); + CCDBNodeLeaf *pNL = s_FpsLeaf ? &*s_FpsLeaf + : &*(s_FpsLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:FPS")); pNL->setValue64((sint64)(1.f/deltaTime)); } } @@ -2263,8 +2267,10 @@ bool mainLoop() H_AUTO_USE ( RZ_Client_Main_Loop_Net ) // Put here things you have to send to the server only once per tick like user position. // UPDATE COMPASS + NLMISC::CCDBNodeLeaf *node = s_UiDirectionLeaf ? (&*s_UiDirectionLeaf) + : &*(s_UiDirectionLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DIRECTION")); CInterfaceProperty prop; - prop.readDouble("UI:VARIABLES:DIRECTION"," "); + prop.setNodePtr(node); if(CompassMode == 1) { double camDir = atan2(View.view().y, View.view().x); diff --git a/code/ryzom/client/src/motion/user_controls.cpp b/code/ryzom/client/src/motion/user_controls.cpp index b780927e2..527bfb5d4 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, ...) diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index f9a5628ca..1eedc16c5 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -3861,22 +3861,28 @@ bool CNetManager::update() CInterfaceManager *im = CInterfaceManager::getInstance(); if (im) { - CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false); + CCDBNodeLeaf *node = m_PingLeaf ? &*m_PingLeaf + : &*(m_PingLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PING", false)); if (node) node->setValue32(getPing()); - node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false); + node = m_UploadLeaf ? &*m_UploadLeaf + : &*(m_UploadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:UPLOAD", false)); if (node) node->setValue32((sint32)(getMeanUpload()*1024.f/8.f)); - node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false); + node = m_DownloadLeaf ? &*m_DownloadLeaf + : &*(m_DownloadLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:DOWNLOAD", false)); if (node) node->setValue32((sint32)(getMeanDownload()*1024.f/8.f)); - node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false); + node = m_PacketLostLeaf ? &* m_PacketLostLeaf + : &*(m_PacketLostLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:PACKETLOST", false)); if (node) node->setValue32((sint32)getMeanPacketLoss()); - node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false); + node = m_ServerStateLeaf ? &*m_ServerStateLeaf + : &*(m_ServerStateLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SERVERSTATE", false)); if (node) node->setValue32((sint32)getConnectionState()); - node = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false); + node = m_ConnectionQualityLeaf ? &*m_ConnectionQualityLeaf + : &*(m_ConnectionQualityLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:CONNECTION_QUALITY", false)); if (node) node->setValue32((sint32)getConnectionQuality()); } diff --git a/code/ryzom/client/src/net_manager.h b/code/ryzom/client/src/net_manager.h index 9fef4bc1d..06d6a7621 100644 --- a/code/ryzom/client/src/net_manager.h +++ b/code/ryzom/client/src/net_manager.h @@ -43,6 +43,7 @@ void initializeNetwork(); namespace NLMISC { class CBitMemStream; + class CCDBNodeLeaf; }; @@ -126,6 +127,13 @@ public: protected: bool _IsReplayStarting; #endif + + NLMISC::CRefPtr m_PingLeaf; + NLMISC::CRefPtr m_UploadLeaf; + NLMISC::CRefPtr m_DownloadLeaf; + NLMISC::CRefPtr m_PacketLostLeaf; + NLMISC::CRefPtr m_ServerStateLeaf; + NLMISC::CRefPtr m_ConnectionQualityLeaf; }; diff --git a/code/ryzom/client/src/r2/tool.cpp b/code/ryzom/client/src/r2/tool.cpp index ddc97fb95..995394b94 100644 --- a/code/ryzom/client/src/r2/tool.cpp +++ b/code/ryzom/client/src/r2/tool.cpp @@ -55,6 +55,7 @@ const uint32 DEFAULT_ENTITY_MIN_OPACITY = 128; bool CTool::_MouseCaptured = false; +NLMISC::CRefPtr CTool::_UserCharFade; static const CVector cardinals[] = { @@ -551,7 +552,8 @@ void CTool::handleMouseOverPlayer(bool over) { //H_AUTO(R2_CTool_handleMouseOverPlayer) // If the mouse is over the player make the player transparent - CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false); + CCDBNodeLeaf *pNL = _UserCharFade ? &*_UserCharFade + : &*(_UserCharFade = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:USER_CHAR_FADE", false)); if ((pNL != NULL) && (pNL->getValue32() == 1) && UserEntity->selectable()) { // If the nearest entity is the player, hide! diff --git a/code/ryzom/client/src/r2/tool.h b/code/ryzom/client/src/r2/tool.h index f7262efc4..d36c514c1 100644 --- a/code/ryzom/client/src/r2/tool.h +++ b/code/ryzom/client/src/r2/tool.h @@ -284,6 +284,7 @@ private: sint64 _AutoPanDelay; sint64 _NumPans; static bool _MouseCaptured; + static NLMISC::CRefPtr _UserCharFade; private: /** compute the nearest valid surface at a given position from the island heightmap * (heightmap must not be empty or an assertion is raised) diff --git a/code/ryzom/client/src/weather.cpp b/code/ryzom/client/src/weather.cpp index 1f5f0f822..91fad6f7c 100644 --- a/code/ryzom/client/src/weather.cpp +++ b/code/ryzom/client/src/weather.cpp @@ -194,10 +194,13 @@ bool ServerDrivenWeather = false; const float WEATHER_BLEND_SPEED = 1.f / 8.f; // number of seconds to blend betwen weather states +static NLMISC::CRefPtr s_ServerWeatherValueDB; + // *************************************************************************** static uint16 getServerWeather() { - CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:WEATHER:VALUE"); + CCDBNodeLeaf *node = s_ServerWeatherValueDB ? &*s_ServerWeatherValueDB + : &*(s_ServerWeatherValueDB = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:WEATHER:VALUE")); if (!node) return 0; return (uint16) node->getValue16(); } diff --git a/code/ryzom/common/src/game_share/crypt.cpp b/code/ryzom/common/src/game_share/crypt.cpp index fa0f1252f..0da908817 100644 --- a/code/ryzom/common/src/game_share/crypt.cpp +++ b/code/ryzom/common/src/game_share/crypt.cpp @@ -79,6 +79,10 @@ static char rz_sccsid[] = "@(#)crypt.c 8.1 (Berkeley) 6/4/93"; #include #define RZ__PASSWORD_EFMT1 '-' +#if DEBUG_CRYPT +void prtab(char *s, unsigned char *t, int num_rows); +#endif + /* * UNIX password, and DES, encryption. * By Tom Truscott, trt@rti.rti.org, @@ -785,7 +789,7 @@ int rz_des_cipher(const char *in, char *out, long salt, int num_iter) { } perm[i] = (unsigned char) k; } -#ifdef DEBUG +#ifdef DEBUG_CRYPT prtab("pc1tab", perm, 8); #endif rz_init_perm(PC1ROT, perm, 8, 8); @@ -809,7 +813,7 @@ int rz_des_cipher(const char *in, char *out, long salt, int num_iter) { if ((k%28) <= j) k -= 28; perm[i] = pc2inv[k]; } -#ifdef DEBUG +#ifdef DEBUG_CRYPT prtab("pc2tab", perm, 8); #endif rz_init_perm(PC2ROT[j], perm, 8, 8); @@ -833,7 +837,7 @@ int rz_des_cipher(const char *in, char *out, long salt, int num_iter) { perm[i*8+j] = (unsigned char) k; } } -#ifdef DEBUG +#ifdef DEBUG_CRYPT prtab("ietab", perm, 8); #endif rz_init_perm(IE3264, perm, 4, 8); @@ -850,7 +854,7 @@ int rz_des_cipher(const char *in, char *out, long salt, int num_iter) { } perm[k-1] = i+1; } -#ifdef DEBUG +#ifdef DEBUG_CRYPT prtab("cftab", perm, 8); #endif rz_init_perm(CF6464, perm, 8, 8); @@ -959,12 +963,8 @@ int rz_encrypt(register char *block, int flag) { return (0); } -#ifdef DEBUG -STATIC -prtab(s, t, num_rows) - char *s; - unsigned char *t; - int num_rows; +#ifdef DEBUG_CRYPT +void prtab(char *s, unsigned char *t, int num_rows) { register int i, j;