diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index b85afb29c..30698a341 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -72,10 +72,6 @@ IF(WIN32) IF(WITH_MFC) FIND_PACKAGE(MFC QUIET) ENDIF(WITH_MFC) - - IF(NOT DEFINED ENV{QTDIR}) - SET(ENV{QTDIR} "c:/qt/4.6.3") - ENDIF(NOT DEFINED ENV{QTDIR}) ENDIF(WIN32) #----------------------------------------------------------------------------- @@ -108,6 +104,7 @@ IF(WIN32) ENDIF(WITH_MFC) ENDIF(WIN32) +FIND_PACKAGE(ZLIB REQUIRED) FIND_PACKAGE(LibXml2 REQUIRED) FIND_PACKAGE(PNG REQUIRED) FIND_PACKAGE(GIF) @@ -147,24 +144,194 @@ IF(WITH_SSE2) ENDIF(WITH_SSE3) ENDIF(WITH_SSE2) +MACRO(ADD_QT_LIBRARY _NAME) + IF(WIN32) + SET(_PREFIX "Qt5") + SET(_EXT "lib") + ELSE() + SET(_PREFIX "libQt5") + SET(_EXT "a") + ENDIF() + SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}.${_EXT}") + IF(EXISTS ${_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} optimized ${_LIB}) + ENDIF() + SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}d.${_EXT}") + IF(EXISTS ${_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} debug ${_LIB}) + ENDIF() +ENDMACRO() + +MACRO(ADD_QT_PLUGIN _TYPE _NAME) + IF(WIN32) + SET(_PREFIX "") + SET(_EXT "lib") + ELSE() + SET(_PREFIX "lib") + SET(_EXT "a") + ENDIF() + SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}.${_EXT}") + IF(EXISTS ${_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} optimized ${_LIB}) + ENDIF() + SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}d.${_EXT}") + IF(EXISTS ${_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} debug ${_LIB}) + ENDIF() +ENDMACRO() + IF(WITH_QT5) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR) + SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR}) + FIND_PACKAGE(Qt5Core QUIET) IF(Qt5Core_FOUND) + # Check if we are using Qt static or shared libraries + GET_TARGET_PROPERTY(_FILE Qt5::Core IMPORTED_LOCATION_RELEASE) + + SET(QT_VERSION "${Qt5Core_VERSION_STRING}") + SET(_VERSION "${QT_VERSION}") + + IF(_FILE MATCHES "\\.(lib|a)$") + SET(QT_STATIC ON) + SET(_VERSION "${_VERSION} static version") + ELSE() + SET(QT_STATIC OFF) + SET(_VERSION "${_VERSION} shared version") + ENDIF() + + MESSAGE(STATUS "Found Qt ${_VERSION}") + + # These variables are not defined with Qt5 CMake modules + SET(QT_BINARY_DIR "${_qt5Core_install_prefix}/bin") + SET(QT_LIBRARY_DIR "${_qt5Core_install_prefix}/lib") + SET(QT_PLUGINS_DIR "${_qt5Core_install_prefix}/plugins") + SET(QT_TRANSLATIONS_DIR "${_qt5Core_install_prefix}/translations") + + # Fix wrong include directories with Qt 5 under Mac OS X + INCLUDE_DIRECTORIES("${_qt5Core_install_prefix}/include") + FIND_PACKAGE(Qt5Gui) FIND_PACKAGE(Qt5Widgets) FIND_PACKAGE(Qt5OpenGL) FIND_PACKAGE(Qt5Xml) FIND_PACKAGE(Qt5LinguistTools) FIND_PACKAGE(Qt5Network) + + SET(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Xml) + + IF(QT_STATIC) + ADD_DEFINITIONS(-DQT_STATICPLUGIN) + + # Core + IF(APPLE) + FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre) + + FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation) + FIND_LIBRARY(CARBON_FRAMEWORK Carbon) + FIND_LIBRARY(SECURITY_FRAMEWORK Security) + + SET(QT_LIBRARIES ${QT_LIBRARIES} + ${PCRE_LIBRARY} + ${FOUNDATION_FRAMEWORK} + ${CARBON_FRAMEWORK} + ${SECURITY_FRAMEWORK}) + ENDIF() + + # Network + FIND_PACKAGE(OpenSSL REQUIRED) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES}) + + IF(WIN32) + SET(QT_LIBRARIES ${QT_LIBRARIES} + ${WINSDK_LIBRARY_DIR}/Crypt32.lib + ${WINSDK_LIBRARY_DIR}/WS2_32.Lib) + ENDIF() + + SET(QT_LIBRARIES ${QT_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARY}) + + # Gui + ADD_QT_LIBRARY(PrintSupport) + ADD_QT_LIBRARY(PlatformSupport) + + IF(WIN32) + SET(QT_LIBRARIES ${QT_LIBRARIES} + ${WINSDK_LIBRARY_DIR}/Imm32.lib + ${WINSDK_LIBRARY_DIR}/OpenGL32.lib + ${WINSDK_LIBRARY_DIR}/WinMM.Lib) + ADD_QT_PLUGIN(platforms qwindows) + ELSEIF(APPLE) + # Cups needs .dylib + SET(OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib) + FIND_LIBRARY(CUPS_LIBRARY cups) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_CMAKE_FIND_LIBRARY_SUFFIXES}) + + FIND_LIBRARY(IOKIT_FRAMEWORK IOKit) + FIND_LIBRARY(COCOA_FRAMEWORK Cocoa) + FIND_LIBRARY(SYSTEMCONFIGURATION_FRAMEWORK SystemConfiguration) + FIND_LIBRARY(OPENGL_FRAMEWORK NAMES OpenGL) + + SET(QT_LIBRARIES ${QT_LIBRARIES} + ${CUPS_LIBRARY} + ${COCOA_FRAMEWORK} + ${SYSTEMCONFIGURATION_FRAMEWORK} + ${IOKIT_FRAMEWORK} + ${OPENGL_FRAMEWORK}) + + ADD_QT_PLUGIN(printsupport cocoaprintersupport) + ADD_QT_PLUGIN(platforms qcocoa) + ENDIF() + + ADD_QT_PLUGIN(imageformats qgif) + ADD_QT_PLUGIN(imageformats qicns) + ADD_QT_PLUGIN(imageformats qico) + ADD_QT_PLUGIN(imageformats qjpeg) + ADD_QT_PLUGIN(imageformats qmng) + ADD_QT_PLUGIN(imageformats qwebp) + + # harfbuzz is needed since Qt 5.3 + IF(APPLE) + SET(HB_LIB "${QT_LIBRARY_DIR}/libqtharfbuzzng.a") + ELSEIF(WIN32) + SET(HB_LIB "${QT_LIBRARY_DIR}/qtharfbuzzng.lib") + ENDIF() + IF(EXISTS ${HB_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${HB_LIB}) + ENDIF() + + # freetype is needed since Qt 5.5 + IF(APPLE) + SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a") + ELSEIF(WIN32) + SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib") + ENDIF() + IF(EXISTS ${FREETYPE_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB}) + ENDIF() + + # pcre is needed since Qt 5.5 + IF(APPLE) + SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre.a") + ELSEIF(WIN32) + SET(PCRE_LIB "${QT_LIBRARY_DIR}/qtpcre.lib") + ENDIF() + IF(EXISTS ${PCRE_LIB}) + SET(QT_LIBRARIES ${QT_LIBRARIES} ${PCRE_LIB}) + ENDIF() + + ADD_QT_PLUGIN(accessible qtaccessiblewidgets) + ENDIF() ELSE() MESSAGE(WARNING "Unable to find Qt 5") ENDIF() ENDIF() IF(WITH_QT) + SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR} $ENV{QTDIR}) + # Use Qt 4 FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED) ENDIF(WITH_QT) @@ -235,7 +402,7 @@ ENDIF(WITH_SNOWBALLS) IF(WITH_TOOLS) ADD_SUBDIRECTORY(tool) -ENDIF(WITH_TOOLS) +ENDIF() IF(WITH_STUDIO) ADD_SUBDIRECTORY(studio) diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index f283eaecb..b538feb4d 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -64,18 +64,12 @@ IF(WITH_INSTALL_LIBRARIES) ENDIF(UNIX) ADD_SUBDIRECTORY(include) -ENDIF(WITH_INSTALL_LIBRARIES) +ENDIF() ADD_SUBDIRECTORY(src) IF(WITH_NEL_SAMPLES) ADD_SUBDIRECTORY(samples) -ENDIF(WITH_NEL_SAMPLES) +ENDIF() -# Allow to compile only max plugins without other tools. -IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN) - IF(WITH_NEL_TOOLS) - FIND_PACKAGE(Squish) - ENDIF(WITH_NEL_TOOLS) - ADD_SUBDIRECTORY(tools) -ENDIF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN) +ADD_SUBDIRECTORY(tools) diff --git a/code/nel/include/nel/gui/group_container_base.h b/code/nel/include/nel/gui/group_container_base.h index 3e9d1c8bf..6aa7425b7 100644 --- a/code/nel/include/nel/gui/group_container_base.h +++ b/code/nel/include/nel/gui/group_container_base.h @@ -82,13 +82,13 @@ namespace NLGUI // Get the header color draw. NB: depends if grayed, and if active. virtual NLMISC::CRGBA getDrawnHeaderColor () const{ return NLMISC::CRGBA(); }; - uint8 getCurrentContainerAlpha() const{ return _CurrentContainerAlpha; } - uint8 getCurrentContentAlpha() const{ return _CurrentContentAlpha; } + uint8 getCurrentContainerAlpha() const { return _CurrentContainerAlpha; } + uint8 getCurrentContentAlpha() const { return _CurrentContentAlpha; } - virtual bool isGrayed() const{ return false; } - virtual bool getTouchFlag(bool clearFlag) const{ return false; } - virtual void backupPosition(){} - virtual void restorePosition(){} + virtual bool isGrayed() const { return false; } + virtual bool getTouchFlag(bool /* clearFlag */) const { return false; } + virtual void backupPosition() {} + virtual void restorePosition() {} protected: void triggerAlphaSettingsChangedAH(); diff --git a/code/nel/include/nel/gui/interface_element.h b/code/nel/include/nel/gui/interface_element.h index e2f9ffc87..65a0fcaff 100644 --- a/code/nel/include/nel/gui/interface_element.h +++ b/code/nel/include/nel/gui/interface_element.h @@ -74,9 +74,9 @@ namespace NLGUI class IDeletionWatcher { public: - IDeletionWatcher(){} - virtual ~IDeletionWatcher(){} - virtual void onDeleted( const std::string &name ){} + IDeletionWatcher() {} + virtual ~IDeletionWatcher() {} + virtual void onDeleted( const std::string &/* name */) {} }; enum EStrech diff --git a/code/nel/include/nel/misc/path.h b/code/nel/include/nel/misc/path.h index 383a0553c..ff7711b06 100644 --- a/code/nel/include/nel/misc/path.h +++ b/code/nel/include/nel/misc/path.h @@ -701,7 +701,7 @@ struct CFile /** Move a file * NB this keeps file attributes */ - static bool moveFile(const char *dest, const char *src); + static bool moveFile(const std::string &dest, const std::string &src); /** Create a directory * \return true if success diff --git a/code/nel/include/nel/misc/sstring.h b/code/nel/include/nel/misc/sstring.h index c9ebff721..a8b231012 100644 --- a/code/nel/include/nel/misc/sstring.h +++ b/code/nel/include/nel/misc/sstring.h @@ -945,14 +945,6 @@ inline CSString operator+(const char* s0,const CSString& s1) return CSString(s0) + s1.c_str(); } -#if !defined(NL_COMP_VC) || (NL_COMP_VC_VERSION <= 100) -// TODO: check if it can be disabled for other compilers too -inline CSString operator+(const std::string& s0,const CSString& s1) -{ - return s0+static_cast(s1); -} -#endif - } // NLMISC // *** The following was commented out by Sadge because there were strange compilation/ link issues *** diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index e12b7aaca..46dd00cba 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -370,7 +370,7 @@ inline void aligned_free(void *ptr) { _aligned_free(ptr); } #elif defined(NL_OS_MAC) #include // under Mac OS X, malloc is already aligned for SSE and Altivec (16 bytes alignment) -inline void *aligned_malloc(size_t size, size_t alignment) { return malloc(size); } +inline void *aligned_malloc(size_t size, size_t /* alignment */) { return malloc(size); } inline void aligned_free(void *ptr) { free(ptr); } #else #include diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index a1ec1971e..dbe947839 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -579,7 +579,7 @@ namespace NLGUI string finalUrl; if (it->type == ImgType) { - CFile::moveFile(it->dest.c_str(), tmpfile.c_str()); + CFile::moveFile(it->dest, tmpfile); //if (lookupLocalFile (finalUrl, file.c_str(), false)) { for(uint i = 0; i < it->imgs.size(); i++) @@ -591,7 +591,7 @@ namespace NLGUI } else { - CFile::moveFile(it->dest.c_str(), tmpfile.c_str()); + CFile::moveFile(it->dest, tmpfile); //if (lookupLocalFile (finalUrl, file.c_str(), false)) { CLuaManager::getInstance().executeLuaScript( it->luaScript, true ); diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 02434e66a..739e807c8 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -356,7 +356,7 @@ namespace NLGUI string backup = nextFileName+".backup"; if (CFile::fileExists(backup)) CFile::deleteFile(backup); - CFile::moveFile(backup.c_str(), nextFileName.c_str()); + CFile::moveFile(backup, nextFileName); } return false; } diff --git a/code/nel/src/misc/bitmap_gif.cpp b/code/nel/src/misc/bitmap_gif.cpp index 355e2a2bf..74f75a968 100644 --- a/code/nel/src/misc/bitmap_gif.cpp +++ b/code/nel/src/misc/bitmap_gif.cpp @@ -154,10 +154,12 @@ uint8 CBitmap::readGIF( NLMISC::IStream &f ) if (curFrame->ExtensionBlockCount > 0) { - for(uint e=0; eExtensionBlockCount; e++){ + for(sint e = 0; e < curFrame->ExtensionBlockCount; e++) + { ExtensionBlock *ext = &curFrame->ExtensionBlocks[e]; - if (ext->Function == GRAPHICS_EXT_FUNC_CODE) { + if (ext->Function == GRAPHICS_EXT_FUNC_CODE) + { uint8 flag = ext->Bytes[0]; //delay = (ext.Bytes[1] << 8) | ext.Bytes[2]; transparency = (flag & GIF_TRANSPARENT_MASK) ? ext->Bytes[3] : GIF_NOT_TRANSPARENT; diff --git a/code/nel/src/misc/file.cpp b/code/nel/src/misc/file.cpp index 842d9ea51..e5c0736f4 100644 --- a/code/nel/src/misc/file.cpp +++ b/code/nel/src/misc/file.cpp @@ -627,7 +627,7 @@ void COFile::internalClose(bool success) if (CFile::fileExists(_FileName)) CFile::deleteFile (_FileName); - if (CFile::moveFile (_FileName.c_str(), _TempFileName.c_str())) + if (CFile::moveFile(_FileName, _TempFileName)) break; nlSleep (0); } diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index 248116f20..de36efa56 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -2451,7 +2451,7 @@ bool CFile::thoroughFileCompare(const std::string &fileName0, const std::string return true; } -bool CFile::moveFile(const char *dest,const char *src) +bool CFile::moveFile(const std::string &dest, const std::string &src) { return CopyMoveFile(dest, src, false); } diff --git a/code/nel/tools/3d/CMakeLists.txt b/code/nel/tools/3d/CMakeLists.txt index 37773e9ee..55481097b 100644 --- a/code/nel/tools/3d/CMakeLists.txt +++ b/code/nel/tools/3d/CMakeLists.txt @@ -66,15 +66,17 @@ IF(WITH_NEL_TOOLS AND WITH_3D) ADD_SUBDIRECTORY(object_viewer_widget) ENDIF(WITH_QT) + IF(WITH_NEL_TOOLS) + FIND_PACKAGE(Squish) + ENDIF() + IF(SQUISH_FOUND) ADD_SUBDIRECTORY(s3tc_compressor_lib) ADD_SUBDIRECTORY(panoply_maker) ADD_SUBDIRECTORY(tga_2_dds) ADD_SUBDIRECTORY(hls_bank_maker) - ENDIF(SQUISH_FOUND) + ENDIF() #crash_log_analyser - #shapes_exporter - ENDIF() diff --git a/code/nel/tools/3d/panoply_maker/panoply_maker.cpp b/code/nel/tools/3d/panoply_maker/panoply_maker.cpp index af0c4b731..9a434d438 100644 --- a/code/nel/tools/3d/panoply_maker/panoply_maker.cpp +++ b/code/nel/tools/3d/panoply_maker/panoply_maker.cpp @@ -563,7 +563,7 @@ static bool CheckIfNeedRebuildColoredVersionForOneBitmap(const CBuildInfo &bi, c return true; // ok, can move the cache - if (!NLMISC::CFile::moveFile(outputHLSInfo.c_str(), cacheHLSInfo.c_str())) + if (!NLMISC::CFile::moveFile(outputHLSInfo, cacheHLSInfo)) { nlwarning(("Couldn't move " + cacheHLSInfo + " to " + outputHLSInfo).c_str()); return true; @@ -595,7 +595,7 @@ static bool CheckIfNeedRebuildColoredVersionForOneBitmap(const CBuildInfo &bi, c // get version that is in the cache std::string cacheDest = bi.OutputPath + outputFileName + bi.OutputFormat; - if (!NLMISC::CFile::moveFile(cacheDest.c_str(), searchName.c_str())) + if (!NLMISC::CFile::moveFile(cacheDest, searchName)) { nlwarning(("Couldn't move " + searchName + " to " + cacheDest).c_str()); return true; diff --git a/code/nel/tools/CMakeLists.txt b/code/nel/tools/CMakeLists.txt index 0e1c5709d..cb3e2b577 100644 --- a/code/nel/tools/CMakeLists.txt +++ b/code/nel/tools/CMakeLists.txt @@ -1,11 +1,15 @@ # Don't add other subdirectories if only max plugins are selected. +ADD_SUBDIRECTORY(misc) + IF(WITH_NEL_TOOLS) - ADD_SUBDIRECTORY(misc) ADD_SUBDIRECTORY(memory) ENDIF(WITH_NEL_TOOLS) # Max plugins are under the 3d directory as well. -ADD_SUBDIRECTORY(3d) +# Allow to compile only max plugins without other tools. +IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN) + ADD_SUBDIRECTORY(3d) +ENDIF() # Don't add other subdirectories if only max plugins are selected. IF(WITH_NEL_TOOLS) diff --git a/code/nel/tools/misc/CMakeLists.txt b/code/nel/tools/misc/CMakeLists.txt index 22328af82..8f962d1f2 100644 --- a/code/nel/tools/misc/CMakeLists.txt +++ b/code/nel/tools/misc/CMakeLists.txt @@ -1,23 +1,29 @@ -SUBDIRS(bnp_make disp_sheet_id extract_filename lock make_sheet_id xml_packer) - +# always compile crash report IF(WITH_QT OR WITH_QT5) - ADD_SUBDIRECTORY(words_dic_qt) - ADD_SUBDIRECTORY(message_box_qt) ADD_SUBDIRECTORY(crash_report) ENDIF() -IF(WIN32) - ADD_SUBDIRECTORY(exec_timeout) - ADD_SUBDIRECTORY(message_box) - ADD_SUBDIRECTORY(multi_cd_setup_fix) +IF(WITH_NEL_TOOLS) + SUBDIRS(bnp_make disp_sheet_id extract_filename lock make_sheet_id xml_packer) - IF(MFC_FOUND) - ADD_SUBDIRECTORY(branch_patcher) - ADD_SUBDIRECTORY(data_mirror) - ADD_SUBDIRECTORY(log_analyser) - ADD_SUBDIRECTORY(log_analyser_plug_ins) - ADD_SUBDIRECTORY(words_dic) + IF(WITH_QT OR WITH_QT5) + ADD_SUBDIRECTORY(words_dic_qt) + ADD_SUBDIRECTORY(message_box_qt) ENDIF() -ENDIF() -ADD_SUBDIRECTORY(probe_timers) + IF(WIN32) + ADD_SUBDIRECTORY(exec_timeout) + ADD_SUBDIRECTORY(message_box) + ADD_SUBDIRECTORY(multi_cd_setup_fix) + + IF(MFC_FOUND) + ADD_SUBDIRECTORY(branch_patcher) + ADD_SUBDIRECTORY(data_mirror) + ADD_SUBDIRECTORY(log_analyser) + ADD_SUBDIRECTORY(log_analyser_plug_ins) + ADD_SUBDIRECTORY(words_dic) + ENDIF() + ENDIF() + + ADD_SUBDIRECTORY(probe_timers) +ENDIF() diff --git a/code/nel/tools/misc/crash_report/CMakeLists.txt b/code/nel/tools/misc/crash_report/CMakeLists.txt index a67b2be5e..d230177f8 100644 --- a/code/nel/tools/misc/crash_report/CMakeLists.txt +++ b/code/nel/tools/misc/crash_report/CMakeLists.txt @@ -11,13 +11,13 @@ SET(CRASHREPORT_UI crash_report_widget.ui ) -SET(QT_USE_QTGUI TRUE) -SET(QT_USE_QTNETWORK TRUE) -SET(QT_USE_QTMAIN TRUE) -SET(QT_USE_QTOPENGL FALSE) -SET(QT_USE_QTXML FALSE) - IF(WITH_QT) + SET(QT_USE_QTGUI TRUE) + SET(QT_USE_QTNETWORK TRUE) + SET(QT_USE_QTMAIN TRUE) + SET(QT_USE_QTOPENGL FALSE) + SET(QT_USE_QTXML FALSE) + INCLUDE_DIRECTORIES(${QT_INCLUDES}) INCLUDE(${QT_USE_FILE}) ADD_DEFINITIONS(${QT_DEFINITIONS}) @@ -29,8 +29,6 @@ IF(WITH_QT) ELSE() QT5_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR}) QT5_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI}) - - SET(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network) ENDIF() SOURCE_GROUP(QtResources FILES ${CRASHREPORT_UI}) diff --git a/code/nel/tools/misc/crash_report/crash_report.cpp b/code/nel/tools/misc/crash_report/crash_report.cpp index c42f1ae6f..72cbc26bf 100644 --- a/code/nel/tools/misc/crash_report/crash_report.cpp +++ b/code/nel/tools/misc/crash_report/crash_report.cpp @@ -76,6 +76,19 @@ public: } }; +#ifdef QT_STATICPLUGIN + +#include + +#ifdef Q_OS_WIN32 + Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) +#endif + +#ifdef Q_OS_MAC + Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) +#endif +#endif + int main( int argc, char **argv ) { #ifndef WIN32 diff --git a/code/nel/tools/misc/message_box_qt/CMakeLists.txt b/code/nel/tools/misc/message_box_qt/CMakeLists.txt index 708e86cf7..be4dd2b63 100644 --- a/code/nel/tools/misc/message_box_qt/CMakeLists.txt +++ b/code/nel/tools/misc/message_box_qt/CMakeLists.txt @@ -1,8 +1,6 @@ IF(WITH_QT) INCLUDE_DIRECTORIES(${QT_INCLUDES}) INCLUDE(${QT_USE_FILE}) -ELSE() - SET(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Gui) ENDIF() INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/code/nel/tools/misc/words_dic_qt/CMakeLists.txt b/code/nel/tools/misc/words_dic_qt/CMakeLists.txt index 55a0a1c66..fc2ced95e 100644 --- a/code/nel/tools/misc/words_dic_qt/CMakeLists.txt +++ b/code/nel/tools/misc/words_dic_qt/CMakeLists.txt @@ -24,8 +24,6 @@ IF(WITH_QT) ADD_DEFINITIONS(${QT_DEFINITIONS}) ELSE() - SET(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Gui) - QT5_ADD_RESOURCES(WORDS_DIC_RC_SRCS ${WORDS_DIC_RCS}) QT5_WRAP_UI(WORDS_DIC_UI_HDRS ${WORDS_DIC_UIS}) QT5_WRAP_CPP(WORDS_DIC_MOC_SRCS ${WORDS_DIC_HDR}) diff --git a/code/nel/tools/nel_unit_test/ut_misc_file.h b/code/nel/tools/nel_unit_test/ut_misc_file.h index bf15267f0..34de2d569 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_file.h +++ b/code/nel/tools/nel_unit_test/ut_misc_file.h @@ -127,7 +127,7 @@ private: fclose(fp); fp = NULL; - NLMISC::CFile::moveFile(_DstFile.c_str(), _SrcFile.c_str()); + NLMISC::CFile::moveFile(_DstFile, _SrcFile); // verify the resulting file fp = fopen(_SrcFile.c_str(), "rb"); diff --git a/code/ryzom/CMakeLists.txt b/code/ryzom/CMakeLists.txt index eda0375d2..20590cc81 100644 --- a/code/ryzom/CMakeLists.txt +++ b/code/ryzom/CMakeLists.txt @@ -1,8 +1,6 @@ #----------------------------------------------------------------------------- #Platform specifics -FIND_PACKAGE(ZLIB) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common/src ) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common ) SET(RZ_SERVER_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/server/src) @@ -20,9 +18,7 @@ ELSEIF(WITH_RYZOM_TOOLS) ADD_SUBDIRECTORY(client) ENDIF(WITH_RYZOM_CLIENT) -IF(WITH_RYZOM_TOOLS) - ADD_SUBDIRECTORY(tools) -ENDIF(WITH_RYZOM_TOOLS) +ADD_SUBDIRECTORY(tools) IF(WITH_RYZOM_SERVER OR WITH_RYZOM_TOOLS) # Need servershare for build packed collision tool diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index b662468ce..fbaac2c86 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1744,7 +1744,7 @@ bool CInterfaceManager::loadConfig (const string &filename) string sFileNameBackup = sFileName+"backup"; if (CFile::fileExists(sFileNameBackup)) CFile::deleteFile(sFileNameBackup); - CFile::moveFile(sFileNameBackup.c_str(), sFileName.c_str()); + CFile::moveFile(sFileNameBackup, sFileName); nlwarning("Config loading failed : restore default"); vector v; if (!ClientCfg.R2EDEnabled) diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index c4a0b8076..42b9a530d 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -854,7 +854,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool else { deleteFile(DstName); - CFile::moveFile(DstName.c_str(), SrcName.c_str()); + CFile::moveFile(DstName, SrcName); } nblab++; @@ -1128,7 +1128,7 @@ void CPatchManager::renameFile (const string &src, const string &dst) ucstring s = CI18N::get("uiRenameFile") + " " + NLMISC::CFile::getFilename(src); setState(true, s); - if (!NLMISC::CFile::moveFile(dst.c_str(), src.c_str())) + if (!NLMISC::CFile::moveFile(dst, src)) { s = CI18N::get("uiRenameErr") + " " + src + " -> " + dst + " (" + toString(errno) + "," + strerror(errno) + ")"; setState(true, s); @@ -3677,7 +3677,7 @@ void CDownloadThread::run() try { pPM->getServerFile(patchName, false, tmpFile); - NLMISC::CFile::moveFile(finalFile.c_str(), tmpFile.c_str()); + NLMISC::CFile::moveFile(finalFile, tmpFile); pPM->applyDate(finalFile, _Entries[first].Timestamp); } diff --git a/code/ryzom/client/src/r2/auto_group.cpp b/code/ryzom/client/src/r2/auto_group.cpp index 7ec0456b6..5a69511d3 100644 --- a/code/ryzom/client/src/r2/auto_group.cpp +++ b/code/ryzom/client/src/r2/auto_group.cpp @@ -120,9 +120,9 @@ CInstance *CAutoGroup::getGroupingCandidate() { CObject *obj = NULL; if(kgetSize()) - obj = components->getValue(k); + obj = components->getValueAtPos(k); else - obj = baseComponents->getValue(k - components->getSize()); + obj = baseComponents->getValueAtPos(k - components->getSize()); CInstance *inst = getEditor().getInstanceFromObject(obj); if (!inst) { @@ -148,9 +148,9 @@ CInstance *CAutoGroup::getGroupingCandidate() { CObject *obj = NULL; if(kgetSize()) - obj = features->getValue(k); + obj = features->getValueAtPos(k); else - obj = baseFeatures->getValue(k - features->getSize()); + obj = baseFeatures->getValueAtPos(k - features->getSize()); CInstance *inst = getEditor().getInstanceFromObject(obj); CDisplayerVisual *dv = inst->getDisplayerVisual(); if (!dv) continue; diff --git a/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp b/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp index cb00080dc..1d24b266c 100644 --- a/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp @@ -124,7 +124,7 @@ void CDisplayerVisualActivitySequence::update() for(uint k = 0; k < activities->getSize(); ++k) { // search next zone of activity - CObjectTable *activity = activities->getValue(k)->toTable(); + CObjectTable *activity = activities->getValueAtPos(k)->toTable(); if (!activity) continue; std::string activityStr = getString(activity, "Activity"); if (activityStr == "Stand Still" || activityStr == "Inactive") continue; @@ -369,7 +369,7 @@ void CDisplayerVisualActivitySequence::onPostRender() for(uint k = 0; k < activities->getSize(); ++k) { // search next zone of activity - CObjectTable *activity = activities->getValue(k)->toTable(); + CObjectTable *activity = activities->getValueAtPos(k)->toTable(); if (!activity) continue; std::string zoneId = getString(activity, "ActivityZoneId"); if (zoneId.empty()) continue; diff --git a/code/ryzom/client/src/r2/displayer_visual_entity.cpp b/code/ryzom/client/src/r2/displayer_visual_entity.cpp index 2e9eeef7a..6b5e091e2 100644 --- a/code/ryzom/client/src/r2/displayer_visual_entity.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_entity.cpp @@ -978,7 +978,7 @@ void CDisplayerVisualEntity::updateName() sint actNb = -1; for(uint i=0; igetSize(); i++) { - if(acts->getValue(i)->equal(act)) + if(acts->getValueAtPos(i)->equal(act)) { actNb = i; break; diff --git a/code/ryzom/client/src/r2/displayer_visual_group.cpp b/code/ryzom/client/src/r2/displayer_visual_group.cpp index 6d80530a4..da0ac31c5 100644 --- a/code/ryzom/client/src/r2/displayer_visual_group.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_group.cpp @@ -755,7 +755,7 @@ void CDisplayerVisualGroup::updateInstanceList() const _Instances.resize(sons->getSize()); for(uint k = 0; k < sons->getSize(); ++k) { - CInstance *inst = getEditor().getInstanceFromObject(sons->getValue(k)); + CInstance *inst = getEditor().getInstanceFromObject(sons->getValueAtPos(k)); if (inst) { _Instances[k] = inst->getDisplayerVisual(); diff --git a/code/ryzom/client/src/r2/dmc/com_lua_module.cpp b/code/ryzom/client/src/r2/dmc/com_lua_module.cpp index 439265734..d3f5b1a65 100644 --- a/code/ryzom/client/src/r2/dmc/com_lua_module.cpp +++ b/code/ryzom/client/src/r2/dmc/com_lua_module.cpp @@ -1114,7 +1114,7 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object) for (first=0 ; first != last; ++first) { std::string key = object->getKey(first); - CObject *value = object->getValue(first); + CObject *value = object->getValueAtPos(first); if (!key.empty()) { lua_pushstring(state, key.c_str()); @@ -2246,7 +2246,7 @@ sint CComLuaModule::luaUpdateScenarioAck(lua_State* state) for(uint i = 0; i < size; ++i) { std::string key = object->getKey(i); - CObject* value = object->getValue(i); + CObject* value = object->getValueAtPos(i); if (value->isInteger()) { diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index dae1a5fb8..2cc6c1812 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -3224,7 +3224,7 @@ void CEditor::initObjectProjectionMetatable() if (ls.isInteger(2)) { // index is an integer - const CObject *other = obj->getValue((uint32) ls.toInteger(2)); + const CObject *other = obj->getValueAtPos((uint32) ls.toInteger(2)); if (other) { pushValue(ls, other); @@ -3569,7 +3569,7 @@ void CEditor::initObjectProjectionMetatable() } ls.pop(2); pushKey(ls, obj, 0); - pushValue(ls, obj->getValue(0)); + pushValue(ls, obj->getValueAtPos(0)); return 2; } } @@ -3618,7 +3618,7 @@ void CEditor::initObjectProjectionMetatable() { ls.pop(2); pushKey(ls, obj, newIndex); - pushValue(ls, obj->getValue(newIndex)); + pushValue(ls, obj->getValueAtPos(newIndex)); return 2; } } @@ -3751,7 +3751,7 @@ void CEditor::setCurrentActFromTitle(const std::string &wantedTitle) { for(uint k = 0; k < actTable->getSize(); ++k) { - R2::CObject *act = actTable->getValue(k); + R2::CObject *act = actTable->getValueAtPos(k); nlassert(act); std::string actTitle; if (act->isString("Name")) @@ -4560,7 +4560,7 @@ void CEditor::updatePrimitiveContextualVisibility() for(uint k = 0; k < activities->getSize(); ++k) { // search next zone of activity - CObjectTable *activity = activities->getValue(k)->toTable(); + CObjectTable *activity = activities->getValueAtPos(k)->toTable(); if (!activity) continue; std::string zoneId = getString(activity, "ActivityZoneId"); CInstance *primitive = getInstanceFromId(zoneId); @@ -4734,7 +4734,7 @@ void CEditor::autoSave() { CFile::deleteFile(next); } - CFile::moveFile(next.c_str(), current.c_str()); + CFile::moveFile(next, current); } } @@ -5031,7 +5031,7 @@ void CEditor::onErase(CObject *root, bool &foundInBase, std::string &nameInParen { for(uint k = 0; k < root->getSize(); ++k) { - CObject *obj = root->getValue(k); + CObject *obj = root->getValueAtPos(k); if (obj->isTable()) { onErase(obj); @@ -5122,7 +5122,7 @@ void CEditor::onErase(CObject *root, bool &foundInBase, std::string &nameInParen CObjectTable *rootTable = root->toTable(); for (uint32 k = 0; k < rootTable->getSize(); ++k) { - CObject *obj = rootTable->getValue(k); + CObject *obj = rootTable->getValueAtPos(k); CObjectRefIdClient *objRefId = dynamic_cast(obj); if (objRefId) { @@ -5547,7 +5547,7 @@ void CEditor::createNewInstanceForObjectTableInternal(const CObject *obj) // do the same on sons for(uint k = 0; k < table->getSize(); ++k) { - createNewInstanceForObjectTableInternal(table->getValue(k)); + createNewInstanceForObjectTableInternal(table->getValueAtPos(k)); } } @@ -5754,7 +5754,7 @@ void CEditor::scenarioUpdated(CObject* highLevel, bool willTP, uint32 initialAct CObject *acts = _Scenario->getAttr("Acts"); if (acts) { - CObject *baseAct = acts->getValue(0); + CObject *baseAct = acts->getValueAtPos(0); if (baseAct) { _BaseAct = getInstanceFromId(baseAct->toString("InstanceId")); @@ -5871,7 +5871,7 @@ CInstance *CEditor::getDefaultFeature(CInstance *act) if (!act) return NULL; CObject *defaultFeature = act->getObjectTable()->getAttr("Features"); if (!defaultFeature) return NULL; - defaultFeature = defaultFeature->getValue(0); + defaultFeature = defaultFeature->getValueAtPos(0); if (!defaultFeature) return NULL; // 0 should be the default feature CInstance *result = getInstanceFromId(defaultFeature->toString("InstanceId")); if (!result) return NULL; diff --git a/code/ryzom/client/src/r2/instance.cpp b/code/ryzom/client/src/r2/instance.cpp index 2baec8431..597e58d5d 100644 --- a/code/ryzom/client/src/r2/instance.cpp +++ b/code/ryzom/client/src/r2/instance.cpp @@ -754,7 +754,7 @@ const CInstance *CInstance::getParentGroupLeader() const { return NULL; } - return getEditor().getInstanceFromObject(components->getValue(0)); + return getEditor().getInstanceFromObject(components->getValueAtPos(0)); } // ********************************************************************************************************* @@ -776,7 +776,7 @@ CObject *CInstance::getGroupSelectedSequence() const { if (selectedSequence >= 0 && selectedSequence < (sint) activities->getSize()) { - return activities->getValue((sint32) selectedSequence); + return activities->getValueAtPos((sint32) selectedSequence); } } } diff --git a/code/ryzom/client/src/r2/object_factory_client.cpp b/code/ryzom/client/src/r2/object_factory_client.cpp index 2b267dd78..688ec3fcb 100644 --- a/code/ryzom/client/src/r2/object_factory_client.cpp +++ b/code/ryzom/client/src/r2/object_factory_client.cpp @@ -221,7 +221,7 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray { if (_IndexInParentArray == -1) { - if (parentInstanceTable->getValue(_IndexInParent) == static_cast(this)) + if (parentInstanceTable->getValueAtPos(_IndexInParent) == static_cast(this)) { name = parentInstanceTable->getKey(_IndexInParent); indexInArray = -1; @@ -230,13 +230,13 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray } else { - CObject *subObject = parentInstanceTable->getValue(_IndexInParent); + CObject *subObject = parentInstanceTable->getValueAtPos(_IndexInParent); if (subObject->isTable()) { CObjectTable *subTable = (CObjectTable *) subObject; if (_IndexInParentArray < (sint32) subTable->getSize()) { - if (subTable->getValue(_IndexInParentArray) == static_cast(this)) + if (subTable->getValueAtPos(_IndexInParentArray) == static_cast(this)) { name = parentInstanceTable->getKey(_IndexInParent); indexInArray = _IndexInParentArray; @@ -261,7 +261,7 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray // if instance is the direct parent (e.g object is not in an array of the parent) for (uint k = 0; k < parentInstanceTable->getSize(); ++k) { - if (parentInstanceTable->getValue(k) == ptrInParent) + if (parentInstanceTable->getValueAtPos(k) == ptrInParent) { _IndexInParent = k; if (ptrInParent == this) @@ -276,7 +276,7 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray // I'm in an array in my parent, retrieve the index for (uint l = 0; l < getParent()->getSize(); ++l) { - if (getParent()->getValue(l) == static_cast(this)) + if (getParent()->getValueAtPos(l) == static_cast(this)) { name = parentInstanceTable->getKey(_IndexInParent); _IndexInParentArray = l; diff --git a/code/ryzom/common/src/game_share/crypt_sha512.cpp b/code/ryzom/common/src/game_share/crypt_sha512.cpp index 4d151880d..70a142baa 100644 --- a/code/ryzom/common/src/game_share/crypt_sha512.cpp +++ b/code/ryzom/common/src/game_share/crypt_sha512.cpp @@ -321,11 +321,28 @@ static char *sha512crypt(const char *key, const char *setting, char *output) p += sprintf(p, "$6$%s%.*s$", rounds, slen, salt); #if 1 static const unsigned char perm[][3] = { - 0,21,42,22,43,1,44,2,23,3,24,45,25,46,4, - 47,5,26,6,27,48,28,49,7,50,8,29,9,30,51, - 31,52,10,53,11,32,12,33,54,34,55,13,56,14,35, - 15,36,57,37,58,16,59,17,38,18,39,60,40,61,19, - 62,20,41 }; + { 0, 21, 42 }, + { 22, 43, 1 }, + { 44, 2, 23 }, + { 3, 24, 45 }, + { 25, 46, 4 }, + { 47, 5, 26 }, + { 6, 27, 48 }, + { 28, 49, 7 }, + { 50, 8, 29 }, + { 9, 30, 51 }, + { 31, 52, 10 }, + { 53, 11, 32 }, + { 12, 33, 54 }, + { 34, 55, 13 }, + { 56, 14, 35 }, + { 15, 36, 57 }, + { 37, 58, 16 }, + { 59, 17, 38 }, + { 18, 39, 60 }, + { 40, 61, 19 }, + { 62, 20, 41 } + }; for (i=0; i<21; i++) p = to64(p, (md[perm[i][0]]<<16)|(md[perm[i][1]]<<8)|md[perm[i][2]], 4); #else diff --git a/code/ryzom/common/src/game_share/mirror_prop_value.h b/code/ryzom/common/src/game_share/mirror_prop_value.h index cbc251be2..b9bc7956e 100644 --- a/code/ryzom/common/src/game_share/mirror_prop_value.h +++ b/code/ryzom/common/src/game_share/mirror_prop_value.h @@ -1154,8 +1154,8 @@ public: friend iterator; // MSVC friend const_iterator; #else - template friend class _CMirrorPropValueListIterator; // GCC3 - template friend class _CCMirrorPropValueListIterator; + template friend struct _CMirrorPropValueListIterator; // GCC3 + template friend struct _CCMirrorPropValueListIterator; #endif /// Constructor @@ -1241,9 +1241,9 @@ public: friend iterator; // MSVC friend const_iterator; #else - template friend class _CMirrorPropValueListIterator; // GCC3 - template friend class _CCMirrorPropValueListIterator; - template friend class CMirrorPropValueItem; + template friend struct _CMirrorPropValueListIterator; // GCC3 + template friend struct _CCMirrorPropValueListIterator; + template friend class CMirrorPropValueItem; #endif /// Constructor diff --git a/code/ryzom/common/src/game_share/object.cpp b/code/ryzom/common/src/game_share/object.cpp index 0505a8b35..f4426d067 100644 --- a/code/ryzom/common/src/game_share/object.cpp +++ b/code/ryzom/common/src/game_share/object.cpp @@ -392,7 +392,7 @@ CObject* CObject::getAttr(const std::string & /* name */) const { return 0;} std::string CObject::getKey(uint32 /* pos */) const{ BOMB("Try to call the function getKey() on an object that is not a table", return ""); return "";} -CObject* CObject::getValue(uint32 /* pos */) const{ BOMB("Try to call the function getValue() on an object that is not a table", return 0); return 0;} +CObject* CObject::getValueAtPos(uint32 /* pos */) const{ BOMB("Try to call the function getValueAtPos() on an object that is not a table", return 0); return 0;} uint32 CObject::getSize() const { BOMB("Try to call the function getSize() on an object that is not a table", return 0); return 0; } @@ -974,7 +974,7 @@ void CObjectTable::checkIntegrity() const { for(uint k = 0; k < getSize(); ++k) { - CObject *subObj = getValue(k); + CObject *subObj = getValueAtPos(k); if (subObj) { if (!subObj->getGhost()) @@ -1017,7 +1017,7 @@ void CObjectTable::setGhost(bool ghost) for(uint k = 0; k < getSize(); ++k) { - CObject *subObj = getValue(k); + CObject *subObj = getValueAtPos(k); if (subObj) { subObj->setGhost(ghost); @@ -1031,7 +1031,7 @@ void CObjectTable::previsit(std::vector &sons) sons.reserve(sons.size() + getSize()); for(uint k = 0; k < getSize(); ++k) { - CObject *subObj = getValue(k); + CObject *subObj = getValueAtPos(k); if (subObj) { subObj->previsit(sons); @@ -1068,7 +1068,7 @@ void CObjectTable::inPlaceCopy(const CObjectTable &src) } else { - src.getValue(k)->inPlaceCopyTo(*dest); + src.getValueAtPos(k)->inPlaceCopyTo(*dest); } } else @@ -1115,7 +1115,7 @@ void CObjectTable::sort() uint32 lastKey = keys->getSize(); for (; firstKey != lastKey ; ++firstKey) { - CObject* keyObject = keys->getValue(firstKey); + CObject* keyObject = keys->getValueAtPos(firstKey); if (! keyObject->isString()) return; std::string key = keyObject->toString(); @@ -1344,7 +1344,7 @@ std::string CObjectTable::getKey(uint32 pos) const return _Value[pos].first; } -CObject* CObjectTable::getValue(uint32 pos) const +CObject* CObjectTable::getValueAtPos(uint32 pos) const { //H_AUTO(R2_CObjectTable_getValue) if (pos >= _Value.size()) @@ -1404,7 +1404,7 @@ bool CObjectTable::setObject(const std::string& key, CObject* value) for ( ; first != last ; ++first) { std::string key1 = table->getKey(first); - CObject* value1 = table->getValue(first); + CObject* value1 = table->getValueAtPos(first); add(key1, value1->clone()); } return true; @@ -1577,9 +1577,9 @@ bool CObjectTable::equal(const CObject* other) const for ( i=0; i!= size ; ++i ) { std::string key = other->getKey(i); - CObject* value = other->getValue(i); + CObject* value = other->getValueAtPos(i); if (key != this->getKey(i)) return false; - if ( !value->equal(this->getValue(i))) return false; + if ( !value->equal(this->getValueAtPos(i))) return false; } return true; } @@ -1835,7 +1835,7 @@ void CObjectGenerator::createDefaultValues(CObjectFactory* factory) uint32 last = prop->getSize(); for ( ; first != last ; ++first ) { - CObject* found = prop->getValue(first); + CObject* found = prop->getValueAtPos(first); if (found && found->isString("DefaultValue") && found->isString("Name") ) { @@ -1895,7 +1895,7 @@ CObject* CObjectGenerator::instanciate(CObjectFactory* factory) const uint32 last = prop->getSize(); for ( ; first != last ; ++first ) { - CObject* found = prop->getValue(first); + CObject* found = prop->getValueAtPos(first); if (found && found->isString("Type") ) { @@ -2461,7 +2461,7 @@ public: uint8 shortKey = static_cast(uiKey); stream.serial(shortKey); - CObject*value = data->getValue(optionalPropFoundIndex[first]); + CObject*value = data->getValueAtPos(optionalPropFoundIndex[first]); if (serializer->Log) { nldebug("R2NET: (%u) Field '%s'", serializer->Level, key.c_str());} onSerial(stream, key, value, serializer); } @@ -2483,7 +2483,7 @@ public: stream.serial(last16); for (; first != last; ++first) { - CObject* value = data->getValue(valuePropFoundIndex[first]); + CObject* value = data->getValueAtPos(valuePropFoundIndex[first]); if (serializer->Log) { nldebug("R2NET: (%u) Field [%u]", serializer->Level, first);} CObjectSerializerImpl::getInstance().serialImpl(stream, value, serializer); } @@ -2509,7 +2509,7 @@ public: { uint32 keyIndex = otherPropFoundIndex[first]; std::string key = data->getKey(keyIndex); - CObject* value = data->getValue(keyIndex); + CObject* value = data->getValueAtPos(keyIndex); stream.serial(key); if (serializer->Log) { nldebug("R2NET: (%u) Field '%s'", serializer->Level, key.c_str());} CObjectSerializerImpl::getInstance().serialImpl(stream, value, serializer); @@ -3270,7 +3270,7 @@ void CObjectSerializerImpl::serialImpl(NLMISC::IStream& stream, CObject*& data, for (uint first = 0; first != size; ++first) { std::string key = data->getKey(first); - CObject* value = data->getValue(first); + CObject* value = data->getValueAtPos(first); stream.serial(key); ++ (serializer->Level); if (serializer->Log) { nldebug("R2NET: (%u) Field '%s'", serializer->Level, key.c_str());} diff --git a/code/ryzom/common/src/game_share/object.h b/code/ryzom/common/src/game_share/object.h index 71a30f32d..7d4ab1f49 100644 --- a/code/ryzom/common/src/game_share/object.h +++ b/code/ryzom/common/src/game_share/object.h @@ -114,7 +114,7 @@ public: virtual std::string getKey(uint32 pos) const; - virtual CObject* getValue(uint32 pos) const; + virtual CObject* getValueAtPos(uint32 pos) const; virtual uint32 getSize() const; @@ -385,7 +385,7 @@ public: virtual std::string getKey(uint32 pos) const; - virtual CObject* getValue(uint32 pos) const; + virtual CObject* getValueAtPos(uint32 pos) const; virtual sint32 findIndex(const CObject* child) const; diff --git a/code/ryzom/common/src/game_share/ring_access.cpp b/code/ryzom/common/src/game_share/ring_access.cpp index ee9d870ee..c191f8c83 100644 --- a/code/ryzom/common/src/game_share/ring_access.cpp +++ b/code/ryzom/common/src/game_share/ring_access.cpp @@ -421,7 +421,7 @@ bool CRingAccess::verifyRtScenario(CObject* rtScenario, const std::string& charR for ( ;firstLocation != lastLocation; ++firstLocation) { - CObject* location = locations->getValue(firstLocation); + CObject* location = locations->getValueAtPos(firstLocation); if (!location || !location->isString("Island")) { err = new CVerfiyRightRtScenarioError(CVerfiyRightRtScenarioError::InvalidData); @@ -445,7 +445,7 @@ bool CRingAccess::verifyRtScenario(CObject* rtScenario, const std::string& charR uint32 lastActIndex = acts->getSize(); for ( ;firstActIndex != lastActIndex; ++firstActIndex) { - CObject* act = acts->getValue(firstActIndex); + CObject* act = acts->getValueAtPos(firstActIndex); if (!act || !act->isTable() || !act->isTable("Npcs")) { err = new CVerfiyRightRtScenarioError(CVerfiyRightRtScenarioError::InvalidData); @@ -457,7 +457,7 @@ bool CRingAccess::verifyRtScenario(CObject* rtScenario, const std::string& charR uint32 lastNpcIndex = npcs->getSize(); for (; firstNpcIndex != lastNpcIndex; ++firstNpcIndex) { - CObject* npc = npcs->getValue(firstNpcIndex); + CObject* npc = npcs->getValueAtPos(firstNpcIndex); if (npc && npc->isTable() && npc->isString("SheetClient") && npc->isString("Sheet")) { std::string botName; diff --git a/code/ryzom/common/src/game_share/scenario.cpp b/code/ryzom/common/src/game_share/scenario.cpp index 6911df31a..120b422d2 100644 --- a/code/ryzom/common/src/game_share/scenario.cpp +++ b/code/ryzom/common/src/game_share/scenario.cpp @@ -122,7 +122,7 @@ CObject *CScenario::find(const std::string& instanceId, const std::string & attr } if (position != -1) { - CObject *subObj = src->getValue(position); + CObject *subObj = src->getValueAtPos(position); if (!subObj) { nlwarning("Can't find attribute %s[%d] inside object with InstanceId = %s", attrName.c_str(), (int) position, instanceId.c_str()); @@ -388,7 +388,7 @@ void CInstanceMap::add(CObject* root) sint32 first = 0; for (first = 0 ; first != size ; ++first) { - CObject* value = root->getValue(first); + CObject* value = root->getValueAtPos(first); add(value); } @@ -416,7 +416,7 @@ void CInstanceMap::remove(CObject* root) sint32 first = 0; for (first = 0 ; first != size ; ++first) { - CObject* value = root->getValue(first); + CObject* value = root->getValueAtPos(first); remove(value); } diff --git a/code/ryzom/common/src/game_share/server_animation_module.cpp b/code/ryzom/common/src/game_share/server_animation_module.cpp index 794d88212..8dd02f621 100644 --- a/code/ryzom/common/src/game_share/server_animation_module.cpp +++ b/code/ryzom/common/src/game_share/server_animation_module.cpp @@ -691,7 +691,7 @@ void CAttributeToProperty::setPrimPath() points->VPoints.resize(last); for ( ; first != last ; ++first ) { - CObject* pt = pts->getValue(first); + CObject* pt = pts->getValueAtPos(first); attr = pt->getAttr("x"); if (attr && attr->isNumber()) { points->VPoints[first].x = static_cast(attr->toNumber()); } @@ -721,7 +721,7 @@ void CAttributeToProperty::setPrimZone() points->VPoints.resize(last); for ( ; first != last ; ++first ) { - CObject* pt = pts->getValue(first); + CObject* pt = pts->getValueAtPos(first); attr = pt->getAttr("x"); if (attr && attr->isNumber()) { points->VPoints[first].x = static_cast(attr->toNumber()); } @@ -1103,7 +1103,7 @@ IPrimitive* CServerAnimationModule::getAction(CObject* action, const std::string uint32 nb =children->getSize(); for(uint32 i=0;igetValue(i), prefix,scenarioId); + IPrimitive* tmp=getAction(children->getValueAtPos(i), prefix,scenarioId); if (!tmp) { nlwarning("Error in action %s nb: %u", action->toString("Name").c_str(), i); @@ -1466,7 +1466,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C for ( ; firstAiState != lastAiState ; ++firstAiState) { - CObject* aiState = aiStates->getValue(firstAiState); + CObject* aiState = aiStates->getValueAtPos(firstAiState); std::string aiMovement = aiState->toString("AiMovement"); @@ -1532,7 +1532,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C uint32 firstChild(0), lastChild(children->getSize()); for ( ; firstChild != lastChild ; ++firstChild) { - CObject* childName = children->getValue(firstChild); + CObject* childName = children->getValueAtPos(firstChild); CObject* component = components.find(childName->toString()); @@ -1597,7 +1597,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C uint32 firstNpc(0), lastNpc(npcChild->getSize()); for ( ; firstNpc != lastNpc ; ++firstNpc) { - CObject* objectNpcId = npcChild->getValue(firstNpc); + CObject* objectNpcId = npcChild->getValueAtPos(firstNpc); std::string npcId ( objectNpcId->toString() ); CObject* objectNpc = components.find(npcId); @@ -1760,14 +1760,14 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C for(;firstEvent!=lastEvent;++firstEvent) { //create the primitive event and its associated actions - IPrimitive* pEvent = getEvent(events->getValue(firstEvent), components, prefix, animSession->SessionId); + IPrimitive* pEvent = getEvent(events->getValueAtPos(firstEvent), components, prefix, animSession->SessionId); if (!pEvent) { nlwarning("Error while generating primitive"); return false; } //insert the primitive event - CObject* eventObject = events->getValue(firstEvent); + CObject* eventObject = events->getValueAtPos(firstEvent); bool isTriggerZone = false; if ( eventObject->isInteger("IsTriggerZone") ) @@ -1806,7 +1806,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C uint32 firstnode = 0; for (; firstnode != lastnode; ++firstnode) { - CObject* node = tree->getValue(firstnode); + CObject* node = tree->getValueAtPos(firstnode); if (!node || !node->isTable() || !node->isString("Name") @@ -1898,7 +1898,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi uint32 firstPlotItem = 0; for (; firstPlotItem != lastPlotItem; ++firstPlotItem) { - CObject* plotItem = plotItems->getValue(firstPlotItem); + CObject* plotItem = plotItems->getValueAtPos(firstPlotItem); if (!plotItem || !plotItem->isTable() || !plotItem->isInteger("SheetId") @@ -1955,7 +1955,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi uint32 firstLocation = 0; for (; firstLocation != lastLocation; ++firstLocation) { - CObject* location = locations->getValue(firstLocation); + CObject* location = locations->getValueAtPos(firstLocation); if (!location || !location->isTable() || !location->isInteger("Season") @@ -1991,7 +1991,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi for (; firstAct != lastAct ; ++firstAct) { //std::string key = acts->getKey(firstAct); - CObject* act= acts->getValue(firstAct); + CObject* act= acts->getValueAtPos(firstAct); if (!act) { nlwarning("R2An: Can't make animation session, invalid RtAct"); @@ -3697,7 +3697,7 @@ IPrimitive* CServerAnimationModule::getEvent(CObject* event,CInstanceMap& compon //for each action of this event for(;firstAction!=lastAction;++firstAction) { - CObject * action_id = actions_id->getValue(firstAction); + CObject * action_id = actions_id->getValueAtPos(firstAction); std::string id = action_id->toString(); CObject* action=components.find(id); // can be null? if (!action) @@ -3770,7 +3770,7 @@ void CServerAnimationModule::requestLoadTable(CAnimationSession* session) msg.serial(size); for(uint32 i=0;igetValue(i); + CObject* entry = textsTable->getValueAtPos(i); std::string tmp = entry->getAttr("Id")->toString(); msg.serial(tmp); tmp = entry->getAttr("Text")->toString(); diff --git a/code/ryzom/common/src/game_share/server_edition_module.cpp b/code/ryzom/common/src/game_share/server_edition_module.cpp index e044e1323..2005879c1 100644 --- a/code/ryzom/common/src/game_share/server_edition_module.cpp +++ b/code/ryzom/common/src/game_share/server_edition_module.cpp @@ -3645,7 +3645,7 @@ bool CServerEditionModule::checkScenario(CObject* scenario) uint32 max = acts->getSize(); for(uint32 i = 0;igetValue(i); + CObject * act = acts->getValueAtPos(i); CObject * npcs = act->findAttr("Npcs"); CObject * states = act->findAttr("AiStates"); if (states && states->isTable()) @@ -4022,14 +4022,14 @@ bool CServerEditionModule::getPosition(TSessionId sessionId, double& x, double& CObject* acts = hl->getAttr("Acts"); BOMB_IF(!acts || !acts->isTable() || actIndex >= acts->getSize(), "Invalid acts.", return false); - CObject* selectedAct = acts->getValue(actIndex); + CObject* selectedAct = acts->getValueAtPos(actIndex); BOMB_IF(!selectedAct || !selectedAct->isString("LocationId"), "Invalid act.", return false); std::string locationInstanceId = selectedAct->toString("LocationId"); uint32 firstLocationIndex = 0, lastLocationIndex = locations->getSize(); for (; firstLocationIndex != lastLocationIndex; ++firstLocationIndex) { - CObject* location = locations->getValue(firstLocationIndex); + CObject* location = locations->getValueAtPos(firstLocationIndex); if ( location && location->isString("InstanceId") && location->toString("InstanceId") == locationInstanceId ) { locationId = firstLocationIndex; @@ -4043,7 +4043,7 @@ bool CServerEditionModule::getPosition(TSessionId sessionId, double& x, double& - CObject* firstLocation = locations->getValue(locationId); + CObject* firstLocation = locations->getValueAtPos(locationId); BOMB_IF(!firstLocation || !firstLocation->isTable(), "Invalid location.", return false); CObject* entryPointObj = firstLocation->getAttr("EntryPoint"); 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 e57d7d17b..83414b668 100644 --- a/code/ryzom/common/src/game_share/small_string_manager.cpp +++ b/code/ryzom/common/src/game_share/small_string_manager.cpp @@ -123,7 +123,7 @@ CSmallStringManager::CSmallStringManager(CObject* textManager) //unused ids for(uint32 i=0;i(unused->getValue(i)->toInteger()); + uint32 id = static_cast(unused->getValueAtPos(i)->toInteger()); _FreeIds.insert(id); } @@ -131,7 +131,7 @@ CSmallStringManager::CSmallStringManager(CObject* textManager) max = texts->getSize(); for(uint32 i=0;igetValue(i); + CObject* entry = texts->getValueAtPos(i); std::string text = entry->getAttr("Text")->toString(); uint32 textId = static_cast(entry->getAttr("TextId")->toInteger()); uint32 textCount = static_cast(entry->getAttr("Count")->toInteger()); 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 9aaa232a2..49d9a9122 100644 --- a/code/ryzom/common/src/game_share/string_mgr_module.cpp +++ b/code/ryzom/common/src/game_share/string_mgr_module.cpp @@ -417,7 +417,7 @@ void CStringManagerModule::registerTableRequested(TSessionId sessionId,CObject* //for each entry of the local table for(uint i=0;igetValue(i); + CObject* text = textsTable->getValueAtPos(i); CObject* tmp = text->getAttr("Id"); nlassert(tmp); std::string localId = tmp->toString(); diff --git a/code/ryzom/server/src/backup_service/backup_file_access.cpp b/code/ryzom/server/src/backup_service/backup_file_access.cpp index d039a147d..7663424e4 100644 --- a/code/ryzom/server/src/backup_service/backup_file_access.cpp +++ b/code/ryzom/server/src/backup_service/backup_file_access.cpp @@ -478,7 +478,7 @@ IFileAccess::TReturnCode CDeleteFile::execute(CFileAccessManager& manager) } while (i <= 10000 && NLMISC::CFile::fileExists(backup)); - fileBackuped = (i <= 10000 && NLMISC::CFile::moveFile(backup.c_str(), (getBackupFileName(Filename)).c_str())); + fileBackuped = (i <= 10000 && NLMISC::CFile::moveFile(backup, getBackupFileName(Filename))); } catch (...) { diff --git a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp index 8ca025870..e6d4d3d8c 100644 --- a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp +++ b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp @@ -3244,8 +3244,8 @@ NLMISC_COMMAND(moveCharAndOfflineCmdToHashTable, "Move all character and offline CFile::createDirectory(PlayerManager.getCharacterPath(userId, false)); // move the file CFile::moveFile( - (PlayerManager.getCharacterPath(userId, false)+CFile::getFilename(allChars[i])).c_str(), - allChars[i].c_str() + PlayerManager.getCharacterPath(userId, false)+CFile::getFilename(allChars[i]), + allChars[i] ); } } @@ -3271,8 +3271,8 @@ NLMISC_COMMAND(moveCharAndOfflineCmdToHashTable, "Move all character and offline CFile::createDirectory(PlayerManager.getOfflineCommandPath(userId, false)); // move the file CFile::moveFile( - (PlayerManager.getOfflineCommandPath(userId, false)+CFile::getFilename(allCommands[i])).c_str(), - allCommands[i].c_str() + PlayerManager.getOfflineCommandPath(userId, false)+CFile::getFilename(allCommands[i]), + allCommands[i] ); } } diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player.cpp b/code/ryzom/server/src/entities_game_service/player_manager/player.cpp index 10544a40b..03efc8291 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/player.cpp @@ -127,7 +127,7 @@ void CPlayer::checkCrashMarker() wipeAndRestore(NLMISC::toString("%s/account_%u_%d_pdr.bin", PlayerManager.getCharacterPath(userId, false).c_str(), userId, charId)); // string fileName = makeCharacterFileName(lastBad[0], lastBad[1]); - // CFile::moveFile((fileName+".wiped").c_str(), fileName.c_str()); + // CFile::moveFile(fileName+".wiped", fileName); // // // try to restore a backup // if (CFile::isExists(fileName+".last_good")) @@ -166,9 +166,9 @@ bool wipeAndRestore(const std::string &fileName) return false; } // move the last wiped file - CFile::moveFile(incFn.c_str(), newfn.c_str()); + CFile::moveFile(incFn, newfn); } - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); // // try to restore a backup //if (CFile::isExists(fileName+".last_good")) @@ -811,13 +811,13 @@ void CPlayer::loadAllCharacters() { nlwarning("Failed to load '%s': %s", serialBinFileName.c_str(), e.what()); string newfn = serialBinFileName+".wiped"; - CFile::moveFile(newfn.c_str(), serialBinFileName.c_str()); + CFile::moveFile(newfn, serialBinFileName); } catch(...) { nlwarning("Failed to load '%s': low level exception", serialBinFileName.c_str()); string newfn = serialBinFileName+".wiped"; - CFile::moveFile(newfn.c_str(), serialBinFileName.c_str()); + CFile::moveFile(newfn, serialBinFileName); } } break; @@ -910,13 +910,13 @@ void CPlayer::loadAllCharacters() { nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); } catch(...) { nlwarning("Failed to load '%s': low level exception", fileName.c_str()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); } } else @@ -937,13 +937,13 @@ void CPlayer::loadAllCharacters() { nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); } catch(...) { nlwarning("Failed to load '%s': low level exception", fileName.c_str()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); } } } @@ -983,14 +983,14 @@ void CPlayer::loadAllCharactersPdr() { nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); continue; } catch(...) { nlwarning("Failed to load '%s': low level exception", fileName.c_str()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); continue; } diff --git a/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp b/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp index dcd402abb..ee7669e19 100644 --- a/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp +++ b/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp @@ -477,7 +477,7 @@ void CRepositoryReceiver::fileEnd(NLNET::IModuleProxy *sender, const std::string // rename the temp file // note that the _receiveBeginFile() method will have removed any file that could be in the way... - bool renameOk= NLMISC::CFile::moveFile((_TargetDirectory+awaitedFileName).c_str(),rrTempFileName(_TargetDirectory,_EmitterName).c_str()); + bool renameOk= NLMISC::CFile::moveFile(_TargetDirectory+awaitedFileName, rrTempFileName(_TargetDirectory,_EmitterName)); DROP_IF(!renameOk,"Failed to move tmp file ('"+rrTempFileName(_TargetDirectory,_EmitterName)+"') to : '"+fileNameRec+"'",return); // setup the index entry for this file and force an index file write diff --git a/code/ryzom/server/src/general_utilities_service/saves_shard_saves.cpp b/code/ryzom/server/src/general_utilities_service/saves_shard_saves.cpp index 90f771ce1..694fea375 100644 --- a/code/ryzom/server/src/general_utilities_service/saves_shard_saves.cpp +++ b/code/ryzom/server/src/general_utilities_service/saves_shard_saves.cpp @@ -318,7 +318,7 @@ namespace SAVES // do the moving nlinfo("Treating request to move file: %s => %s",srcPath.c_str(),dstPath.c_str()); - CFile::moveFile((_Path+dstPath).c_str(),(_Path+srcPath).c_str()); + CFile::moveFile(_Path+dstPath, _Path+srcPath); // make sure the src file no longer exists and that a destination file now exists if (CFile::fileExists(_Path+srcPath) && !CFile::fileExists(_Path+dstPath)) diff --git a/code/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp b/code/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp index 0866aeb79..bac02ae51 100644 --- a/code/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp +++ b/code/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp @@ -138,7 +138,7 @@ bool finalisePatch(const NLMISC::CSString& installDir,const NLMISC::CSString& fi // rename the final patched file nldebug("SPA RENAME: %s => %s",srcFile.c_str(),destFile.c_str()); - NLMISC::CFile::moveFile(destFile.c_str(),srcFile.c_str()); + NLMISC::CFile::moveFile(destFile, srcFile); // delete the temp file used in patch generation (if there was one) if (NLMISC::CFile::fileExists(oldFile)) diff --git a/code/ryzom/server/src/log_analyser_service/commands.cpp b/code/ryzom/server/src/log_analyser_service/commands.cpp index 0c1a1655b..1b70ae4e2 100644 --- a/code/ryzom/server/src/log_analyser_service/commands.cpp +++ b/code/ryzom/server/src/log_analyser_service/commands.cpp @@ -98,7 +98,7 @@ public: // rename the created file... DROP_IF(!NLMISC::CFile::fileExists(_TmpFileName),"No output file created: "+_TmpFileName,return); DROP_IF(NLMISC::CFile::fileExists(_FileName),"Cannot rename output file '"+_TmpFileName+"' because another file is in the way: "+_FileName,return); - NLMISC::CFile::moveFile(_FileName.c_str(),_TmpFileName.c_str()); + NLMISC::CFile::moveFile(_FileName, _TmpFileName); DROP_IF(!NLMISC::CFile::fileExists(_FileName),"Failed to create final output file: '"+_FileName+"' from tmp file: '"+_TmpFileName+"'",return); } diff --git a/code/ryzom/server/src/logger_service/log_storage.h b/code/ryzom/server/src/logger_service/log_storage.h index 56d4e5c1f..82b949310 100644 --- a/code/ryzom/server/src/logger_service/log_storage.h +++ b/code/ryzom/server/src/logger_service/log_storage.h @@ -246,7 +246,7 @@ public: of.serial(*this); } // rename the 'tmp" into finale output file - NLMISC::CFile::moveFile(fileName.c_str(), (fileName+".tmp").c_str()); + NLMISC::CFile::moveFile(fileName, fileName+".tmp"); } diff --git a/code/ryzom/server/src/mail_forum_service/mail_forum_service.cpp b/code/ryzom/server/src/mail_forum_service/mail_forum_service.cpp index f902251e9..79e2008de 100644 --- a/code/ryzom/server/src/mail_forum_service/mail_forum_service.cpp +++ b/code/ryzom/server/src/mail_forum_service/mail_forum_service.cpp @@ -274,7 +274,7 @@ void CMailForumService::changeUserName(uint32 shardid, const string& oldName, co uint i; for (i=0; i _State.EndTimestamp) { - CFile::moveFile((files[i]+".disabled").c_str(), files[i].c_str()); + CFile::moveFile(files[i]+".disabled", files[i]); continue; } diff --git a/code/ryzom/tools/CMakeLists.txt b/code/ryzom/tools/CMakeLists.txt index 041ba210e..2c4118e24 100644 --- a/code/ryzom/tools/CMakeLists.txt +++ b/code/ryzom/tools/CMakeLists.txt @@ -1,30 +1,32 @@ -ADD_SUBDIRECTORY(skill_extractor) -ADD_SUBDIRECTORY(make_alias_file) -ADD_SUBDIRECTORY(make_anim_by_race) -ADD_SUBDIRECTORY(make_anim_melee_impact) -ADD_SUBDIRECTORY(pd_parser) -ADD_SUBDIRECTORY(assoc_mem) -ADD_SUBDIRECTORY(leveldesign) +IF(WITH_RYZOM_TOOLS) + ADD_SUBDIRECTORY(skill_extractor) + ADD_SUBDIRECTORY(make_alias_file) + ADD_SUBDIRECTORY(make_anim_by_race) + ADD_SUBDIRECTORY(make_anim_melee_impact) + ADD_SUBDIRECTORY(pd_parser) + ADD_SUBDIRECTORY(assoc_mem) + ADD_SUBDIRECTORY(leveldesign) -IF(WITH_LIGO) - ADD_SUBDIRECTORY(translation_tools) -ENDIF(WITH_LIGO) + IF(WITH_LIGO) + ADD_SUBDIRECTORY(translation_tools) + ENDIF() -IF(WITH_NET) - ADD_SUBDIRECTORY(stats_scan) - ADD_SUBDIRECTORY(pdr_util) - ADD_SUBDIRECTORY(patch_gen) - IF(WIN32) - ADD_SUBDIRECTORY(sheets_packer_shard) - ENDIF(WIN32) -ENDIF(WITH_NET) + IF(WITH_NET) + ADD_SUBDIRECTORY(stats_scan) + ADD_SUBDIRECTORY(pdr_util) + ADD_SUBDIRECTORY(patch_gen) -IF(WITH_LIGO AND WITH_NET) - ADD_SUBDIRECTORY(sheets_packer) -ENDIF(WITH_LIGO AND WITH_NET) + IF(WIN32) + ADD_SUBDIRECTORY(sheets_packer_shard) + ENDIF() + ENDIF() + + IF(WITH_LIGO AND WITH_NET) + ADD_SUBDIRECTORY(sheets_packer) + ENDIF() +ENDIF() ADD_SUBDIRECTORY(client) - ADD_SUBDIRECTORY(server) # Old stuff that doesn't compile anymore. diff --git a/code/ryzom/tools/client/CMakeLists.txt b/code/ryzom/tools/client/CMakeLists.txt index c76d21a9b..3cdaf0136 100644 --- a/code/ryzom/tools/client/CMakeLists.txt +++ b/code/ryzom/tools/client/CMakeLists.txt @@ -6,4 +6,6 @@ IF(WITH_RYZOM_CLIENT) ENDIF() ENDIF() -ADD_SUBDIRECTORY(r2_islands_textures) +IF(WITH_RYZOM_TOOLS) + ADD_SUBDIRECTORY(r2_islands_textures) +ENDIF() diff --git a/code/ryzom/tools/client/client_config_qt/CMakeLists.txt b/code/ryzom/tools/client/client_config_qt/CMakeLists.txt index 580dc681d..fbc553bda 100644 --- a/code/ryzom/tools/client/client_config_qt/CMakeLists.txt +++ b/code/ryzom/tools/client/client_config_qt/CMakeLists.txt @@ -51,8 +51,6 @@ ELSE() QT5_ADD_RESOURCES(CLIENT_CONFIG_RC_SRCS ${CLIENT_CONFIG_RCS}) QT5_WRAP_CPP(CLIENT_CONFIG_MOC_SRC ${CLIENT_CONFIG_HDR}) QT5_WRAP_UI(CLIENT_CONFIG_UI_HDRS ${CLIENT_CONFIG_UIS}) - - SET(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Gui Qt5::OpenGL) ENDIF() SOURCE_GROUP("Resources" FILES ${CLIENT_CONFIG_RCS}) diff --git a/code/ryzom/tools/client/client_config_qt/main.cpp b/code/ryzom/tools/client/client_config_qt/main.cpp index 2ee5e11bc..33d379068 100644 --- a/code/ryzom/tools/client/client_config_qt/main.cpp +++ b/code/ryzom/tools/client/client_config_qt/main.cpp @@ -21,6 +21,19 @@ #include +#ifdef QT_STATICPLUGIN + +#include + +#ifdef Q_OS_WIN32 + Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) +#endif + +#ifdef Q_OS_MAC + Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) +#endif +#endif + int main( sint32 argc, char **argv ) { QApplication app( argc, argv ); diff --git a/code/ryzom/tools/client/client_config_qt/resources/client_config_qt.rc b/code/ryzom/tools/client/client_config_qt/resources/client_config_qt.rc index 5be048b3e..634158343 100644 --- a/code/ryzom/tools/client/client_config_qt/resources/client_config_qt.rc +++ b/code/ryzom/tools/client/client_config_qt/resources/client_config_qt.rc @@ -20,13 +20,13 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "FileDescription", "Client Config Qt" + VALUE "FileDescription", "Ryzom Configuration" VALUE "FileVersion", NL_VERSION VALUE "LegalCopyright", COPYRIGHT #ifdef _DEBUG - VALUE "OriginalFilename", "client_config_qt_d.exe" + VALUE "OriginalFilename", "ryzom_configuration_qt_d.exe" #else - VALUE "OriginalFilename", "client_config_qt_r.exe" + VALUE "OriginalFilename", "ryzom_configuration_qt_r.exe" #endif VALUE "ProductName", "Ryzom Core" VALUE "ProductVersion", NL_VERSION diff --git a/code/ryzom/tools/patch_gen/patch_gen_common.cpp b/code/ryzom/tools/patch_gen/patch_gen_common.cpp index 2437c068e..0e8831828 100644 --- a/code/ryzom/tools/patch_gen/patch_gen_common.cpp +++ b/code/ryzom/tools/patch_gen/patch_gen_common.cpp @@ -76,15 +76,34 @@ void ApplyPatch(const std::string& srcFileName,const std::string& destFileName,c void GenerateLZMA(const std::string sourceFile, const std::string &outputFile) { - std::string cmd="lzma e "; - cmd+=" "+sourceFile+" "+outputFile; - nlinfo("executing system command: %s",cmd.c_str()); + { + // old syntax incompatible with new versions + std::string cmd = "lzma e "; + cmd += " " + sourceFile + " " + outputFile; + nlinfo("Executing system command: %s", cmd.c_str()); + } #ifdef NL_OS_WINDOWS _spawnlp(_P_WAIT, "lzma.exe","lzma.exe", "e", sourceFile.c_str(), outputFile.c_str(), NULL); #else // NL_OS_WINDOWS - sint error = system (cmd.c_str()); + // new lzma only supports one file name on command line, so make a copy + CFile::copyFile(sourceFile, outputFile); + + // new lzma syntax, -z = compress, -9 = best compression + std::string cmd = NLMISC::toString("lzma -z -9 %s", outputFile.c_str()); + + sint error = system(cmd.c_str()); + if (error) + { nlwarning("'%s' failed with error code %d", cmd.c_str(), error); + + CFile::deleteFile(outputFile); + } + else + { + // lzma always append a .lzma extension, so rename compressed file to wanted one + CFile::moveFile(outputFile + ".lzma", outputFile); + } #endif // NL_OS_WINDOWS } @@ -369,7 +388,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const // process cannot terminate) GenerateLZMA(bnpFileName, lzmaFile+".tmp"); // rename the tmp file - CFile::moveFile(lzmaFile.c_str(), (lzmaFile+".tmp").c_str()); + CFile::moveFile(lzmaFile, lzmaFile+".tmp"); } // store the lzma file size in the descriptor diff --git a/code/ryzom/tools/server/CMakeLists.txt b/code/ryzom/tools/server/CMakeLists.txt index 1f215ae94..1e8a6edb9 100644 --- a/code/ryzom/tools/server/CMakeLists.txt +++ b/code/ryzom/tools/server/CMakeLists.txt @@ -1,9 +1,12 @@ -IF(WITH_LIGO) - ADD_SUBDIRECTORY(ai_build_wmap) -ENDIF(WITH_LIGO) -IF(WITH_3D) - ADD_SUBDIRECTORY(build_world_packed_col) -ENDIF(WITH_3D) +IF(WITH_RYZOM_TOOLS) + IF(WITH_LIGO) + ADD_SUBDIRECTORY(ai_build_wmap) + ENDIF() + + IF(WITH_3D) + ADD_SUBDIRECTORY(build_world_packed_col) + ENDIF() +ENDIF() # Not done yet. #admin diff --git a/code/ryzom/tools/translation_tools/main.cpp b/code/ryzom/tools/translation_tools/main.cpp index 30054ffbd..9198196c7 100644 --- a/code/ryzom/tools/translation_tools/main.cpp +++ b/code/ryzom/tools/translation_tools/main.cpp @@ -408,7 +408,7 @@ bool mergeStringDiff(vector &strings, const string &language, const if (archiveDiff) { // move the diff file in the history dir - CFile::moveFile((historyDir+CFile::getFilename(diffs[i])).c_str(), diffs[i].c_str()); + CFile::moveFile(historyDir+CFile::getFilename(diffs[i]), diffs[i]); } } @@ -801,7 +801,7 @@ int mergeStringDiff(int argc, char *argv[]) ucstring old; CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF); if (old != str) - CFile::moveFile((historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename)).c_str(), filename.c_str()); + CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename); } CI18N::writeTextFile(filename, str); @@ -909,7 +909,7 @@ bool mergePhraseDiff(vector &phrases, const string &language, bool only if (archiveDiff) { // move the diff file in the history dir - CFile::moveFile((historyDir+CFile::getFilename(diffs[i])).c_str(), diffs[i].c_str()); + CFile::moveFile(historyDir+CFile::getFilename(diffs[i]), diffs[i]); } } @@ -1165,7 +1165,7 @@ int mergePhraseDiff(int argc, char *argv[], int version) ucstring old; CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF); if (old != str) - CFile::moveFile((historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename)).c_str(), filename.c_str()); + CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename); } CI18N::writeTextFile(transDir+basename+".txt", str); @@ -1334,7 +1334,7 @@ int mergeClauseDiff(int argc, char *argv[]) ucstring old; CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF); if (old != str) - CFile::moveFile((historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename)).c_str(), filename.c_str()); + CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename); } CI18N::writeTextFile(filename, str); @@ -1449,7 +1449,7 @@ bool mergeWorksheetDiff(const std::string filename, TWorksheet &sheet, bool only if (archiveDiff) { // move the diff file in the history dir - CFile::moveFile((historyDir+CFile::getFilename(fileList[i])).c_str(), fileList[i].c_str()); + CFile::moveFile(historyDir+CFile::getFilename(fileList[i]), fileList[i]); } } diff --git a/code/studio/src/plugins/bnp_manager/bnp_file.cpp b/code/studio/src/plugins/bnp_manager/bnp_file.cpp index 8cae1164b..675baa04f 100644 --- a/code/studio/src/plugins/bnp_manager/bnp_file.cpp +++ b/code/studio/src/plugins/bnp_manager/bnp_file.cpp @@ -245,7 +245,7 @@ void BNPFileHandle::addFiles( const vector &filePathes) if (CFile::fileExists( m_openedBNPFile )) CFile::deleteFile( m_openedBNPFile ); string src = m_openedBNPFile + ".tmp"; - CFile::moveFile( m_openedBNPFile.c_str(), src.c_str() ); + CFile::moveFile(m_openedBNPFile, src); } // *************************************************************************** void BNPFileHandle::deleteFiles( const vector& fileNames) @@ -281,7 +281,7 @@ void BNPFileHandle::deleteFiles( const vector& fileNames) CFile::deleteFile( m_openedBNPFile ); string src = m_openedBNPFile + ".tmp"; - CFile::moveFile( m_openedBNPFile.c_str(), src.c_str() ); + CFile::moveFile(m_openedBNPFile, src); } // *************************************************************************** void BNPFileHandle::append(const string &destination, const PackedFile &source)