From 956da7f9daf6d87668f5b7640d53f71602a1dbba Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 25 Oct 2016 17:41:54 +0200 Subject: [PATCH] Merge with develop --- code/nel/include/nel/3d/texture_font.h | 8 +++ code/nel/include/nel/3d/tile_bank.h | 2 +- code/nel/src/3d/landscape.cpp | 10 ++-- code/nel/src/3d/landscapeig_manager.cpp | 8 +-- code/nel/src/3d/scene_group.cpp | 9 +-- code/nel/src/3d/tile_bank.cpp | 14 ++--- code/nel/src/pacs/global_retriever.cpp | 2 +- code/nel/src/sound/audio_mixer_user.cpp | 2 +- code/ryzom/client/src/connection.cpp | 2 +- code/ryzom/client/src/entity_cl.h | 2 +- code/ryzom/client/src/login.cpp | 2 +- .../client/src/r2/displayer_visual_entity.cpp | 2 +- .../src/game_share/scenario_entry_points.cpp | 2 +- .../src/game_share/small_string_manager.cpp | 2 +- .../src/game_share/string_mgr_module.cpp | 2 +- .../client/client_patcher/CMakeLists.txt | 5 +- .../tools/client/client_patcher/main.cpp | 57 +++++++------------ 17 files changed, 63 insertions(+), 68 deletions(-) diff --git a/code/nel/include/nel/3d/texture_font.h b/code/nel/include/nel/3d/texture_font.h index 3aeb77b65..20353f236 100644 --- a/code/nel/include/nel/3d/texture_font.h +++ b/code/nel/include/nel/3d/texture_font.h @@ -61,6 +61,10 @@ public: sint32 Top; // Distance between origin and top of the texture sint32 Left; // Distance between origin and left of the texture sint32 AdvX; // Advance to the next caracter + + SLetterInfo():Char(0), FontGenerator(NULL), Size(0), Embolden(false), Oblique(false), Next(NULL), Prev(NULL), Cat(0), CharWidth(0), CharHeight(0), GlyphIndex(0), Top(0), Left(0), AdvX(0) + { + } }; struct SLetterKey @@ -74,6 +78,10 @@ public: uint32 getVal(); //bool operator < (const SLetterKey&k) const; //bool operator == (const SLetterKey&k) const; + + SLetterKey():Char(0), FontGenerator(NULL), Size(0), Embolden(false), Oblique(false) + { + } }; public: diff --git a/code/nel/include/nel/3d/tile_bank.h b/code/nel/include/nel/3d/tile_bank.h index 32a205e6d..ec96afb64 100644 --- a/code/nel/include/nel/3d/tile_bank.h +++ b/code/nel/include/nel/3d/tile_bank.h @@ -320,7 +320,7 @@ public: // For edition: change the tileVegetableDesc. NB: only the TileVegetableDescFileName is serialised. void setTileVegetableDesc (const CTileVegetableDesc &tvd); /** try to load the vegetable tile desc associated with the fileName (nlinfo() if can't) - * lookup into CPath. no-op if string=="". + * lookup into CPath. no-op if string empty */ void loadTileVegetableDesc(); diff --git a/code/nel/src/3d/landscape.cpp b/code/nel/src/3d/landscape.cpp index d588fa424..e3658dd88 100644 --- a/code/nel/src/3d/landscape.cpp +++ b/code/nel/src/3d/landscape.cpp @@ -1831,9 +1831,9 @@ void CLandscape::loadTile(uint16 tileId) if(tile) textName= tile->getRelativeFileName(CTile::additive); else - textName= ""; + textName.clear(); // If no additive for this tile, rdrpass is NULL. - if(textName=="") + if(textName.empty()) tileInfo->AdditiveRdrPass= NULL; else { @@ -1844,7 +1844,7 @@ void CLandscape::loadTile(uint16 tileId) // We may have an alpha part for additive. textName= tile->getRelativeFileName (CTile::alpha); - if(textName!="") + if(!textName.empty()) // Must Use clamp for alpha (although NVidia drivers are buggy), because the texture doesn't tile at all pass.TextureAlpha= findTileTexture(TileBank.getAbsPath()+textName, true); @@ -1866,7 +1866,7 @@ void CLandscape::loadTile(uint16 tileId) if(tile) { textName= tile->getRelativeFileName(CTile::diffuse); - if(textName!="") + if(!textName.empty()) // Avoid using Clamp for diffuse, because of recent NVidia GL drivers Bugs in 77.72 pass.TextureDiffuse= findTileTexture(TileBank.getAbsPath()+textName, false); else @@ -1880,7 +1880,7 @@ void CLandscape::loadTile(uint16 tileId) if(tile) { textName= tile->getRelativeFileName (CTile::alpha); - if(textName!="") + if(!textName.empty()) // Must Use clamp for alpha (although NVidia drivers are buggy), because the texture doesn't tile at all pass.TextureAlpha= findTileTexture(TileBank.getAbsPath()+textName, true); } diff --git a/code/nel/src/3d/landscapeig_manager.cpp b/code/nel/src/3d/landscapeig_manager.cpp index f4388f9fa..500373360 100644 --- a/code/nel/src/3d/landscapeig_manager.cpp +++ b/code/nel/src/3d/landscapeig_manager.cpp @@ -174,7 +174,7 @@ UInstanceGroup *CLandscapeIGManager::loadZoneIG(const std::string &name) { NL3D_HAUTO_LAND_MNGR_LOAD_ZONEIG - if(name=="") + if(name.empty()) return NULL; // try to find this InstanceGroup. @@ -232,7 +232,7 @@ void CLandscapeIGManager::unloadArrayZoneIG(const std::vector &name void CLandscapeIGManager::unloadZoneIG(const std::string &name) { NL3D_HAUTO_LAND_MNGR_UNLOAD_ZONEIG - if(name=="") + if(name.empty()) return; // try to find this InstanceGroup. @@ -255,7 +255,7 @@ void CLandscapeIGManager::unloadZoneIG(const std::string &name) // *************************************************************************** bool CLandscapeIGManager::isIGAddedToScene(const std::string &name) const { - if(name=="") + if(name.empty()) return false; // try to find this InstanceGroup. @@ -272,7 +272,7 @@ bool CLandscapeIGManager::isIGAddedToScene(const std::string &name) const // *************************************************************************** UInstanceGroup *CLandscapeIGManager::getIG(const std::string &name) const { - if(name=="") + if(name.empty()) return NULL; // try to find this InstanceGroup. diff --git a/code/nel/src/3d/scene_group.cpp b/code/nel/src/3d/scene_group.cpp index 1d98f21bb..5b29709cc 100644 --- a/code/nel/src/3d/scene_group.cpp +++ b/code/nel/src/3d/scene_group.cpp @@ -573,10 +573,11 @@ bool CInstanceGroup::addToScene (CScene& scene, IDriver *driver, uint selectedTe else { _Instances[i] = scene.createInstance (shapeName); - } - if( _Instances[i] == NULL ) - { - nlwarning("Not found '%s' file", shapeName.c_str()); + + if (_Instances[i] == NULL) + { + nlwarning("Not found '%s' file", shapeName.c_str()); + } } } } diff --git a/code/nel/src/3d/tile_bank.cpp b/code/nel/src/3d/tile_bank.cpp index d4e26ab06..0f05b3df6 100644 --- a/code/nel/src/3d/tile_bank.cpp +++ b/code/nel/src/3d/tile_bank.cpp @@ -264,7 +264,7 @@ sint CTileBank::getNumBitmap (CTile::TBitmap bitmap) const if (!_TileVector[i].isFree()) { const std::string &str=_TileVector[i].getRelativeFileName (bitmap); - if (str!="") + if (!str.empty()) { std::vector vect (str.length()+1); memcpy (&*vect.begin(), str.c_str(), str.length()+1); @@ -583,7 +583,7 @@ void CTileBank::removeDisplacementMap (uint mapId) if (mapId==_DisplacementMap.size()-1) { // Resize the array ? - while ((mapId>0)&&(_DisplacementMap[mapId]._FileName=="")) + while ((mapId>0)&&(_DisplacementMap[mapId]._FileName.empty())) _DisplacementMap.resize (mapId--); } } @@ -608,7 +608,7 @@ uint CTileBank::getDisplacementMap (const string &fileName) for (noiseTile=0; noiseTile<_DisplacementMap.size(); noiseTile++) { // Same name ? - if (_DisplacementMap[noiseTile]._FileName=="") + if (_DisplacementMap[noiseTile]._FileName.empty()) break; } if (noiseTile==_DisplacementMap.size()) @@ -1433,7 +1433,7 @@ void CTileSet::deleteBordersIfLast (const CTileBank& bank, CTile::TBitmap type) while (ite!=_Tile128.end()) { // If the file name is valid - if (bank.getTile (*ite)->getRelativeFileName(type)!="") + if (!bank.getTile (*ite)->getRelativeFileName(type).empty()) { // Don't delete, bDelete=false; @@ -1450,7 +1450,7 @@ void CTileSet::deleteBordersIfLast (const CTileBank& bank, CTile::TBitmap type) while (ite!=_Tile256.end()) { // If the file name is valid - if (bank.getTile (*ite)->getRelativeFileName(type)!="") + if (!bank.getTile (*ite)->getRelativeFileName(type).empty()) { // Don't delete, bDelete=false; @@ -1474,7 +1474,7 @@ void CTileSet::deleteBordersIfLast (const CTileBank& bank, CTile::TBitmap type) if (nTile!=-1) { // If the file name is valid - if (bank.getTile (nTile)->getRelativeFileName(type)!="") + if (!bank.getTile (nTile)->getRelativeFileName(type).empty()) { // Don't delete, bDelete=false; @@ -1564,7 +1564,7 @@ const CTileVegetableDesc &CTileSet::getTileVegetableDesc() const // *************************************************************************** void CTileSet::loadTileVegetableDesc() { - if(_TileVegetableDescFileName!="") + if(!_TileVegetableDescFileName.empty()) { try { diff --git a/code/nel/src/pacs/global_retriever.cpp b/code/nel/src/pacs/global_retriever.cpp index 27b32fbf1..6dfc3a712 100644 --- a/code/nel/src/pacs/global_retriever.cpp +++ b/code/nel/src/pacs/global_retriever.cpp @@ -1221,7 +1221,7 @@ void NLPACS::CGlobalRetriever::findCollisionChains(CCollisionSurfaceTemp &cst, c if (!localRetriever.isLoaded()) { - nlwarning("local retriever %d in %s not loaded, findCollisionChains in this retriever aborted", localRetrieverId, _RetrieverBank->getNamePrefix().c_str()); + nldebug("local retriever %d in %s not loaded, findCollisionChains in this retriever aborted", localRetrieverId, _RetrieverBank->getNamePrefix().c_str()); continue; } diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index 6f2c2b449..4d86df788 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -1797,7 +1797,7 @@ void CAudioMixerUser::addSource( CSourceCommon *source ) _Sources.insert( source ); // _profile(( "AM: ADDSOURCE, SOUND: %d, TRACK: %p, NAME=%s", source->getSound(), source->getTrack(), -// source->getSound() && (source->getSound()->getName()!="") ? source->getSound()->getName().c_str() : "" )); +// source->getSound() && (!source->getSound()->getName().empty()) ? source->getSound()->getName().c_str() : "" )); } diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 69c05cc08..e20e05140 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -2798,7 +2798,7 @@ class CAHScenarioControl : public IActionHandler // description string description = sessionBrowser._LastDescription; - if(description!="") + if(!description.empty()) { result = scenarioWnd->findFromShortId(string("edit_small_description")); if(result) diff --git a/code/ryzom/client/src/entity_cl.h b/code/ryzom/client/src/entity_cl.h index 328ec1cc7..d9cdd5927 100644 --- a/code/ryzom/client/src/entity_cl.h +++ b/code/ryzom/client/src/entity_cl.h @@ -171,7 +171,7 @@ public: // hide every static fxs void hideStaticFXs(); - // Create the loading instance. return false if shapeName!="" while still fails to load. else return true. + // Create the loading instance. return false if shapeName is not empty while still fails to load. else return true. bool createLoading(const std::string &shapeName, const std::string &stickPoint=std::string(""), sint texture=-1, bool clearIfFail= true); // Apply Colors diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 86bb8d337..8f1957afd 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -2661,7 +2661,7 @@ class CAHOnCreateAccountSubmit : public IActionHandler for(uint i=0; itoString("Title"); //obsolete - if(actName!=firstPart && actName!="") + if(actName!=firstPart && !actName.empty()) actName = firstPart+":"+actName; } else diff --git a/code/ryzom/common/src/game_share/scenario_entry_points.cpp b/code/ryzom/common/src/game_share/scenario_entry_points.cpp index 51e3c56c3..c97689211 100644 --- a/code/ryzom/common/src/game_share/scenario_entry_points.cpp +++ b/code/ryzom/common/src/game_share/scenario_entry_points.cpp @@ -385,7 +385,7 @@ void CScenarioEntryPoints::loadFromXMLFile() shortEntryPoint.Y = entryPoint.Y; entryPoints.push_back(shortEntryPoint); - if(package=="") + if(package.empty()) package=entryPoint.Package; else if(package!=entryPoint.Package) nlinfo("Different packages for island '%s' in file %s", island, _EntryPointsFilename.c_str()); diff --git a/code/ryzom/common/src/game_share/small_string_manager.cpp b/code/ryzom/common/src/game_share/small_string_manager.cpp index 83414b668..bcc2a67da 100644 --- a/code/ryzom/common/src/game_share/small_string_manager.cpp +++ b/code/ryzom/common/src/game_share/small_string_manager.cpp @@ -225,7 +225,7 @@ void CStringTableManager::setValue(uint32 tableId,const std::string& localId, co if(found2!=localTable->end()) { std::string oldValue = _StringMgr.getString(found2->second); - if (oldValue=="") nlwarning("error! no string %u in string manager! ",found2->second); + if (oldValue.empty()) nlwarning("error! no string %u in string manager! ",found2->second); _StringMgr.unregisterString(oldValue); found2->second = _StringMgr.registerString(value); } diff --git a/code/ryzom/common/src/game_share/string_mgr_module.cpp b/code/ryzom/common/src/game_share/string_mgr_module.cpp index 49d9a9122..e28fc0c8c 100644 --- a/code/ryzom/common/src/game_share/string_mgr_module.cpp +++ b/code/ryzom/common/src/game_share/string_mgr_module.cpp @@ -469,7 +469,7 @@ static std::string formatString(std::string str,std::vector args) void CStringManagerModule::translateAndForwardWithArg(TDataSetRow senderId,CChatGroup::TGroupType groupType,std::string id,TSessionId sessionId,std::vector& args) { std::string text = getValue(sessionId.asInt(), id ); - if (text!="") + if (!text.empty()) { std::string toSend = formatString(text,args); send(senderId,groupType,toSend); diff --git a/code/ryzom/tools/client/client_patcher/CMakeLists.txt b/code/ryzom/tools/client/client_patcher/CMakeLists.txt index 9616f8153..051be7a60 100644 --- a/code/ryzom/tools/client/client_patcher/CMakeLists.txt +++ b/code/ryzom/tools/client/client_patcher/CMakeLists.txt @@ -1,7 +1,6 @@ FILE(GLOB SRC main.cpp ${CMAKE_SOURCE_DIR}/ryzom/client/src/app_bundle_utils.cpp ${CMAKE_SOURCE_DIR}/ryzom/client/src/user_agent.cpp - ${CMAKE_SOURCE_DIR}/ryzom/client/src/client_cfg.cpp ${CMAKE_SOURCE_DIR}/ryzom/client/src/login_patch.cpp ${CMAKE_SOURCE_DIR}/ryzom/client/src/login_xdelta.cpp ${CMAKE_SOURCE_DIR}/ryzom/client/src/stdpch.cpp @@ -9,7 +8,7 @@ FILE(GLOB SRC main.cpp ) # always enable custom patch server -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DRZ_USE_CUSTOM_PATCH_SERVER) +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) ADD_EXECUTABLE(ryzom_client_patcher ${SRC}) @@ -32,7 +31,7 @@ IF(APPLE) TARGET_LINK_LIBRARIES(ryzom_client_patcher ${FOUNDATION_LIBRARY}) ENDIF(APPLE) -ADD_DEFINITIONS(${CURL_DEFINITIONS} -DRZ_NO_CLIENT -DNL_USE_SEVENZIP) +ADD_DEFINITIONS(${CURL_DEFINITIONS}) NL_DEFAULT_PROPS(ryzom_client_patcher "Ryzom, Tools: Ryzom Client Patcher") NL_ADD_RUNTIME_FLAGS(ryzom_client_patcher) diff --git a/code/ryzom/tools/client/client_patcher/main.cpp b/code/ryzom/tools/client/client_patcher/main.cpp index 08be87fbe..76fcc495b 100644 --- a/code/ryzom/tools/client/client_patcher/main.cpp +++ b/code/ryzom/tools/client/client_patcher/main.cpp @@ -16,6 +16,22 @@ using namespace NLMISC; using namespace std; +// simplified implementation to not depend on client_cfg.cpp +CClientConfig::CClientConfig() +{ +} + +void CClientConfig::serial(class NLMISC::IStream &/* f */) throw(NLMISC::EStream) +{ +} + +bool CClientConfig::getDefaultConfigLocation(std::string&/* p_name */) const +{ + return false; +} + +CClientConfig ClientCfg; + // stuff which is defined as extern in other .cpp files void quitCrashReport() { @@ -126,7 +142,7 @@ void printDownload(const std::string &str) fflush(stdout); } -// hardcoded english translations to not depends on external files +// hardcoded english translations to not depend on external files struct CClientPatcherTranslations : public NLMISC::CI18N::ILoadProxy { virtual void loadStringFile(const std::string &filename, ucstring &text) @@ -174,6 +190,8 @@ struct CClientPatcherTranslations : public NLMISC::CI18N::ILoadProxy } }; +// hardcoded URL to not depend on external files +static const std::string PatchUrl = "http://dl.ryzom.com/patch_live"; int main(int argc, char *argv[]) { @@ -182,7 +200,6 @@ int main(int argc, char *argv[]) Args.setVersion(getDisplayVersion()); Args.setDescription("Ryzom client"); - Args.addArg("c", "config", "id", "Use this configuration to determine what directory to use by default"); if (!Args.parse(argc, argv)) return 1; @@ -194,28 +211,6 @@ int main(int argc, char *argv[]) INelContext::getInstance().getInfoLog()->removeDisplayer("DEFAULT_SD"); INelContext::getInstance().getWarningLog()->removeDisplayer("DEFAULT_SD"); - std::string config = "client.cfg"; - - // if client.cfg is not in current directory, use client.cfg from user directory - if (!CFile::isExists(config)) - config = CPath::getApplicationDirectory("Ryzom") + config; - - // if client.cfg is not in current directory, use client_default.cfg - if (!CFile::isExists(config)) - config = "client_default.cfg"; - -#ifdef RYZOM_ETC_PREFIX - // if client_default.cfg is not in current directory, use application default directory - if (!CFile::isExists(config)) - config = CPath::standardizePath(RYZOM_ETC_PREFIX) + config; -#endif - - if (!CFile::isExists(config)) - { - printError(config + " not found, aborting patch."); - return 1; - } - // check if console supports colors std::string term = toLower(std::string(getenv("TERM") ? getenv("TERM"):"")); useEsc = (term.find("xterm") != string::npos || term.find("linux") != string::npos); @@ -233,16 +228,6 @@ int main(int argc, char *argv[]) } #endif - // load client.cfg or client_default.cfg - ClientCfg.init(config); - - // check if PatchUrl is defined - if (ClientCfg.PatchUrl.empty()) - { - printError("PatchUrl not defined in " + config); - return 1; - } - // allocate translations proxy CClientPatcherTranslations *trans = new CClientPatcherTranslations(); @@ -255,6 +240,8 @@ int main(int argc, char *argv[]) // now translations are read, we don't need it anymore delete trans; + Args.displayVersion(); + printf("\n"); printf("Checking %s files to patch...\n", convert(CI18N::get("TheSagaOfRyzom")).c_str()); // initialize patch manager and set the ryzom full path, before it's used @@ -262,7 +249,7 @@ int main(int argc, char *argv[]) // use PatchUrl vector patchURLs; - pPM->init(patchURLs, ClientCfg.PatchUrl, ClientCfg.PatchVersion); + pPM->init(patchURLs, PatchUrl, ""); pPM->startCheckThread(true /* include background patchs */); ucstring state;