diff --git a/code/nel/include/nel/3d/texture_bump.h b/code/nel/include/nel/3d/texture_bump.h index 1fb6152de..1c1f2a245 100644 --- a/code/nel/include/nel/3d/texture_bump.h +++ b/code/nel/include/nel/3d/texture_bump.h @@ -84,14 +84,6 @@ protected: float *_NormalizationFactor; bool _DisableSharing; bool _ForceNormalize; - // Map that give the normalization factor for each map from its sharename. This avoid to generate several time the maps to get the normalization factor if a bumpmap is shared by severals CTextureBump instances; - struct CNormalizationInfo - { - uint NumRefs; - float NormalizationFactor; - }; - typedef std::map TNameToNI; // sharename to the normalization factor - static TNameToNI _NameToNF; // name to normalization factor private: /// we don't allow for mipmap for bump so we redefine this to prevent the user from doing this on the base class Itexture virtual void setFilterMode(TMagFilter magf, TMinFilter minf); diff --git a/code/nel/include/nel/misc/base64.h b/code/nel/include/nel/misc/base64.h index 4c5c2babd..2d61cf254 100644 --- a/code/nel/include/nel/misc/base64.h +++ b/code/nel/include/nel/misc/base64.h @@ -16,7 +16,7 @@ #ifndef NL_BASE64_H -#define NL_BASE64_h +#define NL_BASE64_H namespace NLMISC { diff --git a/code/nel/include/nel/misc/debug.h b/code/nel/include/nel/misc/debug.h index 7d4ddcd1b..a8c23eced 100644 --- a/code/nel/include/nel/misc/debug.h +++ b/code/nel/include/nel/misc/debug.h @@ -368,10 +368,10 @@ extern bool _assertex_stop_1(bool &ignoreNextTime); // removed because we always check assert (even in release mode) #if defined(NL_DEBUG) -#if defined(_MSC_VER) && _MSC_VER >= 1900 +#if defined(_MSC_VER) && _MSC_VER >= 1500 #define nlassume(exp) do { __analysis_assume(exp); } while (0) // __analysis_assume doesn't evaluate the expression at runtime #else -#define nlassume(exp) do { ) while (0) +#define nlassume(exp) do { } while (0) #endif #ifdef NL_NO_DEBUG @@ -500,6 +500,15 @@ do { \ #endif // NL_NO_DEBUG +// Same as nlassert and nlverify, but only in DEV build +#if !FINAL_VERSION +#define nlassertverbose(exp) nlassert(exp) +#define nlverifyverbose(exp) nlverify(exp) +#else +#define nlassertverbose(exp) nlassume(exp) +#define nlverifyverbose(exp) do { exp; nlassume(exp); } while (0) +#endif + #define nlunreferenced(identifier) (void)identifier #define nlstop \ diff --git a/code/nel/src/3d/texture_bump.cpp b/code/nel/src/3d/texture_bump.cpp index 3707476b2..7705a58fa 100644 --- a/code/nel/src/3d/texture_bump.cpp +++ b/code/nel/src/3d/texture_bump.cpp @@ -26,9 +26,31 @@ namespace NL3D { +namespace /* anonymous */ { -CTextureBump::TNameToNI CTextureBump::_NameToNF; +// Map that give the normalization factor for each map from its sharename. This avoid to generate several time the maps to get the normalization factor if a bumpmap is shared by severals CTextureBump instances; +struct CNormalizationInfo +{ + uint NumRefs; + float NormalizationFactor; +}; +typedef std::map TNameToNI; // sharename to the normalization factor +class CNameToNFStatic { +public: + TNameToNI Map; + bool Initialized; + CNameToNFStatic() : Initialized(true) + { + + } + ~CNameToNFStatic() + { + Initialized = false; + } +}; +CNameToNFStatic s_NameToNF; +} /* anonymous namespace */ #define GET_HGT(x, y) ((sint) ((src[(uint) (x) % width + ((uint) (y) % height) * width] & 0x00ff00) >> 8)) /// create a DsDt texture from a height map (red component of a rgba bitmap) @@ -242,14 +264,15 @@ void CTextureBump::doGenerate(bool async) } // create entry in the map for the normalization factor std::string shareName = getShareName(); - TNameToNI::iterator it = _NameToNF.find(shareName); - if (it == _NameToNF.end()) + nlassertverbose(s_NameToNF.Initialized); + TNameToNI::iterator it = s_NameToNF.Map.find(shareName); + if (it == s_NameToNF.Map.end()) { // create a new entry CNormalizationInfo ni; ni.NumRefs = 1; ni.NormalizationFactor = normalizationFactor; - std::pair pb = _NameToNF.insert(TNameToNI::value_type(shareName, ni)); + std::pair pb = s_NameToNF.Map.insert(TNameToNI::value_type(shareName, ni)); _NormalizationFactor = &(pb.first->second.NormalizationFactor); } else @@ -303,8 +326,9 @@ float CTextureBump::getNormalizationFactor() if (!_HeightMap) return 1.f; // not computed yet, see if another map has computed it std::string shareName = getShareName(); - TNameToNI::iterator it = _NameToNF.find(shareName); - if (it != _NameToNF.end()) + nlassertverbose(s_NameToNF.Initialized); + TNameToNI::iterator it = s_NameToNF.Map.find(shareName); + if (it != s_NameToNF.Map.end()) { _NormalizationFactor = &(it->second.NormalizationFactor); ++(it->second.NumRefs); @@ -320,16 +344,16 @@ float CTextureBump::getNormalizationFactor() ///============================================================================================== CTextureBump::~CTextureBump() { - if (_NormalizationFactor && !_NameToNF.empty()) + if (s_NameToNF.Initialized && _NormalizationFactor && !s_NameToNF.Map.empty()) { // find normalization factor from its name - TNameToNI::iterator it = _NameToNF.find(getShareName()); + TNameToNI::iterator it = s_NameToNF.Map.find(getShareName()); // if found - if (it != _NameToNF.end()) + if (it != s_NameToNF.Map.end()) { // we can delete it only if it's not used anymore - if (--(it->second.NumRefs) == 0) _NameToNF.erase(it); + if (--(it->second.NumRefs) == 0) s_NameToNF.Map.erase(it); } } } diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 8009c5ac8..50b381a3c 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -5178,7 +5178,7 @@ namespace NLGUI if (low < min) low = min; if (high > max) - max = max; + high = max; } float CGroupHTML::HTMLMeterElement::getValueRatio() const diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 2bbfc3c93..e839a57c3 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -697,7 +697,8 @@ static void addPaths(IProgressCallback &progress, const std::vector if (CFile::isDirectory(getRyzomSharePrefix())) directoryPrefixes.push_back(CPath::standardizePath(getRyzomSharePrefix())); #endif - std::map directoriesToProcess; + std::set directoriesToProcessSet; + std::vector directoriesToProcess; // first pass, build a map with all existing directories to process in second pass for (uint j = 0; j < directoryPrefixes.size(); j++) @@ -710,36 +711,29 @@ static void addPaths(IProgressCallback &progress, const std::vector // only prepend prefix if path is relative if (!directory.empty() && !directoryPrefix.empty() && !CPath::isAbsolutePath(directory)) - directory = directoryPrefix + directory; + directory = directoryPrefix + directory; // only process existing directories if (CFile::isExists(directory)) - directoriesToProcess[directory] = 1; + { + if (directoriesToProcessSet.find(directory) == directoriesToProcessSet.end()) + { + directoriesToProcessSet.insert(directory); + directoriesToProcess.push_back(directory); + } + } } } - uint total = (uint)directoriesToProcess.size(); - uint current = 0, next = 0; - - std::map::const_iterator it = directoriesToProcess.begin(), iend = directoriesToProcess.end(); - // second pass, add search paths - while (it != iend) + for (size_t i = 0; i < directoriesToProcess.size(); ++i) { - // update next progress value - ++next; - - progress.progress((float)current/(float)total); - progress.pushCropedValues((float)current/(float)total, (float)next/(float)total); + progress.progress((float)i / (float)directoriesToProcess.size()); + progress.pushCropedValues((float)i / (float)directoriesToProcess.size(), (float)(i + 1) / (float)directoriesToProcess.size()); - // next is current value - current = next; - - CPath::addSearchPath(it->first, recurse, false, &progress); + CPath::addSearchPath(directoriesToProcess[i], recurse, false, &progress); progress.popCropedValues(); - - ++it; } } diff --git a/code/ryzom/client/src/interface_v3/music_player.cpp b/code/ryzom/client/src/interface_v3/music_player.cpp index 77d3fd698..2deaa965b 100644 --- a/code/ryzom/client/src/interface_v3/music_player.cpp +++ b/code/ryzom/client/src/interface_v3/music_player.cpp @@ -378,7 +378,10 @@ public: virtual void execute(CCtrlBase * /* pCaller */, const string &Params) { if(!SoundMngr) + { + CInterfaceManager::getInstance()->messageBox (CI18N::get ("uiSoundDisabled")); return; + } if (Params == "play_songs") { @@ -386,19 +389,26 @@ public: SoundMngr->getMixer()->getMusicExtensions(extensions); // no format supported - if (extensions.empty()) return; - - std::string message; - for(uint i = 0; i < extensions.size(); ++i) + if (extensions.empty()) { - message += " " + extensions[i]; + // in the very unlikely scenario + const ucstring message("Sound driver has no support for music."); + CInterfaceManager::getInstance()->displaySystemInfo(message, "SYS"); + nlinfo("%s", message.toUtf8().c_str()); + return; } - message += " m3u m3u8"; - nlinfo("Media player supports: '%s'", message.substr(1).c_str()); + std::string newPath = CPath::makePathAbsolute(CPath::standardizePath(ClientCfg.MediaPlayerDirectory), CPath::getCurrentPath(), true); + std::string extlist; + join(extensions, ", ", extlist); + extlist += ", m3u, m3u8"; + + std::string msg(CI18N::get("uiMk_system6").toUtf8()); + msg += ": " + newPath + " (" + extlist + ")"; + CInterfaceManager::getInstance()->displaySystemInfo(ucstring::makeFromUtf8(msg), "SYS"); + nlinfo("%s", msg.c_str()); // Recursive scan for files from media directory vector filesToProcess; - string newPath = CPath::standardizePath(ClientCfg.MediaPlayerDirectory); CPath::getPathContent (newPath, true, false, true, filesToProcess); uint i; diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 8dc9e9006..32eb6150f 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -2768,7 +2768,7 @@ void updateInventoryFromStream (NLMISC::CBitMemStream &impulse, const CInventory const string invBranchStr = CInventoryCategoryTemplate::getDbStr( (typename CInventoryCategoryTemplate::TInventoryId)invId ); ICDBNode::CTextId textId( invBranchStr ); ICDBNode *inventoryNode = IngameDbMngr.getNodePtr()->getNode( textId, false ); - BOMB_IF( !inventoryNode, "Inventory missing in database", return ) + BOMB_IF(!inventoryNode, "Inventory missing in database", return); // List of updates for ( uint c=0; c!=nbChanges; ++c ) diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index e97cbf4a5..457cee562 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -243,7 +243,13 @@ void CDynamicMapClientEventForwarder::nodeMoved( void CDynamicMapClientEventForwarder::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialActIndex) { //H_AUTO(R2_CDynamicMapClientEventForwarder_scenarioUpdated) - if (getEditor().getMode() != CEditor::EditionMode) return; + if (getEditor().getMode() != CEditor::EditionMode + && getEditor().getMode() != CEditor::GoingToEditionMode /* New scenario */ + && getEditor().getMode() != CEditor::AnimationModeLoading /* Loading animation scenario from terminal */) + { + nldebug("Scenario update received, but not in edition mode"); + return; + } getEditor().scenarioUpdated(highLevel, willTP, initialActIndex); } @@ -5708,6 +5714,7 @@ void CEditor::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialAct if (_WaitScenarioScreenActive) { // defer scenario update to the end of the wait screen + nlassert(!_NewScenario); _NewScenario = highLevel ? highLevel->clone() : NULL; _NewScenarioInitialAct = initialActIndex; _PostponeScenarioUpdated = true; diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index c194cef6c..a1380407c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -28,7 +28,7 @@ #include "filesextractor.h" #include "filescleaner.h" -#include "seven_zip.h" +#include "nel/misc/seven_zip.h" #if defined(Q_OS_WIN32) && defined(QT_WINEXTRAS_LIB) #include