diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index dcc9f9c93..279aa3d49 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -112,16 +112,20 @@ IF(WITH_STATIC_LIBXML2) SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC) ENDIF(WITH_STATIC_LIBXML2) +IF(WITH_LIBXML2_ICONV) + FIND_PACKAGE(Iconv REQUIRED) + INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES}) +ENDIF(WITH_LIBXML2_ICONV) + IF(WITH_STATIC) # libxml2 could need winsock2 library SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB}) # on Mac OS X libxml2 requires iconv and liblzma IF(APPLE) - FIND_PACKAGE(Iconv REQUIRED) FIND_PACKAGE(LibLZMA REQUIRED) - SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES} ${LIBLZMA_LIBRARIES}) - INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES}) ENDIF(APPLE) ENDIF(WITH_STATIC) @@ -152,9 +156,11 @@ IF(WITH_NEL) FIND_PACKAGE(Luabind REQUIRED) FIND_PACKAGE(CURL REQUIRED) - IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") + IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) SET(CURL_STATIC ON) - ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") + ELSE((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) + SET(CURL_STATIC OFF) + ENDIF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL) IF(CURL_STATIC) SET(CURL_DEFINITIONS -DCURL_STATICLIB) diff --git a/code/CMakeModules/FindIconv.cmake b/code/CMakeModules/FindIconv.cmake index 5e9e48250..092b35702 100644 --- a/code/CMakeModules/FindIconv.cmake +++ b/code/CMakeModules/FindIconv.cmake @@ -1,4 +1,4 @@ -# - Try to find Iconv on Mac OS X +# - Try to find Iconv # Once done this will define # # ICONV_FOUND - system has Iconv @@ -6,78 +6,59 @@ # ICONV_LIBRARIES - Link these to use Iconv # ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const # +include(CheckCCompilerFlag) +include(CheckCSourceCompiles) -IF(APPLE) - include(CheckCCompilerFlag) - include(CheckCSourceCompiles) - - IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - # Already in cache, be silent - SET(ICONV_FIND_QUIETLY TRUE) - ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - - IF(APPLE) - FIND_PATH(ICONV_INCLUDE_DIR iconv.h - PATHS - /opt/local/include/ - NO_CMAKE_SYSTEM_PATH - ) - - FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c - PATHS - /opt/local/lib/ - NO_CMAKE_SYSTEM_PATH - ) - ENDIF(APPLE) - - FIND_PATH(ICONV_INCLUDE_DIR iconv.h PATHS /opt/local/include /sw/include) - - string(REGEX REPLACE "(.*)/include/?" "\\1" ICONV_INCLUDE_BASE_DIR "${ICONV_INCLUDE_DIR}") - - FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c HINTS "${ICONV_INCLUDE_BASE_DIR}/lib" PATHS /opt/local/lib) - - IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - SET(ICONV_FOUND TRUE) - ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - - set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) - set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) - IF(ICONV_FOUND) - check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR) - set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}") - if(ICONV_HAVE_WERROR) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") - endif(ICONV_HAVE_WERROR) - check_c_source_compiles(" - #include - int main(){ - iconv_t conv = 0; - const char* in = 0; - size_t ilen = 0; - char* out = 0; - size_t olen = 0; - iconv(conv, &in, &ilen, &out, &olen); - return 0; - } - " ICONV_SECOND_ARGUMENT_IS_CONST ) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}") - ENDIF(ICONV_FOUND) - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_REQUIRED_LIBRARIES) - - IF(ICONV_FOUND) - IF(NOT ICONV_FIND_QUIETLY) - MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") - ENDIF(NOT ICONV_FIND_QUIETLY) - ELSE(ICONV_FOUND) - IF(Iconv_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find Iconv") - ENDIF(Iconv_FIND_REQUIRED) - ENDIF(ICONV_FOUND) - - MARK_AS_ADVANCED( - ICONV_INCLUDE_DIR - ICONV_LIBRARIES - ICONV_SECOND_ARGUMENT_IS_CONST - ) -ENDIF(APPLE) +IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + # Already in cache, be silent + SET(ICONV_FIND_QUIETLY TRUE) +ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +FIND_PATH(ICONV_INCLUDE_DIR iconv.h HINTS /sw/include/ PATHS /opt/local) + +FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c PATHS /opt/local) + +IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + SET(ICONV_FOUND TRUE) +ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) +set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) +IF(ICONV_FOUND) + check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR) + set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}") + if(ICONV_HAVE_WERROR) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") + endif(ICONV_HAVE_WERROR) + check_c_source_compiles(" + #include + int main(){ + iconv_t conv = 0; + const char* in = 0; + size_t ilen = 0; + char* out = 0; + size_t olen = 0; + iconv(conv, &in, &ilen, &out, &olen); + return 0; + } +" ICONV_SECOND_ARGUMENT_IS_CONST ) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}") +ENDIF(ICONV_FOUND) +set(CMAKE_REQUIRED_INCLUDES) +set(CMAKE_REQUIRED_LIBRARIES) + +IF(ICONV_FOUND) + IF(NOT ICONV_FIND_QUIETLY) + MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") + ENDIF(NOT ICONV_FIND_QUIETLY) +ELSE(ICONV_FOUND) + IF(Iconv_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Iconv") + ENDIF(Iconv_FIND_REQUIRED) +ENDIF(ICONV_FOUND) + +MARK_AS_ADVANCED( + ICONV_INCLUDE_DIR + ICONV_LIBRARIES + ICONV_SECOND_ARGUMENT_IS_CONST +) diff --git a/code/CMakeModules/FindLibOVR.cmake b/code/CMakeModules/FindLibOVR.cmake index 1403a4b2c..707949613 100644 --- a/code/CMakeModules/FindLibOVR.cmake +++ b/code/CMakeModules/FindLibOVR.cmake @@ -38,7 +38,7 @@ ELSEIF(WIN32) ENDIF(UNIX) FIND_LIBRARY(LIBOVR_LIBRARY - NAMES ovr + NAMES ovr libovr PATHS $ENV{LIBOVR_DIR}/${LIBOVR_LIBRARY_BUILD_PATH} /usr/local/lib diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index 14f67ce44..73255077a 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -69,14 +69,48 @@ FIND_PATH(LUABIND_INCLUDE_DIR /opt/include ) -SET(LIBRARY_NAME_RELEASE luabind libluabind) -SET(LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd) +SET(LIBRARY_NAME_RELEASE) +SET(LIBRARY_NAME_DEBUG) + +IF(WITH_LUA52) + IF(WITH_STLPORT) + LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua52) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua52d) + ENDIF(WITH_STLPORT) + + LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d) +ENDIF() + +IF(WITH_LUA51) + IF(WITH_STLPORT) + LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua51) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua51d) + ENDIF(WITH_STLPORT) + + LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua51) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua51d) +ENDIF() + +IF(WITH_LUA50) + IF(WITH_STLPORT) + LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua50) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua50d) + ENDIF(WITH_STLPORT) + + LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua50) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua50d) +ENDIF() IF(WITH_STLPORT) - SET(LIBRARY_NAME_RELEASE luabind_stlport ${LIBRARY_NAME_RELEASE}) - SET(LIBRARY_NAME_DEBUG luabind_stlportd ${LIBRARY_NAME_DEBUG}) + LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport) + LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlportd) ENDIF(WITH_STLPORT) +# generic libraries names +LIST(APPEND LIBRARY_NAME_RELEASE luabind libluabind) +LIST(APPEND LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd) + FIND_LIBRARY(LUABIND_LIBRARY_RELEASE NAMES ${LIBRARY_NAME_RELEASE} PATHS diff --git a/code/CMakeModules/FindMSVC.cmake b/code/CMakeModules/FindMSVC.cmake index 644fc57e6..94146775d 100644 --- a/code/CMakeModules/FindMSVC.cmake +++ b/code/CMakeModules/FindMSVC.cmake @@ -62,7 +62,7 @@ IF(MSVC12) IF(NOT MSVC12_REDIST_DIR) # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF(NOT MSVC11_REDIST_DIR) + ENDIF(NOT MSVC12_REDIST_DIR) ELSEIF(MSVC11) DETECT_VC_VERSION("11.0") SET(MSVC_TOOLSET "110") diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index fd7004884..70113e11b 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -255,6 +255,16 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) ELSE(WITH_STATIC) OPTION(WITH_STATIC_LIBXML2 "With static libxml2" OFF) ENDIF(WITH_STATIC) + IF (WITH_STATIC) + OPTION(WITH_STATIC_CURL "With static curl" ON ) + ELSE(WITH_STATIC) + OPTION(WITH_STATIC_CURL "With static curl" OFF) + ENDIF(WITH_STATIC) + IF(APPLE) + OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" ON ) + ELSE(APPLE) + OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" OFF) + ENDIF(APPLE) OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF) IF(WIN32) OPTION(WITH_EXTERNAL "With provided external." ON ) @@ -363,6 +373,7 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) ### OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON ) OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF) + OPTION(WITH_RYZOM_CLIENT_UAC "Ask to run as Administrator" OFF) ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) @@ -557,9 +568,15 @@ MACRO(NL_SETUP_BUILD) # Ignore default include paths ADD_PLATFORM_FLAGS("/X") - IF(MSVC11) + IF(MSVC12) ADD_PLATFORM_FLAGS("/Gy- /MP") - # /Ox is working with VC++ 2010, but custom optimizations don't exist + # /Ox is working with VC++ 2013, but custom optimizations don't exist + SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") + # without inlining it's unusable, use custom optimizations again + SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") + ELSEIF(MSVC11) + ADD_PLATFORM_FLAGS("/Gy- /MP") + # /Ox is working with VC++ 2012, but custom optimizations don't exist SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") @@ -581,9 +598,9 @@ MACRO(NL_SETUP_BUILD) SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}") - ELSE(MSVC11) + ELSE(MSVC12) MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") - ENDIF(MSVC11) + ENDIF(MSVC12) ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250") diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index 53bf071e3..16a8166fe 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -83,4 +83,3 @@ IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN) ENDIF(WITH_NEL_TOOLS) ADD_SUBDIRECTORY(tools) ENDIF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN) - diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index 8738a7dda..39cafc2de 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -493,7 +493,7 @@ public: * * NB: you must setupViewMatrix() BEFORE setupModelMatrix(), or else undefined results. */ - virtual void setupViewMatrix(const CMatrix &mtx)=0; + virtual void setupViewMatrix(const CMatrix &mtx) = 0; /** setup the view matrix (inverse of camera matrix). * Extended: give a cameraPos (mtx.Pos() is not taken into account but for getViewMatrix()), @@ -1422,7 +1422,6 @@ protected: private: bool _StaticMemoryToVRAM; - }; // -------------------------------------------------- diff --git a/code/nel/include/nel/gui/ctrl_base.h b/code/nel/include/nel/gui/ctrl_base.h index 71e6cad56..3b522e114 100644 --- a/code/nel/include/nel/gui/ctrl_base.h +++ b/code/nel/include/nel/gui/ctrl_base.h @@ -50,6 +50,8 @@ namespace NLGUI // see interface.txt for meaning of auto _ToolTipParentPosRef= Hotspot_TTAuto; _ToolTipPosRef= Hotspot_TTAuto; + _EventX = 0; + _EventY = 0; resizer = false; } @@ -70,6 +72,9 @@ namespace NLGUI bool handleEvent (const NLGUI::CEventDescriptor &event); + sint32 getEventX() { return _EventX; } + sint32 getEventY() { return _EventY; } + virtual CCtrlBase *getSubCtrl (sint32 /* x */, sint32 /* y */) { return this; } /// Debug @@ -181,6 +186,9 @@ namespace NLGUI static std::map< std::string, std::map< std::string, std::string > > AHCache; bool resizer; + + sint32 _EventX; + sint32 _EventY; }; } diff --git a/code/nel/include/nel/gui/dbgroup_combo_box.h b/code/nel/include/nel/gui/dbgroup_combo_box.h index 75208b1e3..e7be1de4b 100644 --- a/code/nel/include/nel/gui/dbgroup_combo_box.h +++ b/code/nel/include/nel/gui/dbgroup_combo_box.h @@ -60,7 +60,7 @@ namespace NLGUI void setText(uint i, const ucstring &text); void insertText(uint i, const ucstring &text); const ucstring &getText(uint i) const; - const uint &getTextId(uint i) const; + uint getTextId(uint i) const; uint getTextPos(uint nId) const; const ucstring &getTexture(uint i) const; void removeText(uint nPos); diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 21d609af3..4f9bee46c 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -17,7 +17,6 @@ #ifndef CL_GROUP_HTML_H #define CL_GROUP_HTML_H -#define CURL_STATICLIB 1 #include #include "nel/misc/types_nl.h" @@ -107,7 +106,7 @@ namespace NLGUI void refresh(); // submit form - void submitForm (uint formId, const char *submitButtonName); + void submitForm (uint formId, const char *submitButtonType, const char *submitButtonName, const char *submitButtonValue, sint32 x, sint32 y); // Browse error void browseError (const char *msg); @@ -328,7 +327,11 @@ namespace NLGUI bool _BrowseNextTime; bool _PostNextTime; uint _PostFormId; + std::string _PostFormSubmitType; std::string _PostFormSubmitButton; + std::string _PostFormSubmitValue; + sint32 _PostFormSubmitX; + sint32 _PostFormSubmitY; // Browsing.. bool _Browsing; diff --git a/code/nel/include/nel/gui/lua_object.h b/code/nel/include/nel/gui/lua_object.h index 1564df080..2360f1609 100644 --- a/code/nel/include/nel/gui/lua_object.h +++ b/code/nel/include/nel/gui/lua_object.h @@ -285,8 +285,7 @@ namespace NLGUI class CLuaHashMapTraits { public: - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; CLuaHashMapTraits() {} diff --git a/code/nel/include/nel/misc/app_context.h b/code/nel/include/nel/misc/app_context.h index 46d2a15c7..df9165baf 100644 --- a/code/nel/include/nel/misc/app_context.h +++ b/code/nel/include/nel/misc/app_context.h @@ -88,6 +88,8 @@ namespace NLMISC virtual void setNoAssert(bool noAssert) =0; virtual bool getAlreadyCreateSharedAmongThreads() =0; virtual void setAlreadyCreateSharedAmongThreads(bool b) =0; + virtual bool isWindowedApplication() = 0; + virtual void setWindowedApplication(bool b = true) = 0; //@} protected: /// Called by derived class to finalize initialisation of context @@ -131,6 +133,8 @@ namespace NLMISC virtual void setNoAssert(bool noAssert); virtual bool getAlreadyCreateSharedAmongThreads(); virtual void setAlreadyCreateSharedAmongThreads(bool b); + virtual bool isWindowedApplication(); + virtual void setWindowedApplication(bool b); private: /// Singleton registry @@ -147,6 +151,7 @@ namespace NLMISC bool DebugNeedAssert; bool NoAssert; bool AlreadyCreateSharedAmongThreads; + bool WindowedApplication; }; /** This class implements the context interface for the a library module. @@ -183,6 +188,8 @@ namespace NLMISC virtual void setNoAssert(bool noAssert); virtual bool getAlreadyCreateSharedAmongThreads(); virtual void setAlreadyCreateSharedAmongThreads(bool b); + virtual bool isWindowedApplication(); + virtual void setWindowedApplication(bool b); private: /// Pointer to the application context. diff --git a/code/nel/include/nel/misc/class_id.h b/code/nel/include/nel/misc/class_id.h index 0628e8030..d02fc5646 100644 --- a/code/nel/include/nel/misc/class_id.h +++ b/code/nel/include/nel/misc/class_id.h @@ -61,8 +61,7 @@ public: class CClassIdHashMapTraits { public: - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; inline size_t operator() ( const CClassId& classId ) const { return ((((uint64)classId >> 32)|0xFFFFFFFF) ^ (((uint64)classId|0xFFFFFFFF) & 0xFFFFFFFF)); diff --git a/code/nel/include/nel/misc/common.h b/code/nel/include/nel/misc/common.h index 26458a540..c2a40cc0f 100644 --- a/code/nel/include/nel/misc/common.h +++ b/code/nel/include/nel/misc/common.h @@ -347,7 +347,7 @@ std::string formatThousands(const std::string& s); /// This function executes a program in the background and returns instantly (used for example to launch services in AES). /// The program will be launched in the current directory -bool launchProgram (const std::string &programName, const std::string &arguments); +bool launchProgram (const std::string &programName, const std::string &arguments, bool log = true); /// This function kills a program using his pid (on unix, it uses the kill() POSIX function) bool killProgram(uint32 pid); diff --git a/code/nel/include/nel/misc/debug.h b/code/nel/include/nel/misc/debug.h index 690d340a3..8d2483e4e 100644 --- a/code/nel/include/nel/misc/debug.h +++ b/code/nel/include/nel/misc/debug.h @@ -350,8 +350,10 @@ void setCrashAlreadyReported(bool state); */ // removed because we always check assert (even in release mode) #if defined (NL_OS_WINDOWS) && defined (NL_DEBUG) -#if defined (NL_OS_WINDOWS) -#define NLMISC_BREAKPOINT __debugbreak(); +#if defined(NL_OS_WINDOWS) +#define NLMISC_BREAKPOINT __debugbreak() +#elif defined(NL_OS_UNIX) && defined(NL_COMP_GCC) +#define NLMISC_BREAKPOINT __builtin_trap() #else #define NLMISC_BREAKPOINT abort() #endif diff --git a/code/nel/include/nel/misc/dummy_window.h b/code/nel/include/nel/misc/dummy_window.h index bd205f0a0..81ef078f9 100644 --- a/code/nel/include/nel/misc/dummy_window.h +++ b/code/nel/include/nel/misc/dummy_window.h @@ -22,6 +22,21 @@ #ifdef NL_OS_WINDOWS // for win32 os only +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#ifndef _WIN32_WINDOWS +# define _WIN32_WINDOWS 0x0410 +#endif +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0400 +#endif +#ifndef WINVER +# define WINVER 0x0400 +#endif +#ifndef NOMINMAX +# define NOMINMAX +#endif #include diff --git a/code/nel/include/nel/misc/entity_id.h b/code/nel/include/nel/misc/entity_id.h index 027fe28c7..b4e40909e 100644 --- a/code/nel/include/nel/misc/entity_id.h +++ b/code/nel/include/nel/misc/entity_id.h @@ -575,8 +575,7 @@ public: // Traits for hash_map using CEntityId struct CEntityIdHashMapTraits { - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; CEntityIdHashMapTraits() { } size_t operator() (const NLMISC::CEntityId &id ) const { diff --git a/code/nel/include/nel/misc/gtk_displayer.h b/code/nel/include/nel/misc/gtk_displayer.h index 88dd3acc8..e2d35c83c 100644 --- a/code/nel/include/nel/misc/gtk_displayer.h +++ b/code/nel/include/nel/misc/gtk_displayer.h @@ -42,11 +42,7 @@ class CGtkDisplayer : public NLMISC::CWindowDisplayer { public: - CGtkDisplayer (const char *displayerName = "") : CWindowDisplayer(displayerName) - { - needSlashR = false; - createLabel ("@Clear|CLEAR"); - } + CGtkDisplayer (const char *displayerName = ""); virtual ~CGtkDisplayer (); diff --git a/code/nel/include/nel/misc/inter_window_msg_queue.h b/code/nel/include/nel/misc/inter_window_msg_queue.h index 02867f8b4..c23a52412 100644 --- a/code/nel/include/nel/misc/inter_window_msg_queue.h +++ b/code/nel/include/nel/misc/inter_window_msg_queue.h @@ -27,6 +27,21 @@ #include "nel/misc/mem_stream.h" #include "nel/misc/dummy_window.h" +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#ifndef _WIN32_WINDOWS +# define _WIN32_WINDOWS 0x0410 +#endif +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0400 +#endif +#ifndef WINVER +# define WINVER 0x0400 +#endif +#ifndef NOMINMAX +# define NOMINMAX +#endif #include namespace NLMISC diff --git a/code/nel/include/nel/misc/p_thread.h b/code/nel/include/nel/misc/p_thread.h index 4f0a9aa63..01f476d7b 100644 --- a/code/nel/include/nel/misc/p_thread.h +++ b/code/nel/include/nel/misc/p_thread.h @@ -39,9 +39,9 @@ class CPThread : public IThread public: enum TThreadState { - ThreadStateNone, - ThreadStateRunning, - ThreadStateFinished, + ThreadStateNone, + ThreadStateRunning, + ThreadStateFinished, }; /// Constructor diff --git a/code/nel/include/nel/misc/path.h b/code/nel/include/nel/misc/path.h index cd19c43ee..383a0553c 100644 --- a/code/nel/include/nel/misc/path.h +++ b/code/nel/include/nel/misc/path.h @@ -343,7 +343,7 @@ public: /** Adds a search path. * The path is a directory "c:/temp" all files in the directory will be included (and recursively if asked) * - * Alternative directories are not pre-cached (instead of non Alternative files) and will used when a file is not found in the standard directories. + * Alternative directories are not pre-cached (instead of non Alternative files) and will be used when a file is not found in the standard directories. * For example, local data will be in the cached directories and server repository files will be in the Alternative files. If a new file is not * found in the local data, we'll try to find it on the repository. * diff --git a/code/nel/include/nel/misc/report.h b/code/nel/include/nel/misc/report.h index 11745b6e3..55a1c2dbf 100644 --- a/code/nel/include/nel/misc/report.h +++ b/code/nel/include/nel/misc/report.h @@ -21,25 +21,38 @@ namespace NLMISC { -/** Display a custom message box. +#if FINAL_VERSION +#define NL_REPORT_SYNCHRONOUS false +#define NL_REPORT_DEFAULT NLMISC::ReportAbort +#else +#define NL_REPORT_SYNCHRONOUS true +#define NL_REPORT_DEFAULT NLMISC::ReportBreak +#endif + +enum TReportResult +{ + // See also crash_report_widget.h EReturnValue + ReportAlwaysIgnore = 21, + ReportIgnore = 22, + ReportAbort = 23, + ReportBreak = 24 +}; + +/** Display a crash report * - * \param title set the title of the report. If empty, it'll display "NeL report". - * \param header message displayed before the edit text box. If empty, it displays the default message. - * \param body message displayed in the edit text box. This string will be sent by email. - * \param debugButton 0 for disabling it, 1 for enable with default behaviors (generate a breakpoint), 2 for enable with no behavior + * \param title set the title of the report. If empty, it'll display "NeL report" + * \param subject extended title of the report + * \param body message displayed in the edit text box. This string will be sent to the crash report tool + * \param attachment binary file to attach. This is a filename + * \param synchronous use system() and wait for the crash tool exit code, passes -dev flag; otherwise return defaultResult immediately + * \param sendReport hide 'dont send' button, or auto enable 'send report' checkbox * - * - * - * \return the button clicked or error + * \return the button clicked or defaultResult */ +TReportResult report(const std::string &title, const std::string &subject, const std::string &body, const std::string &attachment, bool synchronous, bool sendReport, TReportResult defaultResult); -enum TReportResult { ReportDebug, ReportIgnore, ReportQuit, ReportError }; - -TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const std::string &attachedFile = ""); - -/** call this in the main of your appli to enable email: setReportEmailFunction (sendEmail); - */ -void setReportEmailFunction (void *emailFunction); +/// Set the Url of the web service used to post crash reports to. String is copied +void setReportPostUrl(const char *postUrl); } // NLMISC diff --git a/code/nel/include/nel/misc/sheet_id.h b/code/nel/include/nel/misc/sheet_id.h index 869a61af6..b11e97188 100644 --- a/code/nel/include/nel/misc/sheet_id.h +++ b/code/nel/include/nel/misc/sheet_id.h @@ -248,8 +248,7 @@ private : class CSheetIdHashMapTraits { public: - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; inline size_t operator() ( const CSheetId& sheetId ) const { return sheetId.asInt() >> 5; diff --git a/code/nel/include/nel/misc/sstring.h b/code/nel/include/nel/misc/sstring.h index fdeebcfc8..c9ebff721 100644 --- a/code/nel/include/nel/misc/sstring.h +++ b/code/nel/include/nel/misc/sstring.h @@ -937,21 +937,21 @@ inline CSString operator+(const CSString& s0,const CSString& s1) */ inline CSString operator+(char s0,const CSString& s1) { - return CSString(s0)+s1; + return CSString(s0) + s1.c_str(); } inline CSString operator+(const char* s0,const CSString& s1) { - return CSString(s0)+s1; + return CSString(s0) + s1.c_str(); } -#ifndef NL_COMP_VC10 +#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 // NL_COMP_VC10 +#endif } // NLMISC diff --git a/code/nel/include/nel/misc/string_common.h b/code/nel/include/nel/misc/string_common.h index 4a455247d..2d2a7e676 100644 --- a/code/nel/include/nel/misc/string_common.h +++ b/code/nel/include/nel/misc/string_common.h @@ -264,6 +264,40 @@ inline bool fromString(const std::string &str, bool &val) return true; } +inline bool fromString(const char *str, uint32 &val) { if (strstr(str, "-") != NULL) { val = 0; return false; } char *end; unsigned long v; errno = 0; v = strtoul(str, &end, 10); if (errno || v > UINT_MAX || end == str) { val = 0; return false; } else { val = (uint32)v; return true; } } +inline bool fromString(const char *str, sint32 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > INT_MAX || v < INT_MIN || end == str) { val = 0; return false; } else { val = (sint32)v; return true; } } +inline bool fromString(const char *str, uint8 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > UCHAR_MAX || v < 0 || end == str) { val = 0; return false; } else { val = (uint8)v; return true; } } +inline bool fromString(const char *str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str) { val = 0; return false; } else { val = (sint8)v; return true; } } +inline bool fromString(const char *str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str) { val = 0; return false; } else { val = (uint16)v; return true; } } +inline bool fromString(const char *str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str) { val = 0; return false; } else { val = (sint16)v; return true; } } +inline bool fromString(const char *str, uint64 &val) { bool ret = sscanf(str, "%"NL_I64"u", &val) == 1; if (!ret) val = 0; return ret; } +inline bool fromString(const char *str, sint64 &val) { bool ret = sscanf(str, "%"NL_I64"d", &val) == 1; if (!ret) val = 0; return ret; } +inline bool fromString(const char *str, float &val) { bool ret = sscanf(str, "%f", &val) == 1; if (!ret) val = 0.0f; return ret; } +inline bool fromString(const char *str, double &val) { bool ret = sscanf(str, "%lf", &val) == 1; if (!ret) val = 0.0; return ret; } + +inline bool fromString(const char *str, bool &val) +{ + switch (str[0]) + { + case '1': + case 't': + case 'y': + case 'T': + case 'Y': + val = true; + return true; + case '0': + case 'f': + case 'n': + case 'F': + case 'N': + val = false; + return true; + } + + return false; +} + inline bool fromString(const std::string &str, std::string &val) { val = str; return true; } // stl vectors of bool use bit reference and not real bools, so define the operator for bit reference diff --git a/code/nel/include/nel/misc/string_mapper.h b/code/nel/include/nel/misc/string_mapper.h index 36a73ed4d..1f62dd123 100644 --- a/code/nel/include/nel/misc/string_mapper.h +++ b/code/nel/include/nel/misc/string_mapper.h @@ -39,8 +39,7 @@ typedef const std::string *TStringId; // Traits for hash_map using CStringId struct CStringIdHashMapTraits { - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; CStringIdHashMapTraits() { } size_t operator() (const NLMISC::TStringId &stringId) const { diff --git a/code/nel/include/nel/misc/system_utils.h b/code/nel/include/nel/misc/system_utils.h index 9b3c5a971..78fd011c6 100644 --- a/code/nel/include/nel/misc/system_utils.h +++ b/code/nel/include/nel/misc/system_utils.h @@ -77,6 +77,10 @@ public: /// Get desktop current color depth without using UDriver. static uint getCurrentColorDepth(); + + /// Detect whether the current process is a windowed application. Return true if definitely yes, false if unknown + static bool detectWindowedApplication(); + }; } // NLMISC diff --git a/code/nel/include/nel/misc/types_nl.h b/code/nel/include/nel/misc/types_nl.h index f1ed871fc..2461cb5e6 100644 --- a/code/nel/include/nel/misc/types_nl.h +++ b/code/nel/include/nel/misc/types_nl.h @@ -53,7 +53,10 @@ # endif # ifdef _MSC_VER # define NL_COMP_VC -# if _MSC_VER >= 1700 +# if _MSC_VER >= 1800 +# define NL_COMP_VC12 +# define NL_COMP_VC_VERSION 120 +# elif _MSC_VER >= 1700 # define NL_COMP_VC11 # define NL_COMP_VC_VERSION 110 # elif _MSC_VER >= 1600 @@ -414,6 +417,12 @@ extern void operator delete[](void *p) throw(); # define CHashMap stdext::hash_map # define CHashSet stdext::hash_set # define CHashMultiMap stdext::hash_multimap +#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 120) +# include +# include +# define CHashMap ::std::hash_map +# define CHashSet ::std::hash_set +# define CHashMultiMap ::std::hash_multimap #elif defined(NL_COMP_GCC) // GCC4 # include # include @@ -454,7 +463,11 @@ typedef uint16 ucchar; // To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234) #ifdef NL_COMP_VC -# if (NL_COMP_VC_VERSION >= 80) +# if (NL_COMP_VC_VERSION >= 120) +# define INT64_CONSTANT(c) (c##LL) +# define SINT64_CONSTANT(c) (c##LL) +# define UINT64_CONSTANT(c) (c##ULL) +# elif (NL_COMP_VC_VERSION >= 80) # define INT64_CONSTANT(c) (c##LL) # define SINT64_CONSTANT(c) (c##LL) # define UINT64_CONSTANT(c) (c##LL) diff --git a/code/nel/include/nel/misc/ucstring.h b/code/nel/include/nel/misc/ucstring.h index e6d7544b1..88e599c1a 100644 --- a/code/nel/include/nel/misc/ucstring.h +++ b/code/nel/include/nel/misc/ucstring.h @@ -355,8 +355,7 @@ namespace NLMISC // Traits for hash_map using CEntityId struct CUCStringHashMapTraits { - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; CUCStringHashMapTraits() { } size_t operator() (const ucstring &id ) const { diff --git a/code/nel/include/nel/misc/win_displayer.h b/code/nel/include/nel/misc/win_displayer.h index 934a6e990..f450055a9 100644 --- a/code/nel/include/nel/misc/win_displayer.h +++ b/code/nel/include/nel/misc/win_displayer.h @@ -21,8 +21,19 @@ #ifdef NL_OS_WINDOWS -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#ifndef NL_COMP_MINGW +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#ifndef _WIN32_WINDOWS +# define _WIN32_WINDOWS 0x0410 +#endif +#ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0400 +#endif +#ifndef WINVER +# define WINVER 0x0400 +#endif +#ifndef NOMINMAX # define NOMINMAX #endif #include @@ -46,11 +57,7 @@ class CWinDisplayer : public NLMISC::CWindowDisplayer { public: - CWinDisplayer (const char *displayerName = "") : CWindowDisplayer(displayerName), Exit(false) - { - needSlashR = true; - createLabel ("@Clear|CLEAR"); - } + CWinDisplayer(const char *displayerName = ""); virtual ~CWinDisplayer (); diff --git a/code/nel/include/nel/misc/xml_auto_ptr.h b/code/nel/include/nel/misc/xml_auto_ptr.h index eacde74da..8e0c3adb7 100644 --- a/code/nel/include/nel/misc/xml_auto_ptr.h +++ b/code/nel/include/nel/misc/xml_auto_ptr.h @@ -31,7 +31,7 @@ public: ~CXMLAutoPtr() { destroy(); } operator const char *() const { return _Value; } operator bool() const { return _Value != NULL; } - operator std::string() const { return std::string(_Value); } + inline std::string str() const { return _Value; } bool operator ! () const { return _Value == NULL; } operator const unsigned char *() const { return (const unsigned char *) _Value; } char operator * () const { nlassert(_Value); return *_Value; } diff --git a/code/nel/include/nel/net/service.h b/code/nel/include/nel/net/service.h index c74688799..8c7a52c63 100644 --- a/code/nel/include/nel/net/service.h +++ b/code/nel/include/nel/net/service.h @@ -218,13 +218,13 @@ public: static bool isServiceInitialized() { return _Instance != NULL; } /// Returns the current service short name (ie: TS) - const std::string &getServiceShortName () const { return _ShortName; }; + const std::string &getServiceShortName () const { return _ShortName; } /// Returns the current service long name (ie: test_serivce) - const std::string &getServiceLongName () const { return _LongName; }; + const std::string &getServiceLongName () const { return _LongName; } /// Returns the current service alias name setted by AES - const std::string &getServiceAliasName () const { return _AliasName; }; + const std::string &getServiceAliasName () const { return _AliasName; } /// Returns the current service unified name that is alias/short-id or short-id if alias is empty std::string getServiceUnifiedName () const; @@ -242,10 +242,10 @@ public: uint32 getLaunchingDate () const; /// Return true if this service don't use the NS (naming service) - bool getDontUseNS() const { return _DontUseNS; }; + bool getDontUseNS() const { return _DontUseNS; } /// Return true if this service don't use the AES (admin executor service) - bool getDontUseAES() const { return _DontUseAES; }; + bool getDontUseAES() const { return _DontUseAES; } /// Returns arguments of the program pass from the user to the program using parameters (ie: "myprog param1 param2") const NLMISC::CVectorSString &getArgs () const { return _Args; } diff --git a/code/nel/include/nel/sound/containers.h b/code/nel/include/nel/sound/containers.h index 63e134077..57387e91e 100644 --- a/code/nel/include/nel/sound/containers.h +++ b/code/nel/include/nel/sound/containers.h @@ -42,8 +42,7 @@ namespace NLSOUND { template struct THashPtr : public std::unary_function { - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; size_t operator () (const Pointer &ptr) const { //CHashSet::hasher h; diff --git a/code/nel/include/nel/sound/context_sound.h b/code/nel/include/nel/sound/context_sound.h index 13683ac56..8424ee087 100644 --- a/code/nel/include/nel/sound/context_sound.h +++ b/code/nel/include/nel/sound/context_sound.h @@ -82,8 +82,7 @@ struct CContextMatcher struct CHash : public std::unary_function { - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; size_t operator () (const CContextMatcher &patternMatcher) const { return patternMatcher.getHashValue(); diff --git a/code/nel/samples/3d/nel_qt/qtcolorpicker_cpp.h b/code/nel/samples/3d/nel_qt/qtcolorpicker_cpp.h index 0701a803f..2386ff939 100644 --- a/code/nel/samples/3d/nel_qt/qtcolorpicker_cpp.h +++ b/code/nel/samples/3d/nel_qt/qtcolorpicker_cpp.h @@ -543,14 +543,14 @@ ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog, setMouseTracking(true); cols = width; - if (withColorDialog) + if (withColorDialog) { moreButton = new ColorPickerButton(this); moreButton->setFixedWidth(24); moreButton->setFixedHeight(21); moreButton->setFrameRect(QRect(2, 2, 20, 17)); connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog())); - } + } else { moreButton = 0; diff --git a/code/nel/samples/misc/debug/main.cpp b/code/nel/samples/misc/debug/main.cpp index 6ee31754f..5850cb2b3 100644 --- a/code/nel/samples/misc/debug/main.cpp +++ b/code/nel/samples/misc/debug/main.cpp @@ -18,11 +18,16 @@ #include // contains all debug features -#include "nel/misc/debug.h" +#include +#include -using namespace NLMISC; +void repeatederror() +{ + // hit always ignore to surpress this error for the duration of the program + nlassert(false && "hit always ignore"); +} -int main (int /* argc */, char ** /* argv */) +int main(int /* argc */, char ** /* argv */) { // all debug functions have different behaviors in debug and in release mode. // in general, in debug mode, all debug functions are active, they display @@ -36,20 +41,24 @@ int main (int /* argc */, char ** /* argv */) // in release mode, this function does nothing by default. you have to add a displayer // manually, or put true in the parameter to say to the function that you want it to // add the default displayers - createDebug (); + NLMISC::createDebug(); + + // enable the crash report tool + NLMISC::INelContext::getInstance().setWindowedApplication(true); + NLMISC::setReportPostUrl("http://ryzomcore.org/crash_report/"); // display debug information, that will be skipped in release mode. - nldebug ("nldebug() %d", 1); + nldebug("nldebug() %d", 1); // display the string - nlinfo ("nlinfo() %d", 2); + nlinfo("nlinfo() %d", 2); // when something not normal, but that the program can manage, occurs, call nlwarning() - nlwarning ("nlwarning() %d", 3); + nlwarning("nlwarning() %d", 3); // nlassert() is like assert but do more powerful things. in release mode, the test is // not executed and nothing will happen. (Press F5 in Visual C++ to continue the execution) - nlassert (true == false); + nlassert(true == false); // in a switch case or when you want that the program never executes a part of code, use stop. // in release, nlstop does nothing. in debug mode, @@ -61,16 +70,20 @@ int main (int /* argc */, char ** /* argv */) // occurs. (In Visual C++ press F5 to continue) try { - nlerror ("nlerror() %d", 4); + nlerror("nlerror() %d", 4); } - catch(const EFatalError &) + catch (const NLMISC::EFatalError &) { // just continue... - nlinfo ("nlerror() generated an EFatalError exception, just ignore it"); + nlinfo("nlerror() generated an EFatalError exception, just ignore it"); } + // keep repeating the same error + for (int i = 0; i < 32; ++i) + repeatederror(); + printf("\nPress to exit\n"); - getchar (); + getchar(); return EXIT_SUCCESS; } diff --git a/code/nel/samples/net/udp/bench_service.cpp b/code/nel/samples/net/udp/bench_service.cpp index 981a0dd0a..190347d4b 100644 --- a/code/nel/samples/net/udp/bench_service.cpp +++ b/code/nel/samples/net/udp/bench_service.cpp @@ -98,8 +98,7 @@ struct CClient struct TInetAddressHash { - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; inline bool operator() (const NLNET::CInetAddress &x1, const NLNET::CInetAddress &x2) const { diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 916cafe49..8a7be80d2 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1327,6 +1327,10 @@ const D3DFORMAT FinalPixelFormat[ITexture::UploadFormatCount][CDriverD3D::FinalP bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay) { H_AUTO_D3D(CDriver3D_setDisplay); + + if (!mode.OffScreen) + NLMISC::INelContext::getInstance().setWindowedApplication(true); + if (!_D3D) return false; #ifndef NL_NO_ASM @@ -1509,9 +1513,6 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r } } - -// _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, ¶meters, &_DeviceInterface); - // Check some caps D3DCAPS9 caps; if (_DeviceInterface->GetDeviceCaps(&caps) == D3D_OK) diff --git a/code/nel/src/3d/driver/opengl/CMakeLists.txt b/code/nel/src/3d/driver/opengl/CMakeLists.txt index 9e9e05918..12e20fbb3 100644 --- a/code/nel/src/3d/driver/opengl/CMakeLists.txt +++ b/code/nel/src/3d/driver/opengl/CMakeLists.txt @@ -67,6 +67,16 @@ IF(UNIX AND NOT APPLE) ADD_DEFINITIONS(-DHAVE_XCURSOR) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xcursor_LIB}) ENDIF(X11_Xcursor_FOUND) + IF(X11_Xext_FOUND) + TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xext_LIB}) + ENDIF(X11_Xext_FOUND) + # libraries needed to be linked while linking to static X11 libraries + FIND_LIBRARY(XCB_LIBRARY + NAMES xcb + HINTS ${X11_LIB_SEARCH_PATH}) + IF(XCB_LIBRARY) + TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XCB_LIBRARY}) + ENDIF(XCB_LIBRARY) ENDIF(UNIX AND NOT APPLE) IF(WITH_PCH) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index ce60d7f42..35cf9c094 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -435,11 +435,7 @@ bool CDriverGL::setupDisplay() glViewport(0,0,_CurrentMode.Width,_CurrentMode.Height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); -#ifdef USE_OPENGLES - glOrthof(0.f,_CurrentMode.Width,_CurrentMode.Height,0.f,-1.0f,1.0f); -#else glOrtho(0,_CurrentMode.Width,_CurrentMode.Height,0,-1.0f,1.0f); -#endif glMatrixMode(GL_MODELVIEW); glLoadIdentity(); #ifndef USE_OPENGLES @@ -725,11 +721,7 @@ bool CDriverGL::activeFrameBufferObject(ITexture * tex) } else { -#ifdef USE_OPENGLES - nglBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); -#else nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); -#endif return true; } } @@ -2178,7 +2170,7 @@ void CDriverGL::flush() // *************************************************************************** void CDriverGL::setSwapVBLInterval(uint interval) { - H_AUTO_OGL(CDriverGL_setSwapVBLInterval) + H_AUTO_OGL(CDriverGL_setSwapVBLInterval); if (!_Initialized) return; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h b/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h index 41d2c1366..31ca00961 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h @@ -40,6 +40,24 @@ extern "C" { #define GL_ADD_SIGNED_EXT GL_ADD_SIGNED #define GL_INTERPOLATE_EXT GL_INTERPOLATE #define GL_BUMP_ENVMAP_ATI GL_INTERPOLATE +#define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER_OES +#define GL_RENDERBUFFER_EXT GL_RENDERBUFFER_OES +#define GL_DEPTH24_STENCIL8_EXT GL_DEPTH24_STENCIL8_OES +#define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES +#define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0_OES +#define GL_DEPTH_ATTACHMENT_EXT GL_DEPTH_ATTACHMENT_OES +#define GL_STENCIL_ATTACHMENT_EXT GL_STENCIL_ATTACHMENT_OES +#define GL_ARRAY_BUFFER_ARB GL_ARRAY_BUFFER +#define GL_TEXTURE0_ARB GL_TEXTURE0 + +#define GL_ALPHA8 GL_ALPHA +#define GL_LUMINANCE8_ALPHA8 GL_LUMINANCE_ALPHA +#define GL_LUMINANCE8 GL_LUMINANCE +#define GL_RGBA8 GL_RGBA +#define GL_RGB8 GL_RGB + +#define GL_STATIC_DRAW_ARB GL_STATIC_DRAW +#define GL_DYNAMIC_DRAW_ARB GL_DYNAMIC_DRAW #define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES @@ -48,6 +66,31 @@ extern "C" { #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES +#define nglGenRenderbuffersEXT nglGenRenderbuffersOES +#define nglBindRenderbufferEXT nglBindRenderbufferOES +#define nglDeleteRenderbuffersEXT nglDeleteRenderbuffersOES +#define nglRenderbufferStorageEXT nglRenderbufferStorageOES +#define nglGenFramebuffersEXT nglGenFramebuffersOES +#define nglBindFramebufferEXT nglBindFramebufferOES +#define nglFramebufferTexture2DEXT nglFramebufferTexture2DOES +#define nglFramebufferRenderbufferEXT nglFramebufferRenderbufferOES +#define nglCheckFramebufferStatusEXT nglCheckFramebufferStatusOES +#define nglDeleteBuffersARB glDeleteBuffers +#define nglIsBufferARB glIsBuffer +#define nglDeleteRenderbuffersEXT nglDeleteRenderbuffersOES +#define nglBindFramebufferEXT nglBindFramebufferOES +#define nglDeleteFramebuffersEXT nglDeleteFramebuffersOES +#define nglUnmapBufferARB nglUnmapBufferOES +#define nglActiveTextureARB glActiveTexture +#define nglClientActiveTextureARB glClientActiveTexture +#define nglBindBufferARB glBindBuffer +#define nglGenBuffersARB glGenBuffers +#define nglBufferDataARB glBufferData + +#define glFrustum glFrustumf +#define glOrtho glOrthof +#define glDepthRange glDepthRangef + #else #if defined(NL_OS_MAC) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp index 986dd6303..95c8e61f2 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -403,7 +403,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat) // Must setup textures each frame. (need to test if touched). // Must separate texture setup and texture activation in 2 "for"... // because setupTexture() may disable all stage. - if (matShader != CMaterial::Water + if (matShader != CMaterial::Water && ((matShader != CMaterial::Program) || (_LastSetuppedPP->features().MaterialFlags & CProgramFeatures::TextureStages)) ) { diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp index 855c10c21..41575024c 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp @@ -37,19 +37,11 @@ void CDriverGL::setFrustum(float left, float right, float bottom, float top, flo if (perspective) { -#ifdef USE_OPENGLES - glFrustumf(left,right,bottom,top,znear,zfar); -#else glFrustum(left,right,bottom,top,znear,zfar); -#endif } else { -#ifdef USE_OPENGLES - glOrthof(left,right,bottom,top,znear,zfar); -#else glOrtho(left,right,bottom,top,znear,zfar); -#endif } _ProjMatDirty = true; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index 60a0609dc..8ec7a6bc8 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -155,11 +155,7 @@ void CDriverGLStates::forceDefaults(uint nbStages) for(stage=0;stage_TextureUsed[TextureUsedIdx] = NULL; } - -#ifdef USE_OPENGLES - if (InitFBO) - { - nglDeleteFramebuffersOES(1, &FBOId); - if(AttachDepthStencil) - { - nglDeleteRenderbuffersOES(1, &DepthFBOId); - if(!UsePackedDepthStencil) - nglDeleteRenderbuffersOES(1, &StencilFBOId); - } - } -#endif } CDepthStencilFBO::CDepthStencilFBO(CDriverGL *driver, uint width, uint height) @@ -175,56 +162,9 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex) AttachDepthStencil = !((CTextureBloom*)tex)->isMode2D(); } -#ifdef USE_OPENGLES - // generate IDs - nglGenFramebuffersOES(1, &FBOId); - if(AttachDepthStencil) - { - nglGenRenderbuffersOES(1, &DepthFBOId); - if(UsePackedDepthStencil) - StencilFBOId = DepthFBOId; - else - nglGenRenderbuffersOES(1, &StencilFBOId); - } - - //nldebug("3D: using depth %d and stencil %d", DepthFBOId, StencilFBOId); - - // initialize FBO - nglBindFramebufferOES(GL_FRAMEBUFFER_OES, FBOId); - nglFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, TextureMode, ID, 0); - - // attach depth/stencil render to FBO - // note: for some still unkown reason it's impossible to add - // a stencil buffer as shown in the respective docs (see - // opengl.org extension registry). Until a safe approach to add - // them is found, there will be no attached stencil for the time - // being, aside of using packed depth+stencil buffers. - if(AttachDepthStencil) - { - if(UsePackedDepthStencil) - { - //nldebug("3D: using packed depth stencil"); - nglBindRenderbufferOES(GL_RENDERBUFFER_OES, StencilFBOId); - nglRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH24_STENCIL8_OES, tex->getWidth(), tex->getHeight()); - } - else - { - nglBindRenderbufferOES(GL_RENDERBUFFER_OES, DepthFBOId); - nglRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT24_OES, tex->getWidth(), tex->getHeight()); - /* - nglBindRenderbufferEXT(GL_RENDERBUFFER_OES, StencilFBOId); - nglRenderbufferStorageEXT(GL_RENDERBUFFER_OES, GL_STENCIL_INDEX8_EXT, tex->getWidth(), tex->getHeight()); - */ - } - nglFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, DepthFBOId); - nldebug("3D: glFramebufferRenderbufferExt(depth:24) = %X", nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES)); - nglFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES, GL_RENDERBUFFER_OES, StencilFBOId); - nldebug("3D: glFramebufferRenderbufferExt(stencil:8) = %X", nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES)); - } -#else // generate IDs nglGenFramebuffersEXT(1, &FBOId); - + //nldebug("3D: using depth %d and stencil %d", DepthFBOId, StencilFBOId); // initialize FBO @@ -253,15 +193,10 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex) GL_RENDERBUFFER_EXT, DepthStencilFBO->StencilFBOId); nldebug("3D: glFramebufferRenderbufferExt(stencil:8) = %X", nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)); } -#endif // check status - GLenum status; -#ifdef USE_OPENGLES - status = (GLenum) nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); -#else - status = (GLenum) nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); -#endif + GLenum status = (GLenum) nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + switch(status) { #ifdef GL_FRAMEBUFFER_COMPLETE_EXT case GL_FRAMEBUFFER_COMPLETE_EXT: @@ -361,11 +296,8 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex) // clean up resources if allocation failed if (!InitFBO) { -#ifdef USE_OPENGLES - nglDeleteFramebuffersOES(1, &FBOId); -#else nglDeleteFramebuffersEXT(1, &FBOId); -#endif + if (AttachDepthStencil) { DepthStencilFBO = NULL; @@ -385,22 +317,14 @@ bool CTextureDrvInfosGL::activeFrameBufferObject(ITexture * tex) if(initFrameBufferObject(tex)) { glBindTexture(TextureMode, 0); -#ifdef USE_OPENGLES - nglBindFramebufferOES(GL_FRAMEBUFFER_OES, FBOId); -#else nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBOId); -#endif } else return false; } else { -#ifdef USE_OPENGLES - nglBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); -#else nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); -#endif } return true; @@ -508,11 +432,7 @@ GLint CDriverGL::getGlTextureFormat(ITexture& tex, bool &compressed) break; } -#ifdef USE_OPENGLES - return GL_RGBA; -#else return GL_RGBA8; -#endif } // *************************************************************************** @@ -521,11 +441,7 @@ static GLint getGlSrcTextureFormat(ITexture &tex, GLint glfmt) H_AUTO_OGL(getGlSrcTextureFormat) // Is destination format is alpha or lumiance ? -#ifdef USE_OPENGLES - if ((glfmt==GL_ALPHA)||(glfmt==GL_LUMINANCE_ALPHA)||(glfmt==GL_LUMINANCE)) -#else if ((glfmt==GL_ALPHA8)||(glfmt==GL_LUMINANCE8_ALPHA8)||(glfmt==GL_LUMINANCE8)) -#endif { switch(tex.getPixelFormat()) { @@ -578,19 +494,9 @@ uint CDriverGL::computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const H_AUTO_OGL(CDriverGL_computeMipMapMemoryUsage) switch(glfmt) { -#ifdef GL_RGBA8 case GL_RGBA8: return w*h* 4; -#endif -#ifdef GL_RGBA - case GL_RGBA: return w*h* 4; -#endif // Well this is ugly, but simple :). GeForce 888 is stored as 32 bits. -#ifdef GL_RGB8 case GL_RGB8: return w*h* 4; -#endif -#ifdef GL_RGB - case GL_RGB: return w*h* 4; -#endif #ifdef GL_RGBA4 case GL_RGBA4: return w*h* 2; #endif @@ -600,24 +506,9 @@ uint CDriverGL::computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const #ifdef GL_RGB5 case GL_RGB5: return w*h* 2; #endif -#ifdef GL_LUMINANCE8 case GL_LUMINANCE8: return w*h* 1; -#endif -#ifdef GL_LUMINANCE - case GL_LUMINANCE: return w*h* 1; -#endif -#ifdef GL_ALPHA8 case GL_ALPHA8: return w*h* 1; -#endif -#ifdef GL_ALPHA - case GL_ALPHA: return w*h* 1; -#endif -#ifdef GL_LUMINANCE8_ALPHA8 case GL_LUMINANCE8_ALPHA8: return w*h* 2; -#endif -#ifdef GL_LUMINANCE_ALPHA - case GL_LUMINANCE_ALPHA: return w*h* 2; -#endif #ifdef GL_COMPRESSED_RGB_S3TC_DXT1_EXT case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return w*h /2; #endif diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp index 0556fad3e..25c7da614 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp @@ -1216,11 +1216,7 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff GLuint vertexBufferID; glGetError(); -#ifdef USE_OPENGLES - glGenBuffers(1, &vertexBufferID); -#else nglGenBuffersARB(1, &vertexBufferID); -#endif if (glGetError() != GL_NO_ERROR) return NULL; _Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID); @@ -1229,7 +1225,8 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff { case CVertexBuffer::AGPVolatile: #ifdef USE_OPENGLES - glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STREAM_DRAW); + // TODO: GL_STREAM_DRAW doesn't exist in OpenGL ES 1.x + glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW); #else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STREAM_DRAW_ARB); #endif @@ -1259,11 +1256,7 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff } if (glGetError() != GL_NO_ERROR) { -#ifdef USE_OPENGLES - glDeleteBuffers(1, &vertexBufferID); -#else nglDeleteBuffersARB(1, &vertexBufferID); -#endif return NULL; } @@ -1306,13 +1299,10 @@ void CVertexArrayRangeARB::updateLostBuffers() { nlassert((*it)->_VertexObjectId); GLuint id = (GLuint) (*it)->_VertexObjectId; -#ifdef USE_OPENGLES - nlassert(glIsBuffer(id)); - glDeleteBuffers(1, &id); -#else + nlassert(nglIsBufferARB(id)); nglDeleteBuffersARB(1, &id); -#endif + (*it)->_VertexObjectId = 0; (*it)->VB->setLocation(CVertexBuffer::NotResident); } @@ -1361,13 +1351,8 @@ CVertexBufferHardARB::~CVertexBufferHardARB() if (_VertexObjectId) { GLuint id = (GLuint) _VertexObjectId; -#ifdef USE_OPENGLES - nlassert(glIsBuffer(id)); - glDeleteBuffers(1, &id); -#else nlassert(nglIsBufferARB(id)); nglDeleteBuffersARB(1, &id); -#endif } if (_VertexArrayRange) { @@ -1412,12 +1397,7 @@ void *CVertexBufferHardARB::lock() } // recreate a vb GLuint vertexBufferID; - -#ifdef USE_OPENGLES - glGenBuffers(1, &vertexBufferID); -#else nglGenBuffersARB(1, &vertexBufferID); -#endif if (glGetError() != GL_NO_ERROR) { @@ -1429,42 +1409,30 @@ void *CVertexBufferHardARB::lock() { case CVertexBuffer::AGPVolatile: #ifdef USE_OPENGLES - glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STREAM_DRAW); + // TODO: GL_STREAM_DRAW doesn't exist in OpenGL ES 1.x + glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW); #else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STREAM_DRAW_ARB); #endif break; case CVertexBuffer::StaticPreferred: if (_Driver->getStaticMemoryToVRAM()) -#ifdef USE_OPENGLES - glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW); -#else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB); -#endif else -#ifdef USE_OPENGLES - glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW); -#else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); -#endif break; // case CVertexBuffer::AGPPreferred: default: -#ifdef USE_OPENGLES - glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW); -#else nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB); -#endif + break; } if (glGetError() != GL_NO_ERROR) { _Driver->incrementResetCounter(); -#ifdef USE_OPENGLES - glDeleteBuffers(1, &vertexBufferID); -#else + nglDeleteBuffersARB(1, &vertexBufferID); -#endif + return &_DummyVB[0];; } _VertexObjectId = vertexBufferID; @@ -1567,12 +1535,10 @@ void CVertexBufferHardARB::unlock() #ifdef USE_OPENGLES if (_Driver->_Extensions.OESMapBuffer) - { - unmapOk = nglUnmapBufferOES(GL_ARRAY_BUFFER); - } -#else - unmapOk = nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB); #endif + { + unmapOk = nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB); + } #ifdef NL_DEBUG _Unmapping = false; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp index 5470ec5c5..22bc5ff5a 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp @@ -453,7 +453,6 @@ bool CDriverGL::setupEXTVertexShader(const CVPParser::TProgram &program, GLuint // clear last error GLenum glError = glGetError(); - //variants[EVSSecondaryColorVariant] = nglGenSymbolsEXT(GL_VECTOR_EXT, GL_VARIANT_EXT, GL_NORMALIZED_RANGE_EXT, 1); //variants[EVSSecondaryColorVariant] = nglGenSymbolsEXT(GL_VECTOR_EXT, GL_VARIANT_EXT, GL_NORMALIZED_RANGE_EXT, 1); // allocate the symbols diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 9df2a53f9..943371fd9 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -603,6 +603,9 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re { H_AUTO_OGL(CDriverGL_setDisplay) + if (!mode.OffScreen) + NLMISC::INelContext::getInstance().setWindowedApplication(true); + _win = EmptyWindow; _CurrentMode = mode; @@ -627,10 +630,15 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re // Offscreen mode ? if (_CurrentMode.OffScreen) { -#if 0 - if (!createWindow(mode)) - return false; + if (!createWindow(mode)) return false; + HWND tmpHWND = _win; + int width = mode.Width; + int height = mode.Height; + +#ifdef USE_OPENGLES + // TODO: implement for OpenGL ES 1.x +#else // resize the window RECT rc; SetRect (&rc, 0, 0, width, height); @@ -1437,8 +1445,17 @@ bool CDriverGL::createWindow(const GfxMode &mode) #ifdef NL_OS_WINDOWS // create the OpenGL window - window = CreateWindowW(L"NLClass", L"NeL Window", WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, - CW_USEDEFAULT, CW_USEDEFAULT, mode.Width, mode.Height, HWND_DESKTOP, NULL, GetModuleHandle(NULL), NULL); + DWORD dwStyle = WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN|WS_CLIPSIBLINGS; + int pos = CW_USEDEFAULT; + HWND hwndParent = HWND_DESKTOP; + if (mode.OffScreen) + { + dwStyle &= ~WS_VISIBLE; + pos = 0; + hwndParent = NULL; + } + window = CreateWindowW(L"NLClass", L"NeL Window", dwStyle, + pos, pos, mode.Width, mode.Height, hwndParent, NULL, GetModuleHandle(NULL), NULL); if (window == EmptyWindow) { @@ -1469,7 +1486,7 @@ bool CDriverGL::createWindow(const GfxMode &mode) [[CocoaApplicationDelegate alloc] initWithDriver:this]; // set the application delegate, this will handle window/app close events - [NSApp setDelegate:appDelegate]; + [NSApp setDelegate:(id)appDelegate]; // bind the close button of the window to applicationShouldTerminate id closeButton = [cocoa_window standardWindowButton:NSWindowCloseButton]; diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp index d290e0cee..6206d94c3 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp @@ -270,28 +270,14 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server) return false; } - // first event about mouse movement after setting to emulateRawMode - if(_setToEmulateRawMode && - (event.type == NSMouseMoved || - event.type == NSLeftMouseDragged || - event.type == NSRightMouseDragged)) - { - // do not report because it reflects wrapping pointer to 0.5/0.5 - _setToEmulateRawMode = false; - return false; - } - // convert the modifiers for nel to pass them with the events - NLMISC::TKeyButton modifiers = - modifierFlagsToNelKeyButton([event modifierFlags]); + NLMISC::TKeyButton modifiers = modifierFlagsToNelKeyButton([event modifierFlags]); switch(event.type) { case NSLeftMouseDown: { - server->postEvent(new NLMISC::CEventMouseDown( - mousePos.x, mousePos.y, - (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this)); + server->postEvent(new NLMISC::CEventMouseDown(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this)); } break; case NSLeftMouseUp: @@ -319,15 +305,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server) { NLMISC::CEvent* nelEvent; - // when emulating raw mode, send the delta in a CGDMouseMove event - if(_emulateRawMode) - nelEvent = new NLMISC::CGDMouseMove( - this, NULL /* no mouse device */, event.deltaX, -event.deltaY); - - // normally send position in a CEventMouseMove - else - nelEvent = new NLMISC::CEventMouseMove( - mousePos.x, mousePos.y, (NLMISC::TMouseButton)modifiers, this); + nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)modifiers, this); server->postEvent(nelEvent); break; @@ -336,15 +314,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server) { NLMISC::CEvent* nelEvent; - // when emulating raw mode, send the delta in a CGDMouseMove event - if(_emulateRawMode) - nelEvent = new NLMISC::CGDMouseMove( - this, NULL /* no mouse device */, event.deltaX, -event.deltaY); - - // normally send position in a CEventMouseMove - else - nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, - (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this); + nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this); server->postEvent(nelEvent); break; @@ -353,15 +323,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server) { NLMISC::CEvent* nelEvent; - // when emulating raw mode, send the delta in a CGDMouseMove event - if(_emulateRawMode) - nelEvent = new NLMISC::CGDMouseMove( - this, NULL /* no mouse device */, event.deltaX, -event.deltaY); - - // normally send position in a CEventMouseMove - else - nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, - (NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), this); + nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), this); server->postEvent(nelEvent); break; @@ -434,12 +396,6 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server) } } - if(_emulateRawMode && _driver && (event.type == NSMouseMoved || - event.type == NSLeftMouseDragged || event.type == NSRightMouseDragged)) - { - _driver->setMousePos(0.5, 0.5); - } - return true; } @@ -492,17 +448,4 @@ void CCocoaEventEmitter::submitEvents(CEventServer& server, bool /* allWins */) _server = &server; } -void CCocoaEventEmitter::emulateMouseRawMode(bool enable) -{ - _emulateRawMode = enable; - - if(_emulateRawMode) - { - _setToEmulateRawMode = true; - - if(_driver) - _driver->setMousePos(0.5, 0.5); - } -} - } diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h index aa7d591fd..960614ef4 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h @@ -31,8 +31,6 @@ namespace NLMISC class CCocoaEventEmitter : public IEventEmitter { - bool _emulateRawMode; - bool _setToEmulateRawMode; bool _eventLoop; NL3D::IDriver* _driver; CocoaOpenGLView* _glView; @@ -42,8 +40,6 @@ class CCocoaEventEmitter : public IEventEmitter public: CCocoaEventEmitter() : - _emulateRawMode(false), - _setToEmulateRawMode(false), _driver(NULL), _glView(nil), _server(NULL) { } diff --git a/code/nel/src/3d/driver/opengl/unix_event_emitter.h b/code/nel/src/3d/driver/opengl/unix_event_emitter.h index 7eeef970e..493c4ad35 100644 --- a/code/nel/src/3d/driver/opengl/unix_event_emitter.h +++ b/code/nel/src/3d/driver/opengl/unix_event_emitter.h @@ -100,7 +100,6 @@ private: std::map _PressedKeys; XIM _im; XIC _ic; - bool _emulateRawMode; NL3D::IDriver* _driver; CUnixEventServer _InternalServer; ucstring _CopiedString; diff --git a/code/nel/src/3d/landscape.cpp b/code/nel/src/3d/landscape.cpp index 154f6f847..ccdeabc34 100644 --- a/code/nel/src/3d/landscape.cpp +++ b/code/nel/src/3d/landscape.cpp @@ -583,7 +583,6 @@ void CLandscape::setDriver(IDriver *drv) // Does the driver has sufficient requirements for Vegetable??? // only if VP supported by GPU, and Only if max vertices allowed. _DriverOkForVegetable = _VertexShaderOk && (_Driver->getMaxVerticesByVertexBufferHard()>=(uint)NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_MAX); - } } diff --git a/code/nel/src/3d/landscapevb_allocator.cpp b/code/nel/src/3d/landscapevb_allocator.cpp index 2c30cc19b..51714b88d 100644 --- a/code/nel/src/3d/landscapevb_allocator.cpp +++ b/code/nel/src/3d/landscapevb_allocator.cpp @@ -611,7 +611,6 @@ void CLandscapeVBAllocator::setupVBFormatAndVertexProgram(bool withVertexProgr nlverify(_Driver->compileVertexProgram(_VertexProgram[1])); } } - } diff --git a/code/nel/src/3d/meshvp_wind_tree.cpp b/code/nel/src/3d/meshvp_wind_tree.cpp index 0d2e91363..1e3d215a3 100644 --- a/code/nel/src/3d/meshvp_wind_tree.cpp +++ b/code/nel/src/3d/meshvp_wind_tree.cpp @@ -392,7 +392,6 @@ bool CMeshVPWindTree::begin(IDriver *driver, CScene *scene, CMeshBaseInstance *m sint numPls= renderTrav->getNumVPLights()-1; clamp(numPls, 0, CRenderTrav::MaxVPLight-1); - // Enable normalize only if requested by user. Because lighting don't manage correct "scale lighting" uint idVP= (SpecularLighting?2:0) + (driver->isForceNormalize()?1:0) ; // correct VP id for correct unmber of pls. @@ -523,7 +522,7 @@ void CMeshVPWindTree::beginMBRInstance(IDriver *driver, CScene *scene, CMeshBase idVP = numPls*4 + idVP; // re-activate VP if idVP different from last setup - if(idVP != _LastMBRIdVP) + if (idVP != _LastMBRIdVP) { _LastMBRIdVP= idVP; driver->activeVertexProgram(_VertexProgram[_LastMBRIdVP]); diff --git a/code/nel/src/3d/scene.cpp b/code/nel/src/3d/scene.cpp index 67465eb8c..7c552efd4 100644 --- a/code/nel/src/3d/scene.cpp +++ b/code/nel/src/3d/scene.cpp @@ -158,7 +158,7 @@ CScene::CScene(bool bSmallScene) : LightTrav(bSmallScene) _MaxSkeletonsInNotCLodForm= 20; - _FilterRenderFlags= std::numeric_limits::max(); + _FilterRenderFlags = std::numeric_limits::max(); _NextRenderProfile= false; @@ -592,11 +592,9 @@ void CScene::renderPart(UScene::TRenderPart rp, bool doHrcPass, bool doTrav, boo // nlassert(CurrentCamera); - // update models. updateModels(); - // Use the camera to setup Clip / Render pass. float left, right, bottom, top, znear, zfar; CurrentCamera->getFrustum(left, right, bottom, top, znear, zfar); diff --git a/code/nel/src/3d/shadow_map_manager.cpp b/code/nel/src/3d/shadow_map_manager.cpp index 383a28184..0c9f7ba8b 100644 --- a/code/nel/src/3d/shadow_map_manager.cpp +++ b/code/nel/src/3d/shadow_map_manager.cpp @@ -244,7 +244,7 @@ void CShadowMapManager::addShadowReceiver(CTransform *model) void CShadowMapManager::renderGenerate(CScene *scene) { H_AUTO( NL3D_ShadowManager_Generate ); - + // Each frame, do a small garbage collector for unused free textures. garbageShadowTextures(scene); diff --git a/code/nel/src/3d/transform.cpp b/code/nel/src/3d/transform.cpp index c12754c57..0ec65360d 100644 --- a/code/nel/src/3d/transform.cpp +++ b/code/nel/src/3d/transform.cpp @@ -113,7 +113,7 @@ CTransform::CTransform() _StateFlags= IsOpaque | IsUserLightable; // By default, always allow rendering of Transform Models. - _RenderFilterType= std::numeric_limits::max(); + _RenderFilterType = std::numeric_limits::max(); // By default, don't suport fast intersection detection _SupportFastIntersect= false; diff --git a/code/nel/src/3d/water_pool_manager.cpp b/code/nel/src/3d/water_pool_manager.cpp index b38068852..c377ff1f3 100644 --- a/code/nel/src/3d/water_pool_manager.cpp +++ b/code/nel/src/3d/water_pool_manager.cpp @@ -44,19 +44,19 @@ NLMISC_COMMAND(setWaterPool, "Setup a pool of water in the water pool manager", } if (numArgs == 3) { - whmb.FilterWeight = ::atof(args[2].c_str()); + NLMISC::fromString(args[2], whmb.FilterWeight); } if (numArgs == 4) { - whmb.UnitSize = ::atof(args[3].c_str()); + NLMISC::fromString(args[3], whmb.UnitSize); } if (numArgs == 5) { - whmb.WaveIntensity = ::atof(args[4].c_str()); + NLMISC::fromString(args[4], whmb.WaveIntensity); } if (numArgs == 4) { - whmb.WavePeriod = ::atof(args[5].c_str()); + NLMISC::fromString(args[5], whmb.WavePeriod); } // create the water pool GetWaterPoolManager().createWaterPool(whmb); diff --git a/code/nel/src/3d/zone_search.cpp b/code/nel/src/3d/zone_search.cpp index cbadc8c39..f850d4377 100644 --- a/code/nel/src/3d/zone_search.cpp +++ b/code/nel/src/3d/zone_search.cpp @@ -73,7 +73,7 @@ pair CZoneSearch::getZoneName(uint x, uint y, uint cx, uint cy) sprintf(name, "%d_%c%c.zonel", zoneY, firstLetter, secondLetter); - return make_pair(string(name), distance); + return std::pair(string(name), distance); } diff --git a/code/nel/src/georges/form_dfn.cpp b/code/nel/src/georges/form_dfn.cpp index d4a16bb50..16ee74d5b 100644 --- a/code/nel/src/georges/form_dfn.cpp +++ b/code/nel/src/georges/form_dfn.cpp @@ -707,7 +707,7 @@ bool CFormDfn::getEntryIndexByName (uint &entry, const std::string &name) const } entryIndex++; } - entry=std::numeric_limits::max(); + entry = std::numeric_limits::max(); return false; } diff --git a/code/nel/src/gui/CMakeLists.txt b/code/nel/src/gui/CMakeLists.txt index e3d501e23..32125791d 100644 --- a/code/nel/src/gui/CMakeLists.txt +++ b/code/nel/src/gui/CMakeLists.txt @@ -6,7 +6,7 @@ SOURCE_GROUP("src" FILES ${SRC}) NL_TARGET_LIB(nelgui ${SRC} ${HEADERS}) -INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR} ${CURL_INCLUDE_DIRS}) TARGET_LINK_LIBRARIES(nelgui nelmisc nel3d ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBWWW_LIBRARIES} ${CURL_LIBRARIES}) SET_TARGET_PROPERTIES(nelgui PROPERTIES LINK_INTERFACE_LIBRARIES "") diff --git a/code/nel/src/gui/ctrl_base_button.cpp b/code/nel/src/gui/ctrl_base_button.cpp index 4f118cd51..673ea906d 100644 --- a/code/nel/src/gui/ctrl_base_button.cpp +++ b/code/nel/src/gui/ctrl_base_button.cpp @@ -701,6 +701,11 @@ namespace NLGUI //pIM->submitEvent ("button_click:"+getId()); } */ + + // top-right corner is EventX=0, EventY=0 + _EventX = eventDesc.getX() - _XReal; + _EventY = (_YReal + _HReal) - eventDesc.getY(); + runLeftClickAction(); if (CWidgetManager::getInstance()->getCapturePointerLeft() == NULL) return true; // event handler may release cpature from this object (if it is removed for example) diff --git a/code/nel/src/gui/ctrl_scroll.cpp b/code/nel/src/gui/ctrl_scroll.cpp index f534fc0a1..c29f73fea 100644 --- a/code/nel/src/gui/ctrl_scroll.cpp +++ b/code/nel/src/gui/ctrl_scroll.cpp @@ -519,17 +519,17 @@ namespace NLGUI // Read Action handlers prop = (char*) xmlGetProp( node, (xmlChar*)"onscroll" ); - if (prop) _AHOnScroll = NLMISC::strlwr(prop); + if (prop) _AHOnScroll = NLMISC::strlwr(prop.str()); prop = (char*) xmlGetProp( node, (xmlChar*)"params" ); if (prop) _AHOnScrollParams = string((const char*)prop); // prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollend" ); - if (prop) _AHOnScrollEnd = NLMISC::strlwr(prop); + if (prop) _AHOnScrollEnd = NLMISC::strlwr(prop.str()); prop = (char*) xmlGetProp( node, (xmlChar*)"end_params" ); if (prop) _AHOnScrollEndParams = string((const char*)prop); // prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollcancel" ); - if (prop) _AHOnScrollCancel = NLMISC::strlwr(prop); + if (prop) _AHOnScrollCancel = NLMISC::strlwr(prop.str()); prop = (char*) xmlGetProp( node, (xmlChar*)"cancel_params" ); if (prop) _AHOnScrollCancelParams = string((const char*)prop); @@ -538,9 +538,9 @@ namespace NLGUI prop = (char*) xmlGetProp( node, (xmlChar*)"target" ); if (prop) { - CInterfaceGroup *group = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(prop)); + CInterfaceGroup *group = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(prop.str())); if(group == NULL) - group = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(this->getId(), prop)); + group = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(this->getId(), prop.str())); if(group != NULL) setTarget (group); diff --git a/code/nel/src/gui/dbgroup_combo_box.cpp b/code/nel/src/gui/dbgroup_combo_box.cpp index 61b8ec3e6..39ddd63c1 100644 --- a/code/nel/src/gui/dbgroup_combo_box.cpp +++ b/code/nel/src/gui/dbgroup_combo_box.cpp @@ -268,7 +268,7 @@ namespace NLGUI void CDBGroupComboBox::addText(const ucstring &text) { dirt(); - _Texts.push_back(make_pair(_Texts.size(), text)); + _Texts.push_back(make_pair((uint)_Texts.size(), text)); _Textures.push_back(std::string()); } @@ -330,7 +330,7 @@ namespace NLGUI } // *************************************************************************** - const uint &CDBGroupComboBox::getTextId(uint i) const + uint CDBGroupComboBox::getTextId(uint i) const { static uint null = 0; if(i<_Texts.size()) diff --git a/code/nel/src/gui/group_editbox.cpp b/code/nel/src/gui/group_editbox.cpp index 0dd4ffbda..f6d909119 100644 --- a/code/nel/src/gui/group_editbox.cpp +++ b/code/nel/src/gui/group_editbox.cpp @@ -999,7 +999,8 @@ namespace NLGUI break; // OTHER default: - if ((rEDK.getChar() == KeyRETURN) && !_WantReturn) + bool isKeyRETURN = !rEDK.getKeyCtrl() && rEDK.getChar() == KeyRETURN; + if (isKeyRETURN && !_WantReturn) { // update historic. if(_MaxHistoric) @@ -1030,9 +1031,9 @@ namespace NLGUI // If the char is not alphanumeric -> return. // if(!isalnum(ec.Char)) // return - if( (rEDK.getChar()>=32) || (rEDK.getChar() == KeyRETURN) ) + if( (rEDK.getChar()>=32) || isKeyRETURN ) { - if (rEDK.getChar() == KeyRETURN) + if (isKeyRETURN) { ucstring copyStr= _InputString; if ((uint) std::count(copyStr.begin(), copyStr.end(), '\n') >= _MaxNumReturn) @@ -1049,7 +1050,7 @@ namespace NLGUI cutSelection(); } - ucchar c = (rEDK.getChar() == KeyRETURN)?'\n':rEDK.getChar(); + ucchar c = isKeyRETURN ? '\n' : rEDK.getChar(); if (isFiltered(c)) return; switch(_EntryType) { @@ -1128,7 +1129,7 @@ namespace NLGUI ++ _CursorPos; triggerOnChangeAH(); } - if (rEDK.getChar() == KeyRETURN) + if (isKeyRETURN) { CAHManager::getInstance()->runActionHandler(_AHOnEnter, this, _AHOnEnterParams); } diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index dd7eebdef..656e36ca8 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -1217,7 +1217,7 @@ namespace NLGUI normal = value[MY_HTML_INPUT_SRC]; // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" - string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name; + string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name + "|submit_button_type=image"; // Add the ctrl button addButton (CCtrlButton::PushButton, name, normal, pushed.empty()?normal:pushed, over, @@ -1241,7 +1241,15 @@ namespace NLGUI text = value[MY_HTML_INPUT_VALUE]; // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" - string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name; + string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name + "|submit_button_type=submit"; + if (text.size() > 0) + { + // escape AH param separator + string tmp = text; + while(NLMISC::strFindReplace(tmp, "|", "|")) + ; + param = param + "|submit_button_value=" + tmp; + } // Add the ctrl button if (!_Paragraph) @@ -3638,14 +3646,18 @@ namespace NLGUI // *************************************************************************** - void CGroupHTML::submitForm (uint formId, const char *submitButtonName) + void CGroupHTML::submitForm (uint formId, const char *submitButtonType, const char *submitButtonName, const char *submitButtonValue, sint32 x, sint32 y) { // Form id valid ? if (formId < _Forms.size()) { _PostNextTime = true; _PostFormId = formId; + _PostFormSubmitType = submitButtonType; _PostFormSubmitButton = submitButtonName; + _PostFormSubmitValue = submitButtonValue; + _PostFormSubmitX = x; + _PostFormSubmitY = y; } } @@ -3918,9 +3930,22 @@ namespace NLGUI } } - // Add the button coordinates - HTParseFormInput(formfields, (_PostFormSubmitButton + "_x=0").c_str()); - HTParseFormInput(formfields, (_PostFormSubmitButton + "_y=0").c_str()); + if (_PostFormSubmitType == "image") + { + // Add the button coordinates + if (_PostFormSubmitButton.find_first_of("[") == string::npos) + { + HTParseFormInput(formfields, (_PostFormSubmitButton + "_x=" + NLMISC::toString(_PostFormSubmitX)).c_str()); + HTParseFormInput(formfields, (_PostFormSubmitButton + "_y=" + NLMISC::toString(_PostFormSubmitY)).c_str()); + } + else + { + HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + NLMISC::toString(_PostFormSubmitX)).c_str()); + HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + NLMISC::toString(_PostFormSubmitY)).c_str()); + } + } + else + HTParseFormInput(formfields, (_PostFormSubmitButton + "=" + _PostFormSubmitValue).c_str()); // Add custom params addHTTPPostParams(formfields, _TrustedDomain); diff --git a/code/nel/src/gui/group_menu.cpp b/code/nel/src/gui/group_menu.cpp index 08f887e9e..ddd022310 100644 --- a/code/nel/src/gui/group_menu.cpp +++ b/code/nel/src/gui/group_menu.cpp @@ -2200,7 +2200,7 @@ namespace NLGUI if( editorMode ) _Extends = std::string( (const char*)prop ); - CGroupMenu *gm = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(prop)); + CGroupMenu *gm = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(prop.str())); if (!gm) { gm = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:" + std::string((const char*)prop))); diff --git a/code/nel/src/gui/interface_anim.cpp b/code/nel/src/gui/interface_anim.cpp index 627a93280..edd96e1cf 100644 --- a/code/nel/src/gui/interface_anim.cpp +++ b/code/nel/src/gui/interface_anim.cpp @@ -55,7 +55,7 @@ namespace NLGUI if (ptr) _Dynamic = CInterfaceElement::convertBool (ptr); ptr = xmlGetProp (cur, (xmlChar*)"type"); - string sTmp = ptr; + string sTmp = ptr.str(); sTmp = strlwr(sTmp); if (sTmp == "linear") _Type = Track_Linear; @@ -74,7 +74,7 @@ namespace NLGUI } // - if (!CInterfaceLink::splitLinkTargets (ptr, parentGroup, _Targets)) + if (!CInterfaceLink::splitLinkTargets (ptr.str(), parentGroup, _Targets)) { nlwarning ("no target for track"); return false; @@ -194,7 +194,7 @@ namespace NLGUI fromString((const char*)time, fAnimTime); TAnimationTime animTime = fAnimTime * CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionMulCoefAnim).getValFloat(); double animValue; - fromString(value, animValue); + fromString(value.str(), animValue); // Depending on the type of the track add the key switch(_Type) diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index 29ad75f8c..b5027a87c 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -312,7 +312,7 @@ namespace NLGUI ptr = (char*) xmlGetProp( cur, (xmlChar*)"max_sizeparent" ); if (ptr) { - string idparent = ptr; + string idparent = ptr.str(); idparent = NLMISC::strlwr(idparent); if (idparent != "parent") { diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 096c001ae..1dbf62d51 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -664,7 +664,7 @@ namespace NLGUI //if it begins with a #, it is a reference in the instance attribute if (strchr(ptr, '#') != NULL) { - string LastProp = ptr; + string LastProp = ptr.str(); string NewProp =""; string RepProp; @@ -796,7 +796,7 @@ namespace NLGUI return false; } sint32 size; - fromString(cSize, size); + fromString(cSize.str(), size); if (size <= 0) { // todo hulud interface syntax error @@ -929,7 +929,7 @@ namespace NLGUI nlwarning(" Can't read the expression for a link node"); return false; } - std::string expr = ptr; + std::string expr = ptr.str(); std::vector targets; @@ -1119,13 +1119,13 @@ namespace NLGUI nlinfo ("options has no name"); return false; } - string optionsName = ptr; + string optionsName = ptr.str(); // herit if possible ptr = (char*) xmlGetProp( cur, (xmlChar*)"herit" ); if (ptr) { - string optionsParentName = ptr; + string optionsParentName = ptr.str(); CInterfaceOptions *io = wm->getOptions( optionsParentName ); if( io != NULL ) options->copyBasicMap( *io ); @@ -1771,7 +1771,7 @@ namespace NLGUI { CInterfaceExprValue res; - if (CInterfaceExpr::eval(ptrVal2, res)) + if (CInterfaceExpr::eval(ptrVal2.str(), res)) { if (!res.toString()) { @@ -1807,7 +1807,7 @@ namespace NLGUI nlwarning ("no id in a procedure"); return false; } - string procId= ptr; + string procId= ptr.str(); if (_ProcedureMap.find(procId) != _ProcedureMap.end()) { @@ -2171,7 +2171,7 @@ namespace NLGUI //get the property value ptr = (char*)xmlGetProp( cur, props->name); nlassert(ptr); - string propVal= ptr; + string propVal= ptr.str(); string newPropVal; // solve define of this prop @@ -2328,7 +2328,7 @@ namespace NLGUI nlinfo ("anim has no id"); return false; } - string animId = ptr; + string animId = ptr.str(); pAnim = new CInterfaceAnim; if (pAnim->parse (cur, parentGroup)) diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 4591d7554..b9efd50d5 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -2207,7 +2207,7 @@ namespace NLGUI } // Manage complex "Enter" - if (eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyRETURN) + if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyRETURN && !eventDesc.getKeyCtrl() ) { // If the top window has Enter AH CInterfaceGroup *tw= getTopWindow(); diff --git a/code/nel/src/misc/CMakeLists.txt b/code/nel/src/misc/CMakeLists.txt index 2d3ef9066..f40517f5b 100644 --- a/code/nel/src/misc/CMakeLists.txt +++ b/code/nel/src/misc/CMakeLists.txt @@ -1,6 +1,176 @@ FILE(GLOB SRC *.cpp *.h config_file/*.cpp config_file/*.h) FILE(GLOB HEADERS ../../include/nel/misc/*.h) +FILE(GLOB NLMISC_CDB + cdb.cpp ../../include/nel/misc/cdb.h + cdb_*.cpp ../../include/nel/misc/cdb_*.h +) + +FILE(GLOB NLMISC_EVENT + events.cpp ../../include/nel/misc/events.h + event_*.cpp ../../include/nel/misc/event_*.h + *_event_*.cpp ../../include/nel/misc/*_event_*.h +) + +FILE(GLOB NLMISC_DEBUG + debug.cpp ../../include/nel/misc/debug.h + report.cpp ../../include/nel/misc/report.h + log.cpp ../../include/nel/misc/log.h +) + +FILE(GLOB NLMISC_FILESYSTEM + async_file_manager.cpp ../../include/nel/misc/async_file_manager.h + file.cpp ../../include/nel/misc/file.h + path.cpp ../../include/nel/misc/path.h + big_file.cpp ../../include/nel/misc/big_file.h + *_xml.cpp ../../include/nel/misc/*_xml.h + xml_*.cpp ../../include/nel/misc/xml_*.h +) + +FILE(GLOB NLMISC_STREAM + *_stream.cpp ../../include/nel/misc/*_stream.h + stream.cpp ../../include/nel/misc/stream.h + stream_*.cpp ../../include/nel/misc/stream_*.h +) + +FILE(GLOB NLMISC_DISPLAYER + displayer.cpp ../../include/nel/misc/displayer.h + *_displayer.cpp ../../include/nel/misc/*_displayer.h +) + +FILE(GLOB NLMISC_MATH + plane.cpp ../../include/nel/misc/plane.h + ../../include/nel/misc/plane_inline.h + polygon.cpp ../../include/nel/misc/polygon.h + quad.cpp ../../include/nel/misc/quad.h + quat.cpp ../../include/nel/misc/quat.h + rect.cpp ../../include/nel/misc/rect.h + rgba.cpp ../../include/nel/misc/rgba.h + triangle.cpp ../../include/nel/misc/triangle.h + uv.cpp ../../include/nel/misc/uv.h + vector*.cpp ../../include/nel/misc/vector*.h + aabbox.cpp ../../include/nel/misc/aabbox.h + algo.cpp ../../include/nel/misc/algo.h + bsphere.cpp ../../include/nel/misc/bsphere.h + fast_floor.cpp ../../include/nel/misc/fast_floor.h + geom_ext.cpp ../../include/nel/misc/geom_ext.h + line.cpp ../../include/nel/misc/line.h + matrix.cpp ../../include/nel/misc/matrix.h +) + +FILE(GLOB NLMISC_PLATFORM + *_nl.cpp ../../include/nel/misc/*_nl.h + common.cpp ../../include/nel/misc/common.h + app_context.cpp ../../include/nel/misc/app_context.h + check_fpu.cpp ../../include/nel/misc/check_fpu.h + cpu_time_stat.cpp ../../include/nel/misc/cpu_time_stat.h + dummy_window.cpp ../../include/nel/misc/dummy_window.h + dynloadlib.cpp ../../include/nel/misc/dynloadlib.h + fast_mem.cpp ../../include/nel/misc/fast_mem.h + inter_window_msg_queue.cpp ../../include/nel/misc/inter_window_msg_queue.h + system_*.cpp ../../include/nel/misc/system_*.h + win32_util.cpp ../../include/nel/misc/win32_util.h + win_tray.cpp ../../include/nel/misc/win_tray.h +) + +FILE(GLOB NLMISC_GENERIC + ../../include/nel/misc/array_2d.h + *_memory.cpp ../../include/nel/misc/*_memory.h + buf_fifo.cpp ../../include/nel/misc/buf_fifo.h + ../../include/nel/misc/callback.h + *_allocator.cpp ../../include/nel/misc/*_allocator.h + ../../include/nel/misc/enum_bitset.h + fast_id_map.cpp ../../include/nel/misc/fast_id_map.h + hierarchical_timer.cpp ../../include/nel/misc/hierarchical_timer.h + ../../include/nel/misc/historic.h + ../../include/nel/misc/mutable_container.h + ../../include/nel/misc/random.h + smart_ptr.cpp ../../include/nel/misc/smart_ptr.h + ../../include/nel/misc/smart_ptr_inline.h + ../../include/nel/misc/resource_ptr.h + ../../include/nel/misc/resource_ptr_inline.h + bit_set.cpp ../../include/nel/misc/bit_set.h + stop_watch.cpp ../../include/nel/misc/stop_watch.h + ../../include/nel/misc/twin_map.h + object_vector.cpp ../../include/nel/misc/object_vector.h + ../../include/nel/misc/singleton.h + speaker_listener.cpp ../../include/nel/misc/speaker_listener.h + ../../include/nel/misc/static_map.h + stl_block_list.cpp ../../include/nel/misc/stl_block_list.h +) + +FILE(GLOB NLMISC_UTILITY + config_file.cpp ../../include/nel/misc/config_file.h + cf_*.cpp ../../include/nel/misc/cf_*.h + config_file/config_file.cpp config_file/config_file.h + config_file/cf_*.cpp config_file/cf_*.h + class_id.cpp ../../include/nel/misc/class_id.h + class_registry.cpp ../../include/nel/misc/class_registry.h + cmd_args.cpp ../../include/nel/misc/cmd_args.h + command.cpp ../../include/nel/misc/command.h + eid_translator.cpp ../../include/nel/misc/eid_translator.h + entity_id.cpp ../../include/nel/misc/entity_id.h + eval_num_expr.cpp ../../include/nel/misc/eval_num_expr.h + factory.cpp ../../include/nel/misc/factory.h + grid_traversal.cpp ../../include/nel/misc/grid_traversal.h + mouse_smoother.cpp ../../include/nel/misc/mouse_smoother.h + noise_value.cpp ../../include/nel/misc/noise_value.h + progress_callback.cpp ../../include/nel/misc/progress_callback.h + sheet_id.cpp ../../include/nel/misc/sheet_id.h + variable.cpp ../../include/nel/misc/variable.h + value_smoother.cpp ../../include/nel/misc/value_smoother.h +) + +FILE(GLOB NLMISC_STRING + string_*.cpp ../../include/nel/misc/string_*.h + ../../include/nel/misc/ucstring.h + unicode.cpp + sstring.cpp ../../include/nel/misc/sstring.h +) + +FILE(GLOB NLMISC_I18N + diff_tool.cpp ../../include/nel/misc/diff_tool.h + i18n.cpp ../../include/nel/misc/i18n.h + words_dictionary.cpp ../../include/nel/misc/words_dictionary.h +) + +FILE(GLOB NLMISC_THREAD + co_task.cpp ../../include/nel/misc/co_task.h + mutex.cpp ../../include/nel/misc/mutex.h + *_thread.cpp ../../include/nel/misc/*_thread.h + task_*.cpp ../../include/nel/misc/task_*.h + reader_writer.cpp ../../include/nel/misc/reader_writer.h + tds.cpp ../../include/nel/misc/tds.h + thread.cpp ../../include/nel/misc/thread.h +) + +FILE(GLOB NLMISC_BITMAP + bitmap.cpp ../../include/nel/misc/bitmap.h + bitmap_*.cpp +) + +FILE(GLOB NLMISC_CRYPT + md5.cpp ../../include/nel/misc/md5.h + sha1.cpp ../../include/nel/misc/sha1.h +) + +SOURCE_GROUP("" FILES ${SRC} ${HEADERS}) +SOURCE_GROUP("cdb" FILES ${NLMISC_CDB}) +SOURCE_GROUP("event" FILES ${NLMISC_EVENT}) +SOURCE_GROUP("debug" FILES ${NLMISC_DEBUG}) +SOURCE_GROUP("platform" FILES ${NLMISC_PLATFORM}) +SOURCE_GROUP("filesystem" FILES ${NLMISC_FILESYSTEM}) +SOURCE_GROUP("stream" FILES ${NLMISC_STREAM}) +SOURCE_GROUP("displayer" FILES ${NLMISC_DISPLAYER}) +SOURCE_GROUP("math" FILES ${NLMISC_MATH}) +SOURCE_GROUP("generic" FILES ${NLMISC_GENERIC}) +SOURCE_GROUP("utility" FILES ${NLMISC_UTILITY}) +SOURCE_GROUP("bitmap" FILES ${NLMISC_BITMAP}) +SOURCE_GROUP("thread" FILES ${NLMISC_THREAD}) +SOURCE_GROUP("i18n" FILES ${NLMISC_I18N}) +SOURCE_GROUP("crypt" FILES ${NLMISC_CRYPT}) +SOURCE_GROUP("string" FILES ${NLMISC_STRING}) + NL_TARGET_LIB(nelmisc ${HEADERS} ${SRC}) IF(WITH_GTK) diff --git a/code/nel/src/misc/app_context.cpp b/code/nel/src/misc/app_context.cpp index 32b981bb3..2383fcda5 100644 --- a/code/nel/src/misc/app_context.cpp +++ b/code/nel/src/misc/app_context.cpp @@ -114,6 +114,7 @@ CApplicationContext::CApplicationContext() DebugNeedAssert = false; NoAssert = false; AlreadyCreateSharedAmongThreads = false; + WindowedApplication = false; contextReady(); } @@ -242,6 +243,16 @@ void CApplicationContext::setAlreadyCreateSharedAmongThreads(bool b) AlreadyCreateSharedAmongThreads = b; } +bool CApplicationContext::isWindowedApplication() +{ + return WindowedApplication; +} + +void CApplicationContext::setWindowedApplication(bool b) +{ + WindowedApplication = b; +} + CLibraryContext::CLibraryContext(INelContext &applicationContext) : _ApplicationContext(&applicationContext) { @@ -430,6 +441,16 @@ void CLibraryContext::setAlreadyCreateSharedAmongThreads(bool b) _ApplicationContext->setAlreadyCreateSharedAmongThreads(b); } +bool CLibraryContext::isWindowedApplication() +{ + return _ApplicationContext->isWindowedApplication(); +} + +void CLibraryContext::setWindowedApplication(bool b) +{ + _ApplicationContext->setWindowedApplication(b); +} + void initNelLibrary(NLMISC::CLibrary &lib) { nlassert(lib.isLibraryLoaded()); diff --git a/code/nel/src/misc/co_task.cpp b/code/nel/src/misc/co_task.cpp index d238b4853..97a9e1e23 100644 --- a/code/nel/src/misc/co_task.cpp +++ b/code/nel/src/misc/co_task.cpp @@ -43,20 +43,7 @@ #else //NL_USE_THREAD_COTASK // some platform specifics #if defined (NL_OS_WINDOWS) -//# define _WIN32_WINNT 0x0500 -# define NL_WIN_CALLBACK CALLBACK -// Visual .NET won't allow Fibers for a Windows version older than 2000. However the basic features are sufficient for us, we want to compile them for all Windows >= 95 -# if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0400) -# ifdef _WIN32_WINNT -# undef _WIN32_WINNT -# endif -# define _WIN32_WINNT 0x0400 -# endif - -# ifndef NL_COMP_MINGW -# define NOMINMAX -# endif -# include +# define NL_WIN_CALLBACK CALLBACK #elif defined (NL_OS_UNIX) # define NL_WIN_CALLBACK # include diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 31ad7edb0..8183430f1 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -20,10 +20,7 @@ #include "nel/misc/common.h" #ifdef NL_OS_WINDOWS -# ifndef NL_COMP_MINGW -# define NOMINMAX -# endif -# include +# include # include # include #elif defined NL_OS_UNIX @@ -670,7 +667,7 @@ bool abortProgram(uint32 pid) #endif } -bool launchProgram (const std::string &programName, const std::string &arguments) +bool launchProgram(const std::string &programName, const std::string &arguments, bool log) { #ifdef NL_OS_WINDOWS @@ -722,7 +719,8 @@ bool launchProgram (const std::string &programName, const std::string &arguments { LPVOID lpMsgBuf; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL); - nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), GetLastError (), lpMsgBuf); + if (log) + nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), GetLastError(), lpMsgBuf); LocalFree(lpMsgBuf); CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); @@ -779,7 +777,8 @@ bool launchProgram (const std::string &programName, const std::string &arguments if (status == -1) { char *err = strerror (errno); - nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), errno, err); + if (log) + nlwarning("LAUNCH: Failed launched '%s' with arg '%s' err %d: '%s'", programName.c_str(), arguments.c_str(), errno, err); } else if (status == 0) { @@ -799,7 +798,8 @@ bool launchProgram (const std::string &programName, const std::string &arguments return true; } #else - nlwarning ("LAUNCH: launchProgram() not implemented"); + if (log) + nlwarning ("LAUNCH: launchProgram() not implemented"); #endif return false; diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index c7667acc2..798161a21 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -17,28 +17,8 @@ #include "stdmisc.h" #include "nel/misc/types_nl.h" -#include "nel/misc/debug.h" - -#ifdef HAVE_NELCONFIG_H -# include "nelconfig.h" -#endif // HAVE_NELCONFIG_H - -#include "nel/misc/log.h" -#include "nel/misc/displayer.h" -#include "nel/misc/mem_displayer.h" -#include "nel/misc/command.h" -#include "nel/misc/report.h" -#include "nel/misc/path.h" -#include "nel/misc/variable.h" -#include "nel/misc/system_info.h" #ifdef NL_OS_WINDOWS -# define _WIN32_WINDOWS 0x0410 -# ifndef NL_COMP_MINGW -# define WINVER 0x0400 -# define NOMINMAX -# endif -# include # include # include # include @@ -59,6 +39,22 @@ # include #endif +#include "nel/misc/debug.h" + +#ifdef HAVE_NELCONFIG_H +# include "nelconfig.h" +#endif // HAVE_NELCONFIG_H + +#include "nel/misc/log.h" +#include "nel/misc/displayer.h" +#include "nel/misc/mem_displayer.h" +#include "nel/misc/command.h" +#include "nel/misc/report.h" +#include "nel/misc/path.h" +#include "nel/misc/variable.h" +#include "nel/misc/system_info.h" +#include "nel/misc/system_utils.h" + #define NL_NO_DEBUG_FILES 1 using namespace std; @@ -83,7 +79,8 @@ using namespace std; #define LOG_IN_FILE NEL_LOG_IN_FILE // If true, debug system will trap crash even if the application is in debugger -static const bool TrapCrashInDebugger = false; +//static const bool TrapCrashInDebugger = false; +static const bool TrapCrashInDebugger = true; #ifdef DEBUG_NEW #define new DEBUG_NEW @@ -552,8 +549,8 @@ public: { // yoyo: allow only to send the crash report once. Because users usually click ignore, // which create noise into list of bugs (once a player crash, it will surely continues to do it). - bool i = false; - report (progname+shortExc, "", subject, _Reason, true, 1, true, 1, !isCrashAlreadyReported(), i, NL_CRASH_DUMP_FILE); + report(progname + shortExc, subject, _Reason, NL_CRASH_DUMP_FILE, true, !isCrashAlreadyReported(), ReportAbort); + // TODO: Does this need to be synchronous? Why does this not handle the report result? // no more sent mail for crash setCrashAlreadyReported(true); @@ -1196,10 +1193,10 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog) #ifdef NL_OS_WINDOWS if (TrapCrashInDebugger || !IsDebuggerPresent ()) +#endif { DefaultMsgBoxDisplayer = new CMsgBoxDisplayer ("DEFAULT_MBD"); } -#endif #if LOG_IN_FILE if (logInFile) @@ -1227,6 +1224,9 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog) #endif // LOG_IN_FILE DefaultMemDisplayer = new CMemDisplayer ("DEFAULT_MD"); + if (NLMISC::CSystemUtils::detectWindowedApplication()) + INelContext::getInstance().setWindowedApplication(true); + initDebug2(logInFile); INelContext::getInstance().setAlreadyCreateSharedAmongThreads(true); diff --git a/code/nel/src/misc/displayer.cpp b/code/nel/src/misc/displayer.cpp index d48c44d02..57b3e09d4 100644 --- a/code/nel/src/misc/displayer.cpp +++ b/code/nel/src/misc/displayer.cpp @@ -18,6 +18,10 @@ #include "nel/misc/types_nl.h" +#ifndef NL_OS_WINDOWS +# define IsDebuggerPresent() false +#endif + #ifdef NL_OS_WINDOWS # include # include @@ -35,19 +39,6 @@ #include "nel/misc/debug.h" -#ifdef NL_OS_WINDOWS -// these defines is for IsDebuggerPresent(). it'll not compile on windows 95 -// just comment this and the IsDebuggerPresent to compile on windows 95 -# define _WIN32_WINDOWS 0x0410 -# ifndef NL_COMP_MINGW -# define WINVER 0x0400 -# define NOMINMAX -# endif -# include -#else -# define IsDebuggerPresent() false -#endif - #include "nel/misc/displayer.h" using namespace std; @@ -529,7 +520,7 @@ void CFileDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *mes // in release "" void CMsgBoxDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *message) { -#ifdef NL_OS_WINDOWS +//#ifdef NL_OS_WINDOWS bool needSpace = false; // stringstream ss; @@ -688,39 +679,35 @@ void CMsgBoxDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *m // yoyo: allow only to send the crash report once. Because users usually click ignore, // which create noise into list of bugs (once a player crash, it will surely continues to do it). std::string filename = getLogDirectory() + NL_CRASH_DUMP_FILE; + + TReportResult reportResult = report(args.ProcessName + " NeL " + toString(logTypeToString(args.LogType, true)), + subject, body, filename, NL_REPORT_SYNCHRONOUS, !isCrashAlreadyReported(), NL_REPORT_DEFAULT); - if (ReportDebug == report (args.ProcessName + " NeL " + toString(logTypeToString(args.LogType, true)), "", subject, body, true, 2, true, 1, !isCrashAlreadyReported(), IgnoreNextTime, filename.c_str())) + switch (reportResult) { + case ReportAlwaysIgnore: + IgnoreNextTime = true; + break; + case ReportBreak: INelContext::getInstance().setDebugNeedAssert(true); + break; + case ReportAbort: +# ifdef NL_OS_WINDOWS +# ifndef NL_COMP_MINGW + // disable the Windows popup telling that the application aborted and disable the dr watson report. + _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); +# endif +# endif + abort(); + break; } // no more sent mail for crash setCrashAlreadyReported(true); } + } -/* // Check the envvar NEL_IGNORE_ASSERT - if (getenv ("NEL_IGNORE_ASSERT") == NULL) - { - // Ask the user to continue, debug or ignore - int result = MessageBox (NULL, ss2.str().c_str (), logTypeToString(args.LogType, true), MB_ABORTRETRYIGNORE | MB_ICONSTOP); - if (result == IDABORT) - { - // Exit the program now - exit (EXIT_FAILURE); - } - else if (result == IDRETRY) - { - // Give the debugger a try - DebugNeedAssert = true; - } - else if (result == IDIGNORE) - { - // Continue, do nothing - } - } -*/ } - -#endif +//#endif } diff --git a/code/nel/src/misc/gtk_displayer.cpp b/code/nel/src/misc/gtk_displayer.cpp index c2e04e67e..0c581b2e5 100644 --- a/code/nel/src/misc/gtk_displayer.cpp +++ b/code/nel/src/misc/gtk_displayer.cpp @@ -32,6 +32,7 @@ #pragma comment(lib, "gthread-1.3.lib") #endif +#include "nel/misc/app_context.h" #include "nel/misc/path.h" #include "nel/misc/command.h" #include "nel/misc/thread.h" @@ -59,6 +60,14 @@ static GtkWidget *hrootbox = NULL, *scrolled_win2 = NULL; // Functions // +CGtkDisplayer (const char *displayerName) : CWindowDisplayer(displayerName) +{ + needSlashR = false; + createLabel ("@Clear|CLEAR"); + + INelContext::getInstance().setWindowedApplication(true); +} + CGtkDisplayer::~CGtkDisplayer () { if (_Init) diff --git a/code/nel/src/misc/log.cpp b/code/nel/src/misc/log.cpp index 478a5e338..f0e3e36f8 100644 --- a/code/nel/src/misc/log.cpp +++ b/code/nel/src/misc/log.cpp @@ -19,11 +19,7 @@ #include "nel/misc/log.h" #ifdef NL_OS_WINDOWS -# ifndef NL_COMP_MINGW -# define NOMINMAX -# endif # include -# include #else # include #endif diff --git a/code/nel/src/misc/mem_displayer.cpp b/code/nel/src/misc/mem_displayer.cpp index 49431097d..0aaac26cc 100644 --- a/code/nel/src/misc/mem_displayer.cpp +++ b/code/nel/src/misc/mem_displayer.cpp @@ -24,10 +24,6 @@ #include "nel/misc/debug.h" #ifdef NL_OS_WINDOWS -# ifndef NL_COMP_MINGW -# define NOMINMAX -# endif -# include # include # pragma comment(lib, "imagehlp.lib") # ifdef NL_OS_WIN64 @@ -103,7 +99,7 @@ static string getFuncInfo (DWORD_TYPE funcAddr, DWORD_TYPE stackAddr) if (stop==0 && (parse[i] == ',' || parse[i] == ')')) { char tmp[32]; - sprintf (tmp, "=0x%p", *((ULONG*)(stackAddr) + 2 + pos++)); + sprintf(tmp, "=0x%p", *((DWORD_TYPE*)(stackAddr) + 2 + pos++)); str += tmp; } str += parse[i]; diff --git a/code/nel/src/misc/mutex.cpp b/code/nel/src/misc/mutex.cpp index 28f6bae37..8135d954f 100644 --- a/code/nel/src/misc/mutex.cpp +++ b/code/nel/src/misc/mutex.cpp @@ -41,15 +41,6 @@ using namespace std; #ifdef NL_OS_WINDOWS -// these defines are for IsDebuggerPresent(). It'll not compile on windows 95 -// just comment this and the IsDebuggerPresent to compile on windows 95 -#define _WIN32_WINDOWS 0x0410 -#ifndef NL_COMP_MINGW -# define WINVER 0x0400 -# define NOMINMAX -#endif -#include - #ifdef DEBUG_NEW #define new DEBUG_NEW #endif diff --git a/code/nel/src/misc/p_thread.cpp b/code/nel/src/misc/p_thread.cpp index a24029b3c..e71f56611 100644 --- a/code/nel/src/misc/p_thread.cpp +++ b/code/nel/src/misc/p_thread.cpp @@ -17,8 +17,8 @@ #include "stdmisc.h" -#include -#include +#include "nel/misc/types_nl.h" +#include "nel/misc/debug.h" #ifdef NL_OS_UNIX diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index 2a25276e8..248116f20 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -25,10 +25,6 @@ #include "nel/misc/xml_pack.h" #ifdef NL_OS_WINDOWS -# ifndef NL_COMP_MINGW -# define NOMINMAX -# endif -# include # include # include # include @@ -858,6 +854,8 @@ string getname (dirent *de) void CPath::getPathContent (const string &path, bool recurse, bool wantDir, bool wantFile, vector &result, class IProgressCallback *progressCallBack, bool showEverything) { getInstance()->_FileContainer.getPathContent(path, recurse, wantDir, wantFile, result, progressCallBack, showEverything); + + sort(result.begin(), result.end()); } void CFileContainer::getPathContent (const string &path, bool recurse, bool wantDir, bool wantFile, vector &result, class IProgressCallback *progressCallBack, bool showEverything) @@ -900,10 +898,10 @@ void CFileContainer::getPathContent (const string &path, bool recurse, bool want if (isdirectory(de)) { - // skip CVS and .svn directory - if ((!showEverything) && (fn == "CVS" || fn == ".svn")) + // skip CVS, .svn and .hg directory + if ((!showEverything) && (fn == "CVS" || fn == ".svn" || fn == ".hg")) { - NL_DISPLAY_PATH("PATH: CPath::getPathContent(%s, %d, %d, %d): skip CVS and .svn directory", path.c_str(), recurse, wantDir, wantFile); + NL_DISPLAY_PATH("PATH: CPath::getPathContent(%s, %d, %d, %d): skip CVS, .svn and .hg directory", path.c_str(), recurse, wantDir, wantFile); continue; } @@ -939,10 +937,10 @@ void CFileContainer::getPathContent (const string &path, bool recurse, bool want closedir (dir); #ifndef NL_OS_WINDOWS - BasePathgetPathContent = ""; + BasePathgetPathContent.clear(); #endif - // let s recurse + // let's recurse for (uint i = 0; i < recursPath.size (); i++) { // Progress bar @@ -960,8 +958,6 @@ void CFileContainer::getPathContent (const string &path, bool recurse, bool want progressCallBack->popCropedValues (); } } - - sort(result.begin(), result.end()); } void CPath::removeAllAlternativeSearchPath () @@ -1037,6 +1033,9 @@ void CFileContainer::addSearchPath (const string &path, bool recurse, bool alter { // find all path and subpath getPathContent (newPath, recurse, true, false, pathsToProcess, progressCallBack); + + // sort files + sort(pathsToProcess.begin(), pathsToProcess.end()); } for (uint p = 0; p < pathsToProcess.size(); p++) @@ -1082,7 +1081,10 @@ void CFileContainer::addSearchPath (const string &path, bool recurse, bool alter // find all files in the path and subpaths getPathContent (newPath, recurse, false, true, filesToProcess, progressCallBack); - // Progree bar + // sort files + sort(filesToProcess.begin(), filesToProcess.end()); + + // Progress bar if (progressCallBack) { progressCallBack->popCropedValues (); diff --git a/code/nel/src/misc/report.cpp b/code/nel/src/misc/report.cpp index 20b2b1c11..ef3280ef5 100644 --- a/code/nel/src/misc/report.cpp +++ b/code/nel/src/misc/report.cpp @@ -16,346 +16,209 @@ #include "stdmisc.h" +#include +#include + #include "nel/misc/common.h" #include "nel/misc/ucstring.h" #include "nel/misc/report.h" #include "nel/misc/path.h" - -#ifdef NL_OS_WINDOWS -# ifndef NL_COMP_MINGW -# define NOMINMAX -# endif -# include -# include -# include -#endif // NL_OS_WINDOWS - -#define NL_NO_DEBUG_FILES 1 - -using namespace std; +#include "nel/misc/file.h" +#include "nel/misc/system_utils.h" #ifdef DEBUG_NEW #define new DEBUG_NEW #endif +#define NL_REPORT_POST_URL_ENVVAR "NL_REPORT_POST_URL" +#ifdef NL_OS_WINDOWS +#define NL_CRASH_REPORT_TOOL "crash_report.exe" +#else +#define NL_CRASH_REPORT_TOOL "crash_report" +#endif +#define NL_DEBUG_REPORT 0 +// Set to 1 if you want command line report tool +#define NL_REPORT_CONSOLE 0 +// Set to 1 if you want command line report tool even when the debugger is present +#define NL_REPORT_CONSOLE_DEBUGGER 1 + namespace NLMISC { -#ifdef NL_OS_WINDOWS -static HWND sendReport=NULL; -#endif - -//old doesn't work on visual c++ 7.1 due to default parameter typedef bool (*TEmailFunction) (const std::string &smtpServer, const std::string &from, const std::string &to, const std::string &subject, const std::string &body, const std::string &attachedFile = "", bool onlyCheck = false); -typedef bool (*TEmailFunction) (const std::string &smtpServer, const std::string &from, const std::string &to, const std::string &subject, const std::string &body, const std::string &attachedFile, bool onlyCheck); - -#define DELETE_OBJECT(a) if((a)!=NULL) { DeleteObject (a); a = NULL; } - -static TEmailFunction EmailFunction = NULL; - -void setReportEmailFunction (void *emailFunction) +void setReportPostUrl(const char *postUrl) { - EmailFunction = (TEmailFunction)emailFunction; - -#ifdef NL_OS_WINDOWS - if (sendReport) - EnableWindow(sendReport, FALSE); +#if NL_DEBUG_REPORT + if (INelContext::isContextInitialised()) + nldebug("Set report post url to '%s'", postUrl); #endif -} - -#ifndef NL_OS_WINDOWS - -// GNU/Linux, do nothing - -void report () -{ -} - +#ifdef NL_OS_WINDOWS + SetEnvironmentVariableA(NL_REPORT_POST_URL_ENVVAR, postUrl); #else + setenv(NL_REPORT_POST_URL_ENVVAR, postUrl, 1); +#endif +} -// Windows specific version - -static string Body; -static string Subject; -static string AttachedFile; - -static HWND checkIgnore=NULL; -static HWND debug=NULL; -static HWND ignore=NULL; -static HWND quit=NULL; -static HWND dialog=NULL; - -static bool NeedExit; -static TReportResult Result; -static bool IgnoreNextTime; -static bool CanSendMailReport= false; - -static bool DebugDefaultBehavior, QuitDefaultBehavior; - -static void sendEmail() +inline const char *getReportPostURL() { - if (CanSendMailReport && SendMessage(sendReport, BM_GETCHECK, 0, 0) != BST_CHECKED) +#ifdef NL_OS_WINDOWS + static char buf[512]; + buf[0] = '\0'; + int res = GetEnvironmentVariableA(NL_REPORT_POST_URL_ENVVAR, buf, sizeof(buf)); + if (res <= 0 || res > 511) return NULL; + if (buf[0] == '\0') return NULL; + return buf; +#else + char *res = getenv(NL_REPORT_POST_URL_ENVVAR); + if (res == NULL || res[0] == '\0') return NULL; + return res; +#endif +} + +TReportResult report(const std::string &title, const std::string &subject, const std::string &body, const std::string &attachment, bool synchronous, bool sendReport, TReportResult defaultResult) +{ + std::string reportPath; + if (!body.empty()) { - bool res = EmailFunction ("", "", "", Subject, Body, AttachedFile, false); - if (res) + std::stringstream reportFile; + reportFile << getLogDirectory(); + reportFile << "nel_report_"; + reportFile << (int)time(NULL); + reportFile << ".log"; + reportPath = CFile::findNewFile(reportFile.str()); + std::ofstream f; + f.open(reportPath.c_str()); + if (!f.good()) { - // EnableWindow(sendReport, FALSE); - // MessageBox (dialog, "The email was successfully sent", "email", MB_OK); -#ifndef NL_NO_DEBUG_FILES - CFile::createEmptyFile(getLogDirectory() + "report_sent"); +#if NL_DEBUG_REPORT + if (INelContext::isContextInitialised()) + nldebug("Failed to write report log to '%s'", reportPath.c_str()); +#endif + reportPath.clear(); + } + else + { + f << body; + f.close(); + } + } + + if (((INelContext::isContextInitialised() + && INelContext::getInstance().isWindowedApplication()) + || CSystemUtils::detectWindowedApplication()) + && CFile::isExists(NL_CRASH_REPORT_TOOL)) + { + std::stringstream params; + params << NL_CRASH_REPORT_TOOL; + + if (!reportPath.empty()) + params << " -log \"" << reportPath << "\""; + + if (!subject.empty()) + params << " -attachment \"" << attachment << "\""; + + if (!title.empty()) + params << " -title \"" << title << "\""; + + if (!subject.empty()) + params << " -subject \"" << subject << "\""; + + const char *reportPostUrl = getReportPostURL(); + if (reportPostUrl) + params << " -host \"" << reportPostUrl << "\""; + + if (synchronous) + params << " -dev"; + + if (sendReport) + params << " -sendreport"; + + std::string paramsStr = params.str(); + + if (synchronous) + { + TReportResult result = (TReportResult)::system(paramsStr.c_str()); + if (result != ReportAlwaysIgnore + && result != ReportIgnore + && result != ReportAbort + && result != ReportBreak) + { +#if NL_DEBUG_REPORT + if (INelContext::isContextInitialised()) + nldebug("Return default result, invalid return code %i", (int)result); +#endif + return defaultResult; + } + return result; + } + else + { + NLMISC::launchProgram(NL_CRASH_REPORT_TOOL, paramsStr, + NL_DEBUG_REPORT ? INelContext::isContextInitialised() : false); // Only log if required, avoid infinite loop + return defaultResult; + } + } + else + { +#if NL_DEBUG_REPORT + if (INelContext::isContextInitialised() && !CFile::isExists(NL_CRASH_REPORT_TOOL)) + nldebug("Crash report tool '%s' does not exist", NL_CRASH_REPORT_TOOL); +#endif +#if defined(NL_OS_WINDOWS) && !FINAL_VERSION && !NL_REPORT_CONSOLE_DEBUGGER + if (IsDebuggerPresent()) + { + return defaultResult; + } + else +#endif + if (synchronous) + { +#if NL_REPORT_CONSOLE + // An interactive console based report + printf("\n"); + if (!title.empty()) + printf("%s\n", title.c_str()); + else + printf("NeL report\n"); + printf("\n"); + if (!subject.empty()) + printf("\tsubject: '%s'\n", subject.c_str()); + if (!body.empty()) + printf("\tbody: '%s'\n", reportPath.c_str()); + if (!attachment.empty()) + printf("\tattachment: '%s'\n", attachment.c_str()); + for (;;) + { + printf("\n"); + printf("Always Ignore (S), Ignore (I), Abort (A), Break (B)?\n"); // S for Surpress + printf("> "); + int c = getchar(); + getchar(); + switch (c) + { + case 'S': + case 's': + return ReportAlwaysIgnore; + case 'I': + case 'i': + return ReportIgnore; + case 'A': + case 'a': + return ReportAbort; + case 'B': + case 'b': + return ReportBreak; + } + } +#else + return defaultResult; #endif } else { -#ifndef NL_NO_DEBUG_FILES - CFile::createEmptyFile(getLogDirectory() + "report_failed"); -#endif - // MessageBox (dialog, "Failed to send the email", "email", MB_OK | MB_ICONERROR); + return defaultResult; } } - else - { -#ifndef NL_NO_DEBUG_FILES - CFile::createEmptyFile(getLogDirectory() + "report_refused"); -#endif - } } -static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - //MSGFILTER *pmf; - - if (message == WM_COMMAND && HIWORD(wParam) == BN_CLICKED) - { - if ((HWND) lParam == checkIgnore) - { - IgnoreNextTime = !IgnoreNextTime; - } - else if ((HWND) lParam == debug) - { - sendEmail(); - NeedExit = true; - Result = ReportDebug; - if (DebugDefaultBehavior) - { - NLMISC_BREAKPOINT; - } - } - else if ((HWND) lParam == ignore) - { - sendEmail(); - NeedExit = true; - Result = ReportIgnore; - } - else if ((HWND) lParam == quit) - { - sendEmail(); - NeedExit = true; - Result = ReportQuit; - - if (QuitDefaultBehavior) - { - // ace: we cannot call exit() because it's call the static object dtor and can crash the application - // if the dtor call order is not good. - //exit(EXIT_SUCCESS); -#ifdef NL_OS_WINDOWS -#ifndef NL_COMP_MINGW - // disable the Windows popup telling that the application aborted and disable the dr watson report. - _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); -#endif -#endif - // quit without calling atexit or static object dtors. - abort(); - } - } - /*else if ((HWND) lParam == sendReport) - { - if (EmailFunction != NULL) - { - bool res = EmailFunction ("", "", "", Subject, Body, AttachedFile, false); - if (res) - { - EnableWindow(sendReport, FALSE); - MessageBox (dialog, "The email was successfully sent", "email", MB_OK); - CFile::createEmptyFile(getLogDirectory() + "report_sent"); - } - else - { - MessageBox (dialog, "Failed to send the email", "email", MB_OK | MB_ICONERROR); - } - } - }*/ - } - else if (message == WM_CHAR) - { - if (wParam == 27) - { - // ESC -> ignore - sendEmail(); - NeedExit = true; - Result = ReportIgnore; - } - } - - return DefWindowProc (hWnd, message, wParam, lParam); -} - -TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const string &attachedFile) -{ - // register the window - static bool AlreadyRegister = false; - if(!AlreadyRegister) - { - WNDCLASSW wc; - memset (&wc,0,sizeof(wc)); - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = (WNDPROC)WndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = GetModuleHandle(NULL); - wc.hIcon = NULL; - wc.hCursor = LoadCursor(NULL,IDC_ARROW); - wc.hbrBackground = (HBRUSH)COLOR_WINDOW; - wc.lpszClassName = L"NLReportWindow"; - wc.lpszMenuName = NULL; - if (!RegisterClassW(&wc)) return ReportError; - AlreadyRegister = true; - } - - ucstring formatedTitle = title.empty() ? ucstring("NeL report") : ucstring(title); - - - // create the window - dialog = CreateWindowW (L"NLReportWindow", (LPCWSTR)formatedTitle.c_str(), WS_DLGFRAME | WS_CAPTION /*| WS_THICKFRAME*/, CW_USEDEFAULT, CW_USEDEFAULT, 456, 400, NULL, NULL, GetModuleHandle(NULL), NULL); - - // create the font - HFONT font = CreateFont (-12, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial"); - - Subject = subject; - AttachedFile = attachedFile; - - // create the edit control - HWND edit = CreateWindowW (L"EDIT", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_LEFT | ES_MULTILINE, 7, 70, 429, 212, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); - SendMessage (edit, WM_SETFONT, (WPARAM) font, TRUE); - - // set the edit text limit to lot of :) - SendMessage (edit, EM_LIMITTEXT, ~0U, 0); - - Body = addSlashR (body); - - // set the message in the edit text - SendMessage (edit, WM_SETTEXT, (WPARAM)0, (LPARAM)Body.c_str()); - - if (enableCheckIgnore) - { - // create the combo box control - checkIgnore = CreateWindowW (L"BUTTON", L"Don't display this report again", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_CHECKBOX, 7, 290, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); - SendMessage (checkIgnore, WM_SETFONT, (WPARAM) font, TRUE); - - if(ignoreNextTime) - { - SendMessage (checkIgnore, BM_SETCHECK, BST_CHECKED, 0); - } - } - - // create the debug button control - debug = CreateWindowW (L"BUTTON", L"Debug", WS_CHILD | WS_VISIBLE, 7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); - SendMessage (debug, WM_SETFONT, (WPARAM) font, TRUE); - - if (debugButton == 0) - EnableWindow(debug, FALSE); - - // create the ignore button control - ignore = CreateWindowW (L"BUTTON", L"Ignore", WS_CHILD | WS_VISIBLE, 75+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); - SendMessage (ignore, WM_SETFONT, (WPARAM) font, TRUE); - - if (ignoreButton == 0) - EnableWindow(ignore, FALSE); - - // create the quit button control - quit = CreateWindowW (L"BUTTON", L"Quit", WS_CHILD | WS_VISIBLE, 75+75+7+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); - SendMessage (quit, WM_SETFONT, (WPARAM) font, TRUE); - - if (quitButton == 0) - EnableWindow(quit, FALSE); - - // create the debug button control - sendReport = CreateWindowW (L"BUTTON", L"Don't send the report", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 7, 315+32, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); - SendMessage (sendReport, WM_SETFONT, (WPARAM) font, TRUE); - - string formatedHeader; - if (header.empty()) - { - formatedHeader = "This application stopped to display this report."; - } - else - { - formatedHeader = header; - } - - // ace don't do that because it s slow to try to send a mail - //CanSendMailReport = sendReportButton && EmailFunction != NULL && EmailFunction("", "", "", "", "", true); - CanSendMailReport = sendReportButton && EmailFunction != NULL; - - if (CanSendMailReport) - formatedHeader += " Send report will only email the contents of the box below. Please, send it to help us (it could take few minutes to send the email, be patient)."; - else - EnableWindow(sendReport, FALSE); - - ucstring uc = ucstring::makeFromUtf8(formatedHeader); - - // create the label control - HWND label = CreateWindowW (L"STATIC", (LPCWSTR)uc.c_str(), WS_CHILD | WS_VISIBLE /*| SS_WHITERECT*/, 7, 7, 429, 51, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); - SendMessage (label, WM_SETFONT, (WPARAM) font, TRUE); - - - DebugDefaultBehavior = debugButton==1; - QuitDefaultBehavior = quitButton==1; - - IgnoreNextTime = ignoreNextTime; - - // show until the cursor really show :) - while (ShowCursor(TRUE) < 0) - ; - - SetWindowPos (dialog, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); - - SetFocus(dialog); - SetForegroundWindow(dialog); - - NeedExit = false; - - while(!NeedExit) - { - MSG msg; - while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessageW(&msg); - } - nlSleep (1); - } - - // set the user result - ignoreNextTime = IgnoreNextTime; - - ShowWindow(dialog, SW_HIDE); - - - - DELETE_OBJECT(sendReport) - DELETE_OBJECT(quit) - DELETE_OBJECT(ignore) - DELETE_OBJECT(debug) - DELETE_OBJECT(checkIgnore) - DELETE_OBJECT(edit) - DELETE_OBJECT(label) - DELETE_OBJECT(dialog) - - return Result; -} - -#endif - - } // NLMISC diff --git a/code/nel/src/misc/shared_memory.cpp b/code/nel/src/misc/shared_memory.cpp index 7b11fea52..3afe795f1 100644 --- a/code/nel/src/misc/shared_memory.cpp +++ b/code/nel/src/misc/shared_memory.cpp @@ -19,12 +19,7 @@ #include "nel/misc/shared_memory.h" #include "nel/misc/debug.h" -#ifdef NL_OS_WINDOWS -# ifndef NL_COMP_MINGW -# define NOMINMAX -# endif -# include -#else +#ifndef NL_OS_WINDOWS # include # include # include diff --git a/code/nel/src/misc/sheet_id.cpp b/code/nel/src/misc/sheet_id.cpp index 83dd4be89..690d09ab1 100644 --- a/code/nel/src/misc/sheet_id.cpp +++ b/code/nel/src/misc/sheet_id.cpp @@ -217,7 +217,7 @@ bool CSheetId::buildSheetId(const std::string& sheetName) return true; } } - + #ifdef NL_TEMP_YUBO_NO_SOUND_SHEET_ID if (a_NoSoundSheetId && sheetName.find(".sound") != std::string::npos) { @@ -236,7 +236,7 @@ bool CSheetId::buildSheetId(const std::string& sheetName) return true; } #endif - + return false; } @@ -417,10 +417,10 @@ void CSheetId::initWithoutSheet() nlassert(_DontHaveSheetKnowledge); return; } - + _Initialised = true; _DontHaveSheetKnowledge = true; - + // Initialize id 0,0 as unknown.unknown CSheetId unknownunknown = CSheetId("unknown.unknown"); nlassert(unknownunknown == CSheetId::Unknown); @@ -525,7 +525,7 @@ bool CSheetId::operator < (const CSheetId& sheetRef ) const string CSheetId::toString(bool ifNotFoundUseNumericId) const { if (!_Initialised) init(false); - + if (_DontHaveSheetKnowledge) { // FIXME: When someone punches in a fake sheet id this will @@ -564,7 +564,7 @@ string CSheetId::toString(bool ifNotFoundUseNumericId) const void CSheetId::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { nlassert(!_DontHaveSheetKnowledge); - + f.serial( _Id.Id ); #ifdef NL_DEBUG_SHEET_ID diff --git a/code/nel/src/misc/sstring.cpp b/code/nel/src/misc/sstring.cpp index fe9332328..833553f21 100644 --- a/code/nel/src/misc/sstring.cpp +++ b/code/nel/src/misc/sstring.cpp @@ -1731,7 +1731,9 @@ namespace NLMISC double CSString::atof() const { - return ::atof(c_str()); + double val; + NLMISC::fromString(*this, val); + return val; } bool CSString::readFromFile(const CSString& fileName) diff --git a/code/nel/src/misc/stdmisc.h b/code/nel/src/misc/stdmisc.h index b98d92d2a..b24a74616 100644 --- a/code/nel/src/misc/stdmisc.h +++ b/code/nel/src/misc/stdmisc.h @@ -42,12 +42,20 @@ #include #include -#ifdef _WIN32 -# ifndef __MINGW32__ - #define NOMINMAX +#include + +#ifdef NL_OS_WINDOWS +# define WIN32_LEAN_AND_MEAN +# define _WIN32_WINDOWS 0x0410 +# ifndef _WIN32_WINNT +# define _WIN32_WINNT 0x0400 +# endif +# ifndef NL_COMP_MINGW +# define WINVER 0x0400 +# define NOMINMAX # endif # include -# include +# include #endif #endif // NL_STDMISC_H diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index 31cde5283..8524939c8 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -19,10 +19,6 @@ #include "nel/misc/system_info.h" #ifdef NL_OS_WINDOWS -# ifndef NL_COMP_MINGW -# define NOMINMAX -# endif -# include # include # include # include diff --git a/code/nel/src/misc/system_utils.cpp b/code/nel/src/misc/system_utils.cpp index a66eed02f..bb1111b88 100644 --- a/code/nel/src/misc/system_utils.cpp +++ b/code/nel/src/misc/system_utils.cpp @@ -18,16 +18,12 @@ #include "nel/misc/system_utils.h" #ifdef NL_OS_WINDOWS - #ifndef NL_COMP_MINGW - #define NOMINMAX - #endif - #include - - #ifdef _WIN32_WINNT_WIN7 +# include +# ifdef _WIN32_WINNT_WIN7 // only supported by Windows 7 Platform SDK - #include - #define TASKBAR_PROGRESS 1 - #endif +# include +# define TASKBAR_PROGRESS 1 +# endif #endif #ifdef DEBUG_NEW @@ -359,4 +355,14 @@ uint CSystemUtils::getCurrentColorDepth() return depth; } +/// Detect whether the current process is a windowed application. Return true if definitely yes, false if unknown +bool CSystemUtils::detectWindowedApplication() +{ +#ifdef NL_OS_WINDOWS + if (GetConsoleWindow() == NULL) + return true; +#endif + return false; +} + } // NLMISC diff --git a/code/nel/src/misc/time_nl.cpp b/code/nel/src/misc/time_nl.cpp index 8aacbd002..70b7b3807 100644 --- a/code/nel/src/misc/time_nl.cpp +++ b/code/nel/src/misc/time_nl.cpp @@ -21,10 +21,7 @@ #include "nel/misc/thread.h" #ifdef NL_OS_WINDOWS -# ifndef NL_COMP_MINGW -# define NOMINMAX -# endif -# include +# include #elif defined (NL_OS_UNIX) # include # include diff --git a/code/nel/src/misc/win32_util.cpp b/code/nel/src/misc/win32_util.cpp index 63315e1b2..6085e98e5 100644 --- a/code/nel/src/misc/win32_util.cpp +++ b/code/nel/src/misc/win32_util.cpp @@ -20,8 +20,6 @@ #ifdef NL_OS_WINDOWS -#include - #ifdef DEBUG_NEW #define new DEBUG_NEW #endif diff --git a/code/nel/src/misc/win_displayer.cpp b/code/nel/src/misc/win_displayer.cpp index 95b6b34cf..5da7db65b 100644 --- a/code/nel/src/misc/win_displayer.cpp +++ b/code/nel/src/misc/win_displayer.cpp @@ -18,10 +18,6 @@ #include "nel/misc/win_displayer.h" #ifdef NL_OS_WINDOWS -#ifndef NL_COMP_MINGW -# define NOMINMAX -#endif -#include #include #include #include @@ -30,6 +26,7 @@ #include #include +#include "nel/misc/app_context.h" #include "nel/misc/path.h" #include "nel/misc/command.h" #include "nel/misc/thread.h" @@ -45,6 +42,13 @@ namespace NLMISC { static CHARFORMAT2 CharFormat; +CWinDisplayer::CWinDisplayer(const char *displayerName) : CWindowDisplayer(displayerName), Exit(false) +{ + needSlashR = true; + createLabel("@Clear|CLEAR"); + + INelContext::getInstance().setWindowedApplication(true); +} CWinDisplayer::~CWinDisplayer () { diff --git a/code/nel/src/misc/win_event_emitter.cpp b/code/nel/src/misc/win_event_emitter.cpp index 01da89564..67e426f1e 100644 --- a/code/nel/src/misc/win_event_emitter.cpp +++ b/code/nel/src/misc/win_event_emitter.cpp @@ -22,10 +22,6 @@ #include "nel/misc/event_server.h" #ifdef NL_OS_WINDOWS -#ifndef NL_COMP_MINGW -#define NOMINMAX -#endif -#include #include /** diff --git a/code/nel/src/misc/win_thread.cpp b/code/nel/src/misc/win_thread.cpp index f556779ba..4178b7a58 100644 --- a/code/nel/src/misc/win_thread.cpp +++ b/code/nel/src/misc/win_thread.cpp @@ -198,7 +198,7 @@ void CWinThread::start () { if (isRunning()) throw EThread("Starting a thread that is already started, existing thread will continue running, this should not happen"); - + // ThreadHandle = (void *) ::CreateThread (NULL, _StackSize, ProxyFunc, this, 0, (DWORD *)&ThreadId); ThreadHandle = (void *) ::CreateThread (NULL, 0, ProxyFunc, this, 0, (DWORD *)&ThreadId); // nldebug("NLMISC: thread %x started for runnable '%x'", typeid( Runnable ).name()); diff --git a/code/nel/src/misc/words_dictionary.cpp b/code/nel/src/misc/words_dictionary.cpp index e2113e62d..4d5057dd7 100644 --- a/code/nel/src/misc/words_dictionary.cpp +++ b/code/nel/src/misc/words_dictionary.cpp @@ -251,7 +251,7 @@ void CWordsDictionary::exactLookupByKey( const CSString& key, CVectorSString& re */ inline CSString CWordsDictionary::makeResult( const CSString &key, const CSString &word ) { - return key + CSString(": ") + word; + return key + ": " + word.c_str(); } diff --git a/code/nel/src/net/service.cpp b/code/nel/src/net/service.cpp index f42806245..1f3436d1c 100644 --- a/code/nel/src/net/service.cpp +++ b/code/nel/src/net/service.cpp @@ -23,12 +23,6 @@ #ifdef NL_OS_WINDOWS // these defines is for IsDebuggerPresent(). it'll not compile on windows 95 // just comment this and the IsDebuggerPresent to compile on windows 95 -# define _WIN32_WINDOWS 0x0410 -# ifndef NL_COMP_MINGW -# define WINVER 0x0400 -# define NOMINMAX -# endif -# include # include #elif defined NL_OS_UNIX # include @@ -606,7 +600,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName, ListeningPort = servicePort; - setReportEmailFunction ((void*)sendEmail); + // setReportEmailFunction ((void*)sendEmail); // setDefaultEmailParams ("gw.nevrax.com", "", "cado@nevrax.com"); diff --git a/code/nel/src/net/stdnet.h b/code/nel/src/net/stdnet.h index d18db3222..df2bc931d 100644 --- a/code/nel/src/net/stdnet.h +++ b/code/nel/src/net/stdnet.h @@ -17,7 +17,9 @@ #include "nel/misc/types_nl.h" #ifdef NL_OS_WINDOWS +# define _WIN32_WINDOWS 0x0410 # ifndef NL_COMP_MINGW +# define WINVER 0x0400 # define NOMINMAX # endif # include diff --git a/code/nel/src/pacs/local_retriever.cpp b/code/nel/src/pacs/local_retriever.cpp index 7158cee0a..c17709c70 100644 --- a/code/nel/src/pacs/local_retriever.cpp +++ b/code/nel/src/pacs/local_retriever.cpp @@ -2253,7 +2253,7 @@ bool NLPACS::CLocalRetriever::checkSurfaceIntegrity(uint surf, NLMISC::CVector t for (k=0; k+1(ochain[k], ochain[k+1])); + edges.push_back(std::pair(ochain[k], ochain[k+1])); } } } diff --git a/code/nel/src/sound/CMakeLists.txt b/code/nel/src/sound/CMakeLists.txt index 2cf570f69..6b0dc285d 100644 --- a/code/nel/src/sound/CMakeLists.txt +++ b/code/nel/src/sound/CMakeLists.txt @@ -86,6 +86,7 @@ NL_TARGET_LIB(nelsound ${HEADERS} ${SRC}) INCLUDE_DIRECTORIES(${VORBIS_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${OGG_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nelsound ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY}) diff --git a/code/nel/src/sound/driver/dsound/source_dsound.h b/code/nel/src/sound/driver/dsound/source_dsound.h index 81174c1a0..1aa2d5625 100644 --- a/code/nel/src/sound/driver/dsound/source_dsound.h +++ b/code/nel/src/sound/driver/dsound/source_dsound.h @@ -80,7 +80,7 @@ enum TSourceDSoundEndState class CSourceDSound : public ISource { friend class CSoundDriverDSound; - + public: /// Constructor CSourceDSound(uint sourcename = 0); @@ -446,7 +446,7 @@ private: // Set the 'used' state of the source. Managed by the driver. void setUsed(bool v) { _IsUsed = v; } - + // Return the 'used' state of the source bool isUsed() { return _IsUsed; } */ diff --git a/code/nel/src/sound/driver/fmod/source_fmod.cpp b/code/nel/src/sound/driver/fmod/source_fmod.cpp index c5c6e8266..6026ce2f5 100644 --- a/code/nel/src/sound/driver/fmod/source_fmod.cpp +++ b/code/nel/src/sound/driver/fmod/source_fmod.cpp @@ -419,7 +419,7 @@ void CSourceFMod::setMinMaxDistances( float mindist, float maxdist, bool /* defe nlwarning("SOUND_DEV (FMod): Ridiculously high max distance set on source"); maxdist = maxSqrt; } - + _MinDist= mindist; _MaxDist= maxdist; if(_FModChannel!=-1) diff --git a/code/nel/src/sound/driver/openal/buffer_al.cpp b/code/nel/src/sound/driver/openal/buffer_al.cpp index b63e39fa2..352128c3e 100644 --- a/code/nel/src/sound/driver/openal/buffer_al.cpp +++ b/code/nel/src/sound/driver/openal/buffer_al.cpp @@ -121,7 +121,7 @@ bool CBufferAL::unlock(uint size) // Error handling if (alGetError() == AL_NO_ERROR) _IsLoaded = true; // ->lock() set it to false - + return _IsLoaded; } @@ -162,7 +162,7 @@ bool CBufferAL::fill(const uint8 *src, uint size) // Error handling _IsLoaded = (alGetError() == AL_NO_ERROR); - + return _IsLoaded; } diff --git a/code/nel/src/sound/simple_source.cpp b/code/nel/src/sound/simple_source.cpp index 2c9dda86c..9b9ee5950 100644 --- a/code/nel/src/sound/simple_source.cpp +++ b/code/nel/src/sound/simple_source.cpp @@ -176,7 +176,7 @@ void CSimpleSource::play() // and play the sound bool play = pSource->play(); - + #ifdef NL_DEBUG nlassert(play); #else diff --git a/code/nel/src/sound/sound_animation.cpp b/code/nel/src/sound/sound_animation.cpp index 5a6f1c256..1d1f9093a 100644 --- a/code/nel/src/sound/sound_animation.cpp +++ b/code/nel/src/sound/sound_animation.cpp @@ -176,7 +176,10 @@ void CSoundAnimation::load() throw NLMISC::Exception("Invalid sound animation marker"); } - marker->setTime((float) atof(time)); + float val; + NLMISC::fromString(time, val); + + marker->setTime(val); xmlFree ((void*)time); diff --git a/code/nel/tools/3d/ligo/plugin_max/script.cpp b/code/nel/tools/3d/ligo/plugin_max/script.cpp index 41740bcbe..8a88136c5 100644 --- a/code/nel/tools/3d/ligo/plugin_max/script.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/script.cpp @@ -1739,14 +1739,14 @@ bool MakeSnapShot (NLMISC::CBitmap &snapshot, const NL3D::CTileBank &tileBank, c float posY = config.CellSize * (float)ymin; // Use NELU - if (CNELU::init (oversampledWidth, oversampledHeight, CViewport(), 32, true, NULL, true)) + if (CNELU::init (oversampledWidth, oversampledHeight, CViewport(), 32, true, NULL, false, true)) // FIXME: OpenGL not working correctly, offscreen not available in Direct3D { // Setup the camera CNELU::Camera->setTransformMode (ITransformable::DirectMatrix); CMatrix view; view.setPos (CVector (width/2 + posX, height/2 + posY, width)); view.setRot (CVector::I, -CVector::K, CVector::J); - CNELU::Camera->setFrustum (width, height, 0.1f, 1000.f, false); + CNELU::Camera->setFrustum (width, height, 0.1f, 10000.f, false); CNELU::Camera->setMatrix (view); // Create a Landscape. @@ -1766,12 +1766,17 @@ bool MakeSnapShot (NLMISC::CBitmap &snapshot, const NL3D::CTileBank &tileBank, c theLand->enableAdditive (true); theLand->Landscape.setRefineMode (true); + // theLand->Landscape.setupStaticLight(CRGBA(255, 255, 255), CRGBA(0, 0, 0), 1.0f); + // theLand->Landscape.setThreshold(0.0005); + // Enbable automatique lighting #ifndef NL_DEBUG - theLand->Landscape.enableAutomaticLighting (true); - theLand->Landscape.setupAutomaticLightDir (CVector (0, 0, -1)); + // theLand->Landscape.enableAutomaticLighting (true); + // theLand->Landscape.setupAutomaticLightDir (CVector (0, 0, -1)); #endif // NL_DEBUG + // theLand->Landscape.updateLightingAll(); + // Clear the backbuffer and the alpha CNELU::clearBuffers(CRGBA(255,0,255,0)); @@ -1851,7 +1856,7 @@ bool MakeSnapShot (NLMISC::CBitmap &snapshot, const NL3D::CTileBank &tileBank, c Value* make_snapshot_cf (Value** arg_list, int count) { // Make sure we have the correct number of arguments (7) - check_arg_count(check_zone_with_template, 7, count); + check_arg_count(NeLLigoMakeSnapShot, 7, count); // Check to see if the arguments match up to what we expect char *message = "NeLLigoMakeSnapShot [Object] [Snapshot filename] [xMin] [xMax] [yMin] [yMax] [Error in dialog]"; @@ -1903,11 +1908,11 @@ Value* make_snapshot_cf (Value** arg_list, int count) else { // Build a filename - char drive[512]; - char path[512]; - char name[512]; - char ext[512]; - _splitpath (fileName.c_str(), drive, path, name, ext); + char drivetga[512]; + char pathtga[512]; + char nametga[512]; + char exttga[512]; + _splitpath (fileName.c_str(), drivetga, pathtga, nametga, exttga); // Build the zone CZone zone; @@ -1970,7 +1975,7 @@ Value* make_snapshot_cf (Value** arg_list, int count) { // Build the snap shot filename char outputFilenameSnapShot[512]; - _makepath (outputFilenameSnapShot, drive, path, name, ".tga"); + _makepath (outputFilenameSnapShot, drivetga, pathtga, nametga, ".tga"); // Output the snap shot COFile outputSnapShot; @@ -2011,10 +2016,10 @@ Value* make_snapshot_cf (Value** arg_list, int count) // Write the zone COFile outputLigoZone; - _makepath (outputFilenameSnapShot, drive, path, name, ".ligozone"); + _makepath (outputFilenameSnapShot, drivetga, pathtga, nametga, ".ligozone"); // Catch exception - try + /*try { // Open the selected zone file if (outputLigoZone.open (outputFilenameSnapShot)) @@ -2043,7 +2048,7 @@ Value* make_snapshot_cf (Value** arg_list, int count) char tmp[512]; smprintf (tmp, 512, "Error while loading the file %s : %s", fileName, e.what()); CMaxToLigo::errorMessage (tmp, "NeL Ligo export zone", *MAXScript_interface, errorInDialog); - } + }*/ } else { diff --git a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.cpp b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.cpp index da04de211..76592f556 100644 --- a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.cpp +++ b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.cpp @@ -68,6 +68,7 @@ NEL_3DSMAX_SHARED_API NLMISC::INelContext &GetSharedNelContext() { new NLMISC::CApplicationContext(); NLMISC::createDebug(); + NLMISC::INelContext::getInstance().setWindowedApplication(true); } return NLMISC::INelContext::getInstance(); } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp index 7bc128706..c5457786e 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp @@ -957,6 +957,7 @@ protected: Value* force_quit_on_msg_displayer_cf(Value** arg_list, int count) { nlwarning("Enable force quit on NeL report msg displayer"); + NLMISC::INelContext::getInstance().setWindowedApplication(false); // disable the Windows popup telling that the application aborted and disable the dr watson report. _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); putenv("NEL_IGNORE_ASSERT=1"); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp index d6bdbb690..d82e2a394 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp @@ -2144,6 +2144,8 @@ void appendLightmapLog (COFile &outputLog, const char *lightmapName, const vecto bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshBaseBuild *pZeMeshBaseBuild, INode& ZeNode, TimeValue tvTime, uint firstMaterial, bool outputLightmapLog) { + nldebug("Calculate LM: '%s'", ZeNode.GetName()); + DWORD t = timeGetTime(); uint32 i, j; diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp b/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp index 8acae94bd..80e715f21 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp @@ -338,6 +338,8 @@ get_selected_tile_cf(Value** arg_list, int count) if (tri->rpatch->tileSel[i]) array->append(Integer::intern(i+1)); } + if (os.obj != tri) + delete tri; } } @@ -383,6 +385,8 @@ get_selected_patch_cf(Value** arg_list, int count) if (tri->patch.patchSel[i]) array->append(Integer::intern(i+1)); } + if (os.obj != tri) + delete tri; } } @@ -428,6 +432,8 @@ get_selected_vertex_cf(Value** arg_list, int count) if (tri->patch.vertSel[i]) array->append(Integer::intern(i+1)); } + if (os.obj != tri) + delete tri; } } @@ -617,6 +623,8 @@ set_vertex_count_cf(Value** arg_list, int count) { nRet=tri->patch.numVerts; } + if (os.obj != tri) + delete tri; } return Integer::intern(nRet); @@ -655,6 +663,8 @@ set_vector_count_cf(Value** arg_list, int count) { nRet=tri->patch.numVecs; } + if (os.obj != tri) + delete tri; } return Integer::intern(nRet); @@ -702,6 +712,8 @@ set_vertex_pos_cf(Value** arg_list, int count) node->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE); ip->RedrawViews(ip->GetTime()); } + if (os.obj != tri) + delete tri; } } @@ -750,6 +762,8 @@ set_vector_pos_cf(Value** arg_list, int count) node->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE); ip->RedrawViews(ip->GetTime()); } + if (os.obj != tri) + delete tri; } } @@ -792,6 +806,8 @@ get_vertex_pos_cf(Value** arg_list, int count) { vRet=new Point3Value (tri->patch.verts[nVertex].p); } + if (os.obj != tri) + delete tri; } } @@ -834,6 +850,8 @@ get_vector_pos_cf(Value** arg_list, int count) { vRet=new Point3Value (tri->patch.vecs[nVertex].p); } + if (os.obj != tri) + delete tri; } } @@ -877,6 +895,8 @@ get_edge_vect1_cf(Value** arg_list, int count) { nVert=tri->patch.edges[nEdge].vec12; } + if (os.obj != tri) + delete tri; } } @@ -919,6 +939,8 @@ get_edge_vect2_cf(Value** arg_list, int count) { nVert=tri->patch.edges[nEdge].vec21; } + if (os.obj != tri) + delete tri; } } @@ -961,6 +983,8 @@ get_edge_vert1_cf(Value** arg_list, int count) { nVert=tri->patch.edges[nEdge].v1; } + if (os.obj != tri) + delete tri; } } @@ -1004,6 +1028,8 @@ get_edge_vert2_cf(Value** arg_list, int count) { nVert=tri->patch.edges[nEdge].v2; } + if (os.obj != tri) + delete tri; } } @@ -1050,6 +1076,8 @@ get_sel_edge_cf(Value** arg_list, int count) array->append(Integer::intern(i+1)); //array->data[j++]=; } + if (os.obj != tri) + delete tri; } } @@ -1158,6 +1186,8 @@ set_tile_steps_cf(Value** arg_list, int count) nTess=5; tri->rpatch->rTess.TileTesselLevel=nTess; tri->rpatch->InvalidateChannels (PART_ALL); + if (os.obj != tri) + delete tri; } if (bRet) { diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h b/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h index d0bfd1773..ec8947571 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/editpat.h @@ -755,6 +755,7 @@ class EditPatchMod : public Modifier, IPatchOps, IPatchSelect, ISubMtlAPI, Attac TCHAR *GetObjectName() { return GetString(IDS_TH_EDITPATCH); } void ActivateSubobjSel(int level, XFormModes& modes ); int NeedUseSubselButton() { return 0; } + void SelectSubPatch(int index); void SelectSubComponent( HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert ); void ClearSelection(int selLevel); void SelectAll(int selLevel); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp index 7b1c9c644..133d0b4d6 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np.cpp @@ -84,6 +84,31 @@ *> Copyright(c) 1994, All Rights Reserved. **********************************************************************/ #include "stdafx.h" + +#if MAX_VERSION_MAJOR >= 14 +# include +# include +# include +# include +# include +# include +# include +# include +# include +#else +# include +# include +// Various MAX and MXS includes +# include +# include +# include +# include +# include +# include +// define the new primitives using macros from SDK +# include +#endif + #include "editpat.h" #include "../nel_patch_lib/vertex_neighborhood.h" @@ -855,3 +880,67 @@ void ResetVert (PatchMesh *patch) patch->computeInteriors(); patch->InvalidateGeomCache (); } + +def_visible_primitive(turn_patch, "RykolTurnPatch"); + +Value *turn_patch_cf (Value** arg_list, int count) +{ + // Make sure we have the correct number of arguments (2) + check_arg_count(RykolTurnPatch, 3, count); + + // Check to see if the arguments match up to what we expect + // We want to use 'TurnAllTexturesOn ' + type_check(arg_list[0], MAXNode, "RykolTurnPatch [Node] [Modifier] [Patch]"); + type_check(arg_list[1], MAXModifier, "RykolTurnPatch [Node] [Modifier] [Patch]"); + type_check(arg_list[2], Integer, "RykolTurnPatch [Node] [Modifier] [Patch]"); + + // Get a good interface pointer + Interface *ip = MAXScript_interface; + + // Get a INode pointer from the argument passed to us + INode *node = arg_list[0]->to_node(); + nlassert (node); + + // Get a Object pointer + ObjectState os = node->EvalWorldState(ip->GetTime()); + + // ok ? + bool bRet=false; + + if (os.obj) + { + // Get class id + if (os.obj->CanConvertToType(RYKOLPATCHOBJ_CLASS_ID)) + { + bRet = true; + RPO *tri = (RPO *)os.obj->ConvertToType(ip->GetTime(), RYKOLPATCHOBJ_CLASS_ID); + if (tri) + { + Modifier *mod = arg_list[1]->to_modifier(); + if (mod) + { + EditPatchMod *epmod = (EditPatchMod *)mod; + epmod->ClearSelection(EP_PATCH); + epmod->SelectSubPatch(arg_list[2]->to_int() - 1); + epmod->DoPatchTurn(true); + epmod->ClearSelection(EP_PATCH); + } + else + { + bRet = false; + } + } + // Note that the TriObject should only be deleted + // if the pointer to it is not equal to the object + // pointer that called ConvertToType() + if (os.obj != tri) + delete tri; + + // redraw and update + node->NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE); + ip->RedrawViews(ip->GetTime()); + } + } + + return bRet?&true_value:&false_value; +} \ No newline at end of file diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_selection.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_selection.cpp index 3814a2df9..0b15b63e7 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_selection.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_epm_selection.cpp @@ -236,6 +236,50 @@ void EditPatchMod::SetSelLevel(DWORD level) // ------------------------------------------------------------------------------------------------------------------------------------------------------ +void EditPatchMod::SelectSubPatch(int index) +{ + if (!ip) + return; + TimeValue t = ip->GetTime(); + + ip->ClearCurNamedSelSet(); + + ModContextList mcList; + INodeTab nodes; + ip->GetModContexts(mcList, nodes); + + for (int i = 0; i < mcList.Count(); i++) + { + EditPatchData *patchData =(EditPatchData*)mcList[i]->localData; + + if (!patchData) + return; + + RPatchMesh *rpatch; + PatchMesh *patch = patchData->TempData(this)->GetPatch(t, rpatch); + if (!patch) + return; + + patchData->BeginEdit(t); + if (theHold.Holding()) + theHold.Put(new PatchRestore(patchData, this, patch, rpatch, "SelectSubComponent")); + + patch->patchSel.Set(index); + + patchData->UpdateChanges(patch, rpatch, FALSE); + if (patchData->tempData) + { + patchData->tempData->Invalidate(PART_SELECT); + } + } + PatchSelChanged(); + + UpdateSelectDisplay(); + NotifyDependents(FOREVER, PART_SELECT, REFMSG_CHANGE); +} + +// ------------------------------------------------------------------------------------------------------------------------------------------------------ + // Select a subcomponent within our object(s). WARNING! Because the HitRecord list can // indicate any of the objects contained within the group of patches being edited, we need // to watch for control breaks in the patchData pointer within the HitRecord! diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/keys.cfg b/code/nel/tools/3d/plugin_max/nel_patch_paint/keys.cfg index a94996500..4f1013dae 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/keys.cfg +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/keys.cfg @@ -176,6 +176,7 @@ LockBorders = KeyL; ZoomIn = Key1; ZoomOut = Key2; GetState = Key3; +ResetPatch = KeyF10; /*************** *This is the the light settings diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp index 3fd00f000..73bb142b1 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint.cpp @@ -145,7 +145,7 @@ std::vector symVector; // Painter modes enum TModePaint { ModeTile, ModeColor, ModeDisplace}; -enum TModeMouse { ModePaint, ModeSelect, ModePick, ModeFill, ModeGetState }; +enum TModeMouse { ModePaint, ModeSelect, ModePick, ModeFill, ModeGetState, ModeResetPatch }; /*-------------------------------------------------------------------*/ @@ -2585,6 +2585,13 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi // Set mode modeSelect=ModeGetState; + // Mode reset zone + if (AsyncListener.isKeyDown ((TKey)PainterKeys[ResetPatch])) + { + // Set mode + modeSelect=ModeResetPatch; + } + // Mode picking if (AsyncListener.isKeyDown ((TKey)PainterKeys[Fill0])) { @@ -2891,6 +2898,8 @@ void mainproc(CScene& scene, CEventListenerAsync& AsyncListener, CEvent3dMouseLi SetCursor (bankCont->HFill); else if (pData->pobj->TileTrick) SetCursor (bankCont->HTrick); + else if (modeSelect==ModeResetPatch) + SetCursor (LoadCursor (NULL, IDC_NO)); else SetCursor (LoadCursor (NULL, IDC_ARROW)); @@ -3034,7 +3043,7 @@ private: // Callback on mouse events virtual void operator ()(const CEvent& event) { - if (event==EventDestroyWindowId) + if (event==EventDestroyWindowId || event==EventCloseWindowId) { WindowActive=false; } @@ -3140,9 +3149,30 @@ private: _FillTile.fillColor (mesh1, patch, _VectMesh, maxToNel (color1), (uint16)(256.f*opa1), PaintColor); else if (nModeTexture==ModeDisplace) - // Fill this patch with the current color + // Fill this patch with the current displace _FillTile.fillDisplace (mesh1, patch, _VectMesh, bank); } + else if (modeSelect==ModeResetPatch) + { + int np = _VectMesh[mesh1].PMesh->numPatches; + for (int pp = 0; pp < np; ++pp) + { + // Fill default tile + _FillTile.fillTile (mesh1, pp, _VectMesh, -1, 0, 0, true, bank); + + // Fill default color + _FillTile.fillColor (mesh1, pp, _VectMesh, CRGBA(255, 255, 255), 256, PaintColor); + + // Backup current displace, fill default, restore + int bkdt = _Pobj->DisplaceTile; + int bkdts = _Pobj->DisplaceTileSet; + _Pobj->DisplaceTile = 0; + _Pobj->DisplaceTileSet = -1; + _FillTile.fillDisplace (mesh1, pp, _VectMesh, bank); + _Pobj->DisplaceTile = bkdt; + _Pobj->DisplaceTileSet = bkdts; + } + } } } // Pick with right mouse @@ -4095,7 +4125,7 @@ DWORD WINAPI myThread (LPVOID vData) // Create a Landscape. CLandscapeModel *TheLand= (CLandscapeModel*)CNELU::Scene->createModel(LandscapeModelId); - TheLand->Landscape.setTileNear (1000.f); + TheLand->Landscape.setTileNear (10000.f); TheLand->Landscape.TileBank=bank; // Enbable automatique lighting @@ -4192,7 +4222,7 @@ DWORD WINAPI myThread (LPVOID vData) mat.setPos(P); CNELU::Camera->setTransformMode (ITransformable::DirectMatrix); CNELU::Camera->setMatrix (mat); - CNELU::Camera->setPerspective( 75.f*(float)Pi/180.f/*vp->GetFOV()*/, 1.33f, 0.1f, 1000.f); + CNELU::Camera->setPerspective( 75.f*(float)Pi/180.f/*vp->GetFOV()*/, 1.33f, 0.1f, 10000.f); // Resize the sym vector symVector.resize (pData->VectMesh.size()); @@ -4257,6 +4287,7 @@ DWORD WINAPI myThread (LPVOID vData) CNELU::EventServer.addListener (EventMouseUpId, &listener); CNELU::EventServer.addListener (EventMouseDblClkId, &listener); CNELU::EventServer.addListener (EventDestroyWindowId, &listener); + CNELU::EventServer.addListener (EventCloseWindowId, &listener); CNELU::EventServer.addListener (EventKeyDownId, &listener); // Camera position @@ -4326,6 +4357,7 @@ DWORD WINAPI myThread (LPVOID vData) CNELU::EventServer.removeListener (EventMouseDblClkId, &listener); CNELU::EventServer.removeListener (EventKeyDownId, &listener); CNELU::EventServer.removeListener (EventDestroyWindowId, &listener); + CNELU::EventServer.removeListener (EventCloseWindowId, &listener); // End. //======== diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp index 1c756e0c8..b8503c137 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.cpp @@ -43,6 +43,7 @@ uint PainterKeys[KeyCounter]= Key1, Key2, KeyI, + KeyF10, }; // Keys @@ -77,6 +78,7 @@ const char* PainterKeysName[KeyCounter]= "ZoomIn", "ZoomOut", "GetState", + "ResetPatch", }; // Light settings diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.h b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.h index aa56b06ba..13d1708ef 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/paint_ui.h @@ -122,6 +122,7 @@ enum PainterKeysType ZoomIn, ZoomOut, GetState, + ResetPatch, KeyCounter }; diff --git a/code/nel/tools/3d/plugin_max/scripts/nel_orient_zones.ms b/code/nel/tools/3d/plugin_max/scripts/nel_orient_zones.ms new file mode 100644 index 000000000..26fd67171 --- /dev/null +++ b/code/nel/tools/3d/plugin_max/scripts/nel_orient_zones.ms @@ -0,0 +1,124 @@ + +gc() +nodes = getCurrentSelection() +max select none +clearselection() + +undo off +( + for cnode in nodes do + ( + if (classof cnode) == Editable_Patch or (classof cnode) == RklPatch then + ( + print cnode.name + selectmore cnode + if (classof cnode) == Editable_Patch and (classof cnode) != RklPatch then + ( + modPanel.addModToSelection (NeL_Convert ()) ui:on + ) + modPanel.addModToSelection (NeL_Edit ()) ui:on + setCommandPanelTaskMode #modify + cmod = modpanel.getCurrentObject() + pcount = (GetRykolPatchCount cnode) + print pcount + for p = 1 to pcount do + ( + --print p + vbegin = (NeLGetPatchVertex cnode p 1) + vend = (NeLGetPatchVertex cnode p 2) + vref = (NeLGetPatchVertex cnode p 3) + begin = (GetRykolVertexPos cnode vbegin) + end = (GetRykolVertexPos cnode vend) + ref = (GetRykolVertexPos cnode vref) + normal = (cross (end - begin) (ref - begin)) + normal = (normalize normal) + + rotnormal = (point3 0 0 0) + if (normal.z > 0.9) then + ( + --print "x normal" + rotnormal = (normal * (rotateXMatrix -90)) + ) + else + ( + normal.z = 0 + normal = (normalize normal) + rotnormal = (normal * (rotateZMatrix -90)) + ) + --print rotnormal + + -- print normal + -- print rotnormal + -- print begin + -- print end + dir = (normalize (end - begin)) + -- print dir + score1 = (dot dir rotnormal) + + RykolTurnPatch cnode cmod (p) + vbegin = (NeLGetPatchVertex cnode p 1) + vend = (NeLGetPatchVertex cnode p 2) + begin = (GetRykolVertexPos cnode vbegin) + end = (GetRykolVertexPos cnode vend) + dir = (normalize (end - begin)) + score2 = (dot dir rotnormal) + + RykolTurnPatch cnode cmod (p) + vbegin = (NeLGetPatchVertex cnode p 1) + vend = (NeLGetPatchVertex cnode p 2) + begin = (GetRykolVertexPos cnode vbegin) + end = (GetRykolVertexPos cnode vend) + dir = (normalize (end - begin)) + score3 = (dot dir rotnormal) + + RykolTurnPatch cnode cmod (p) + vbegin = (NeLGetPatchVertex cnode p 1) + vend = (NeLGetPatchVertex cnode p 2) + begin = (GetRykolVertexPos cnode vbegin) + end = (GetRykolVertexPos cnode vend) + dir = (normalize (end - begin)) + score4 = (dot dir rotnormal) + + -- print score1 + -- print score2 + -- print score3 + -- print score4 + + if (score1 > score2 and score1 > score3 and score1 > score4) then + ( + -- print "score 1" + RykolTurnPatch cnode cmod (p) + ) + else if (score2 > score3 and score2 > score4) then + ( + -- print "score 2" + RykolTurnPatch cnode cmod (p) + RykolTurnPatch cnode cmod (p) + ) + else if (score3 > score4) then + ( + -- print "score 3" + RykolTurnPatch cnode cmod (p) + RykolTurnPatch cnode cmod (p) + RykolTurnPatch cnode cmod (p) + ) + else + ( + -- print "score 4" + ) + ) + maxOps.CollapseNode cnode off + max select none + ) + ) +) + +max select none +clearselection() +undo off +( + for cnode in nodes do + ( + selectmore cnode + ) +) diff --git a/code/nel/tools/3d/plugin_max/scripts/nel_zone_namer.ms b/code/nel/tools/3d/plugin_max/scripts/nel_zone_namer.ms new file mode 100644 index 000000000..e651dd76a --- /dev/null +++ b/code/nel/tools/3d/plugin_max/scripts/nel_zone_namer.ms @@ -0,0 +1,68 @@ +-- This script sets proper centered zone positions and generates their names +-- Use after cutting the zone into 160m by 160m pieces + +cell_size = 160.0 +offset_x = 7680 / 2 +offset_y = -(20480 + (5120 / 2)) + +alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + +-- http://proofofprogress.blogspot.be/2011/03/solution-align-pivot-to-world-without.html +Function alignPivotToWorld &theObject = ( + --VLM = Visible Local Matrix. + --The matrix/pivot you see when selecting object and "Local" axis is selected as viewable. + VLM = theObject.Transform; + IP_LocalRot = theObject.objectOffsetRot; --Rotation to be used later. + IP_LOCAL = theObject.objectOffsetPos; --Invisible Pivot Local coordinates + --In relation to VLM matrix. + IP_WORLD = IP_LOCAL * VLM; --World Coordinates of Invisible Pivot. [Local To World Transform] + VLM_0 = matrix3 1; --Reset Visible Local matrix coordinates. + + NEW_IP_LOCAL = IP_WORLD * inverse(VLM_0); --[World To local Transform] + + theObject.Transform = VLM_0; + theObject.objectOffsetPos = NEW_IP_LOCAL; + + --Now Handle Rotation: + --Since rotation of visible local matrix has been zeroed out, + --You must add that loss to the invisible pivot rotation. + GeomWorldRot = VLM.RotationPart + IP_LocalRot; + theObject.objectOffsetRot = GeomWorldRot; +) + +-- Convert a coordinate in a name +-- name = coordToName #(x, y) +fn coordToName coord = +( + up = floor(coord[1] / 26) + 1 + down = floor(coord[1] - ((up-1) * 26)) + 1 + return (((-coord[2] + 1) as integer) as string) + "_" + alphabet[up] + alphabet[down] +) + +fn realCoordToName coord = +( + return coordToName(#(((coord[1] + offset_x) / cell_size) + 0.5, ((coord[2] + offset_y) / cell_size) + 0.5)) +) + +fn roundedCoord coord = +( + return #(ceil(coord[1] / cell_size) * cell_size - (cell_size / 2), ceil(coord[2] / cell_size) * cell_size - (cell_size / 2)) +) + +max select none +clearselection() + +for node in geometry do +( + if (classof node) == RklPatch or (classof node) == Editable_Patch then + ( + newcoords = roundedCoord(#(node.center.x, node.center.y)) + newname = realCoordToName(newcoords) + node.name = newname + alignPivotToWorld &node + node.pivot.x = newcoords[1] + node.pivot.y = newcoords[2] + resetxform node + maxOps.CollapseNode node off + ) +) diff --git a/code/nel/tools/3d/plugin_max/scripts/nel_zone_snapshot.ms b/code/nel/tools/3d/plugin_max/scripts/nel_zone_snapshot.ms new file mode 100644 index 000000000..edab4f35d --- /dev/null +++ b/code/nel/tools/3d/plugin_max/scripts/nel_zone_snapshot.ms @@ -0,0 +1,162 @@ +-- Use to take the snapshots of a large manually created zone + +from_x = 160 +size_x = 7680-320 +from_y = -25600+160 +size_y = 5120-320 + +targetdir = "W:/database/landscape/ligo/asteroids/max" +snapshotdir = "W:/database/landscape/ligo/asteroids/zonebitmaps" +zonename = "anne" +resumeonly = true + +cell_size = 160.0 + +alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + +fn lowercase instring = -- beginning of function definition +( + local upper, lower, outstring -- declare variables as local + upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ" -- set variables to literals + lower="abcdefghijklmnopqrstuvwxyz" + outstring=copy instring + for i=1 to outstring.count do + ( + j=findString upper outstring[i] + if (j != undefined) do outstring[i]=lower[j] + ) + return outstring -- value of outstring will be returned as function result +) + +fn existFile fname = (getfiles fname).count != 0 + +-- Convert a coordinate in a name +-- name = coordToName #(x, y) +fn coordToName coord = +( + up = floor(coord[1] / 26) + 1 + down = floor(coord[1] - ((up-1) * 26)) + 1 + return (((-coord[2] + 1) as integer) as string) + "_" + alphabet[up] + alphabet[down] +) + +fn roundedCoord coord = +( + return #(ceil(coord[1] / cell_size) * cell_size - (cell_size / 2), ceil(coord[2] / cell_size) * cell_size - (cell_size / 2)) +) + +fn coordId coord = +( + coordr = (roundedCoord coord) + return #(((coordr[1]) / cell_size) + 0.5, ((coordr[2]) / cell_size) + 0.5) +) + +from_coord = (coordId #(from_x, from_y)) +to_coord = (coordId #(from_x + size_x, from_y + size_y)) + +print from_coord +print to_coord + +print (coordToName from_coord) + +undo off +( + for x=from_coord[1] to to_coord[1] do + ( + for y=from_coord[2] to to_coord[2] do + ( + ny=y+1 + sy=y-1 + ex=x+1 + wx=x-1 + zc = coordToName #(x, y) + zn = coordToName #(x, ny) + zne = coordToName #(ex, ny) + ze = coordToName #(ex, y) + zse = coordToName #(ex, sy) + zs = coordToName #(x, sy) + zsw = coordToName #(wx, sy) + zw = coordToName #(wx, y) + znw = coordToName #(wx, ny) + maxc = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zc) + ".max" + csnapfile = snapshotdir + "/" + zonename + "-" + (lowercase zc) + ".tga" + if existFile maxc and (not resumeonly or not (existFile csnapfile)) then + ( + print zc + resetMAXFile #noprompt + gc() + mergeMAXFile maxc #(zc) + ccenter = getnodebyname zc + maxn = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zn) + ".max" + if existFile maxn then + ( + mergeMAXFile maxn #(zn) + cnode = getnodebyname zn + cnode.position.y = cnode.position.y + 160 + NeLAttachPatchMesh cnode ccenter + ) + maxne = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zne) + ".max" + if existFile maxne then + ( + mergeMAXFile maxne #(zne) + cnode = getnodebyname zne + cnode.position.x = cnode.position.x + 160 + cnode.position.y = cnode.position.y + 160 + NeLAttachPatchMesh cnode ccenter + ) + maxe = targetdir + "/zonematerial-" + zonename + "-" + (lowercase ze) + ".max" + if existFile maxe then + ( + mergeMAXFile maxe #(ze) + cnode = getnodebyname ze + cnode.position.x = cnode.position.x + 160 + NeLAttachPatchMesh cnode ccenter + ) + maxse = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zse) + ".max" + if existFile maxse then + ( + mergeMAXFile maxse #(zse) + cnode = getnodebyname zse + cnode.position.x = cnode.position.x + 160 + cnode.position.y = cnode.position.y - 160 + NeLAttachPatchMesh cnode ccenter + ) + maxs = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zs) + ".max" + if existFile maxs then + ( + mergeMAXFile maxs #(zs) + cnode = getnodebyname zs + cnode.position.y = cnode.position.y - 160 + NeLAttachPatchMesh cnode ccenter + ) + maxsw = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zsw) + ".max" + if existFile maxsw then + ( + mergeMAXFile maxsw #(zsw) + cnode = getnodebyname zsw + cnode.position.x = cnode.position.x - 160 + cnode.position.y = cnode.position.y - 160 + --NeLAttachPatchMesh cnode ccenter + ) + maxw = targetdir + "/zonematerial-" + zonename + "-" + (lowercase zw) + ".max" + if existFile maxw then + ( + mergeMAXFile maxw #(zw) + cnode = getnodebyname zw + cnode.position.x = cnode.position.x - 160 + NeLAttachPatchMesh cnode ccenter + ) + maxnw = targetdir + "/zonematerial-" + zonename + "-" + (lowercase znw) + ".max" + if existFile maxnw then + ( + mergeMAXFile maxnw #(znw) + cnode = getnodebyname znw + cnode.position.x = cnode.position.x - 160 + cnode.position.y = cnode.position.y + 160 + NeLAttachPatchMesh cnode ccenter + ) + NeLWeldPatchMesh ccenter 1.0 + NeLLigoMakeSnapShot ccenter csnapfile 0 1 0 1 false + ) + ) + ) +) diff --git a/code/nel/tools/3d/tile_edit/Browse.cpp b/code/nel/tools/3d/tile_edit/Browse.cpp index 0d71ffad7..7c4f6d745 100644 --- a/code/nel/tools/3d/tile_edit/Browse.cpp +++ b/code/nel/tools/3d/tile_edit/Browse.cpp @@ -885,7 +885,7 @@ void Browse::OnChangeVariety() void Browse::OnBatchLoad () { CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING, - "Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); + "PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); if (sFile.DoModal()==IDOK) { @@ -1365,7 +1365,7 @@ void Browse::OnExportBorder() { // Select a file CFileDialog sFile (false, NULL, NULL, OFN_ENABLESIZING, - "Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); + "PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); if (sFile.DoModal()==IDOK) { // Get the border of the bank @@ -1431,7 +1431,7 @@ void Browse::OnImportBorder() { // Select a file CFileDialog sFile (true, NULL, NULL, OFN_ENABLESIZING, - "Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); + "PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); if (sFile.DoModal()==IDOK) { // Get the border of the bank diff --git a/code/nel/tools/3d/tile_edit/CMakeLists.txt b/code/nel/tools/3d/tile_edit/CMakeLists.txt index ea7e1ac77..394359cd0 100644 --- a/code/nel/tools/3d/tile_edit/CMakeLists.txt +++ b/code/nel/tools/3d/tile_edit/CMakeLists.txt @@ -1,4 +1,4 @@ -FILE(GLOB SRC *.cpp *.h PIC/*.cpp PIC/*.h) +FILE(GLOB SRC *.cpp *.h) FILE(GLOB SRC2 cpu.cpp DllEntry.cpp Popup.* thread_win32.* TileCtrl.* TileList.* TileView.*) LIST(REMOVE_ITEM SRC ${SRC2}) diff --git a/code/nel/tools/3d/tile_edit/PIC/PIC_System.cpp b/code/nel/tools/3d/tile_edit/PIC/PIC_System.cpp deleted file mode 100644 index 439de9979..000000000 --- a/code/nel/tools/3d/tile_edit/PIC/PIC_System.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include -#include -#include -#include -#include - -#define PIC_ERRSIZE 256 - -static unsigned long PIC_Sys_MEM_Allocated; -static unsigned long PIC_Sys_MEM_NbAllocs; - -// ---------------------------------------------------------------------------------------------------------------------------------- - -void *Pic_malloc(unsigned long size) -{ - void *mem; - mem=malloc(size); - if (mem) - { - PIC_Sys_MEM_Allocated+=size; - PIC_Sys_MEM_NbAllocs++; - } - return(mem); -} -// ----- -void *Pic_calloc(unsigned long count, unsigned long size) -{ - void *mem; - mem=calloc(count,size); - if (mem) - { - PIC_Sys_MEM_Allocated+=(size*count); - PIC_Sys_MEM_NbAllocs++; - } - return(mem); -} -// ----- -void Pic_free(void *memblock) -{ - unsigned long size; - size=(unsigned long)_msize(memblock); - PIC_Sys_MEM_Allocated-=size; - PIC_Sys_MEM_NbAllocs--; - free(memblock); -} -// ----- -unsigned long Pic__msize(void *memblock) -{ - return(unsigned long)(_msize(memblock)); -} -// ----- -unsigned long PIC_GetMemNbAllocs(void) -{ - return(PIC_Sys_MEM_NbAllocs); -} -// ----- -unsigned long PIC_GetMemAllocated(void) -{ - return(PIC_Sys_MEM_Allocated); -} - -// ---------------------------------------------------------------------------------------------------------------------------------- - -static char PIC_ErrorFlag; -static char PIC_ErrorString[PIC_ERRSIZE]; -static unsigned char PIC_Sys_FnctActive=0; -static void (*PIC_Sys_Fnct)(void); - -void Pic_SetError(const char *msg, ...) -{ - char curerr[PIC_ERRSIZE],olderr[PIC_ERRSIZE]; - va_list args; - - va_start(args,msg); - vsprintf(curerr,msg,args); - va_end(args); - if ( (strlen(curerr)+strlen(PIC_ErrorString))>PIC_ERRSIZE ) return; - - if (PIC_ErrorFlag) - { - strcpy(olderr,PIC_ErrorString); - sprintf(PIC_ErrorString,"--- [PIC#%03d] :\n%s",PIC_ErrorFlag,curerr); - strcat(PIC_ErrorString,"\n"); - strcat(PIC_ErrorString,olderr); - } - else - { - sprintf(PIC_ErrorString,"--- [PIC#%03d] :\n%s",PIC_ErrorFlag,curerr); - } - PIC_ErrorFlag++; - if (PIC_Sys_FnctActive) PIC_Sys_Fnct(); - return; -} -// ----- -char* PIC_GetError(void) -{ - return(PIC_ErrorString); -} -// ----- -unsigned char PIC_Error(void) -{ - return(PIC_ErrorFlag); -} -// ----- -void PIC_ResetError(void) -{ - strcpy(PIC_ErrorString,""); - PIC_ErrorFlag=0; -} -// ----- -unsigned char PIC_OnErrorCall( void pFnct(void) ) -{ - if (pFnct != NULL) - { - PIC_Sys_Fnct=pFnct; - PIC_Sys_FnctActive=1; - } - else - { - PIC_Sys_FnctActive=0; - } - return(1); -} - -// ---------------------------------------------------------------------------------------------------------------------------------- - diff --git a/code/nel/tools/3d/tile_edit/PIC/Pic_BMP.cpp b/code/nel/tools/3d/tile_edit/PIC/Pic_BMP.cpp deleted file mode 100644 index 9ea55e029..000000000 --- a/code/nel/tools/3d/tile_edit/PIC/Pic_BMP.cpp +++ /dev/null @@ -1,215 +0,0 @@ -#include -#include -#include - -#include "pic_private.h" -#include "pic.h" - -// ---------------------------------------------------------------------------------------------------------------------------------- - -#pragma pack(1) -typedef struct BMP_HEADER -{ - unsigned short bfType; - unsigned long bfSize; - unsigned short Res1; - unsigned short Res2; - unsigned long bfOffBits; - unsigned long biSize; - unsigned long biWidth; - unsigned long biHeight; - unsigned short biPlanes; - unsigned short biBitCount; - unsigned long biCompression; - unsigned long biSizeImage; - unsigned long biXPelsPerMeter; - unsigned long biYPelsPerMeter; - unsigned long biClrUsed; - unsigned long biClrImportant; -} BMP_HEADER; -#pragma pack() - -// ---------------------------------------------------------------------------------------------------------------------------------- - -unsigned long Pic_BMP_Write( const char *FileName, - char *pPal, char *pDatas, - unsigned long w, unsigned long h, unsigned long d) - -{ - FILE *file; - BMP_HEADER bmph; - unsigned long slsize; - unsigned char *scanline; - unsigned long i; - long x,y,rest; - unsigned char r,g,b; - - file=fopen(FileName,"wb"); - if (!file) - { - return(0); - } - memset(&bmph,0,sizeof(BMP_HEADER)); - bmph.bfType=19778; - bmph.bfSize=sizeof(BMP_HEADER); - bmph.bfSize+=w*h*d/8; - if (pPal) - { - bmph.bfSize+=(256*4); - } - bmph.bfOffBits=sizeof(BMP_HEADER); - if (pPal) - { - bmph.bfOffBits+=(256*4); - } - bmph.biSize=40;//sizeof(BMP_HEADER); - bmph.biWidth=w; - bmph.biHeight=h; - bmph.biPlanes=1; - bmph.biBitCount=(unsigned short)d; - bmph.biCompression=0; - bmph.biSizeImage=w*h*d/8; - - fwrite(&bmph,1,sizeof(BMP_HEADER),file); - if (pPal) - { - for(i=0 ; i<256 ; i++) - { - fwrite(&pPal[i*3+0],1,1,file); - fwrite(&pPal[i*3+1],1,1,file); - fwrite(&pPal[i*3+2],1,1,file); - fwrite(&pPal[i*3+2],1,1,file); - } - } - slsize=w*d/8; - scanline=(unsigned char*)Pic_calloc(1,slsize); - if (!scanline) - { - Pic_SetError("BMP_Write, not enough memory for scanline"); - return(0); - } - for(rest=0 ; ((w*d/8)+rest)%4!=0 ; rest++); - for(y=0 ; y<(long)h ; y++) - { - memcpy(scanline,&pDatas[(h-y-1)*slsize],slsize); - if (d==24) - { - for(x=0 ; x<(long)w ; x++) - { - b=scanline[x*3+0]; - g=scanline[x*3+1]; - r=scanline[x*3+2]; - scanline[x*3+0]=b; - scanline[x*3+1]=g; - scanline[x*3+2]=r; - } - } - fwrite(scanline,1,slsize,file); - if (rest) - { - fwrite(scanline,1,rest,file); - } - } - Pic_free(scanline); - fclose(file); - return(1); -} - -// ---------------------------------------------------------------------------------------------------------------------------------- - -unsigned long Pic_BMP_Read( const char *FileName, - char **ppPal, char **ppDatas, - unsigned long *pWidth, unsigned long *pHeight, - unsigned long *pDepth) -{ - FILE *file; - BMP_HEADER bmph; - char *pPal; - char *pDatas; - unsigned char *scanline; - long w,h,d; - long i,x,y,rest; - unsigned char r,g,b; - unsigned char pad[4]; - - pPal=NULL; - pDatas=NULL; - file=fopen(FileName,"rb"); - if (!file) - { - Pic_SetError("BMP_Read, unable to open %s",FileName); - return(0); - } - fread(&bmph,1,sizeof(BMP_HEADER),file); - *pWidth=w=bmph.biWidth; - *pHeight=h=bmph.biHeight; - *pDepth=d=bmph.biBitCount; - if (d!=8 && d!=24) - { - Pic_SetError("BMP_Read, number of bits per pixel unsupported"); - return(0); - } - if (*pDepth==8) - { - pPal=(char*)Pic_calloc(1,256*3); - if (!pPal) - { - Pic_SetError("BMP_Read, not enough memory for palette"); - return(0); - } - for(i=0 ; i<256 ; i++) - { - fread(&pPal[i*3+2],1,1,file); - fread(&pPal[i*3+1],1,1,file); - fread(&pPal[i*3+0],1,1,file); - fread(&pad[0],1,1,file); - } - } - pDatas=(char*)Pic_calloc(1,w*h*d/8); - if (!pDatas) - { - if (pPal) - { - Pic_free(pPal); - } - Pic_SetError("BMP_Read, not enough memory for datas"); - return(0); - } - scanline=(unsigned char*)Pic_calloc(1,w*h*d/8); - if (!scanline) - { - if (pPal) - { - Pic_free(pPal); - } - Pic_free(pDatas); - Pic_SetError("BMP_Read, not enough memory for scanline"); - return(0); - } - for(rest=0 ; (w+rest)%4!=0 ; rest++); - for(y=0 ; y -#include -#include -#include - -#include -#include "pic_private.h" -#include "pic.h" - -// ---------------------------------------------------------------------------------------------------------------------------------- - -struct my_error_mgr -{ - struct jpeg_error_mgr pub; - jmp_buf setjmp_buffer; -}; -typedef struct my_error_mgr * my_error_ptr; - -// ---------------------------------------------------------------------------------------------------------------------------------- - -static unsigned char error; - -// ---------------------------------------------------------------------------------------------------------------------------------- - -void my_error_exit(j_common_ptr cinfo) -{ - my_error_ptr myerr = (my_error_ptr) cinfo->err; - error=1; - longjmp(myerr->setjmp_buffer, 1); -} - -// ---------------------------------------------------------------------------------------------------------------------------------- - -unsigned long Pic_JPG_Read(const char *FileName, char **ppPal, char **ppDatas, unsigned long *w, unsigned long *h) -{ - struct jpeg_decompress_struct cinfo; - struct my_error_mgr jerr; - FILE *file; - JSAMPARRAY buffer; - int row_stride,i; - char *pDatas,*pPal; - unsigned long ptr; - - error=0; - ptr=0; - file=fopen(FileName, "rb"); - if (!file) - { - Pic_SetError("JPG_Read, unable to open %s",FileName); - return(0); - } - cinfo.err = jpeg_std_error(&jerr.pub); - jerr.pub.error_exit = my_error_exit; - setjmp(jerr.setjmp_buffer); - if (error) - { - Pic_SetError("JPG_Read, internal decompression error"); - jpeg_destroy_decompress(&cinfo); - return(0); - } - jpeg_create_decompress(&cinfo); - jpeg_stdio_src(&cinfo, file); - (void) jpeg_read_header(&cinfo, TRUE); - *w=cinfo.image_width; - *h=cinfo.image_height; - if (!ppPal) - { - pDatas=(char*)Pic_calloc(1,(*w)*(*h)*3); - } - else - { - pDatas=(char*)Pic_calloc(1,(*w)*(*h)); - pPal=(char*)Pic_calloc(1,256*3); - if (!pPal) - { - Pic_SetError("JPG_Read, not enough memory for palette"); - return(0); - } - cinfo.desired_number_of_colors = 256; - cinfo.quantize_colors = TRUE; - cinfo.dither_mode = JDITHER_ORDERED; - } - if (!pDatas) - { - Pic_SetError("JPG_Read, not enough memory for pic"); - return(0); - } - (void) jpeg_start_decompress(&cinfo); - row_stride = cinfo.output_width * cinfo.output_components; - buffer = (*cinfo.mem->alloc_sarray) - ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1); - while (cinfo.output_scanline < cinfo.output_height) - { - (void) jpeg_read_scanlines(&cinfo, buffer, 1); - memcpy(&pDatas[ptr],buffer[0],row_stride); - ptr+=row_stride; - } - *ppDatas=pDatas; - if (ppPal) - { - for(i=0 ; i<256 ; i++) - { - pPal[i*3+0]=cinfo.colormap[2][i]; - pPal[i*3+1]=cinfo.colormap[1][i]; - pPal[i*3+2]=cinfo.colormap[0][i]; - } - *ppPal=pPal; - } - (void) jpeg_finish_decompress(&cinfo); - jpeg_destroy_decompress(&cinfo); - fclose(file); - return(1); -} - -// ---------------------------------------------------------------------------------------------------------------------------------- - -unsigned long Pic_JPG_Write(const char *FileName, unsigned long Qual, char *pDatas, unsigned long w, unsigned long h) -{ - struct jpeg_compress_struct cinfo; - struct my_error_mgr jerr; - FILE *file; - JSAMPROW row_pointer[1]; - int row_stride; - - error=0; - file=fopen(FileName,"wb"); - if (!file) - { - Pic_SetError("JPG_Write, unable to open %s",FileName); - return(0); - } - jpeg_create_compress(&cinfo); - cinfo.err = jpeg_std_error(&jerr.pub); - jerr.pub.error_exit = my_error_exit; - setjmp(jerr.setjmp_buffer); - if (error) - { - Pic_SetError("JPG_Write, internal compression error"); - jpeg_destroy_compress(&cinfo); - return(0); - } - jpeg_stdio_dest(&cinfo, file); - cinfo.image_width = w; - cinfo.image_height = h; - cinfo.input_components = 3; - cinfo.in_color_space = JCS_RGB; - jpeg_set_defaults(&cinfo); - jpeg_set_quality(&cinfo, Qual, TRUE); - jpeg_start_compress(&cinfo, TRUE); - row_stride = w * 3; - while(cinfo.next_scanline -#include "pic_private.h" -#include "pic.h" - -static unsigned long NbPics=0; -static PIC_PICTURE *HeadPic=NULL; - -// ---------------------------------------------------------------------------------------------------------------------------------- - -static PIC_PICTURE *GetPic(unsigned long id) -{ - PIC_PICTURE *pic; - - for(pic=HeadPic ; pic ; pic=pic->Next) - { - if (pic->ID==id) - { - return(pic); - } - } - return(NULL); -} - -// ---------------------------------------------------------------------------------------------------------------------------------- - -unsigned long PIC_Load(char* FileName, unsigned char Quantize) -{ - char ext[4]; - unsigned long type; - unsigned long i,taken,id; - PIC_PICTURE *pic; - char *pDatas; - char *pPal; - unsigned long w,h,Depth; - unsigned long ret; - - // --- Init - ret=0; - type=0; - id=0; - taken=0; - w=0; - h=0; - Depth=0; - pic=NULL; - pDatas=NULL; - pPal=NULL; - // --- Get 1st available ID - for(i=1 ; i<=NbPics+1 ; i++) - { - taken=0; - for(pic=HeadPic ; pic ; pic=pic->Next) - { - if (pic->ID==i) - { - taken=1; - break; - } - } - if (!taken) - { - id=i; - break; - } - } - if (!id) - { - Pic_SetError("Load, unable to create ID"); - return(0); - } - // --- Load pic - if (FileName) - { - ext[0]=FileName[strlen(FileName)-3]; - ext[1]=FileName[strlen(FileName)-2]; - ext[2]=FileName[strlen(FileName)-1]; - ext[3]=0; - strupr(ext); - if ( !strcmp(ext,"JPG") ) - { - type=1; - } - else if ( !strcmp(ext,"TGA") ) - { - type=2; - } - else if ( !strcmp(ext,"BMP") ) - { - type=3; - } - - switch(type) - { - // - JPG - case 1: - if (!Quantize) - { - Depth=24; - ret=Pic_JPG_Read(FileName,NULL,&pDatas,&w,&h); - } - else - { - Depth=8; - ret=Pic_JPG_Read(FileName,&pPal,&pDatas,&w,&h); - } - if (!ret) - { - Pic_SetError("Load, unable to load JPG file %s",FileName); - return(0); - } - break; - // - TGA - case 2: - ret=Pic_TGA_Read(FileName,&pPal,&pDatas,&w,&h,&Depth); - if (!ret) - { - Pic_SetError("Load, unable to load TGA file %s",FileName); - return(0); - } - break; - // - BMP - case 3: - ret=Pic_BMP_Read(FileName,&pPal,&pDatas,&w,&h,&Depth); - if (!ret) - { - Pic_SetError("Load, unable to load BMP file %s",FileName); - return(0); - } - break; - // - Unknown - default: - Pic_SetError("Load, unknown extension for %s",FileName); - return(0); - } - } - - // --- Create and place new pic struct - pic=(PIC_PICTURE *)Pic_calloc(1,sizeof(PIC_PICTURE)); - if (!pic) - { - Pic_SetError("Load, not enough memory for internal structure"); - return(0); - } - pic->Next=HeadPic; - HeadPic=pic; - NbPics++; - pic->ID=id; - pic->pDatas=pDatas; - pic->pPal=pPal; - pic->Width=w; - pic->Height=h; - pic->Depth=Depth; - return(id); -} - -// ---------------------------------------------------------------------------------------------------------------------------------- - -unsigned long PIC_Create(char* pPal, char* pDatas, unsigned long w, unsigned long h, unsigned long d) -{ - unsigned long i,taken,id; - PIC_PICTURE *pic; - - // --- Init - id=0; - taken=0; - pic=NULL; - // --- Get 1st available ID - for(i=1 ; i<=NbPics+1 ; i++) - { - taken=0; - for(pic=HeadPic ; pic ; pic=pic->Next) - { - if (pic->ID==i) - { - taken=1; - break; - } - } - if (!taken) - { - id=i; - break; - } - } - if (!id) - { - Pic_SetError("Create, unable to create ID"); - return(0); - } - // --- Create pic - if (!pDatas) - { - pDatas=(char *)Pic_calloc(1,w*h*d/8); - if (!pDatas) - { - Pic_SetError("Create, not enough memory for datas"); - return(0); - } - } - if (d==8) - { - if (!pPal) - { - pPal=(char *)Pic_calloc(1,256*3); - if (!pPal) - { - Pic_SetError("Create, not enough memory for palette"); - return(0); - } - } - } - else - { - pPal=NULL; - } - // --- Create and place new pic struct - pic=(PIC_PICTURE *)Pic_calloc(1,sizeof(PIC_PICTURE)); - if (!pic) - { - Pic_SetError("Create, not enough memory for internal structure"); - return(0); - } - pic->Next=HeadPic; - HeadPic=pic; - NbPics++; - pic->ID=id; - pic->pDatas=pDatas; - pic->pPal=pPal; - pic->Width=w; - pic->Height=h; - pic->Depth=d; - return(id); - -} - -// ---------------------------------------------------------------------------------------------------------------------------------- - -unsigned long PIC_GetInfos( unsigned long id, - char **ppPal, char **ppDatas, - unsigned long *pW, unsigned long *pH, unsigned long *pD) -{ - PIC_PICTURE *pic; - - pic=GetPic(id); - if (!pic) - { - Pic_SetError("GetInfos, picture internal structure not found"); - return(0); - } - if (ppPal) - { - *ppPal=pic->pPal; - } - if (ppDatas) - { - *ppDatas=pic->pDatas; - } - if (pW) - { - *pW=pic->Width; - } - if (pH) - { - *pH=pic->Height; - } - if (pD) - { - *pD=pic->Depth; - } - return(id); -} - -// ---------------------------------------------------------------------------------------------------------------------------------- - -static char* Conv8To24(unsigned long id) -{ - PIC_PICTURE *pic; - char *buf; - unsigned long i; - - pic=GetPic(id); - if (!pic) - { - Pic_SetError("Conv8To24, picture internal structure not found"); - return(NULL); - } - buf=(char *)Pic_malloc(pic->Width*pic->Height*3); - if (!buf) - { - Pic_SetError("Conv8To24, not enough memory for temporary buffer"); - return(NULL); - } - for(i=0 ; iWidth*pic->Height ; i++) - { - buf[i*3+0]=pic->pPal[pic->pDatas[i]*3+0]; - buf[i*3+1]=pic->pPal[pic->pDatas[i]*3+1]; - buf[i*3+2]=pic->pPal[pic->pDatas[i]*3+2]; - } - return(buf); -} - -// ---------------------------------------- -static char* Conv8To16(unsigned long id) -{ - PIC_PICTURE *pic; - unsigned short *buf; - unsigned long i; - unsigned short r,g,b,pix16; - - pic=GetPic(id); - if (!pic) - { - Pic_SetError("Conv8To24, picture internal structure not found"); - return(NULL); - } - buf=(unsigned short*)Pic_malloc(pic->Width*pic->Height*2); - if (!buf) - { - Pic_SetError("Conv8To24, not enough memory for temporary buffer"); - return(NULL); - } - for(i=0 ; iWidth*pic->Height ; i++) - { - b=pic->pPal[pic->pDatas[i]*3+0]; - g=pic->pPal[pic->pDatas[i]*3+1]; - r=pic->pPal[pic->pDatas[i]*3+2]; - r>>=3; - g>>=3; g&=0x3E; - b>>=3; - pix16=(r<<10)+(g<<5)+b; - buf[i]=pix16; - } - return (char*)buf; -} - -// ---------------------------------------- - -static char* Conv16To24(unsigned long id) -{ - PIC_PICTURE *pic; - unsigned short *pDatas; - unsigned char *buf; - unsigned long i; - unsigned short r,g,b; - - pic=GetPic(id); - if (!pic) - { - Pic_SetError("Conv16To24, picture internal structure not found"); - return(NULL); - } - buf=(unsigned char *)Pic_malloc(pic->Width*pic->Height*3); - if (!buf) - { - Pic_SetError("Conv16To24, not enough memory for temporary buffer"); - return(NULL); - } - pDatas=(unsigned short*)pic->pDatas; - for(i=0 ; iWidth*pic->Height ; i++) - { - r=(pDatas[i] & 0x7C00)>>(10-3); - g=(pDatas[i] & 0x03E0)>>(5-3); - b=(pDatas[i] & 0x001F)<<3; - buf[i*3+0]=(unsigned char)r; - buf[i*3+1]=(unsigned char)g; - buf[i*3+2]=(unsigned char)b; - } - return (char*)buf; -} - -// ---------------------------------------- - -static char* Conv24To16(unsigned long id) -{ - PIC_PICTURE *pic; - unsigned short *buf; - unsigned long i; - unsigned short r,g,b; - unsigned short pix16; - - pic=GetPic(id); - if (!pic) - { - Pic_SetError("Conv24To16, picture internal structure not found"); - return(NULL); - } - buf=(unsigned short*)Pic_malloc(pic->Width*pic->Height*2); - if (!buf) - { - Pic_SetError("Conv24To16, not enough memory for temporary buffer"); - return(NULL); - } - for(i=0 ; iWidth*pic->Height ; i++) - { - r=pic->pDatas[i*3+0]; - g=pic->pDatas[i*3+1]; - b=pic->pDatas[i*3+2]; - // r : 5 bits forts (0x7C) - // g : 5 bits (6e zapped) (0x3E) - // b : 5 bits faibles (0x1F) - r>>=3; - g>>=3; g&=0x3E; - b>>=3; - pix16=(r<<10)+(g<<5)+b; - buf[i]=pix16; - } - return (char*)buf; -} - -// ---------------------------------------- - -static char* ConvPic(PIC_PICTURE *pic, unsigned long type, char* pErr) -{ - char *buf; - unsigned long src,dst; - - *pErr=0; - buf=NULL; - src=pic->Depth; - if (type==PIC_TYPE_TGA8 || type==PIC_TYPE_BMP8) - { - dst=8; - } - if (type==PIC_TYPE_TGA16) - { - dst=16; - } - if (type==PIC_TYPE_JPG || type==PIC_TYPE_TGA24 || type==PIC_TYPE_BMP24) - { - dst=24; - } - // --- - if (src==dst) - { - return(NULL); - } - // --- - if (src==8 && dst==24) - { - buf=Conv8To24(pic->ID); - if (!buf) - { - *pErr=1; - } - return(buf); - } - if (src==8 && dst==16) - { - buf=Conv8To16(pic->ID); - if (!buf) - { - *pErr=1; - } - return(buf); - } - // --- - if (src==16 && dst==24) - { - buf=Conv16To24(pic->ID); - if (!buf) - { - *pErr=1; - } - return(buf); - } - // --- - if (src==24 && dst==16) - { - buf=Conv24To16(pic->ID); - if (!buf) - { - *pErr=1; - } - return buf; - } - // --- - if (src==24 && dst==8) - { - Pic_SetError("ConvPic, downsampling 24 to 8 bits unsupported"); - *pErr=1; - return(NULL); - } - Pic_SetError("ConvPic, conversion %d to %d unsupported",src,dst); - *pErr=1; - return(NULL); -} - -// ---------------------------------------- - -unsigned long PIC_Save(unsigned long id, char* FileName, unsigned long type, unsigned long qual) -{ - PIC_PICTURE *pic; - char err; - char *buf; - char *freeit; - unsigned long depth; - - freeit=NULL; - pic=GetPic(id); - if (!pic) - { - Pic_SetError("Save %s, picture internal structure not found",FileName); - return(0); - } - freeit = ConvPic(pic,type,&err); - if (err) - { - Pic_SetError("Save %s, error while converting picture",FileName); - return(0); - } - if (!freeit) - { - buf=pic->pDatas; - } - else - { - buf=freeit; - } - err=0; - switch(type) - { - // --- - case PIC_TYPE_JPG: - if ( !Pic_JPG_Write(FileName,qual,buf,pic->Width,pic->Height) ) - { - if (freeit) - { - Pic_free(buf); - } - Pic_SetError("Save %s, error while saving JPG file",FileName); - err=1; - } - break; - // --- - case PIC_TYPE_TGA8: - case PIC_TYPE_TGA16: - case PIC_TYPE_TGA24: - if (type==PIC_TYPE_TGA8) - { - depth=8; - } - if (type==PIC_TYPE_TGA16) - { - depth=16; - } - if (type==PIC_TYPE_TGA24) - { - depth=24; - } - if ( !Pic_TGA_Write(FileName,pic->pPal,buf,pic->Width,pic->Height,depth) ) - { - if (freeit) - { - Pic_free(freeit); - } - Pic_SetError("Save %s, error while saving TGA file",FileName); - err=1; - } - break; - // --- - case PIC_TYPE_BMP8: - case PIC_TYPE_BMP24: - if (type==PIC_TYPE_BMP8) - { - depth=8; - } - if (type==PIC_TYPE_BMP24) - { - depth=24; - } - if ( !Pic_BMP_Write(FileName,pic->pPal,buf,pic->Width,pic->Height,depth) ) - { - if (freeit) - { - Pic_free(freeit); - } - Pic_SetError("Save %s, error while saving BMP file",FileName); - err=1; - } - break; - // --- - default: - Pic_SetError("Save %s, unknow save format/type",FileName); - err=1; - break; - } - if (freeit) - { - Pic_free(freeit); - } - return(err-1); -} - -// ---------------------------------------------------------------------------------------------------------------------------------- - -unsigned long PIC_Destroy(unsigned long id) -{ - PIC_PICTURE *prevpic,*pic; - unsigned long found; - - prevpic=NULL; - found=0; - for(pic=HeadPic ; pic ; pic=pic->Next) - { - if (pic->ID==id) - { - found=1; - break; - } - prevpic=pic; - } - if (!found) - { - Pic_SetError("Destroy, picture internal structure not found"); - return(0); - } - if (prevpic) - { - prevpic->Next=pic->Next; - } - if (pic->pDatas) - { - Pic_free(pic->pDatas); - } - if (pic->pPal) - { - Pic_free(pic->pPal); - } - if (pic==HeadPic) - { - HeadPic=pic->Next; - } - Pic_free(pic); - return(1); -} - -// ---------------------------------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/code/nel/tools/3d/tile_edit/PIC/Pic_TGA.cpp b/code/nel/tools/3d/tile_edit/PIC/Pic_TGA.cpp deleted file mode 100644 index 6d69b914e..000000000 --- a/code/nel/tools/3d/tile_edit/PIC/Pic_TGA.cpp +++ /dev/null @@ -1,215 +0,0 @@ -#include -#include -#include - -#include "pic_private.h" -#include "pic.h" - -// ---------------------------------------------------------------------------------------------------------------------------------- - -#pragma pack(1) -typedef struct TGA_HEADER -{ - unsigned char LengthID; - unsigned char CMapType; - unsigned char ImageType; - unsigned short Origin; - unsigned short Length; - unsigned char Depth; - unsigned short XOrg; - unsigned short YOrg; - unsigned short Width; - unsigned short Height; - unsigned char ImageDepth; - unsigned char Desc; -} TGA_HEADER; -#pragma pack() - -// ---------------------------------------------------------------------------------------------------------------------------------- - -unsigned long Pic_TGA_Read( const char *FileName, - char **ppPal, char **ppDatas, - unsigned long *pWidth, unsigned long *pHeight, - unsigned long *pDepth) -{ - FILE *file; - TGA_HEADER tgah; - long w,h,d; - unsigned long size; - char *pDatas; - char *pPal; - long x,y; - long slsize; - unsigned char *scanline; - unsigned char r,g,b; - long i; - int upSideDown; - - pDatas=NULL; - pPal=NULL; - file=fopen(FileName,"rb"); - if (!file) - { - Pic_SetError("TGA_Read, unable to open %s",FileName); - return(0); - } - fread(&tgah,1,sizeof(TGA_HEADER),file); - if (tgah.ImageType>3) - { - Pic_SetError("TGA_Read, unsupported TGA format"); - return(0); - } - *pWidth=w=tgah.Width; - *pHeight=h=tgah.Height; - *pDepth=d=tgah.ImageDepth; - upSideDown = ((tgah.Desc & (1 << 5))==0); - - size=tgah.Width*tgah.Height*(tgah.ImageDepth/8); - pDatas=(char*)Pic_malloc(size); - if (!pDatas) - { - Pic_SetError("TGA_Read, not enough memory"); - return(0); - } - if (*pDepth==8) - { - if (!ppPal) - { - Pic_free(pDatas); - Pic_SetError("TGA_Read, need a pointer to palette"); - return(0); - } - pPal=(char*)Pic_calloc(1,256*3); - if (!pPal) - { - Pic_SetError("TGA_Read, not enough memory for palette"); - return(0); - } - if (tgah.ImageType==1) - { - for(i=0 ; i<256*3 ; i+=3) - { - fread(&pPal[i+2],1,1,file); - fread(&pPal[i+1],1,1,file); - fread(&pPal[i+0],1,1,file); - } - } - *ppPal=pPal; - } - - slsize=w*d/8; - scanline=(unsigned char*)Pic_calloc(1,slsize); - if (!scanline) - { - if (pPal) - { - Pic_free(pPal); - } - Pic_free(pDatas); - Pic_SetError("TGA_Read, not enough memory for scanline"); - return(0); - } - for(y=0 ; y8) - { - tgah.CMapType=0; - tgah.ImageType=2; - tgah.Length=0; - tgah.Depth=0; - } - else - { - tgah.CMapType=1; - tgah.ImageType=1; - tgah.Length=256; - tgah.Depth=24; - } - tgah.Origin=0; - tgah.XOrg=0; - tgah.YOrg=0; - tgah.Width=(unsigned short)w; - tgah.Height=(unsigned short)h; - tgah.ImageDepth=(unsigned char)d; - tgah.Desc=0; - fwrite(&tgah,1,sizeof(TGA_HEADER),file); - if (d==8) - { - fwrite(pPal,1,256*3,file); - } - slsize=w*d/8; - scanline=(unsigned char*)Pic_calloc(1,slsize); - if (!scanline) - { - Pic_SetError("TGA_Write, not enough memory for scanline"); - return(0); - } - for(y=0 ; y<(long)h ; y++) - { - memcpy(scanline,&pDatas[(h-y-1)*slsize],slsize); - if (d==24) - { - for(x=0 ; x<(long)w ; x++) - { - r=scanline[x*3+0]; - g=scanline[x*3+1]; - b=scanline[x*3+2]; - scanline[x*3+0]=b; - scanline[x*3+1]=g; - scanline[x*3+2]=r; - } - } - fwrite(scanline,1,slsize,file); - } - Pic_free(scanline); - fclose(file); - return(1); -} diff --git a/code/nel/tools/3d/tile_edit/PIC/pic.h b/code/nel/tools/3d/tile_edit/PIC/pic.h deleted file mode 100644 index ec6582c6b..000000000 --- a/code/nel/tools/3d/tile_edit/PIC/pic.h +++ /dev/null @@ -1,58 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef _PIC_H_ -#define _PIC_H_ - -// ---------------------------------------------------------------------------------------------------------------------------------- - -#define PIC_TYPE_JPG 1 -#define PIC_TYPE_TGA8 2 -#define PIC_TYPE_TGA16 3 -#define PIC_TYPE_TGA24 4 -#define PIC_TYPE_BMP8 5 -#define PIC_TYPE_BMP24 6 - -// ---------------------------------------------------------------------------------------------------------------------------------- - -// -// Basic API -// -extern unsigned long PIC_Load(char* FileName, unsigned char Quantize); - -extern unsigned long PIC_Create(char* pPal, char* pDatas, unsigned long w, unsigned long h, unsigned long d); - -extern unsigned long PIC_Save(unsigned long id, char* FileName, unsigned long type, unsigned long qual); - -extern unsigned long PIC_GetInfos( unsigned long id, - char **ppPal, char **ppDatas, - unsigned long *pW, unsigned long *pH, unsigned long *pD); - - -extern unsigned long PIC_Destroy(unsigned long id); -// -// System -// -extern unsigned long PIC_GetMemNbAllocs(void); -extern unsigned long PIC_GetMemAllocated(void); -extern char* PIC_GetError(void); -extern unsigned char PIC_Error(void); -extern void PIC_ResetError(void); -extern unsigned char PIC_OnErrorCall( void pFnct(void) ); - -// ---------------------------------------------------------------------------------------------------------------------------------- - -#endif diff --git a/code/nel/tools/3d/tile_edit/PIC/pic_private.h b/code/nel/tools/3d/tile_edit/PIC/pic_private.h deleted file mode 100644 index 4a67bbc9c..000000000 --- a/code/nel/tools/3d/tile_edit/PIC/pic_private.h +++ /dev/null @@ -1,81 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef _PIC_PRIVATE_H_ -#define _PIC_PRIVATE_H_ - -// ---------------------------------------------------------------------------------------------------------------------------------- - -typedef struct PIC_PICTURE -{ - unsigned long ID; - unsigned long Width; - unsigned long Height; - unsigned long Depth; - char *pDatas; - char *pPal; - struct PIC_PICTURE *Next; -} PIC_PICTURE; - -// ---------------------------------------------------------------------------------------------------------------------------------- - - -// -// JPG -// - - -extern unsigned long Pic_JPG_Read( const char *FileName, - char **ppPal, char **ppDatas, - unsigned long *w, unsigned long *h); - -extern unsigned long Pic_JPG_Write( const char *FileName, - unsigned long Qual, - char *pDatas, - unsigned long w, unsigned long h); -// -// TGA -// -extern unsigned long Pic_TGA_Read( const char *FileName, - char **ppPal, char **ppDatas, - unsigned long *pWidth, unsigned long *pHeight, - unsigned long *pDepth); -extern unsigned long Pic_TGA_Write( const char *FileName, - char *pPal, char *pDatas, - unsigned long w, unsigned long h, unsigned long d); -// -// BMP -// -extern unsigned long Pic_BMP_Read( const char *FileName, - char **ppPal, char **ppDatas, - unsigned long *pWidth, unsigned long *pHeight, - unsigned long *pDepth); - -extern unsigned long Pic_BMP_Write( const char *FileName, - char *pPal, char *pDatas, - unsigned long w, unsigned long h, unsigned long d); -// -// System -// -extern void* Pic_malloc(unsigned long size); -extern void* Pic_calloc(unsigned long count, unsigned long size); -extern void Pic_free(void *memblock); -extern unsigned long Pic__msize(void *memblock); -extern void Pic_SetError(const char *msg, ...); - -// ---------------------------------------------------------------------------------------------------------------------------------- - -#endif \ No newline at end of file diff --git a/code/nel/tools/3d/tile_edit/PIC/readpic.cpp b/code/nel/tools/3d/tile_edit/PIC/readpic.cpp deleted file mode 100644 index 8afac2b45..000000000 --- a/code/nel/tools/3d/tile_edit/PIC/readpic.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - -#include -#include -#include "readpic.h" -#include "pic.h" -#include - -using namespace std; - -//============================================================ -// Image API. -//============================================================ - - -bool PIC_LoadPic(string path, vector &tampon, uint &Width, uint &Height) -{ - uint32 id; - char *pal, *data; - unsigned long w,h,depth; - uint i; - - - // Loadons l'image. - id= PIC_Load((char*)path.c_str(), 0); - if(id==0) - return false; - PIC_GetInfos( id, &pal, &data, &w, &h, &depth); - Width=w; - Height=h; - - // On traduit en RGBA. - tampon.resize(w*h); - switch(depth) - { - case 8: - for(i=0;i //#include "ListGroup.h" //#include "ViewPopup.h" -#include "pic/readpic.h" +//#include "pic/readpic.h" using namespace std; using namespace NL3D; @@ -74,6 +74,37 @@ void rotateBuffer (uint &Width, uint &Height, std::vector& Tampon Height=tmp; } +static bool loadPic(const string &path, std::vector &tampon, uint &width, uint &height) +{ + try + { + NLMISC::CIFile file; + if (file.open(path.c_str())) + { + NLMISC::CBitmap bitmap; + bitmap.load(file); + width = bitmap.getWidth(); + height = bitmap.getHeight(); + tampon.resize(width * height); + bitmap.convertToType(NLMISC::CBitmap::RGBA); + for (uint y = 0; y < height; ++y) + { + for (uint x = 0; x < width; ++x) + { + NLMISC::CRGBA c = bitmap.getPixelColor(x, y, 0); + c.R = (c.R * c.A) / 255; + c.G = (c.G * c.A) / 255; + c.B = (c.B * c.A) / 255; + tampon[(y * width) + x] = c; + } + } + return true; + } + } + catch (NLMISC::Exception& ) { } + return false; +} + ///////////////////////////////////////////////////////////////////////////// // CTView //Attention : windows veut que le buffer image commence du bas vers le haut @@ -82,7 +113,7 @@ int _LoadBitmap(const std::string& path,LPBITMAPINFO BitmapInfo, std::vector Tampon; uint Width; uint Height; - if (PIC_LoadPic(path, Tampon, Width, Height)) + if (loadPic(path, Tampon, Width, Height)) { BitmapInfo->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); BitmapInfo->bmiHeader.biWidth=Width; @@ -207,7 +238,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma vector tampon; uint Width; uint Height; - if (!PIC_LoadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) + if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) { return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES); } @@ -272,7 +303,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma vector tampon; uint Width; uint Height; - if (!PIC_LoadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) + if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) { return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES); } @@ -338,7 +369,7 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile: vector tampon; uint Width; uint Height; - if (!PIC_LoadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) + if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) { return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES); } @@ -451,7 +482,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot vector tampon; uint Width; uint Height; - if (!PIC_LoadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) + if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height)) { return MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES; } @@ -1490,7 +1521,7 @@ LRESULT CTView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { _chdir (LastPath.c_str()); CFileDialog load(true, NULL, LastPath.c_str(), OFN_ENABLESIZING | OFN_ALLOWMULTISELECT, - "Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); + "PNG Bitmap (*.png)|*.png|Targa bitmap (*.tga)|*.tga|All files (*.*)|*.*||",NULL); load.m_ofn.lpstrFile = new char[10000]; // buffer contains filenames list load.m_ofn.lpstrFile[0] = 0; // with 10 KB we should be large enough... diff --git a/code/nel/tools/CMakeLists.txt b/code/nel/tools/CMakeLists.txt index 2c1f641a0..0e1c5709d 100644 --- a/code/nel/tools/CMakeLists.txt +++ b/code/nel/tools/CMakeLists.txt @@ -1,4 +1,3 @@ - # Don't add other subdirectories if only max plugins are selected. IF(WITH_NEL_TOOLS) ADD_SUBDIRECTORY(misc) diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/clod.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/clod.ms index 68c8455d6..1a947f7d6 100755 --- a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/clod.ms +++ b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/clod.ms @@ -49,6 +49,7 @@ fn runNelMaxExport inputMaxFile = tagThisFile = true -- Unhide category + unhidelayers() unhidecategory() -- Unhide diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/ig.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/ig.ms index df0ecf7fc..43a05abcc 100755 --- a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/ig.ms +++ b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/ig.ms @@ -54,6 +54,7 @@ fn runNelMaxExport inputMaxFile = tagThisFile = true -- Unhide category + unhidelayers() unhidecategory() -- Unhide diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms index d8d6c8d9d..cfb51d0e0 100755 --- a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms +++ b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/shape.ms @@ -187,11 +187,14 @@ fn haveCoarseMesh node = return false ) +fn getRoot node = if isvalidnode node.parent then getRoot node.parent else node + fn runNelMaxExportSub inputMaxFile retryCount = ( tagThisFile = false -- Unhide category + unhidelayers() unhidecategory() -- Unhide @@ -273,55 +276,51 @@ fn runNelMaxExportSub inputMaxFile retryCount = -- For each node for node in array_node do ( - -- It is root ? - if (node.parent == undefined) then + -- Is not a skeleton ? + if (((substring node.name 1 3) != "Bip") and ((substring (getRoot node).name 1 3) != "Bip")) then ( - -- Is not a skeleton ? - if (node.name != "Bip01") then + -- Can be exported ? + if (isToBeExported node == true) then ( - -- Can be exported ? - if (isToBeExported node == true) then + -- Not a lod ? + if ((isLod node) == false) then ( - -- Not a lod ? - if ((isLod node) == false) then + -- Output directory + if (haveCoarseMesh node) == true then + output = ("%OutputDirectoryWithCoarseMesh%/" + (node.name) + ".shape") + else + output = ("%OutputDirectoryWithoutCoarseMesh%/" + (node.name) + ".shape") + + -- Compare file date + if (NeLTestFileDate output inputMaxFile) == true then ( - -- Output directory - if (haveCoarseMesh node) == true then - output = ("%OutputDirectoryWithCoarseMesh%/" + (node.name) + ".shape") - else - output = ("%OutputDirectoryWithoutCoarseMesh%/" + (node.name) + ".shape") - - -- Compare file date - if (NeLTestFileDate output inputMaxFile) == true then + try ( - try + -- Export the shape + if (NelExportShapeEx node output %ShapeExportOptShadow% %ShapeExportOptExportLighting% "%OutputDirectoryLightmap%" %ShapeExportOptLightingLimit% %ShapeExportOptLumelSize% %ShapeExportOptOversampling% true false %ShapeExportOptLightmapLog%) == true then ( - -- Export the shape - if (NelExportShapeEx node output %ShapeExportOptShadow% %ShapeExportOptExportLighting% "%OutputDirectoryLightmap%" %ShapeExportOptLightingLimit% %ShapeExportOptLumelSize% %ShapeExportOptOversampling% true false %ShapeExportOptLightmapLog%) == true then - ( - nlerror("OK "+output) - exported = exported +1 - ) - else - ( - -- Error - nlerror("ERROR exporting shape " + node.name + " in file " + inputMaxFile) - tagThisFile = false - ) + nlerror("OK "+output) + exported = exported +1 ) - catch + else ( -- Error - nlerror("ERROR fatal error exporting shape " + node.name + " in file " + inputMaxFile) + nlerror("ERROR exporting shape " + node.name + " in file " + inputMaxFile) tagThisFile = false ) ) - else + catch ( - nlerror("SKIPPED " + output) - exported = exported + 1 + -- Error + nlerror("ERROR fatal error exporting shape " + node.name + " in file " + inputMaxFile) + tagThisFile = false ) ) + else + ( + nlerror("SKIPPED " + output) + exported = exported + 1 + ) ) ) ) diff --git a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/veget.ms b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/veget.ms index 22c49013a..614a9a94f 100755 --- a/code/nel/tools/build_gamedata/generators/max_exporter_scripts/veget.ms +++ b/code/nel/tools/build_gamedata/generators/max_exporter_scripts/veget.ms @@ -39,6 +39,7 @@ fn runNelMaxExport inputMaxFile = tagThisFile = true -- Unhide category + unhidelayers() unhidecategory() -- Unhide diff --git a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/export_header.ms b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/export_header.ms index 2d5e5434f..f06bab786 100755 --- a/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/export_header.ms +++ b/code/nel/tools/build_gamedata/generators/simple_max_exporter_template/export_header.ms @@ -13,6 +13,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( diff --git a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_header.ms b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_header.ms index 03bfea443..a7b97a064 100755 --- a/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_header.ms +++ b/code/nel/tools/build_gamedata/generators/tagged_max_exporter_template/export_header.ms @@ -16,6 +16,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( diff --git a/code/nel/tools/build_gamedata/processes/anim/1_export.py b/code/nel/tools/build_gamedata/processes/anim/1_export.py index 4c51fc261..1745c45a9 100755 --- a/code/nel/tools/build_gamedata/processes/anim/1_export.py +++ b/code/nel/tools/build_gamedata/processes/anim/1_export.py @@ -6,7 +6,7 @@ # # \file 1_export.py # \brief Export anim -# \date 2011-09-21-20-51-GMT +# \date 2015-01-06-16-31-GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Export anim diff --git a/code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms b/code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms index 7121e16d5..fc1eda5f9 100755 --- a/code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms +++ b/code/nel/tools/build_gamedata/processes/anim/maxscript/anim_export.ms @@ -16,6 +16,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( diff --git a/code/nel/tools/build_gamedata/processes/clodbank/1_export.py b/code/nel/tools/build_gamedata/processes/clodbank/1_export.py index 64cd875df..c73a86ac7 100755 --- a/code/nel/tools/build_gamedata/processes/clodbank/1_export.py +++ b/code/nel/tools/build_gamedata/processes/clodbank/1_export.py @@ -6,7 +6,7 @@ # # \file 1_export.py # \brief Export clodbank -# \date 2011-09-21-20-51-GMT +# \date 2015-01-06-16-31-GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Export clodbank diff --git a/code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms b/code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms index a8693dc8a..02856d2c7 100755 --- a/code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms +++ b/code/nel/tools/build_gamedata/processes/clodbank/maxscript/clod_export.ms @@ -16,6 +16,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( @@ -115,6 +125,7 @@ fn runNelMaxExport inputMaxFile = tagThisFile = true -- Unhide category + unhidelayers() unhidecategory() -- Unhide diff --git a/code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms b/code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms index 65cb38c4a..e91732391 100755 --- a/code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms +++ b/code/nel/tools/build_gamedata/processes/ig/maxscript/ig_export.ms @@ -16,6 +16,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( @@ -120,6 +130,7 @@ fn runNelMaxExport inputMaxFile = tagThisFile = true -- Unhide category + unhidelayers() unhidecategory() -- Unhide diff --git a/code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms b/code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms index 933468459..07d032809 100755 --- a/code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms +++ b/code/nel/tools/build_gamedata/processes/ligo/maxscript/nel_ligo_export.ms @@ -17,6 +17,16 @@ NEL3D_APPDATA_IGNAME = 1423062564 -- string : name of the Instance Group tagThisFile = true +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( @@ -307,6 +317,10 @@ fn buildTransitionMatrixObj mt transitionZone cellSize = -- Export instance groups from the current loaded zone fn exportInstanceGroupFromZone inputFile outputPath igName transitionZone cellSize = ( + -- Unhide category + unhidelayers() + unhidecategory() + -- Unhide max unhide all @@ -501,6 +515,7 @@ try objXRefMgr.UpdateAllRecords() -- Unhide category + unhidelayers() unhidecategory() DeleteDebugMarkersFn () @@ -648,6 +663,7 @@ try objXRefMgr.UpdateAllRecords() -- Unhide category + unhidelayers() unhidecategory() DeleteDebugMarkersFn () @@ -863,6 +879,7 @@ try objXRefMgr.UpdateAllRecords() -- Unhide category + unhidelayers() unhidecategory() DeleteDebugMarkersFn () diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py b/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py index 4fb464704..cfb46635f 100755 --- a/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py +++ b/code/nel/tools/build_gamedata/processes/pacs_prim/1_export.py @@ -6,7 +6,7 @@ # # \file 1_export.py # \brief Export pacs_prim -# \date 2013-07-24-14-21-GMT +# \date 2015-01-06-16-31-GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Export pacs_prim @@ -130,6 +130,13 @@ if MaxAvailable: +# Remove bad file from previous script version +listPath = ExportBuildDirectory + "/" + PacsPrimExportDirectory + "/landscape_col_prim_pacs_list.txt" +if os.path.isfile(listPath): + os.remove(listPath) + + + log.close() if os.path.isfile("log.log"): os.remove("log.log") diff --git a/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms b/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms index 750af80d9..d0d7c7ce4 100755 --- a/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms +++ b/code/nel/tools/build_gamedata/processes/pacs_prim/maxscript/pacs_prim_export.ms @@ -16,6 +16,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( diff --git a/code/nel/tools/build_gamedata/processes/rbank/1_export.py b/code/nel/tools/build_gamedata/processes/rbank/1_export.py index 4b5667961..65c14c907 100755 --- a/code/nel/tools/build_gamedata/processes/rbank/1_export.py +++ b/code/nel/tools/build_gamedata/processes/rbank/1_export.py @@ -6,7 +6,7 @@ # # \file 1_export.py # \brief Export rbank -# \date 2011-09-21-20-51-GMT +# \date 2015-01-06-16-31-GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Export rbank diff --git a/code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms b/code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms index 59b444db3..4949f7c60 100755 --- a/code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms +++ b/code/nel/tools/build_gamedata/processes/rbank/maxscript/cmb_export.ms @@ -16,6 +16,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( diff --git a/code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms b/code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms index 16c6dcec9..f97419aa7 100755 --- a/code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms +++ b/code/nel/tools/build_gamedata/processes/shape/maxscript/shape_export.ms @@ -16,6 +16,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( @@ -253,11 +263,14 @@ fn haveCoarseMesh node = return false ) +fn getRoot node = if isvalidnode node.parent then getRoot node.parent else node + fn runNelMaxExportSub inputMaxFile retryCount = ( tagThisFile = false -- Unhide category + unhidelayers() unhidecategory() -- Unhide @@ -339,55 +352,51 @@ fn runNelMaxExportSub inputMaxFile retryCount = -- For each node for node in array_node do ( - -- It is root ? - if (node.parent == undefined) then + -- Is not a skeleton ? + if (((substring node.name 1 3) != "Bip") and ((substring (getRoot node).name 1 3) != "Bip")) then ( - -- Is not a skeleton ? - if (node.name != "Bip01") then + -- Can be exported ? + if (isToBeExported node == true) then ( - -- Can be exported ? - if (isToBeExported node == true) then + -- Not a lod ? + if ((isLod node) == false) then ( - -- Not a lod ? - if ((isLod node) == false) then + -- Output directory + if (haveCoarseMesh node) == true then + output = ("%OutputDirectoryWithCoarseMesh%/" + (node.name) + ".shape") + else + output = ("%OutputDirectoryWithoutCoarseMesh%/" + (node.name) + ".shape") + + -- Compare file date + if (NeLTestFileDate output inputMaxFile) == true then ( - -- Output directory - if (haveCoarseMesh node) == true then - output = ("%OutputDirectoryWithCoarseMesh%/" + (node.name) + ".shape") - else - output = ("%OutputDirectoryWithoutCoarseMesh%/" + (node.name) + ".shape") - - -- Compare file date - if (NeLTestFileDate output inputMaxFile) == true then + try ( - try + -- Export the shape + if (NelExportShapeEx node output %ShapeExportOptShadow% %ShapeExportOptExportLighting% "%OutputDirectoryLightmap%" %ShapeExportOptLightingLimit% %ShapeExportOptLumelSize% %ShapeExportOptOversampling% true false %ShapeExportOptLightmapLog%) == true then ( - -- Export the shape - if (NelExportShapeEx node output %ShapeExportOptShadow% %ShapeExportOptExportLighting% "%OutputDirectoryLightmap%" %ShapeExportOptLightingLimit% %ShapeExportOptLumelSize% %ShapeExportOptOversampling% true false %ShapeExportOptLightmapLog%) == true then - ( - nlerror("OK "+output) - exported = exported +1 - ) - else - ( - -- Error - nlerror("ERROR exporting shape " + node.name + " in file " + inputMaxFile) - tagThisFile = false - ) + nlerror("OK "+output) + exported = exported +1 ) - catch + else ( -- Error - nlerror("ERROR fatal error exporting shape " + node.name + " in file " + inputMaxFile) + nlerror("ERROR exporting shape " + node.name + " in file " + inputMaxFile) tagThisFile = false ) ) - else + catch ( - nlerror("SKIPPED " + output) - exported = exported + 1 + -- Error + nlerror("ERROR fatal error exporting shape " + node.name + " in file " + inputMaxFile) + tagThisFile = false ) ) + else + ( + nlerror("SKIPPED " + output) + exported = exported + 1 + ) ) ) ) diff --git a/code/nel/tools/build_gamedata/processes/skel/1_export.py b/code/nel/tools/build_gamedata/processes/skel/1_export.py index 5f065fe5d..dcf336dbd 100755 --- a/code/nel/tools/build_gamedata/processes/skel/1_export.py +++ b/code/nel/tools/build_gamedata/processes/skel/1_export.py @@ -6,7 +6,7 @@ # # \file 1_export.py # \brief Export skel -# \date 2011-09-28-07-42-GMT +# \date 2015-01-06-16-31-GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Export skel diff --git a/code/nel/tools/build_gamedata/processes/skel/maxscript/skel_export.ms b/code/nel/tools/build_gamedata/processes/skel/maxscript/skel_export.ms index 7fd2af0fb..74440350b 100755 --- a/code/nel/tools/build_gamedata/processes/skel/maxscript/skel_export.ms +++ b/code/nel/tools/build_gamedata/processes/skel/maxscript/skel_export.ms @@ -13,6 +13,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( diff --git a/code/nel/tools/build_gamedata/processes/swt/1_export.py b/code/nel/tools/build_gamedata/processes/swt/1_export.py index 0803f1246..820950fe5 100755 --- a/code/nel/tools/build_gamedata/processes/swt/1_export.py +++ b/code/nel/tools/build_gamedata/processes/swt/1_export.py @@ -6,7 +6,7 @@ # # \file 1_export.py # \brief Export swt -# \date 2011-09-28-07-42-GMT +# \date 2015-01-06-16-31-GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Export swt diff --git a/code/nel/tools/build_gamedata/processes/swt/maxscript/swt_export.ms b/code/nel/tools/build_gamedata/processes/swt/maxscript/swt_export.ms index ea6ff95c3..99d684ea3 100755 --- a/code/nel/tools/build_gamedata/processes/swt/maxscript/swt_export.ms +++ b/code/nel/tools/build_gamedata/processes/swt/maxscript/swt_export.ms @@ -13,6 +13,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( diff --git a/code/nel/tools/build_gamedata/processes/veget/1_export.py b/code/nel/tools/build_gamedata/processes/veget/1_export.py index b2f8a7c57..ae8b835a3 100755 --- a/code/nel/tools/build_gamedata/processes/veget/1_export.py +++ b/code/nel/tools/build_gamedata/processes/veget/1_export.py @@ -6,7 +6,7 @@ # # \file 1_export.py # \brief Export veget -# \date 2011-09-21-20-51-GMT +# \date 2015-01-06-16-31-GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Export veget diff --git a/code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms b/code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms index cbc2f2177..1b8154530 100755 --- a/code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms +++ b/code/nel/tools/build_gamedata/processes/veget/maxscript/veget_export.ms @@ -16,6 +16,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( @@ -105,6 +115,7 @@ fn runNelMaxExport inputMaxFile = tagThisFile = true -- Unhide category + unhidelayers() unhidecategory() -- Unhide diff --git a/code/nel/tools/build_gamedata/processes/zone/1_export.py b/code/nel/tools/build_gamedata/processes/zone/1_export.py index 94a90900c..acffe9abb 100755 --- a/code/nel/tools/build_gamedata/processes/zone/1_export.py +++ b/code/nel/tools/build_gamedata/processes/zone/1_export.py @@ -6,7 +6,7 @@ # # \file 1_export.py # \brief Export zone -# \date 2011-09-28-07-42-GMT +# \date 2015-01-06-16-31-GMT # \author Jan Boon (Kaetemi) # Python port of game data build pipeline. # Export zone diff --git a/code/nel/tools/build_gamedata/processes/zone/maxscript/zone_export.ms b/code/nel/tools/build_gamedata/processes/zone/maxscript/zone_export.ms index 3a0ebf8fe..6c4e0c8a0 100755 --- a/code/nel/tools/build_gamedata/processes/zone/maxscript/zone_export.ms +++ b/code/nel/tools/build_gamedata/processes/zone/maxscript/zone_export.ms @@ -13,6 +13,16 @@ nlErrorStream = openFile nlErrorFilename mode:"a" if nlErrorStream == undefined then nlErrorStream = createFile nlErrorFilename +-- Unhide layers +fn unhidelayers = +( + for i = 0 to (LayerManager.count - 1) do + ( + layer = (LayerManager.getLayer i) + layer.ishidden = false + ) +) + -- Unhide category fn unhidecategory = ( diff --git a/code/nel/tools/build_gamedata/sky_dev.bat b/code/nel/tools/build_gamedata/sky_dev.bat new file mode 100644 index 000000000..ac80d591e --- /dev/null +++ b/code/nel/tools/build_gamedata/sky_dev.bat @@ -0,0 +1,11 @@ +title Ryzom Core: 1_export.py (LEVELDESIGN) +1_export.py -ipj common/sky common/sfx common/gamedev common/data_common common/data_shard common/leveldesign common/exedll common/cfg shard/data_shard shard/data_language shard/data_leveldesign shard/data_game_share +title Ryzom Core: 2_build.py (LEVELDESIGN) +2_build.py -ipj common/sky common/sfx common/gamedev common/data_common common/data_shard common/leveldesign common/exedll common/cfg shard/data_shard shard/data_language shard/data_leveldesign shard/data_game_share +title Ryzom Core: 3_install.py (LEVELDESIGN) +3_install.py -ipj common/sky common/sfx common/gamedev common/data_common common/data_shard common/leveldesign common/exedll common/cfg shard/data_shard shard/data_language shard/data_leveldesign shard/data_game_share +title Ryzom Core: b1_client_dev.py (LEVELDESIGN) +b1_client_dev.py +title Ryzom Core: b2_shard_data.py (LEVELDESIGN) +b2_shard_data.py +title Ryzom Core: Ready diff --git a/code/nel/tools/misc/CMakeLists.txt b/code/nel/tools/misc/CMakeLists.txt index 5386cbbc6..c9bbcd058 100644 --- a/code/nel/tools/misc/CMakeLists.txt +++ b/code/nel/tools/misc/CMakeLists.txt @@ -3,6 +3,7 @@ SUBDIRS(bnp_make disp_sheet_id extract_filename lock make_sheet_id xml_packer) IF(WITH_QT) ADD_SUBDIRECTORY(words_dic_qt) ADD_SUBDIRECTORY(message_box_qt) + ADD_SUBDIRECTORY(crash_report) ENDIF(WITH_QT) IF(WIN32) diff --git a/code/nel/tools/misc/crash_report/CMakeLists.txt b/code/nel/tools/misc/crash_report/CMakeLists.txt new file mode 100644 index 000000000..0e2d2a9bc --- /dev/null +++ b/code/nel/tools/misc/crash_report/CMakeLists.txt @@ -0,0 +1,39 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SRC_DIR} ${QT_INCLUDES}) +FILE(GLOB CRASHREPORT_SRC *.cpp) +FILE(GLOB CRASHREPORT_HDR *h) + +SET(CRASHREPORT_MOC_HDR +crash_report_socket.h +crash_report_widget.h +) + +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) + +INCLUDE(${QT_USE_FILE}) +ADD_DEFINITIONS(${QT_DEFINITIONS}) + +QT4_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR}) +QT4_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI}) + +SOURCE_GROUP(QtResources FILES ${CRASHREPORT_UI}) +SOURCE_GROUP(QtGeneratedUiHdr FILES ${CRASHREPORT_UI_HDR}) +SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${CRASHREPORT_MOC_SRC}) +SOURCE_GROUP("source files" FILES ${CRASHREPORT_SRC}) +SOURCE_GROUP("header files" FILES ${CRASHREPORT_HDR}) + +ADD_EXECUTABLE(crash_report WIN32 MACOSX_BUNDLE ${CRASHREPORT_SRC} ${CRASHREPORT_MOC_HDR} ${CRASHREPORT_MOC_SRC} ${CRASHREPORT_UI_HDR}) +TARGET_LINK_LIBRARIES(crash_report ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY}) + +NL_DEFAULT_PROPS(crash_report "NeL, Tools, Misc: Crash Report") +NL_ADD_RUNTIME_FLAGS(crash_report) + +INSTALL(TARGETS crash_report RUNTIME DESTINATION ${NL_BIN_PREFIX}) + diff --git a/code/nel/tools/misc/crash_report/crash_report.cpp b/code/nel/tools/misc/crash_report/crash_report.cpp new file mode 100644 index 000000000..c42f1ae6f --- /dev/null +++ b/code/nel/tools/misc/crash_report/crash_report.cpp @@ -0,0 +1,111 @@ +// Nel MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#include "crash_report_widget.h" +#include +#include + +#include +#include +#include + +class CCmdLineParser +{ +public: + static void parse( int argc, char **argv, std::vector< std::pair< std::string, std::string > > &v ) + { + std::stack< std::string > stack; + std::string key; + std::string value; + + for( int i = argc - 1 ; i >= 0; i-- ) + { + stack.push( std::string( argv[ i ] ) ); + } + + while( !stack.empty() ) + { + key = stack.top(); + stack.pop(); + + // If not a real parameter ( they start with '-' ), discard. + if( key[ 0 ] != '-' ) + continue; + + // Remove the '-' + key = key.substr( 1 ); + + // No more parameters + if( stack.empty() ) + { + v.push_back( std::make_pair( key, "" ) ); + break; + } + + value = stack.top(); + + // If next parameter is a key, process it in the next iteration + if( value[ 0 ] == '-' ) + { + v.push_back( std::make_pair( key, "" ) ); + continue; + } + // Otherwise store the pair + else + { + v.push_back( std::make_pair( key, value ) ); + stack.pop(); + } + } + } +}; + +int main( int argc, char **argv ) +{ +#ifndef WIN32 + // Workaround to default -style=gtk+ on recent Cinnamon versions + char *currentDesktop = getenv("XDG_CURRENT_DESKTOP"); + if (currentDesktop) + { + printf("XDG_CURRENT_DESKTOP: %s\n", currentDesktop); + if (!strcmp(currentDesktop, "X-Cinnamon")) + { + setenv("XDG_CURRENT_DESKTOP", "gnome", 1); + } + } +#endif + + QApplication app( argc, argv ); + + std::vector< std::pair< std::string, std::string > > params; + + CCmdLineParser::parse( argc, argv, params ); + + CCrashReportWidget w; + w.setup( params ); + w.show(); + + int ret = app.exec(); + + if( ret != EXIT_SUCCESS ) + return ret; + else + return w.getReturnValue(); + +} \ No newline at end of file diff --git a/code/nel/tools/3d/tile_edit/PIC/readpic.h b/code/nel/tools/misc/crash_report/crash_report_data.h similarity index 55% rename from code/nel/tools/3d/tile_edit/PIC/readpic.h rename to code/nel/tools/misc/crash_report/crash_report_data.h index 614eba224..5884e7eb4 100644 --- a/code/nel/tools/3d/tile_edit/PIC/readpic.h +++ b/code/nel/tools/misc/crash_report/crash_report_data.h @@ -1,5 +1,7 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited +// Ryzom Core MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as @@ -14,27 +16,18 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#ifndef _READPIC_H_ -#define _READPIC_H_ -#ifdef _MSC_VER -#pragma warning(disable:4786) +#ifndef RCERROR_DATA +#define RCERROR_DATA + +#include + + +struct SCrashReportData +{ + QString description; + QString report; + QString email; +}; + #endif - - -#include -#include - -#include -#include - -//============================================================ -// API. -//============================================================ - - -bool PIC_LoadPic(std::string Path, std::vector &Tampon, uint &Width, uint &Height); - - - -#endif \ No newline at end of file diff --git a/code/nel/tools/misc/crash_report/crash_report_socket.cpp b/code/nel/tools/misc/crash_report/crash_report_socket.cpp new file mode 100644 index 000000000..f2a14e84b --- /dev/null +++ b/code/nel/tools/misc/crash_report/crash_report_socket.cpp @@ -0,0 +1,78 @@ +// Nel MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "crash_report_socket.h" +#include +#include +#include +#include +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) +# include +#endif + +class CCrashReportSocketPvt +{ +public: + QNetworkAccessManager mgr; +}; + +CCrashReportSocket::CCrashReportSocket( QObject *parent ) : +QObject( parent ) +{ + m_pvt = new CCrashReportSocketPvt(); + + connect( &m_pvt->mgr, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( onFinished( QNetworkReply* ) ) ); +} + +CCrashReportSocket::~CCrashReportSocket() +{ + delete m_pvt; +} + +void CCrashReportSocket::sendReport( const SCrashReportData &data ) +{ +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) + QUrlQuery params; +#else + QUrl params; +#endif + params.addQueryItem( "report", data.report ); + params.addQueryItem( "descr", data.description ); + params.addQueryItem("email", data.email); + + QUrl url( m_url ); + QNetworkRequest request( url ); + request.setRawHeader( "Connection", "close" ); + +#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) + QByteArray postData = params.query(QUrl::FullyEncoded).toUtf8(); +#else + QByteArray postData = params.encodedQuery(); +#endif + + m_pvt->mgr.post(request, postData); +} + +void CCrashReportSocket::onFinished( QNetworkReply *reply ) +{ + if( reply->error() != QNetworkReply::NoError ) + Q_EMIT reportFailed(); + else + Q_EMIT reportSent(); +} + diff --git a/code/nel/tools/misc/crash_report/crash_report_socket.h b/code/nel/tools/misc/crash_report/crash_report_socket.h new file mode 100644 index 000000000..32ccc5da0 --- /dev/null +++ b/code/nel/tools/misc/crash_report/crash_report_socket.h @@ -0,0 +1,55 @@ +// Nel MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#ifndef RCERROR_SOCKET +#define RCERROR_SOCKET + +#include +#include "crash_report_data.h" + +class CCrashReportSocketPvt; +class QNetworkReply; + +class CCrashReportSocket : public QObject +{ + Q_OBJECT + +public: + CCrashReportSocket( QObject *parent ); + ~CCrashReportSocket(); + + void setURL( const char *URL ){ m_url = URL; } + QString url() const{ return m_url; } + + void sendReport( const SCrashReportData &data ); + +Q_SIGNALS: + void reportSent(); + void reportFailed(); + +private Q_SLOTS: + void onFinished( QNetworkReply *reply ); + +private: + CCrashReportSocketPvt *m_pvt; + QString m_url; +}; + +#endif + diff --git a/code/nel/tools/misc/crash_report/crash_report_widget.cpp b/code/nel/tools/misc/crash_report/crash_report_widget.cpp new file mode 100644 index 000000000..218b3545c --- /dev/null +++ b/code/nel/tools/misc/crash_report/crash_report_widget.cpp @@ -0,0 +1,301 @@ +// Nel MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#include "crash_report_widget.h" +#include "crash_report_socket.h" +#include "crash_report_data.h" +#include +#include +#include +#include +#include +#include +#include +#include + +CCrashReportWidget::CCrashReportWidget( QWidget *parent ) : +QWidget( parent ) +{ + m_developerMode = false; + m_forceSend = false; + m_devSendReport = false; + m_returnValue = ERET_NULL; + + m_ui.setupUi( this ); + + m_socket = new CCrashReportSocket( this ); + + QTimer::singleShot( 1, this, SLOT( onLoad() ) ); + + connect( m_ui.emailCB, SIGNAL( stateChanged( int ) ), this, SLOT( onCBClicked() ) ); + + connect( m_socket, SIGNAL( reportSent() ), this, SLOT( onReportSent() ) ); + connect( m_socket, SIGNAL( reportFailed() ), this, SLOT( onReportFailed() ) ); +} + +CCrashReportWidget::~CCrashReportWidget() +{ + m_socket = NULL; +} + +void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::string > > ¶ms ) +{ + for( int i = 0; i < params.size(); i++ ) + { + const std::pair< std::string, std::string > &p = params[ i ]; + const std::string &k = p.first; + const std::string &v = p.second; + + if( k == "log" ) + { + m_fileName = v.c_str(); + if( !QFile::exists( m_fileName ) ) + m_fileName.clear(); + } + else + if( k == "host" ) + { + m_socket->setURL( v.c_str() ); + } + else + if( k == "title" ) + { + setWindowTitle( v.c_str() ); + } + else + if( k == "dev" ) + { + m_developerMode = true; + } + else + if( k == "sendreport" ) + { + m_forceSend = true; + } + } + + if( m_fileName.isEmpty() ) + { + m_ui.reportLabel->hide(); + m_ui.reportEdit->hide(); + } + + + if( m_socket->url().isEmpty() || m_fileName.isEmpty() ) + { + m_ui.descriptionEdit->hide(); + m_ui.emailCB->hide(); + m_ui.emailEdit->hide(); + m_ui.descrLabel->hide(); + } + + QHBoxLayout *hbl = new QHBoxLayout( this ); + + if( m_developerMode ) + { + if( !m_socket->url().isEmpty() && !m_fileName.isEmpty() ) + { + m_ui.emailCB->setEnabled( false ); + + QCheckBox *cb = new QCheckBox( tr( "Send report" ), this ); + m_ui.gridLayout->addWidget( cb, 4, 0, 1, 1 ); + + m_ui.gridLayout->addWidget( m_ui.emailCB, 5, 0, 1, 1 ); + m_ui.gridLayout->addWidget( m_ui.emailEdit, 6, 0, 1, 1 ); + + connect(cb, SIGNAL(stateChanged(int)), this, SLOT(onSendCBClicked())); + if (m_forceSend) + cb->setChecked(true); + } + + hbl->addStretch(); + + QPushButton *alwaysIgnoreButton = new QPushButton( tr( "Always Ignore" ), this ); + QPushButton *ignoreButton = new QPushButton( tr( "Ignore" ), this ); + QPushButton *abortButton = new QPushButton( tr( "Abort" ), this ); + QPushButton *breakButton = new QPushButton(tr("Break"), this); + breakButton->setAutoDefault(true); + + hbl->addWidget( alwaysIgnoreButton ); + hbl->addWidget( ignoreButton ); + hbl->addWidget( abortButton ); + hbl->addWidget( breakButton ); + + m_ui.gridLayout->addLayout( hbl, 7, 0, 1, 3 ); + + connect( alwaysIgnoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onAlwaysIgnoreClicked() ) ); + connect( ignoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onIgnoreClicked() ) ); + connect( abortButton, SIGNAL( clicked( bool ) ), this, SLOT( onAbortClicked() ) ); + connect( breakButton, SIGNAL( clicked( bool ) ), this, SLOT( onBreakClicked() ) ); + } + else + { + hbl->addStretch(); + + // If -host is specified, offer the send function + if( !m_socket->url().isEmpty() && !m_fileName.isEmpty() ) + { + if (!m_forceSend) + { + QPushButton *cancelButton = new QPushButton(tr("Don't send report"), this); + connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(onCancelClicked())); + hbl->addWidget(cancelButton); + } + + QPushButton *sendButton = new QPushButton( tr( "Send report" ), this ); + sendButton->setAutoDefault(true); + connect( sendButton, SIGNAL( clicked( bool ) ), this, SLOT( onSendClicked() ) ); + hbl->addWidget( sendButton ); + } + // Otherwise only offer exit + else + { + QPushButton *exitButton = new QPushButton( tr( "Exit" ), this ); + connect( exitButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) ); + hbl->addWidget(exitButton); + exitButton->setAutoDefault(true); + } + + m_ui.gridLayout->addLayout( hbl, 6, 0, 1, 3 ); + } +} + +void CCrashReportWidget::onLoad() +{ + if( m_fileName.isEmpty() ) + return; + + QFile f( m_fileName ); + bool b = f.open( QFile::ReadOnly | QFile::Text ); + if( !b ) + { + m_fileName.clear(); + return; + } + + QTextStream ss( &f ); + m_ui.reportEdit->setPlainText( ss.readAll() ); + f.close(); +} + +void CCrashReportWidget::onSendClicked() +{ + if( m_developerMode && !m_devSendReport ) + { + close(); + return; + } + + if( m_socket->url().isEmpty() || m_fileName.isEmpty() ) + { + close(); + return; + } + + QApplication::setOverrideCursor( Qt::WaitCursor ); + + SCrashReportData data; + data.description = m_ui.descriptionEdit->toPlainText(); + data.report = m_ui.reportEdit->toPlainText(); + + if( m_ui.emailCB->isChecked() ) + data.email = m_ui.emailEdit->text(); + + m_socket->sendReport( data ); +} + +void CCrashReportWidget::onCancelClicked() +{ + removeAndQuit(); +} + +void CCrashReportWidget::onCBClicked() +{ + m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() ); +} + +void CCrashReportWidget::onSendCBClicked() +{ + bool b = m_ui.emailCB->isEnabled(); + + if( b ) + { + m_ui.emailCB->setChecked( false ); + } + + m_ui.emailCB->setEnabled( !b ); + + m_devSendReport = !m_devSendReport; +} + +void CCrashReportWidget::onAlwaysIgnoreClicked() +{ + m_returnValue = ERET_ALWAYS_IGNORE; + onSendClicked(); +} + +void CCrashReportWidget::onIgnoreClicked() +{ + m_returnValue = ERET_IGNORE; + onSendClicked(); +} + +void CCrashReportWidget::onAbortClicked() +{ + m_returnValue = ERET_ABORT; + onSendClicked(); +} + +void CCrashReportWidget::onBreakClicked() +{ + m_returnValue = ERET_BREAK; + onSendClicked(); +} + + +void CCrashReportWidget::onReportSent() +{ + QApplication::setOverrideCursor( Qt::ArrowCursor ); + + QMessageBox::information( this, + tr( "Report sent" ), + tr( "The report has been sent." ) ); + + removeAndQuit(); +} + +void CCrashReportWidget::onReportFailed() +{ + QApplication::setOverrideCursor( Qt::ArrowCursor ); + + QMessageBox::information( this, + tr( "Report failed" ), + tr( "Failed to send the report..." ) ); + + removeAndQuit(); +} + +void CCrashReportWidget::removeAndQuit() +{ + if( !m_fileName.isEmpty() ) + QFile::remove( m_fileName ); + + close(); +} + diff --git a/code/nel/tools/misc/crash_report/crash_report_widget.h b/code/nel/tools/misc/crash_report/crash_report_widget.h new file mode 100644 index 000000000..f40e40854 --- /dev/null +++ b/code/nel/tools/misc/crash_report/crash_report_widget.h @@ -0,0 +1,82 @@ +// Nel MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + +#ifndef RCERROR_WIDGET +#define RCERROR_WIDGET + + +#include "ui_crash_report_widget.h" +#include +#include + +class CCrashReportSocket; + +class CCrashReportWidget : public QWidget +{ + Q_OBJECT +public: + + enum EReturnValue + { + ERET_NULL = 0, + ERET_ALWAYS_IGNORE = 21, + ERET_IGNORE = 22, + ERET_ABORT = 23, + ERET_BREAK = 24 + }; + + CCrashReportWidget( QWidget *parent = NULL ); + ~CCrashReportWidget(); + + void setFileName( const char *fn ){ m_fileName = fn; } + + void setup( const std::vector< std::pair< std::string, std::string > > ¶ms ); + + EReturnValue getReturnValue() const{ return m_returnValue; } + +private Q_SLOTS: + void onLoad(); + void onSendClicked(); + void onCancelClicked(); + void onCBClicked(); + void onSendCBClicked(); + + void onAlwaysIgnoreClicked(); + void onIgnoreClicked(); + void onAbortClicked(); + void onBreakClicked(); + + void onReportSent(); + void onReportFailed(); + +private: + void removeAndQuit(); + + Ui::CrashReportWidget m_ui; + QString m_fileName; + CCrashReportSocket *m_socket; + bool m_developerMode; + bool m_forceSend; + bool m_devSendReport; + + EReturnValue m_returnValue; +}; + +#endif + diff --git a/code/nel/tools/misc/crash_report/crash_report_widget.ui b/code/nel/tools/misc/crash_report/crash_report_widget.ui new file mode 100644 index 000000000..da1e38618 --- /dev/null +++ b/code/nel/tools/misc/crash_report/crash_report_widget.ui @@ -0,0 +1,68 @@ + + + CrashReportWidget + + + Qt::ApplicationModal + + + + 0 + 0 + 406 + 430 + + + + NeL report + + + + + + What were you doing when the crash occured? + + + + + + + Contents of the report ( automatically generated ) + + + + + + + + + + Email me if you have further questions, or updates on this issue + + + + + + + false + + + Enter your email address here + + + + + + + true + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + diff --git a/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp b/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp index 53d515fdd..851dfe6df 100644 --- a/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp +++ b/code/nel/tools/misc/make_sheet_id/make_sheet_id.cpp @@ -163,7 +163,7 @@ void readFormId( string& outputFileName ) map::iterator itFT = FileTypeToId.find(fileType); if( itFT == FileTypeToId.end() ) { - FileTypeToId.insert( make_pair(fileType,fid.FormIDInfos.Type) ); + FileTypeToId.insert( std::pair(fileType,fid.FormIDInfos.Type) ); } } else diff --git a/code/nel/tools/misc/xml_packer/xml_packer.cpp b/code/nel/tools/misc/xml_packer/xml_packer.cpp index 6f82b5426..2d7695de4 100644 --- a/code/nel/tools/misc/xml_packer/xml_packer.cpp +++ b/code/nel/tools/misc/xml_packer/xml_packer.cpp @@ -379,7 +379,7 @@ int main(int argc, char *argv[]) CSString subFileName = parser.leftCrop(sizeof(" (i, fi)); + faultyInstances.insert(std::pair(i, fi)); } } @@ -1046,7 +1046,7 @@ void processGlobalRetriever() { if (Verbose) nlinfo("after fix: unlink: %s", unlinkstr.c_str()); - faultyInstances.insert(make_pair(i, fi)); + faultyInstances.insert(std::pair(i, fi)); } } } diff --git a/code/nel/tools/pacs/build_rbank/build_surf.cpp b/code/nel/tools/pacs/build_rbank/build_surf.cpp index 9546e19f1..10d4c6a19 100644 --- a/code/nel/tools/pacs/build_rbank/build_surf.cpp +++ b/code/nel/tools/pacs/build_rbank/build_surf.cpp @@ -201,8 +201,7 @@ template class CHashPtr { public: - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; typedef A *ptrA; size_t operator() (const ptrA &a) const diff --git a/code/nelns/login_service/connection_client.cpp b/code/nelns/login_service/connection_client.cpp index 8ff713ec2..ebdef1b9a 100644 --- a/code/nelns/login_service/connection_client.cpp +++ b/code/nelns/login_service/connection_client.cpp @@ -126,7 +126,7 @@ retry: // now the user is on the database - uid = atoi(row[0]); + NLMISC::fromString(row[0], uid); if(cpassword != row[2]) { diff --git a/code/nelns/login_system/nel_launcher_windows_ext/Configuration.cpp b/code/nelns/login_system/nel_launcher_windows_ext/Configuration.cpp index f9092e56b..88b0d854a 100644 --- a/code/nelns/login_system/nel_launcher_windows_ext/Configuration.cpp +++ b/code/nelns/login_system/nel_launcher_windows_ext/Configuration.cpp @@ -52,7 +52,7 @@ BOOL CConfiguration::Load() // Reading the configuration file version GetValue(csBuffer, KEY_VERSION, csValue); - m_dVersion = atof(csValue); + NLMISC::fromString(csValue, m_dVersion); nlinfo("Config' version %s", csValue); if(m_dVersion < APP.m_dVersion) diff --git a/code/nelns/login_system/nel_launcher_windows_ext/nel_launcher.cpp b/code/nelns/login_system/nel_launcher_windows_ext/nel_launcher.cpp index 8ace867f7..2e36702d8 100644 --- a/code/nelns/login_system/nel_launcher_windows_ext/nel_launcher.cpp +++ b/code/nelns/login_system/nel_launcher_windows_ext/nel_launcher.cpp @@ -324,7 +324,7 @@ void CNel_launcherApp::LoadVersion() else { nlinfo("Launcher' version %s", csVersion); - m_dVersion = atof(csVersion); + NLMISC::fromString(csVersion, m_dVersion); } } diff --git a/code/ryzom/client/src/3d_notes.cpp b/code/ryzom/client/src/3d_notes.cpp index 7156854e4..618525de4 100644 --- a/code/ryzom/client/src/3d_notes.cpp +++ b/code/ryzom/client/src/3d_notes.cpp @@ -57,9 +57,10 @@ void cbNotesChanged() Notes.Notes.clear(); return; } - pos.x = (float)atof(posstr[0].c_str()); - pos.y = (float)atof(posstr[1].c_str()); - pos.z = (float)atof(posstr[2].c_str()); + + NLMISC::fromString(posstr[0], pos.x); + NLMISC::fromString(posstr[1], pos.y); + NLMISC::fromString(posstr[2], pos.z); string note(var.asString(i+2)); if(note.empty()) diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index c20d9d0dc..9c2b4b431 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -1,4 +1,3 @@ - # Need clientsheets lib for sheets packer tool ADD_SUBDIRECTORY(client_sheets) @@ -84,6 +83,7 @@ INCLUDE_DIRECTORIES( ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR} ${CURL_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIR} ) TARGET_LINK_LIBRARIES(ryzom_client @@ -121,6 +121,14 @@ NL_ADD_RUNTIME_FLAGS(ryzom_client) NL_ADD_LIB_SUFFIX(ryzom_client) +IF(WITH_RYZOM_CLIENT_UAC) + IF(CMAKE_GENERATOR MATCHES "Visual Studio") + SET_PROPERTY(TARGET ryzom_client PROPERTY LINK_FLAGS_RELEASE "/level='requireAdministrator'") + ELSEIF(CMAKE_GENERATOR MATCHES "NMake Makefiles") + SET_PROPERTY(TARGET ryzom_client PROPERTY LINK_FLAGS_RELEASE "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\"") + ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio") +ENDIF(WITH_RYZOM_CLIENT_UAC) + IF(WITH_PCH AND (NOT MINGW OR NOT WITH_SYMBOLS)) ADD_NATIVE_PRECOMPILED_HEADER(ryzom_client ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) ENDIF(WITH_PCH AND (NOT MINGW OR NOT WITH_SYMBOLS)) diff --git a/code/ryzom/client/src/actions.h b/code/ryzom/client/src/actions.h index e9b9d53e0..b177c1818 100644 --- a/code/ryzom/client/src/actions.h +++ b/code/ryzom/client/src/actions.h @@ -30,8 +30,8 @@ /////////// // CLASS // class CCombo; -class CActionsManager; class CAction; +class CActionsManager; /** * The goal of CCombo is to gather together Inputs that will validate an Action. @@ -281,8 +281,7 @@ public: // HashMapTraits for NLMISC::TKey struct CTKeyHashMapTraits { - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; CTKeyHashMapTraits() { } size_t operator() (NLMISC::TKey key) const { diff --git a/code/ryzom/client/src/cdb_synchronised.cpp b/code/ryzom/client/src/cdb_synchronised.cpp index 45c57dd55..2ad3022cf 100644 --- a/code/ryzom/client/src/cdb_synchronised.cpp +++ b/code/ryzom/client/src/cdb_synchronised.cpp @@ -41,7 +41,7 @@ #include -#include "../../common/src/game_share/ryzom_database_banks.h" +#include "game_share/ryzom_database_banks.h" //////////////// diff --git a/code/ryzom/client/src/character_cl.cpp b/code/ryzom/client/src/character_cl.cpp index 23fdb78e2..89c9b805b 100644 --- a/code/ryzom/client/src/character_cl.cpp +++ b/code/ryzom/client/src/character_cl.cpp @@ -4537,7 +4537,7 @@ void CCharacterCL::applyBehaviourFlyingHPs(const CBehaviourContext &bc, const MB { if(behaviour.DeltaHP != 0) { - CRGBA deltaHPColor( 0, 0, 0 ); + CRGBA deltaHPColor(0, 0, 0); // if it's a hit if( behaviour.DeltaHP < 0 ) { diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index 19af0545d..1b4285dd5 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -26,7 +26,6 @@ #include "nel/misc/types_nl.h" #ifdef NL_OS_WINDOWS -#include #include #else #include @@ -366,6 +365,8 @@ int main(int argc, char **argv) createDebug(); + INelContext::getInstance().setWindowedApplication(true); + #ifndef NL_DEBUG INelContext::getInstance().getDebugLog()->removeDisplayer("DEFAULT_SD"); INelContext::getInstance().getInfoLog()->removeDisplayer("DEFAULT_SD"); diff --git a/code/ryzom/client/src/client_chat_manager.cpp b/code/ryzom/client/src/client_chat_manager.cpp index 09f874b96..141edea27 100644 --- a/code/ryzom/client/src/client_chat_manager.cpp +++ b/code/ryzom/client/src/client_chat_manager.cpp @@ -969,8 +969,6 @@ void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstrin name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name), bWoman); } } - - } else { @@ -1052,8 +1050,6 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName), bWoman); } } - - } switch(type) @@ -1208,7 +1204,7 @@ class CHandlerTell : public IActionHandler ucstring s = CI18N::get("youTellPlayer"); strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); - CInterfaceManager::getInstance()->log(finalMsg); + CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); } }; REGISTER_ACTION_HANDLER( CHandlerTell, "tell"); diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index ad8a328ba..90287955d 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -3890,7 +3890,6 @@ NLMISC_COMMAND(displayInventoryCounter, "display the Inventory counter to compar NLMISC_COMMAND(displayActionCounter, "display the action counters", "") { - CInterfaceManager *pIM= CInterfaceManager::getInstance(); CSPhraseManager *pPM= CSPhraseManager::getInstance(); diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 8b07cc7f2..3f3a3d809 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -31,7 +31,7 @@ // 3D Interface. #include "nel/3d/u_driver.h" #include "nel/3d/u_text_context.h" -#include +#include "nel/3d/stereo_display.h" // Game Share //#include "game_share/gd_time.h" // \todo GUIGUI : TO DELETE/CHANGE #include "game_share/gender.h" @@ -103,7 +103,6 @@ extern uint32 Version; // Client Version. extern UDriver *Driver; extern UTextContext *TextContext; extern bool game_exit; -extern CMsgBoxDisplayer MsgBoxError; extern CSoundManager *SoundMngr; diff --git a/code/ryzom/client/src/entities.cpp b/code/ryzom/client/src/entities.cpp index 7bc478ce7..516232108 100644 --- a/code/ryzom/client/src/entities.cpp +++ b/code/ryzom/client/src/entities.cpp @@ -426,7 +426,7 @@ void CEntityManager::initialize(uint nbMaxEntity) _Entities.resize(_NbMaxEntity, 0); _EntityGroundFXHandle.resize(_NbMaxEntity); } - + ICDBNode::CTextId textId; // Add an observer on the mission database diff --git a/code/ryzom/client/src/entity_cl.cpp b/code/ryzom/client/src/entity_cl.cpp index 0063c93f4..6a14d6400 100644 --- a/code/ryzom/client/src/entity_cl.cpp +++ b/code/ryzom/client/src/entity_cl.cpp @@ -2296,6 +2296,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) } ucstring replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle)); + // Sometimes translation contains another title { ucstring::size_type pos = replacement.find('$'); @@ -2308,7 +2309,7 @@ void CEntityCL::onStringAvailable(uint /* stringId */, const ucstring &value) replacement = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, womanTitle); } } - + _Tags = STRING_MANAGER::CStringManagerClient::getTitleInfos(_TitleRaw, womanTitle); if (!replacement.empty() || !ClientCfg.DebugStringManager) @@ -2949,7 +2950,7 @@ void CEntityCL::dataSetId(CLFECOMMON::TClientDataSetIndex dataSet) { _DataSetId = dataSet; - if (_Primitive && _Primitive->UserData == UserDataEntity) + if (_Primitive && _Primitive->UserData == UserDataEntity) _Primitive->UserData |= (((uint64)_DataSetId)<<16); // additionaly, on a UID change, must check the IsInTeam and IsAniml flags diff --git a/code/ryzom/client/src/far_tp.cpp b/code/ryzom/client/src/far_tp.cpp index 4f48d2ff5..5b9b0c836 100644 --- a/code/ryzom/client/src/far_tp.cpp +++ b/code/ryzom/client/src/far_tp.cpp @@ -188,7 +188,6 @@ const std::string& CLoginStateMachine::toString(CLoginStateMachine::TEvent event _CurrentState = stateId; \ break; \ } \ - extern std::string LoginLogin, LoginPassword; extern bool noUserChar; diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp index db830a9df..008bef19a 100644 --- a/code/ryzom/client/src/http_client_curl.cpp +++ b/code/ryzom/client/src/http_client_curl.cpp @@ -15,7 +15,6 @@ // along with this program. If not, see . #include "stdpch.h" -#define CURL_STATICLIB 1 #include #include "http_client_curl.h" diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 6958fe790..5484141a2 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -142,7 +142,6 @@ using namespace std; // Ligo primitive class CLigoConfig LigoConfig; -CMsgBoxDisplayer MsgBoxError; CClientChatManager ChatMngr; bool LastScreenSaverEnabled = false; @@ -554,26 +553,6 @@ void checkDriverDepth () } } -static std::string replaceApplicationDirToken(const std::string &dir) -{ -#ifdef NL_OS_MAC - // if client_default.cfg is not in current directory, and it's not an absolute path, use application default directory - if (!CFile::isExists("client_default.cfg") && !dir.empty() && dir[0]!='/') - { - return getAppBundlePath() + "/Contents/Resources/" + dir; - } -#else - static const std::string token = ""; - std::string::size_type pos = dir.find(token); - if (pos != std::string::npos) - return dir.substr(0, pos) + getAppBundlePath() + dir.substr(pos + token.length()); -#endif - -// preDataPath = getAppBundlePath() + "/Contents/Resources/" + preDataPath; - - return dir; -} - void listStereoDisplayDevices(std::vector &devices) { bool cache = VRDeviceCache.empty(); @@ -588,7 +567,7 @@ void listStereoDisplayDevices(std::vector &devices) std::stringstream name; name << IStereoDisplay::getLibraryName(it->Library) << " - " << it->Manufacturer << " - " << it->ProductName; std::stringstream fullname; - fullname << std::string("[") << name << "] [" << it->Serial << "]"; + fullname << std::string("[") << name.str() << "] [" << it->Serial << "]"; nlinfo("VR [C]: Stereo Display: %s", name.str().c_str()); if (cache) { @@ -677,39 +656,94 @@ void addSearchPaths(IProgressCallback &progress) progress.progress ((float)i/(float)ClientCfg.DataPath.size()); progress.pushCropedValues ((float)i/(float)ClientCfg.DataPath.size(), (float)(i+1)/(float)ClientCfg.DataPath.size()); - CPath::addSearchPath(replaceApplicationDirToken(ClientCfg.DataPath[i]), true, false, &progress); + CPath::addSearchPath(ClientCfg.DataPath[i], true, false, &progress); progress.popCropedValues (); } CPath::loadRemappedFiles("remap_files.csv"); } + for (uint i = 0; i < ClientCfg.DataPathNoRecurse.size(); i++) { progress.progress ((float)i/(float)ClientCfg.DataPathNoRecurse.size()); progress.pushCropedValues ((float)i/(float)ClientCfg.DataPathNoRecurse.size(), (float)(i+1)/(float)ClientCfg.DataPathNoRecurse.size()); - CPath::addSearchPath(replaceApplicationDirToken(ClientCfg.DataPathNoRecurse[i]), false, false, &progress); + CPath::addSearchPath(ClientCfg.DataPathNoRecurse[i], false, false, &progress); progress.popCropedValues (); } -} + std::string defaultDirectory; + +#ifdef NL_OS_MAC + defaultDirectory = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources"); +#elif defined(NL_OS_UNIX) && defined(RYZOM_SHARE_PREFIX) + defaultDirectory = CPath::standardizePath(std::string(RYZOM_SHARE_PREFIX)); +#endif + + // add in last position, a specific possibly read only directory + if (!defaultDirectory.empty()) + { + for (uint i = 0; i < ClientCfg.DataPath.size(); i++) + { + // don't prepend default directory if path is absolute + if (!ClientCfg.DataPath[i].empty() && ClientCfg.DataPath[i][0] != '/') + { + progress.progress ((float)i/(float)ClientCfg.DataPath.size()); + progress.pushCropedValues ((float)i/(float)ClientCfg.DataPath.size(), (float)(i+1)/(float)ClientCfg.DataPath.size()); + + CPath::addSearchPath(defaultDirectory + ClientCfg.DataPath[i], true, false, &progress); + + progress.popCropedValues (); + } + } + } +} void addPreDataPaths(NLMISC::IProgressCallback &progress) { NLMISC::TTime initPaths = ryzomGetLocalTime (); - H_AUTO(InitRZAddSearchPaths) + + H_AUTO(InitRZAddSearchPaths); + for (uint i = 0; i < ClientCfg.PreDataPath.size(); i++) { progress.progress ((float)i/(float)ClientCfg.PreDataPath.size()); progress.pushCropedValues ((float)i/(float)ClientCfg.PreDataPath.size(), (float)(i+1)/(float)ClientCfg.PreDataPath.size()); - CPath::addSearchPath(replaceApplicationDirToken(ClientCfg.PreDataPath[i]), true, false, &progress); + CPath::addSearchPath(ClientCfg.PreDataPath[i], true, false, &progress); progress.popCropedValues (); } + //nlinfo ("PROFILE: %d seconds for Add search paths Predata", (uint32)(ryzomGetLocalTime ()-initPaths)/1000); + + std::string defaultDirectory; + +#ifdef NL_OS_MAC + defaultDirectory = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources"); +#elif defined(NL_OS_UNIX) && defined(RYZOM_SHARE_PREFIX) + defaultDirectory = CPath::standardizePath(std::string(RYZOM_SHARE_PREFIX)); +#endif + + // add in last position, a specific possibly read only directory + if (!defaultDirectory.empty()) + { + for (uint i = 0; i < ClientCfg.PreDataPath.size(); i++) + { + // don't prepend default directory if path is absolute + if (!ClientCfg.PreDataPath[i].empty() && ClientCfg.PreDataPath[i][0] != '/') + { + progress.progress ((float)i/(float)ClientCfg.PreDataPath.size()); + progress.pushCropedValues ((float)i/(float)ClientCfg.PreDataPath.size(), (float)(i+1)/(float)ClientCfg.PreDataPath.size()); + + CPath::addSearchPath(defaultDirectory + ClientCfg.PreDataPath[i], true, false, &progress); + + progress.popCropedValues (); + } + } + } } static void addPackedSheetUpdatePaths(NLMISC::IProgressCallback &progress) @@ -718,7 +752,7 @@ static void addPackedSheetUpdatePaths(NLMISC::IProgressCallback &progress) { progress.progress((float)i/(float)ClientCfg.UpdatePackedSheetPath.size()); progress.pushCropedValues ((float)i/(float)ClientCfg.UpdatePackedSheetPath.size(), (float)(i+1)/(float)ClientCfg.UpdatePackedSheetPath.size()); - CPath::addSearchPath(replaceApplicationDirToken(ClientCfg.UpdatePackedSheetPath[i]), true, false, &progress); + CPath::addSearchPath(ClientCfg.UpdatePackedSheetPath[i], true, false, &progress); progress.popCropedValues(); } } @@ -753,12 +787,12 @@ void prelogInit() #ifdef NL_OS_WINDOWS _control87 (_EM_INVALID|_EM_DENORMAL/*|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM); #endif // NL_OS_WINDOWS - + CTime::CTimerInfo timerInfo; NLMISC::CTime::probeTimerInfo(timerInfo); if (timerInfo.RequiresSingleCore) // TODO: Also have a FV configuration value to force single core. setCPUMask(); - + FPU_CHECKER_ONCE NLMISC::TTime initStart = ryzomGetLocalTime (); @@ -895,7 +929,6 @@ void prelogInit() switch(ClientCfg.Driver3D) { #ifdef NL_OS_WINDOWS - case CClientConfig::Direct3D: driver = UDriver::Direct3d; break; @@ -948,7 +981,7 @@ void prelogInit() Driver->setSwapVBLInterval(1); else Driver->setSwapVBLInterval(0); - + if (StereoDisplay) // VR_CONFIG // VR_DRIVER { // override mode TODO @@ -1076,7 +1109,7 @@ void prelogInit() // Set the monitor color properties CMonitorColorProperties monitorColor; - for ( uint i=0; i<3; i++) + for (uint i=0; i<3; i++) { monitorColor.Contrast[i] = ClientCfg.Contrast; monitorColor.Luminosity[i] = ClientCfg.Luminosity; diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 63d2c93b7..b76bbce21 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -1950,13 +1950,14 @@ public: womanTitle = pChar->getGender() == GSGENDER::female; STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle); - + // Sometimes translation contains another title ucstring::size_type pos = copyInout.find('$'); if (pos != ucstring::npos) { copyInout = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(copyInout), womanTitle); } + CStringPostProcessRemoveTitle::cbIDStringReceived(copyInout); inout = copyInout; } diff --git a/code/ryzom/client/src/interface_v3/action_handler_help.cpp b/code/ryzom/client/src/interface_v3/action_handler_help.cpp index e519bb2d0..ed2b34ce3 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -1117,6 +1117,11 @@ class CHandlerHTMLSubmitForm : public IActionHandler fromString(getParam (sParams, "form"), form); string submit_button = getParam (sParams, "submit_button"); + string type = getParam (sParams, "submit_button_type"); + string value = getParam (sParams, "submit_button_value"); + + sint32 x = pCaller->getEventX(); + sint32 y = pCaller->getEventY(); CInterfaceElement *element = CWidgetManager::getInstance()->getElementFromId(container); { @@ -1125,7 +1130,7 @@ class CHandlerHTMLSubmitForm : public IActionHandler if (groupHtml) { // Submit the form the url - groupHtml->submitForm (form, submit_button.c_str ()); + groupHtml->submitForm (form, type.c_str(), submit_button.c_str(), value.c_str(), x, y); } } } @@ -3613,7 +3618,7 @@ public: uint8 index; fromString(Params, index); --index; // Param is 1-based so subtract 1 - if ( index >= MAX_INVENTORY_ANIMAL) + if (index >= MAX_INVENTORY_ANIMAL) { return; } diff --git a/code/ryzom/client/src/interface_v3/action_handler_item.cpp b/code/ryzom/client/src/interface_v3/action_handler_item.cpp index 24f59cecc..f6dec2d1f 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -815,7 +815,6 @@ public: CurrentStackDst= NULL; validateStackItem(pCSSrc, pCSDst, val, CurrentStackMode); } - }; REGISTER_ACTION_HANDLER( CHandlerStackOk, "stack_item"); @@ -826,17 +825,17 @@ class CPlayerTradePutBagItemToExchange : public IActionHandler public: virtual void execute (CCtrlBase *pCaller, const string &/* Params */) { - CInterfaceManager *im = CInterfaceManager::getInstance(); - CDBCtrlSheet *src = dynamic_cast(pCaller); - CDBCtrlSheet *dest = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); - if (src->getSheetId() == 0) - { - putExchangedItemToInventory(dest); - } - else - { - putInventoryItemToExchange(src, dest); - } + CInterfaceManager *im = CInterfaceManager::getInstance(); + CDBCtrlSheet *src = dynamic_cast(pCaller); + CDBCtrlSheet *dest = dynamic_cast(CWidgetManager::getInstance()->getCtrlLaunchingModal()); + if (src->getSheetId() == 0) + { + putExchangedItemToInventory(dest); + } + else + { + putInventoryItemToExchange(src, dest); + } } }; REGISTER_ACTION_HANDLER(CPlayerTradePutBagItemToExchange, "put_bag_item_to_exchange"); diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp index 688c27635..4e8966e16 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -520,7 +520,7 @@ CCameraBackup setupCameraForScreenshot(UScene &scene, uint left, uint right, uin // Build a viewport CViewport viewport; NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); - viewport.init (0, 0, (float)(right-left)/Driver->getWindowWidth(),(float)(bottom-top)/Driver->getWindowHeight()); + viewport.init (0, 0, (float)(right-left)/Driver->getWindowWidth(), (float)(bottom-top)/Driver->getWindowHeight()); // Activate all this scene.getCam().setFrustum (frustumPart); diff --git a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp index efd19fe45..67f798cb8 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -777,7 +777,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P sint32 dstPhraseId= pCSDst->getSPhraseId(); sint32 dstMacroId= pCSDst->getMacroId(); - if ((src.empty()) && (CHandlerPhraseMemoryCopy::haveLastPhraseElement)) + if (src.empty() && (CHandlerPhraseMemoryCopy::haveLastPhraseElement)) { // get the slot ids from save srcIsMacro= CHandlerPhraseMemoryCopy::isMacro; @@ -1600,7 +1600,6 @@ public: } } }; - REGISTER_ACTION_HANDLER(CHandlerPhraseSelectMemory2, "phrase_select_memory_2"); // *************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp index bb16353f5..caa90cdda 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_mission.cpp @@ -53,7 +53,6 @@ void CBotChatPageMission::init() NLGUI::CDBManager::getInstance()->addBranchObserver("SERVER:CHOOSE_MISSIONS", &_MissionPagesObs); } - // *************************************************************************************** void CBotChatPageMission::begin() { diff --git a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 17aaead48..966a3886a 100644 --- a/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/code/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -1808,7 +1808,6 @@ void CBotChatPageTrade::giveFocusToMaxEBChangeBuyFilterDialog() setFocusOnEditBox(ig->getGroup("edit_max:eb")); } - // *************************************************************************** void CBotChatPageTrade::startChangeBuyFilterMPDialog() { @@ -1822,7 +1821,6 @@ void CBotChatPageTrade::startChangeBuyFilterMPDialog() CWidgetManager::getInstance()->enableModalWindow(NULL, ig); } - // *************************************************************************** void CBotChatPageTrade::confirmChangeBuyFilterMPDialog(uint ft) { @@ -1840,7 +1838,6 @@ void CBotChatPageTrade::confirmChangeBuyFilterMPDialog(uint ft) CWidgetManager::getInstance()->disableModalWindow(); } - // *************************************************************************** void CBotChatPageTrade::resetItemPartAndTypeFilters() { diff --git a/code/ryzom/client/src/interface_v3/chat_displayer.h b/code/ryzom/client/src/interface_v3/chat_displayer.h index e84179f94..e2afc7207 100644 --- a/code/ryzom/client/src/interface_v3/chat_displayer.h +++ b/code/ryzom/client/src/interface_v3/chat_displayer.h @@ -30,7 +30,6 @@ #undef LOG_WARNING #endif - /** * class used to display console text commands in the chat window * \author Nicolas Brigand diff --git a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp index faaf86092..83ef7474e 100644 --- a/code/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/code/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -47,7 +47,6 @@ CChatTextManager::~CChatTextManager() _TextShadowed = NULL; delete _ShowTimestamps; _ShowTimestamps = NULL; - } //================================================================================= uint CChatTextManager::getTextFontSize() const @@ -96,6 +95,7 @@ bool CChatTextManager::showTimestamps() const } return _ShowTimestamps->getValueBool(); } + //================================================================================= static CInterfaceGroup *parseCommandTag(ucstring &line) { @@ -186,7 +186,6 @@ CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA msg = cur_time + msg; } - vt->setTextFormatTaged(msg); vt->setColor(NLMISC::CRGBA::White); } diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 1d4c0516b..0bb192fc5 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -483,7 +483,7 @@ void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstrin strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); displayMessage(finalMsg, prop.getRGBA(), CChatGroup::tell, 0, numBlinks); - CInterfaceManager::getInstance()->log(finalMsg); + CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); } void CChatWindow::encodeColorTag(const NLMISC::CRGBA &color, ucstring &text, bool append) @@ -601,7 +601,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC if (pos == ucstring::npos || (colonpos < pos)) { // No timestamp, so put it right after the color and add a space - pos = newmsg.find(ucstring("}"));; + pos = newmsg.find(ucstring("}")); prefix += " "; } diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 6aa1f0e40..68ceb7bf0 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -333,29 +333,29 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr prop = (char*) xmlGetProp( cur, (xmlChar*)"nature" ); if (prop) { - if (NLMISC::strlwr(prop) == "item") + if (NLMISC::strlwr(prop.str()) == "item") _Type = CCtrlSheetInfo::SheetType_Item; - else if (NLMISC::strlwr(prop) == "pact") + else if (NLMISC::strlwr(prop.str()) == "pact") _Type = CCtrlSheetInfo::SheetType_Pact; - else if (NLMISC::strlwr(prop) == "skill") + else if (NLMISC::strlwr(prop.str()) == "skill") _Type = CCtrlSheetInfo::SheetType_Skill; - else if (NLMISC::strlwr(prop) == "auto") + else if (NLMISC::strlwr(prop.str()) == "auto") _Type = CCtrlSheetInfo::SheetType_Auto; - else if (NLMISC::strlwr(prop) == "macro") + else if (NLMISC::strlwr(prop.str()) == "macro") _Type = CCtrlSheetInfo::SheetType_Macro; - else if (NLMISC::strlwr(prop) == "guild_flag") + else if (NLMISC::strlwr(prop.str()) == "guild_flag") _Type = CCtrlSheetInfo::SheetType_GuildFlag; - else if (NLMISC::strlwr(prop) == "mission") + else if (NLMISC::strlwr(prop.str()) == "mission") _Type = CCtrlSheetInfo::SheetType_Mission; - else if (NLMISC::strlwr(prop) == "sbrick") + else if (NLMISC::strlwr(prop.str()) == "sbrick") _Type = CCtrlSheetInfo::SheetType_SBrick; - else if (NLMISC::strlwr(prop) == "sphraseid") + else if (NLMISC::strlwr(prop.str()) == "sphraseid") _Type = CCtrlSheetInfo::SheetType_SPhraseId; - else if (NLMISC::strlwr(prop) == "sphrase") + else if (NLMISC::strlwr(prop.str()) == "sphrase") _Type = CCtrlSheetInfo::SheetType_SPhrase; - else if (NLMISC::strlwr(prop) == "elevator_destination") + else if (NLMISC::strlwr(prop.str()) == "elevator_destination") _Type = CCtrlSheetInfo::SheetType_ElevatorDestination; - else if (NLMISC::strlwr(prop) == "outpost_building") + else if (NLMISC::strlwr(prop.str()) == "outpost_building") _Type = CCtrlSheetInfo::SheetType_OutpostBuilding; } @@ -468,7 +468,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr prop = (char*) xmlGetProp( cur, (xmlChar*)"item_slot" ); if(prop) { - string str= prop; + string str= prop.str(); _ItemSlot= SLOTTYPE::stringToSlotType(NLMISC::toUpper(str)); } @@ -1741,7 +1741,6 @@ void CDBCtrlSheet::resetCharBitmaps() _CharBitmaps.clear(); } - // *************************************************************************** void CDBCtrlSheet::setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar, bool topDown) { diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp index 74bd2be47..2966e65b4 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp @@ -115,7 +115,7 @@ bool CDBGroupListSheet::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) if (prop) { // get a branch in the database. - CCDBNodeBranch *branch= NLGUI::CDBManager::getInstance()->getDbBranch(prop); + CCDBNodeBranch *branch = NLGUI::CDBManager::getInstance()->getDbBranch(prop.str()); if(!branch) { nlinfo ("Branch not found in the database %s", (const char*)prop); diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index 772f99418..2294d3926 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -98,7 +98,7 @@ bool CDBGroupListSheetText::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) if (prop) { // get a branch in the database. - CCDBNodeBranch *branch= NLGUI::CDBManager::getInstance()->getDbBranch(prop); + CCDBNodeBranch *branch = NLGUI::CDBManager::getInstance()->getDbBranch(prop.str()); if(!branch) { nlinfo ("Branch not found in the database %s", (const char*)prop); diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.cpp index fcef370e0..112ec3e9e 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_share.cpp @@ -175,7 +175,6 @@ void CDBGroupListSheetTextShare::CSheetChildShare::init(CDBGroupListSheetText *p pNL = NLGUI::CDBManager::getInstance()->getDbProp(sTmp, false); nlassert(pNL != NULL); CurrentWanted.link ( sTmp.c_str() ); - } diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp index 0028ad964..d4fc5da86 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -728,7 +728,6 @@ void CDBGroupListSheetTrade::sort() } } - bool CDBGroupListSheetTrade::needCheckAllItems() { if (_LastFamePriceFactor != _FamePriceFactorLeaf->getValue16()) diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index 76d97c519..53cddc93b 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -198,7 +198,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) ucstring theTribeName; ucstring entityName = entity->getDisplayName(); ucstring entityTitle = entity->getTitle(); - + // For some NPC's the name is empty and only a title is given, // in that case, treat the title as the name. if (entityName.empty()) @@ -652,7 +652,6 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) if (pPlayer == NULL) needPvPLogo = false; - if (pPlayer != NULL && needPvPLogo) { if (pvpFactionLogo) @@ -756,7 +755,6 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) view = leftGroup->getView ("win_jauge_bot"); if (view) leftGroup->delView (view); - } // Delete remaining strings @@ -771,8 +769,7 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) CViewBase *win_mid = leftGroup->getView ("win_mid"); if (win_mid) { - win_mid->setH (win_mid->getH() - spaceBar/2 ); - + win_mid->setH (win_mid->getH() - spaceBar/2); } // Set player name @@ -963,7 +960,7 @@ void CGroupInSceneUserInfo::updateDynamicData () if (pPlayer != NULL) if (pPlayer->isAFK()) - entityName += CI18N::get("uiAFK"); + entityName += CI18N::get("uiAFK"); _Name->setText(entityName); // Title color get the PVP color diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index 558ab960c..667e900c4 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -556,7 +556,7 @@ bool CGroupMap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) ptr = (char*) xmlGetProp( cur, (xmlChar*)"map_mode" ); if (ptr) { - string sTmp = ptr; + string sTmp = ptr.str(); if (sTmp == "normal") _MapMode = MapMode_Normal; else if (sTmp == "death") @@ -3213,7 +3213,7 @@ class CAHValidateUserLandMarkName : public IActionHandler CGroupEditBox *eb = dynamic_cast(ig->getGroup("eb")); if (!eb) return; ig->setActive(false); - + CGroupContainer *gc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(WIN_LANDMARK_NAME)); if (!gc) return; // Retrieve ComboBox to get the position(ordered landmark type) of the selected item diff --git a/code/ryzom/client/src/interface_v3/group_skills.cpp b/code/ryzom/client/src/interface_v3/group_skills.cpp index e414ab4e4..b5e5c5d34 100644 --- a/code/ryzom/client/src/interface_v3/group_skills.cpp +++ b/code/ryzom/client/src/interface_v3/group_skills.cpp @@ -87,7 +87,7 @@ bool CGroupSkills::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) string sTmp; ICDBNode::CTextId textId; - + for (uint k = 0; k < SKILLS::NUM_SKILLS; ++k) { sTmp = string(DB_SKILLS)+":"+NLMISC::toString((sint32)k)+":BaseSKILL"; diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index 9edf86c56..2e0e4e3e7 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -378,13 +378,13 @@ void CGuildManager::update() // Online status not changed for this member continue; } - + if ( (*it).second.Online != ccs_offline && _GuildMembers[i].Online != ccs_offline) { // Not from offline, or to offline, so don't show anything continue; } - + ucstring msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage; strFindReplace(msg, "%s", _GuildMembers[i].Name); string cat = getStringCategory(msg, msg); @@ -398,7 +398,6 @@ void CGuildManager::update() bool dummy; PeopleInterraction.ChatInput.Guild.displayMessage(msg, col, 2, &dummy); break; - } } diff --git a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp index 0d51a538e..6acc2a17b 100644 --- a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp +++ b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp @@ -162,13 +162,13 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) _Ref3DScene = NULL; if (ptr) { - CInterfaceElement *pIE = CWidgetManager::getInstance()->getElementFromId(this->getId(), ptr); + CInterfaceElement *pIE = CWidgetManager::getInstance()->getElementFromId(this->getId(), ptr.str()); _Ref3DScene = dynamic_cast(pIE); } if (_Ref3DScene != NULL) { ptr = (char*) xmlGetProp( cur, (xmlChar*)"curcam" ); - if (ptr) setCurrentCamera (ptr); + if (ptr) setCurrentCamera (ptr.str()); return true; } @@ -294,7 +294,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) CXMLAutoPtr ptr((const char*)xmlGetProp (cur, (xmlChar*)"name")); string animName; if (ptr) - animName = strlwr (CFile::getFilenameWithoutExtension(ptr)); + animName = strlwr (CFile::getFilenameWithoutExtension(ptr.str())); if (!animName.empty()) { @@ -340,7 +340,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) // Get the current camera ptr = (char*) xmlGetProp( cur, (xmlChar*)"curcam" ); - if (ptr) setCurrentCamera (ptr); + if (ptr) setCurrentCamera(ptr.str()); return true; } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 8186d246b..70be8abe4 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -2684,7 +2684,7 @@ bool CInterfaceManager::deletePlayerKeys (const std::string &playerFileIdent) } // *************************************************************************** -void CInterfaceManager::log(const ucstring &str) +void CInterfaceManager::log(const ucstring &str, const std::string &cat) { if (_LogState) { @@ -2693,7 +2693,7 @@ void CInterfaceManager::log(const ucstring &str) FILE *f = fopen(fileName.c_str(), "at"); if (f != NULL) { - const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " * " + str.toUtf8(); + const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpper(cat) + ") * " + str.toUtf8(); fprintf(f, "%s\n", finalString.c_str()); } fclose(f); @@ -3982,5 +3982,3 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) ucstr = str; return true;; } - - diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index 36bd909e3..d947f4912 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -218,7 +218,7 @@ public: // Log system (all chat/tell void setLogState(bool state) { _LogState = state; } bool getLogState() const { return _LogState; } - void log(const ucstring &str); + void log(const ucstring &str, const std::string &cat = ""); /// Text from here and from server diff --git a/code/ryzom/client/src/interface_v3/interface_observer.h b/code/ryzom/client/src/interface_v3/interface_observer.h index 4261f10a4..6da93637e 100644 --- a/code/ryzom/client/src/interface_v3/interface_observer.h +++ b/code/ryzom/client/src/interface_v3/interface_observer.h @@ -119,7 +119,7 @@ public: char * end = ptr.getDatas() + strlen( ptr.getDatas() ); char * dataTok = strtok( ptr.getDatas()," ,"); NLMISC::ICDBNode::CTextId textId; - + while(dataTok) { std::string data (dataTok); diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp index 5e7d66075..7a56e470e 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/code/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -1981,7 +1981,7 @@ bool SBagOptions::parse(xmlNodePtr cur, CInterfaceGroup * /* parentGroup */) prop = xmlGetProp (cur, (xmlChar*)"inv_type"); if (prop) { - InvType = CInventoryManager::invTypeFromString(prop); + InvType = CInventoryManager::invTypeFromString(prop.str()); } else { @@ -1990,22 +1990,22 @@ bool SBagOptions::parse(xmlNodePtr cur, CInterfaceGroup * /* parentGroup */) } prop = xmlGetProp (cur, (xmlChar*)"filter_armor"); - if (prop) DbFilterArmor = NLGUI::CDBManager::getInstance()->getDbProp(prop); + if (prop) DbFilterArmor = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); prop = xmlGetProp (cur, (xmlChar*)"filter_weapon"); - if (prop) DbFilterWeapon = NLGUI::CDBManager::getInstance()->getDbProp(prop); + if (prop) DbFilterWeapon = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); prop = xmlGetProp (cur, (xmlChar*)"filter_tool"); - if (prop) DbFilterTool = NLGUI::CDBManager::getInstance()->getDbProp(prop); + if (prop) DbFilterTool = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); prop = xmlGetProp (cur, (xmlChar*)"filter_mp"); - if (prop) DbFilterMP = NLGUI::CDBManager::getInstance()->getDbProp(prop); + if (prop) DbFilterMP = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); prop = xmlGetProp (cur, (xmlChar*)"filter_missmp"); - if (prop) DbFilterMissMP = NLGUI::CDBManager::getInstance()->getDbProp(prop); + if (prop) DbFilterMissMP = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); prop = xmlGetProp (cur, (xmlChar*)"filter_tp"); - if (prop) DbFilterTP = NLGUI::CDBManager::getInstance()->getDbProp(prop); + if (prop) DbFilterTP = NLGUI::CDBManager::getInstance()->getDbProp(prop.str()); return true; } diff --git a/code/ryzom/client/src/interface_v3/parser_modules.cpp b/code/ryzom/client/src/interface_v3/parser_modules.cpp index ff1c93645..b540900a4 100644 --- a/code/ryzom/client/src/interface_v3/parser_modules.cpp +++ b/code/ryzom/client/src/interface_v3/parser_modules.cpp @@ -353,7 +353,7 @@ bool CCommandParser::parse( xmlNodePtr cur, NLGUI::CInterfaceGroup *parentGroup if (ptrName) { // Does the action exist ? - std::string name = ptrName; + std::string name = ptrName.str(); if (!ICommand::exists (name) || (CUserCommand::CommandMap.find(name) != CUserCommand::CommandMap.end())) { // Get the action @@ -369,7 +369,7 @@ bool CCommandParser::parse( xmlNodePtr cur, NLGUI::CInterfaceGroup *parentGroup // if prop "ctrlchar" is declared with false, then disable ctrlchar for this command CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"ctrlchar" )); if( (const char*)prop && (CInterfaceElement::convertBool((const char*)prop)==false) ) - ICommand::enableControlCharForCommand(ptrName, false); + ICommand::enableControlCharForCommand(ptrName.str(), false); // Done ret = true; diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 332bcac57..c2eb972dd 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -2193,7 +2193,6 @@ class CHandlerTellContact : public IActionHandler CInterfaceGroup *ig = pCaller->getParent(); if (!ig) return; CGroupContainer *gc = static_cast< CGroupContainer* >( ig->getEnclosingContainer() ); - if (!gc) return; CPeopleList *list; uint peopleIndex; diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index a2ee04808..c2167358f 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -478,7 +478,7 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA())); - CInterfaceManager::getInstance()->log(finalMsg); + CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); // if the group is closed, make it blink if (!gc->isOpen()) @@ -895,7 +895,7 @@ class CHandlerContactEntry : public IActionHandler // it is simpler to keep it as it and to just use this action handler to manage user input. if (!pCaller || !pCaller->getParent()) return; CGroupContainer *gc = static_cast< CGroupContainer* >( pCaller->getParent()->getEnclosingContainer() ); - + // title gives the name of the player ucstring playerName = gc->getUCTitle(); @@ -946,7 +946,7 @@ class CHandlerContactEntry : public IActionHandler ucstring s = CI18N::get("youTellPlayer"); strFindReplace(s, "%name", pWin->getFreeTellerName(str)); strFindReplace(final, CI18N::get("youTell"), s); - CInterfaceManager::getInstance()->log(final); + CInterfaceManager::getInstance()->log(final, CChatGroup::groupTypeToString(CChatGroup::tell)); } } } diff --git a/code/ryzom/client/src/interface_v3/skill_manager.cpp b/code/ryzom/client/src/interface_v3/skill_manager.cpp index e71225cc2..d8656d925 100644 --- a/code/ryzom/client/src/interface_v3/skill_manager.cpp +++ b/code/ryzom/client/src/interface_v3/skill_manager.cpp @@ -159,10 +159,8 @@ void CSkillManager::initInGame() _TrackSkillChange= NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TRACK_SKILL_CHANGE", true); // Add a branch observer on skill value change NLGUI::CDBManager::getInstance()->addBranchObserver( "SERVER:CHARACTER_INFO:SKILLS", &_SkillChangeObs ); - } - // *************************************************************************** void CSkillManager::uninitInGame() { diff --git a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp index 790657e2e..d214d1150 100644 --- a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -474,16 +474,16 @@ void CSPhraseManager::memorizePhrase(uint32 memoryLine, uint32 memorySlot, ui } } -void CSPhraseManager::selectMemoryLineDBalt(sint32 memoryLine) +// *************************************************************************** +void CSPhraseManager::selectMemoryLineDB(sint32 memoryLine) { if(memoryLine<0) memoryLine= -1; - - if(_SelectedMemoryDBalt!=memoryLine) + + if(_SelectedMemoryDB!=memoryLine) { - _SelectedMemoryDBalt= memoryLine; + _SelectedMemoryDB= memoryLine; // since memory selection changes then must update all the DB and the Ctrl states - updateMemoryDBAll(); updateAllMemoryCtrlState(); updateAllMemoryCtrlRegenTickRange(); @@ -492,14 +492,14 @@ void CSPhraseManager::selectMemoryLineDBalt(sint32 memoryLine) } } -// *************************************************************************** -void CSPhraseManager::selectMemoryLineDB(sint32 memoryLine) +void CSPhraseManager::selectMemoryLineDBalt(sint32 memoryLine) { if(memoryLine<0) memoryLine= -1; - if(_SelectedMemoryDB!=memoryLine) + + if(_SelectedMemoryDBalt!=memoryLine) { - _SelectedMemoryDB= memoryLine; + _SelectedMemoryDBalt= memoryLine; // since memory selection changes then must update all the DB and the Ctrl states updateMemoryDBAll(); updateAllMemoryCtrlState(); @@ -573,7 +573,7 @@ void CSPhraseManager::updateMemoryDBSlot(uint32 memorySlot) _MemoryDbLeaves[memorySlot]->setValue32(0); else _MemoryDbLeaves[memorySlot]->setValue32(slot.Id); - + CMemorySlot &slotAlt= _Memories[_SelectedMemoryDBalt].Slot[memorySlot]; if(!slotAlt.isPhrase()) @@ -1126,7 +1126,7 @@ void CSPhraseManager::buildPhraseDesc(ucstring &text, const CSPhraseCom &phrase, uint32 totalActionMalus= 0; CCDBNodeLeaf *actMalus = _TotalMalusEquipLeaf ? &*_TotalMalusEquipLeaf : &*(_TotalMalusEquipLeaf = NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:TOTAL_MALUS_EQUIP", false)); - + // root brick must not be Power or aura, because Action malus don't apply to them // (ie leave 0 ActionMalus for Aura or Powers if(actMalus && !rootBrick->isSpecialPower()) @@ -4519,7 +4519,7 @@ uint32 CSPhraseManager::getTotalActionMalus(const CSPhraseCom &phrase) const if (!rootBrick) nlerror("Invalid root sbrick in sphrase_com '%s'", phrase.Name.toUtf8().c_str()); else if (actMalus && !rootBrick->isSpecialPower()) - totalActionMalus = actMalus->getValue32(); + totalActionMalus = actMalus->getValue32(); } return totalActionMalus; } diff --git a/code/ryzom/client/src/interface_v3/view_radar.cpp b/code/ryzom/client/src/interface_v3/view_radar.cpp index 8c8cd1de8..5ebb7fd64 100644 --- a/code/ryzom/client/src/interface_v3/view_radar.cpp +++ b/code/ryzom/client/src/interface_v3/view_radar.cpp @@ -177,7 +177,7 @@ void CViewRadar::draw () // Select the icon to display and draw it uint spotId = CNPCIconCache::getInstance().getNPCIcon(entity).getSpotId(); CRadarSpotDesc spotDesc = _SpotDescriptions[spotId]; - + if (!_MissionIconsObs._displayMissionSpots) spotDesc = _SpotDescriptions[0]; diff --git a/code/ryzom/client/src/interfaces_manager/interf_script.cpp b/code/ryzom/client/src/interfaces_manager/interf_script.cpp index f083eda18..734b99098 100644 --- a/code/ryzom/client/src/interfaces_manager/interf_script.cpp +++ b/code/ryzom/client/src/interfaces_manager/interf_script.cpp @@ -37,7 +37,11 @@ float getFloat() char delimiter[] = "[] \t"; char *ptr = strtok(NULL, delimiter); if(ptr != NULL) - return (float) atof(ptr); + { + float val; + NLMISC::fromString(ptr, val); + return val; + } return 0.f; }// getFloat // @@ -94,7 +98,7 @@ std::vector getVectorOfFloat(uint8 nbCol) ptr = strtok(NULL, delimiter); if(ptr != NULL) { - val = (float)atof(ptr); + NLMISC::fromString(ptr, val); if (val != 0.0f) vect.push_back(val); } diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index da94f37d6..3cc14e6d2 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -26,6 +26,10 @@ #include #endif +#ifdef NL_OS_MAC + #include "app_bundle_utils.h" +#endif + #include #include @@ -207,9 +211,18 @@ CPatchManager::CPatchManager() : State("t_state"), DataScanState("t_data_scan_st // **************************************************************************** void CPatchManager::setClientRootPath(const std::string& clientRootPath) { - ClientRootPath = clientRootPath; - ClientPatchPath = ClientRootPath + "unpack/"; - ClientDataPath = ClientRootPath + "data/"; + ClientRootPath = CPath::standardizePath(clientRootPath); + ClientPatchPath = CPath::standardizePath(ClientRootPath + "unpack"); + + WritableClientDataPath = CPath::standardizePath(ClientRootPath + "data"); + +#ifdef NL_OS_MAC + ReadableClientDataPath = CPath::standardizePath(getAppBundlePath() + "/Contents/Resources/data"); +#elif defined(NL_OS_UNIX) && defined(RYZOM_SHARE_PREFIX) + ReadableClientDataPath = CPath::standardizePath(std::string(RYZOM_SHARE_PREFIX) + "/data"); +#else + ReadableClientDataPath = WritableClientDataPath; +#endif } // **************************************************************************** @@ -253,7 +266,7 @@ void CPatchManager::init(const std::vector& patchURIs, const std::s DisplayedServerPath = ServerPath; NLMISC::CFile::createDirectory(ClientPatchPath); - NLMISC::CFile::createDirectory(ClientDataPath); + NLMISC::CFile::createDirectory(WritableClientDataPath); // try to read the version file from the server (that will replace the version number) @@ -787,7 +800,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool if (!result) { -//:TODO: handle exception? + // TODO: handle exception? string err = toString("Error unpacking %s", rFilename.c_str()); if (useBatchFile) @@ -913,7 +926,6 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool throw NLMISC::EWriteError(UpdateBatchFilename.c_str()); } } - } // **************************************************************************** @@ -1616,9 +1628,25 @@ void CPatchManager::getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn, // Only look in data path if the file should not be unpack (otherwise it should only remains in the "unpack" directory) if (!needUnpack) { - if (sFilePath.empty() && NLMISC::CFile::fileExists(ClientDataPath + rFilename)) sFilePath = ClientDataPath + rFilename; + if (sFilePath.empty()) + { + if (NLMISC::CFile::fileExists(WritableClientDataPath + rFilename)) + { + // if file exists in writable directory, use it + sFilePath = WritableClientDataPath + rFilename; + } + else if (NLMISC::CFile::fileExists(ReadableClientDataPath + rFilename)) + { + // if file exists in readable directory, use it + sFilePath = ReadableClientDataPath + rFilename; + } + } + } + + if (sFilePath.empty() && NLMISC::CFile::fileExists(ClientPatchPath + rFilename)) + { + sFilePath = ClientPatchPath + rFilename; } - if (sFilePath.empty() && NLMISC::CFile::fileExists(ClientPatchPath + rFilename)) sFilePath = ClientPatchPath + rFilename; // following lines removed by Sadge to ensure that the correct file is patched // string sFilePath = CPath::lookup(rFilename, false, false); @@ -2039,7 +2067,8 @@ uint CPatchManager::applyScanDataResult() if(ScanDataThread) return 0; - uint numError= 0; + uint numError= 0; + { TSyncDataScanState::CAccessor ac(&DataScanState); CDataScanState &val= ac.value(); @@ -2057,7 +2086,8 @@ uint CPatchManager::applyScanDataResult() // get file path // following lines added by Sadge to ensure that the correct file gets patched string sFilePath; - if (NLMISC::CFile::fileExists(ClientDataPath + ftp.FileName)) sFilePath = ClientDataPath + ftp.FileName; + if (NLMISC::CFile::fileExists(WritableClientDataPath + ftp.FileName)) sFilePath = WritableClientDataPath + ftp.FileName; + if (sFilePath.empty() && NLMISC::CFile::fileExists(ReadableClientDataPath + ftp.FileName)) sFilePath = ReadableClientDataPath + ftp.FileName; if (sFilePath.empty() && NLMISC::CFile::fileExists(ClientPatchPath + ftp.FileName)) sFilePath = ClientPatchPath + ftp.FileName; // following lines removed by Sadge to ensure that the correct file gets patched @@ -2768,15 +2798,31 @@ public: void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) { CPatchManager *pPM = CPatchManager::getInstance(); - // Source File Name + + // Source File Name (in writable or readable directory) string SourceName; + + // Destination File Name (in writable directory) + string DestinationName; + if (rFTP.ExtractPath.empty()) { + DestinationName = pPM->WritableClientDataPath + rFTP.FileName; + if (rFTP.LocalFileExists) { // following lines added by Sadge to ensure that the correct file gets patched SourceName.clear(); - if (NLMISC::CFile::fileExists(pPM->ClientDataPath + rFTP.FileName)) SourceName = pPM->ClientDataPath + rFTP.FileName; + + if (NLMISC::CFile::fileExists(pPM->WritableClientDataPath + rFTP.FileName)) + { + SourceName = pPM->WritableClientDataPath + rFTP.FileName; + } + else if (NLMISC::CFile::fileExists(pPM->ReadableClientDataPath + rFTP.FileName)) + { + SourceName = pPM->ReadableClientDataPath + rFTP.FileName; + } + // version from previous download if (SourceName.empty()) throw Exception (std::string("ERROR: Failed to find file: ")+rFTP.FileName); @@ -2788,12 +2834,13 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) // note : if file was background downloaded, we have : // rFTP.LocalFileExists = false // rFTP.SrcFileName = "unpack/filename.bnp.tmp" - SourceName = pPM->ClientDataPath + rFTP.FileName; + SourceName = DestinationName; } } else { SourceName = pPM->ClientPatchPath + rFTP.FileName; + DestinationName = SourceName; } if (rFTP.LocalFileToDelete) @@ -2838,7 +2885,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) for (uint i=0; ideleteFile(SourceName, false, false); // File can exists if bad BNP loading if (_CommitPatch) { - pPM->renameFile(OutFilename+".tmp", SourceName); + pPM->renameFile(OutFilename+".tmp", DestinationName); } } } - if (usePatchFile && !rFTP.Patches.empty()) + if (usePatchFile) { uint32 currentPatchedSize = 0; for (uint32 j = 0; j < rFTP.Patches.size(); ++j) @@ -2987,21 +3034,14 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) SourceNameXD = SourceNameXD.substr(0, SourceNameXD.rfind('.')); SourceNameXD += "_.ref"; - std::string refPath; - if (_CommitPatch) - { - refPath = pPM->ClientDataPath; - } - else + if (!_CommitPatch) { // works - refPath = pPM->ClientPatchPath; std::string tmpRefFile = SourceNameXD + ".tmp"; if (!NLMISC::CFile::fileExists(pPM->ClientPatchPath + tmpRefFile)) { // Not found in the patch directory -> version in data directory should be good, or would have been // detected by the check thread else. - refPath = pPM->ClientDataPath; } else { @@ -3018,7 +3058,14 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) // if (SourceNameXDFull.empty()) // SourceNameXDFull = pPM->ClientDataPath + SourceNameXD; // SourceNameXD = SourceNameXDFull; - SourceNameXD = pPM->ClientDataPath + SourceNameXD; + if (CFile::fileExists(pPM->WritableClientDataPath + SourceNameXD)) + { + SourceNameXD = pPM->WritableClientDataPath + SourceNameXD; + } + else if (CFile::fileExists(pPM->ReadableClientDataPath + SourceNameXD)) + { + SourceNameXD = pPM->ReadableClientDataPath + SourceNameXD; + } } PatchName = pPM->ClientPatchPath + PatchName; @@ -3042,7 +3089,8 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) PatchSizeProgress += rFTP.PatcheSizes[j]; currentPatchedSize += rFTP.PatcheSizes[j]; } - if (tmpSourceName != SourceName) + + if (tmpSourceName != DestinationName) { pPM->deleteFile(SourceName, false, false); // File can exists if bad BNP loading if (!_CommitPatch) @@ -3052,7 +3100,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) } else { - pPM->renameFile(tmpSourceName, SourceName); + pPM->renameFile(tmpSourceName, DestinationName); } } } @@ -3060,9 +3108,10 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) { PatchSizeProgress += totalPatchSize; } + // If all patches applied with success so file size should be ok // We just have to change file date to match the last patch applied - pPM->applyDate(SourceName, rFTP.LastFileDate); + pPM->applyDate(DestinationName, rFTP.LastFileDate); //progress.progress(1.f); } diff --git a/code/ryzom/client/src/login_patch.h b/code/ryzom/client/src/login_patch.h index 565de7da2..509a74f9a 100644 --- a/code/ryzom/client/src/login_patch.h +++ b/code/ryzom/client/src/login_patch.h @@ -447,8 +447,9 @@ private: std::string UpdateBatchFilename; // Where the client get all delta and desc file - std::string ClientPatchPath; - std::string ClientDataPath; + std::string ClientPatchPath; // Temporary path + std::string ReadableClientDataPath; // Where original data can be found + std::string WritableClientDataPath; // Where data can be written /// Output useful information for debugging in the log file bool VerboseLog; diff --git a/code/ryzom/client/src/main_loop_debug.cpp b/code/ryzom/client/src/main_loop_debug.cpp index 19ea38414..992325c54 100644 --- a/code/ryzom/client/src/main_loop_debug.cpp +++ b/code/ryzom/client/src/main_loop_debug.cpp @@ -371,6 +371,9 @@ void displayDebug() // Current GameCycle TextContext->printfAt(1.f, line, "Ms per Cycle : %d", NetMngr.getMsPerTick()); line += lineStep; + // Smoothed Client Date + TextContext->printfAt(1.f, line, "Smoothed Client Date : %u %f", SmoothedClientDate.Day, SmoothedClientDate.Hour); + line += lineStep; // Packet Loss TextContext->printfAt(1.f, line, "Packet Loss : %.1f %%", NetMngr.getMeanPacketLoss()*100.0f); line += lineStep; diff --git a/code/ryzom/client/src/misc.h b/code/ryzom/client/src/misc.h index d74010c03..463f02b66 100644 --- a/code/ryzom/client/src/misc.h +++ b/code/ryzom/client/src/misc.h @@ -225,6 +225,7 @@ uint getCurrentColorDepth(); // get maximized bool isWindowMaximized(); +// get all supported video modes sint getRyzomModes(std::vector &videoModes, std::vector &stringModeList); #endif // CL_MISC_H diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 0d369fe85..ecadce14e 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -879,7 +879,28 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c } // Log - pIM->log (finalString); + + string channel; + if (mode == CChatGroup::dyn_chat) + { + sint32 dbIndex = ChatMngr.getDynamicChannelDbIndexFromId(dynChatId); + clamp(dbIndex, (sint32)0 , (sint32)CChatGroup::MaxDynChanPerPlayer); + + channel = "dyn" + toString(dbIndex); + } + else + { + channel = CChatGroup::groupTypeToString(mode); + if (channel.empty()) + { + channel = "#" + toString((uint32)mode); + } + } + if (!stringCategory.empty() && NLMISC::toUpper(stringCategory) != "SYS") + { + channel = channel + "/" + stringCategory; + } + pIM->log (finalString, channel); } @@ -911,7 +932,7 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u colorizeSender(finalString, senderPart, prop.getRGBA()); PeopleInterraction.ChatInput.Tell.displayTellMessage(/*senderIndex, */finalString, goodSenderName, prop.getRGBA(), 2, &windowVisible); - CInterfaceManager::getInstance()->log(finalString); + CInterfaceManager::getInstance()->log(finalString, CChatGroup::groupTypeToString(CChatGroup::tell)); // Open the free teller window CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow(); diff --git a/code/ryzom/client/src/network_connection.h b/code/ryzom/client/src/network_connection.h index 3eb5cd95b..da47f925e 100644 --- a/code/ryzom/client/src/network_connection.h +++ b/code/ryzom/client/src/network_connection.h @@ -776,16 +776,10 @@ protected: /// @name NLMISC::CEntityId handling (for gamedev) //@{ - class CHash + struct CHash { - public: - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; - - CHash() {} - + enum { bucket_size = 4, min_buckets = 8, }; size_t operator () (const CLFECOMMON::TSheetId &id) const { return id; } - inline bool operator() (const CLFECOMMON::TSheetId &id1, const CLFECOMMON::TSheetId &id2) const { return (size_t)id1 < (size_t)id2; } }; diff --git a/code/ryzom/client/src/player_cl.cpp b/code/ryzom/client/src/player_cl.cpp index 4166dbec8..a050ac197 100644 --- a/code/ryzom/client/src/player_cl.cpp +++ b/code/ryzom/client/src/player_cl.cpp @@ -673,7 +673,7 @@ void CPlayerCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle * } // update title when gender changed - const ucstring replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw,_Gender == GSGENDER::female)); + const ucstring replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw, _Gender == GSGENDER::female)); if (!replacement.empty() || !ClientCfg.DebugStringManager) { // Get extended name diff --git a/code/ryzom/client/src/r2/dmc/client_edition_module.cpp b/code/ryzom/client/src/r2/dmc/client_edition_module.cpp index 93978800d..5d00cdc2b 100644 --- a/code/ryzom/client/src/r2/dmc/client_edition_module.cpp +++ b/code/ryzom/client/src/r2/dmc/client_edition_module.cpp @@ -1352,8 +1352,8 @@ bool CClientEditionModule::loadUserComponent(const std::string& filename, bool m } } - std::string sourceExtension = UserComponentsSourceExtension; - std::string componentExtension = UserComponentsComponentExtension; + std::string sourceExtension = UserComponentsSourceExtension.get(); + std::string componentExtension = UserComponentsComponentExtension.get(); uint32 uncompressedFileLength = 0; diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index 2bceb4200..aa5995b05 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -5293,10 +5293,8 @@ void CEditor::onTestModeDisconnected(TSessionId sessionId, uint32 lastAct, TSce //H_AUTO(R2_CEditor_onTestModeDisconnected) CHECK_EDITOR _DMC->CDynamicMapClient::onTestModeDisconnected(sessionId, lastAct, sessionType); - } - // ********************************************************************************************************* void CEditor::nodeInserted(const std::string& instanceId, const std::string& attrName, sint32 position, const std::string& key, CObject* value) { @@ -6611,7 +6609,7 @@ NLMISC::CVectorD getVectorD(const CObject *obj) CObject *buildVector(const NLMISC::CVectorD &vector, const std::string &instanceId /*= ""*/) { CObject *table; - if (instanceId.empty() ) + if (instanceId.empty()) { table = getEditor().getDMC().newComponent("Position"); table->set("x", vector.x); diff --git a/code/ryzom/client/src/scene_parser.cpp b/code/ryzom/client/src/scene_parser.cpp index 1108f3a19..484c00129 100644 --- a/code/ryzom/client/src/scene_parser.cpp +++ b/code/ryzom/client/src/scene_parser.cpp @@ -123,7 +123,7 @@ void CSceneParser::load(const string &filename) char *ptr = strtok(tmpBuff, delimiter); if(ptr != NULL) - _FrameRate = atof(ptr); + NLMISC::fromString(ptr, _FrameRate); } // Close the speed file. @@ -1693,7 +1693,7 @@ void CSceneParser::loadScene(const string &filename) ptr = strtok(NULL, delimiter); if(ptr != NULL) { - seq.second = atof(ptr); + NLMISC::fromString(ptr, seq.second); _Scene.push_back(seq); } } diff --git a/code/ryzom/client/src/sky.cpp b/code/ryzom/client/src/sky.cpp index d5a9216ce..855ab3387 100644 --- a/code/ryzom/client/src/sky.cpp +++ b/code/ryzom/client/src/sky.cpp @@ -235,7 +235,7 @@ uint CSky::setup(const CClientDate &date, const CClientDate &animationDate, floa // animate objects if (_PlayListManager) { - double globalDate = ((double) _NumHourInDay * date.Day + (double) date.Hour) / _NumHourInDay; + double globalDate = (double)date.Hour / (double)_NumHourInDay; //nlinfo("global date = %f", (float) globalDate); _PlayListManager->animate(_AnimLengthInSeconds * globalDate); } diff --git a/code/ryzom/client/src/sound_manager.cpp b/code/ryzom/client/src/sound_manager.cpp index f87c6cdee..4a981366d 100644 --- a/code/ryzom/client/src/sound_manager.cpp +++ b/code/ryzom/client/src/sound_manager.cpp @@ -106,11 +106,11 @@ enum TFilterMapping // constructor //----------------------------------------------- CSoundManager::CSoundManager(IProgressCallback * /* progressCallBack */) -: _AudioMixer(NULL), +: _AudioMixer(NULL), _GroupControllerEffects(NULL), - _GroupControllerEffectsGame(NULL), - _EnvSoundRoot(NULL), - _Sources(NULL), + _GroupControllerEffectsGame(NULL), + _EnvSoundRoot(NULL), + _Sources(NULL), _UserEntitySoundLevel(1.0f) { _EnableBackgroundMusicAtTime= 0; diff --git a/code/ryzom/client/src/time_client.h b/code/ryzom/client/src/time_client.h index 9243a908d..b3327ee76 100644 --- a/code/ryzom/client/src/time_client.h +++ b/code/ryzom/client/src/time_client.h @@ -48,7 +48,7 @@ extern sint64 DT64; // Diff time with current and last frame in ms. extern float DT; // Diff time with current and last frame in sec. extern TTime TSend; // Next Time to send motions. extern TTime DTSend; // Delta of time to generate the next time to send motions. - extern double TimeInSec; // Time for the current frame in second. +extern double TimeInSec; // Time for the current frame in second. extern double FirstTimeInSec; // Game local origin time diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index bb632cf4e..62d45f330 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -518,7 +518,7 @@ void CUserEntity::updateVisualPropertyName(const NLMISC::TGameCycle &gameCycle, html->browse("home"); } } -*/ +*/ }// updateVisualPropertyName // //----------------------------------------------- diff --git a/code/ryzom/common/data_common/r2/r2_misc.lua b/code/ryzom/common/data_common/r2/r2_misc.lua index 827e91579..d85744bd0 100644 --- a/code/ryzom/common/data_common/r2/r2_misc.lua +++ b/code/ryzom/common/data_common/r2/r2_misc.lua @@ -187,7 +187,7 @@ end function strify(str) return [["]] .. tostring(str) .. [["]] end - + ------------------------------------------------------------------------------------------------- -- enclose a string by double quotes function strifyXml(str) diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml index de424f76f..d9aae794a 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml +++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml @@ -1112,7 +1112,7 @@ - + @@ -1126,7 +1126,7 @@ - + @@ -5023,13 +5023,13 @@ - + - + - + diff --git a/code/ryzom/common/src/game_share/_backup_service_interface_non_module.cpp b/code/ryzom/common/src/game_share/_backup_service_interface_non_module.cpp index 2e1d474b2..801d78433 100644 --- a/code/ryzom/common/src/game_share/_backup_service_interface_non_module.cpp +++ b/code/ryzom/common/src/game_share/_backup_service_interface_non_module.cpp @@ -381,7 +381,7 @@ void CBSIINonModule::activate() // setup the callback array CUnifiedNetwork::getInstance()->addCallbackArray( CbArray, sizeof(CbArray)/sizeof(CbArray[0]) ); - string host = BackupServiceIP; + string host = BackupServiceIP.get(); if(host.empty()) { nlwarning("Can't use backup because BSHost variable is empty"); diff --git a/code/ryzom/common/src/game_share/base_types.h b/code/ryzom/common/src/game_share/base_types.h index 250e5f5e4..5330537b7 100644 --- a/code/ryzom/common/src/game_share/base_types.h +++ b/code/ryzom/common/src/game_share/base_types.h @@ -238,8 +238,7 @@ public: CHashCode() {} - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; size_t operator () ( const TDataSetRow &index ) const { return index.getHashCode(); } diff --git a/code/ryzom/common/src/game_share/crypt.cpp b/code/ryzom/common/src/game_share/crypt.cpp index 9a46281f7..1750d5d20 100644 --- a/code/ryzom/common/src/game_share/crypt.cpp +++ b/code/ryzom/common/src/game_share/crypt.cpp @@ -520,7 +520,7 @@ char * rz_crypt(register const char *key, register const char *setting, char *bu return buff; #endif - if (setting[0] == '$' && setting[1] == '6') { + if (strlen(setting) >= 2 && setting[0] == '$' && setting[1] == '6') { return __crypt_sha512(key, setting, buf); } diff --git a/code/ryzom/common/src/game_share/deployment_configuration.cpp b/code/ryzom/common/src/game_share/deployment_configuration.cpp index 52fc9087c..8957c89ac 100644 --- a/code/ryzom/common/src/game_share/deployment_configuration.cpp +++ b/code/ryzom/common/src/game_share/deployment_configuration.cpp @@ -313,13 +313,13 @@ namespace DEPCFG void CInfoBlock::addUseEntry(const NLMISC::CSString& entry,const NLMISC::CSString& context,uint32& errors) { - DROP_IF(_UseEntries.find(entry)!=_UseEntries.end(),context+"Ignoring duplicate refference to 'use' clause: "+entry,return); + DROP_IF(_UseEntries.find(entry) != _UseEntries.end(), context + "Ignoring duplicate refference to 'use' clause: " + entry.c_str(), return); _UseEntries.insert(entry); } void CInfoBlock::addDataEntry(const NLMISC::CSString& entry,const NLMISC::CSString& context,uint32& errors) { - DROP_IF(_DataEntries.find(entry)!=_DataEntries.end(),context+"Ignoring duplicate refference to 'data' clause: "+entry,return); + DROP_IF(_DataEntries.find(entry) != _DataEntries.end(), context + "Ignoring duplicate refference to 'data' clause: " + entry.c_str(), return); _DataEntries.insert(entry); } @@ -406,10 +406,10 @@ namespace DEPCFG // try to get a pointer to the refferenced info block... CInfoBlock* infoBlockPtr= container->getInfoBlock(theEntry); - DROP_IF(infoBlockPtr==NULL,"Failed to find block named '"+theEntry+"' while fixing up children of block: "+_Name, ++errors;continue); + DROP_IF(infoBlockPtr == NULL, "Failed to find block named '" + theEntry + "' while fixing up children of block: " + _Name.c_str(), ++errors; continue); // make sure that this block doesn't figure amongst the children of the refferenced info block (to avoid circular refs) - DROP_IF(_haveCircularRef(infoBlockPtr),"Circular dependency found between definitions of '"+_Name+"' and '"+theEntry+"'", ++errors;continue); + DROP_IF(_haveCircularRef(infoBlockPtr), "Circular dependency found between definitions of '" + _Name + "' and '" + theEntry.c_str() + "'", ++errors; continue); // add the info block to our children _Children.push_back(infoBlockPtr); @@ -431,7 +431,7 @@ namespace DEPCFG DROP_IF(!_ShardName.empty() && !theExe.ShardName.empty(), "more than one shard found in: "+theExe.FullName, ++errors ); DROP_IF(!_CmdLine.empty() && !theExe.CmdLine.empty(), "more than one cmdLine found in: "+theExe.FullName, ++errors ); DROP_IF(!_Host.empty() && !theExe.Host.empty(), "more than one host found in: "+theExe.FullName, ++errors ); - WARN_IF(!_UniqueName.empty() && !theExe.UniqueName.empty(), "replacing name '"+theExe.UniqueName+"' with '"+_UniqueName+"' in: "+theExe.FullName); + WARN_IF(!_UniqueName.empty() && !theExe.UniqueName.empty(), "replacing name '" + theExe.UniqueName + "' with '" + _UniqueName.c_str() + "' in: " + theExe.FullName.c_str()); // fill our own data into the exe record if (!_DomainName.empty()) theExe.DomainName = _DomainName; @@ -645,22 +645,22 @@ namespace DEPCFG // try to treat the keyword if (keyword=="include") { - DROP_IF(args.empty(),context+"No file name found following 'include': "+line, ++errors;continue); - DROP_IF(fileNameSet.find(args)!=fileNameSet.end(),context+"Warning: Duplicate 'include' block ignored: "+line, continue); + DROP_IF(args.empty(), context + "No file name found following 'include': " + line.c_str(), ++errors; continue); + DROP_IF(fileNameSet.find(args) != fileNameSet.end(), context + "Warning: Duplicate 'include' block ignored: " + line.c_str(), continue); fileNameSet.insert(args); _readFile(args.unquoteIfQuoted(),errors,fileNameSet); } else if (keyword=="define") { - DROP_IF(args.empty(),context+"No block name found following 'define': "+line, ++errors;continue); - DROP_IF(_InfoBlocks.find(args)!=_InfoBlocks.end(),context+"Duplicate 'define' block found: "+line, ++errors;continue); + DROP_IF(args.empty(), context + "No block name found following 'define': " + line.c_str(), ++errors; continue); + DROP_IF(_InfoBlocks.find(args) != _InfoBlocks.end(), context + "Duplicate 'define' block found: " + line.c_str(), ++errors; continue); // create a new info block and push it into our infoblock set _CurrentInfoBlock= new CInfoBlock(args); _InfoBlocks[args]= _CurrentInfoBlock; } else { - DROP_IF(_CurrentInfoBlock==NULL,context+"Expecting 'define ' but found: "+line, ++errors;continue); + DROP_IF(_CurrentInfoBlock == NULL, context + "Expecting 'define ' but found: " + line.c_str(), ++errors; continue); if (keyword=="domain") { _CurrentInfoBlock->setDomainName(args,context,errors); } else if (keyword=="shard") { _CurrentInfoBlock->setShardName(args,context,errors); } @@ -674,7 +674,7 @@ namespace DEPCFG else if (keyword=="cfgAfter") { _CurrentInfoBlock->addCfgEntryPost(rawArgs,context,errors); } else if (keyword=="cfgFile") { _CurrentInfoBlock->addCfgFile(args,context,errors); } else if (keyword=="cfgFileAfter") { _CurrentInfoBlock->addCfgFilePost(args,context,errors); } - else { DROP(context+"Unrecognised keyword: "+line, ++errors;continue); } + else { DROP(context + "Unrecognised keyword: " + line.c_str(), ++errors; continue); } } } } @@ -725,7 +725,7 @@ namespace DEPCFG // yell if the name already looks like a 'fixed up' name DROP_IF(name.right(3).left(1)=="_" && (name.right(2)=="00" || name.right(2).atoui()!=0),"Appending '_' to name ending in '_00' style format as this can clash with auto renumbering => "+name+'_',name+='_') // compose a second version of the name with the shard name added - NLMISC::CSString name_with_shard= name+'_'+it2->ShardName; + NLMISC::CSString name_with_shard = name + '_' + it2->ShardName.c_str(); // insert both versions of the name into the unique name counter ++nameCounts[name]; ++nameCounts[name_with_shard]; @@ -1123,7 +1123,7 @@ namespace DEPCFG result.CfgFile= "// Auto generated config file\n" "// Use with commandline: "+theApp.CmdLine+"\n" - "AESAliasName= \""+appName+"\";\n" + "AESAliasName= \"" + appName.c_str() + "\";\n" "\n"; // copy the cfg set to the result record (the cfgAfter set should have been merged in already) diff --git a/code/ryzom/common/src/game_share/fame.cpp b/code/ryzom/common/src/game_share/fame.cpp index b453bca4e..ca226ecdc 100644 --- a/code/ryzom/common/src/game_share/fame.cpp +++ b/code/ryzom/common/src/game_share/fame.cpp @@ -479,10 +479,9 @@ void CStaticFames::loadStaticFame( const string& filename ) else NLMISC::fromString(s.substr(sep+1, s.size()-sep-1), factor); // Fames in file are in [-600;600] so don't forget 1000 factor - sint32 fame; float fameFloat; NLMISC::fromString(s.substr(0, sep), fameFloat); - fame = (sint32)(fameFloat * 1000.f); + sint32 fame = (sint32)(fameFloat * 1000.f); _FameTable[iFaction*_FameTableSize + jFaction] = fame; _PropagationFactorTable[iFaction*_FameTableSize + jFaction] = factor; diff --git a/code/ryzom/common/src/game_share/persistent_data_inline.h b/code/ryzom/common/src/game_share/persistent_data_inline.h index 72ef3fc9d..a2d575eef 100644 --- a/code/ryzom/common/src/game_share/persistent_data_inline.h +++ b/code/ryzom/common/src/game_share/persistent_data_inline.h @@ -706,7 +706,12 @@ inline float CPersistentDataRecord::CArg::asFloat() const case UINT64: return (float)(uint64)_Value.i64; case FLOAT32: return (float)_Value.f32; case FLOAT64: return (float)_Value.f64; - case STRING: return (float)atof(_String.c_str()); + case STRING: + { + float val; + NLMISC::fromString(_String, val); + return val; + } case FLAG: return 1.0f; case EXTEND_TYPE: switch(_Value.ExType) @@ -733,7 +738,12 @@ inline double CPersistentDataRecord::CArg::asDouble() const case UINT64: return (double)(uint64)_Value.i64; case FLOAT32: return (double)_Value.f32; case FLOAT64: return (double)_Value.f64; - case STRING: return (double)atof(_String.c_str()); + case STRING: + { + double val; + NLMISC::fromString(_String, val); + return val; + } case FLAG: return 1.0; case EXTEND_TYPE: switch(_Value.ExType) diff --git a/code/ryzom/common/src/game_share/persistent_data_tree.cpp b/code/ryzom/common/src/game_share/persistent_data_tree.cpp index 63252a70c..feefbad1c 100644 --- a/code/ryzom/common/src/game_share/persistent_data_tree.cpp +++ b/code/ryzom/common/src/game_share/persistent_data_tree.cpp @@ -139,10 +139,10 @@ bool CPersistentDataTreeNode::attachToParent(CPersistentDataTreeNode* parent) bool CPersistentDataTreeNode::attachToParent(CPersistentDataTreeNode* parent,uint32 idx) { // check value of 'idx' - BOMB_IF(parent!=NULL && idx>1024*1024,"Implausibly high number of children requested ("+NLMISC::toString("%d",idx)+") for persistent data tree node: "+parent->getNodeName(),return false); + BOMB_IF(parent != NULL && idx>1024 * 1024, "Implausibly high number of children requested (" + NLMISC::toString("%d", idx) + ") for persistent data tree node: " + parent->getNodeName().c_str(), return false); // check for attachment to previous parent - BOMB_IF(_Parent!=NULL,"Attempting to attach a persistent data node to parent '"+(parent==NULL?"NULL":parent->getNodeName())+"' when it's already attached to another parent as: "+getNodeName(),return false); + BOMB_IF(_Parent != NULL, "Attempting to attach a persistent data node to parent '" + (parent == NULL ? "NULL" : parent->getNodeName()) + "' when it's already attached to another parent as: " + getNodeName().c_str(), return false); // split the name into its component parts CSString mapIndex= _Name; @@ -159,7 +159,7 @@ bool CPersistentDataTreeNode::attachToParent(CPersistentDataTreeNode* parent,uin if (parent!=NULL) { // check parent isn't a value - BOMB_IF(parent->_IsValue,"Attempting to attach a persistent data node to parent that has a value '"+parent->getNodeName()+"' = "+parent->_Value,return false); + BOMB_IF(parent->_IsValue, "Attempting to attach a persistent data node to parent that has a value '" + parent->getNodeName() + "' = " + parent->_Value.c_str(), return false); if (hasExplicitIndex) { @@ -179,7 +179,7 @@ bool CPersistentDataTreeNode::attachToParent(CPersistentDataTreeNode* parent,uin } // ensure that there isn't already a node with the same '#' value attached to the same parent - DROP_IF(parent->_ChildIndex.find(nameBase+'#'+mapIndex)!=parent->_ChildIndex.end(),"Failed to add child '"+_Name+"' to parent '"+parent->getNodeName()+"' because another child of same name already exists",return false); + DROP_IF(parent->_ChildIndex.find(nameBase + '#' + mapIndex.c_str()) != parent->_ChildIndex.end(), "Failed to add child '" + _Name + "' to parent '" + parent->getNodeName().c_str() + "' because another child of same name already exists", return false); } } if (!hasExplicitIndex) @@ -190,7 +190,7 @@ bool CPersistentDataTreeNode::attachToParent(CPersistentDataTreeNode* parent,uin } // construct our cleaned up name from its constituent parts - _Name= nameBase+'#'+mapIndex; + _Name = nameBase + '#' + mapIndex.c_str(); // setup own _Parent property and ensure that there are no trailing spaces round the _Name _Parent= parent; @@ -205,7 +205,7 @@ bool CPersistentDataTreeNode::attachToParent(CPersistentDataTreeNode* parent,uin } // ensure that there isn't another child already assigned to this parent slot - BOMB_IF(_Parent->_Children[idx]!=NULL,"Ignoring attempt to add second child to same slot ("+NLMISC::toString("%d",idx)+") in persistent data tree node's children: "+_Parent->getNodeName(),return false); + BOMB_IF(_Parent->_Children[idx] != NULL, "Ignoring attempt to add second child to same slot (" + NLMISC::toString("%d", idx) + ") in persistent data tree node's children: " + _Parent->getNodeName().c_str(), return false); // write own pointer into parent's _Children vector _Parent->_Children[idx]= this; @@ -239,7 +239,7 @@ bool CPersistentDataTreeNode::readFromPdr(CPersistentDataRecord& pdr) return false; // pop the end of block token for the block we just finished processing - DROP_IF(pdr.peekNextToken()!=token,"ERROR: End of "+pdr.lookupString(token)+" block expected but not found at: "+getNodeName(),return false); + DROP_IF(pdr.peekNextToken() != token, "ERROR: End of " + pdr.lookupString(token) + " block expected but not found at: " + getNodeName().c_str(), return false); pdr.popStructEnd(token); } else if (pdr.isEndOfStruct()) @@ -259,7 +259,7 @@ bool CPersistentDataTreeNode::readFromPdr(CPersistentDataRecord& pdr) // extract the map key and ensure that it's followed by a valid __Val__ entry CSString mapKey; pdr.pop(mapKeyToken,mapKey); - DROP_IF(pdr.isEndOfData() || pdr.peekNextToken()!=mapValToken,"ERROR: Ignoring map key (__Key__) because __Val__ token expected but not found at: "+getNodeName()+":"+mapKey,continue); + DROP_IF(pdr.isEndOfData() || pdr.peekNextToken() != mapValToken, "ERROR: Ignoring map key (__Key__) because __Val__ token expected but not found at: " + getNodeName() + ":" + mapKey.c_str(), continue); if (needsQuotes(mapKey)) mapKey=mapKey.quote(); @@ -278,7 +278,7 @@ bool CPersistentDataTreeNode::readFromPdr(CPersistentDataRecord& pdr) return false; // pop the end of struct marker - DROP_IF(pdr.peekNextToken()!=mapValToken,"ERROR: End of __Val__ block expected but not found at: "+getNodeName()+":"+mapKey,return false); + DROP_IF(pdr.peekNextToken() != mapValToken, "ERROR: End of __Val__ block expected but not found at: " + getNodeName() + ":" + mapKey.c_str(), return false); pdr.popStructEnd(mapValToken); } else @@ -419,9 +419,9 @@ bool CPersistentDataTreeNode::writeToBuffer(NLMISC::CSString& buffer) const { // write a value if (needsQuotes(_Value)) - buffer+= getNodeName()+"=="+_Value.quote()+"\n"; + buffer += getNodeName() + "==" + _Value.quote().c_str() + "\n"; else - buffer+= getNodeName()+"="+_Value+"\n"; + buffer += getNodeName() + "=" + _Value.c_str() + "\n"; } else { @@ -468,8 +468,8 @@ CSString CPersistentDataTreeNode::getNodeName() const // return one of name, parentName.name and parentName:name if (parentName.empty()) return name; - if (isMapEntry()) return parentName+":"+name; - else return parentName+"."+name; + if (isMapEntry()) return parentName + ":" + name.c_str(); + else return parentName + "." + name.c_str(); } void CPersistentDataTreeNode::setValue(const TValue& value) @@ -507,7 +507,7 @@ bool CPersistentDataTreeNode::isMapEntry() const bool CPersistentDataTreeNode::flagAsMap() { - DROP_IF(_IsValue,"ERROR: Failed to flag persistent data tree node '"+getNodeName()+"' as a map as it already has a value: "+_Value,return false); + DROP_IF(_IsValue, "ERROR: Failed to flag persistent data tree node '" + getNodeName() + "' as a map as it already has a value: " + _Value.c_str(), return false); if (_IsMap) return true; diff --git a/code/ryzom/common/src/game_share/ryzom_version.h b/code/ryzom/common/src/game_share/ryzom_version.h index 915f9ed1c..9476ac849 100644 --- a/code/ryzom/common/src/game_share/ryzom_version.h +++ b/code/ryzom/common/src/game_share/ryzom_version.h @@ -20,7 +20,7 @@ #define RYZOM_VERSION "ryzomcore" \ "/" \ "v0.11.2" \ - "" + "-dev" #endif // RYZOM_VERSION_H 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 51d7ce19e..3d3548d54 100644 --- a/code/ryzom/common/src/game_share/server_animation_module.cpp +++ b/code/ryzom/common/src/game_share/server_animation_module.cpp @@ -1017,7 +1017,7 @@ IPrimitive* CServerAnimationModule::getAction(CObject* action, const std::string } if(result.size()>=2) - result[1] = "DSS_"+toString(scenarioId)+" "+result[1]; + result[1] = "DSS_"+toString(scenarioId)+" "+result[1].c_str(); if(result.size()>=3) { for(uint32 i=2;i(ICommand::getCommand(gvi.VarName)); if (var != NULL) - gs.SampleValue = atof(var->toString().c_str()); + NLMISC::fromString(var->toString(), gs.SampleValue); } } } @@ -306,7 +306,11 @@ namespace ADMIN // no sample collected yet, just ask a new one IVariable *var = dynamic_cast(ICommand::getCommand(gvi.VarName)); if (var != NULL) - gd.setValue(atof(var->toString().c_str())); + { + float val; + NLMISC::fromString(var->toString(), val); + gd.setValue(val); + } } else { diff --git a/code/ryzom/server/src/ags_test/commands.cpp b/code/ryzom/server/src/ags_test/commands.cpp index 7b2e6c2a8..4fa955401 100644 --- a/code/ryzom/server/src/ags_test/commands.cpp +++ b/code/ryzom/server/src/ags_test/commands.cpp @@ -586,7 +586,10 @@ NLMISC_COMMAND(actorSetOrientation,"Add one or more static actors"," if (i<(sizeof(angleNames)/sizeof(angleNames[0]))) theta=3.14159265359f*2.0f*(float)i/(float)(sizeof(angleNames)/sizeof(angleNames[0])); else - theta=(float)atof(args[0].c_str())/360.0f*2.0f*3.14159265359f; + { + NLMISC::fromString(args[0], theta); + theta = theta / 360.0f*2.0f*3.14159265359f; + } if (args.size()==1) { @@ -620,11 +623,13 @@ NLMISC_COMMAND(actorSetMagnetRange,"Set the magnet properties for wandering beha if(args.size() <1) return false; COMMAND_MACRO_RECORD_TEST - float range=(float)atof(args[0].c_str()); + float range; + NLMISC::fromString(args[0], range); if (range<=0.0f) return false; unsigned start; - float decay=(float)atof(args[0].c_str()); + float decay; + NLMISC::fromString(args[0], decay); if (decay<0.0f) return false; if (decay==0.0f) { @@ -664,7 +669,8 @@ NLMISC_COMMAND(actorSetAttackDistance,"set actor attack distance"," [< if(args.size() <1) return false; COMMAND_MACRO_RECORD_TEST - float distance=(float)atof(args[0].c_str()); + float distance; + NLMISC::fromString(args[0], distance); // if (distance<=0.0f) return false; if (args.size()<2) @@ -781,11 +787,13 @@ NLMISC_COMMAND(actorSetRespawnDelay,"set actor respawn delay"," [ filters; diff --git a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp index 28e55559c..e52b97573 100644 --- a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp +++ b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp @@ -1651,7 +1651,7 @@ public: first.flags = (topNode.isInWater() ? 1 : 0) + (topNode.isInNogo() ? 2 : 0); // push first position - stacks[first.flags].insert(make_pair(first.flags, stwp)); + stacks[first.flags].insert(std::pair(first.flags, stwp)); while (true) { @@ -1750,11 +1750,11 @@ public: } if (tmp.getTopologyNode().Id == topNode.Id) { - stacks[0].insert(make_pair(ndist, tmp)); + stacks[0].insert(std::pair(ndist, tmp)); } else { - stacks[tmpflags+1].insert(make_pair(ndist, tmp)); + stacks[tmpflags + 1].insert(std::pair(ndist, tmp)); } } } @@ -2465,9 +2465,17 @@ NLMISC_COMMAND(setDefaultStart,"Set the default start point for all continents", CVectorD startPoint; - startPoint.x = atof(args[0].c_str()); - startPoint.y = atof(args[1].c_str()); - startPoint.z = (args.size() < 3 ? 0.0 : atof(args[2].c_str())); + NLMISC::fromString(args[0], startPoint.x); + NLMISC::fromString(args[1], startPoint.y); + + if (args.size() > 2) + { + NLMISC::fromString(args[2], startPoint.z); + } + else + { + startPoint.z = 0.0; + } DefaultStartPoint = startPoint; @@ -2921,13 +2929,15 @@ NLMISC_COMMAND(testPacsMove, "test a pacs move", " " if (args.size() != 5) return false; - CPacsCruncher pc; + CPacsCruncher pc; - string name = args[0]; - double x = atof(args[1].c_str()); - double y = atof(args[2].c_str()); - double dx = atof(args[3].c_str()); - double dy = atof(args[4].c_str()); + string name = args[0]; + + double x, y, dx, dy; + NLMISC::fromString(args[1], x); + NLMISC::fromString(args[2], y); + NLMISC::fromString(args[3], dx); + NLMISC::fromString(args[4], dy); pc.init(name); diff --git a/code/ryzom/server/src/ai_service/ai.cpp b/code/ryzom/server/src/ai_service/ai.cpp index 587e5ac0c..49144fa9d 100644 --- a/code/ryzom/server/src/ai_service/ai.cpp +++ b/code/ryzom/server/src/ai_service/ai.cpp @@ -224,7 +224,7 @@ uint32 CAIS::getEmotNumber(const std::string &name) { std::map::iterator it(_EmotNames.find(name)); if (it==_EmotNames.end()) - return ~0; + return std::numeric_limits::max(); return it->second; } @@ -280,7 +280,7 @@ uint32 CAIS::createAIInstance(const std::string &continentName, uint32 instanceN continue; nlwarning("CAIS::createAIInstance: instance number %u is already in use, can't create new instance.", instanceNumber); - return ~0; + return std::numeric_limits::max(); } CAIInstance *aii = _AIInstances.addChild(new CAIInstance(this)); diff --git a/code/ryzom/server/src/ai_service/ai.h b/code/ryzom/server/src/ai_service/ai.h index 4f9a7d802..57ff524ec 100644 --- a/code/ryzom/server/src/ai_service/ai.h +++ b/code/ryzom/server/src/ai_service/ai.h @@ -104,7 +104,7 @@ public: // classic init(), update() and release() /** create an AI instance, return the instance index in the AIList - * Return ~0 if the instance number is already in use. + * Return std::numeric_limits::max() if the instance number is already in use. */ uint32 createAIInstance(const std::string &continentName, uint32 instanceNumber); /** destroy an AI Instance (useful for ring creation / destruction of session) @@ -205,7 +205,7 @@ public: /// Time warp managment. This method is called when time as warped more than 600ms bool advanceUserTimer(uint32 nbTicks); - /// Retreive emot number given it's name, return ~0 if not found + /// Retreive emot number given it's name, return std::numeric_limits::max() if not found uint32 getEmotNumber(const std::string &name); CCont &AIList () { return _AIInstances; } @@ -243,7 +243,7 @@ public: class CCounter { public: - CCounter(const uint32 max=~0):_Total(0),_Max(max) + CCounter(const uint32 max=std::numeric_limits::max()):_Total(0),_Max(max) {} virtual ~CCounter() {} diff --git a/code/ryzom/server/src/ai_service/ai_bot_npc.cpp b/code/ryzom/server/src/ai_service/ai_bot_npc.cpp index 8a7518709..201cc517c 100644 --- a/code/ryzom/server/src/ai_service/ai_bot_npc.cpp +++ b/code/ryzom/server/src/ai_service/ai_bot_npc.cpp @@ -878,9 +878,9 @@ Colors are something like that: 2: VERT CITRON VERT CITRON GREEN 3: VERT VERT TURQUOISE 4: BLEU BLEU BLUE -5: ROUGE fonce ROUGE (tout court) CRIMSON +5: ROUGE dark ROUGE (normal) CRIMSON 6: BLANC JAUNE WHITE -7: NOIR BLEU tres fonce BLACK +7: NOIR BLEU very dark BLACK 3D column is (probably) used for equipment */ diff --git a/code/ryzom/server/src/ai_service/ai_generic_fight.cpp b/code/ryzom/server/src/ai_service/ai_generic_fight.cpp index a19f747c3..f4c9a5cb0 100644 --- a/code/ryzom/server/src/ai_service/ai_generic_fight.cpp +++ b/code/ryzom/server/src/ai_service/ai_generic_fight.cpp @@ -571,7 +571,7 @@ bool CFightOrganizer::reorganizeIteration(CBot* bot) ennemy=entity; } } - entity->_ChooseLastTime=~0; + entity->_ChooseLastTime = std::numeric_limits::max(); } if (fleeEnnemy==NULL && !spawnBot->getUnreachableTarget().isNULL()) diff --git a/code/ryzom/server/src/ai_service/ai_grp_fauna.cpp b/code/ryzom/server/src/ai_service/ai_grp_fauna.cpp index 2bab5200d..6cd657ff2 100644 --- a/code/ryzom/server/src/ai_service/ai_grp_fauna.cpp +++ b/code/ryzom/server/src/ai_service/ai_grp_fauna.cpp @@ -220,7 +220,7 @@ void CSpawnGroupFauna::update() getPersistent().updateStateInstance(); - if (_CurrentCycle==~0) + if (_CurrentCycle==std::numeric_limits::max()) return; // Respawn @@ -606,9 +606,9 @@ CGrpFauna::CGrpFauna(CMgrFauna* mgr, CAIAliasDescriptionNode* aliasTree, RYAI_MA // state - _CurPopulation = ~0u; + _CurPopulation = std::numeric_limits::max(); - _CurrentCycle = ~0; + _CurrentCycle = std::numeric_limits::max(); // default values. setTimer(EAT_TIME, refTimer(EAT_TIME)); @@ -699,9 +699,9 @@ CAliasTreeOwner* CGrpFauna::createChild(IAliasCont* cont, CAIAliasDescriptionNod CAIPlaceXYRFauna *faunaPlace = new CAIPlaceXYRFauna(this, aliasTree); child = faunaPlace; uint placeIndex = faunaPlace->setupFromOldName(name); - nlassert(placeIndex!=~0); + nlassert(placeIndex!=std::numeric_limits::max()); - if (placeIndex!=~0) + if (placeIndex!=std::numeric_limits::max()) cont->addAliasChild(child, placeIndex); return child; @@ -769,7 +769,7 @@ bool CGrpFauna::spawn() return false; setStartState(getStartState()); // stateInstance. - return spawnPop(~0); + return spawnPop(std::numeric_limits::max()); } bool CGrpFauna::timeAllowSpawn(uint32 popVersion) const @@ -841,7 +841,7 @@ bool CGrpFauna::spawnPop(uint popVersion) } // check the validity of the input parameter - if (popVersion!=~0 && popVersion>=_Populations.size()) + if (popVersion!=std::numeric_limits::max() && popVersion>=_Populations.size()) { nlwarning("CGrpFauna::spawn(idx) FAILED for group %s because idx (%d) >= _Populations.size() (%d)",this->CGroup::getFullName().c_str(),popVersion,_Populations.size()); return false; diff --git a/code/ryzom/server/src/ai_service/ai_vector_mirror.h b/code/ryzom/server/src/ai_service/ai_vector_mirror.h index 0464de4fb..da229b4c3 100644 --- a/code/ryzom/server/src/ai_service/ai_vector_mirror.h +++ b/code/ryzom/server/src/ai_service/ai_vector_mirror.h @@ -95,7 +95,7 @@ public: // Methods. inline double distTo(const CAIVectorMirror &dest) const; inline double distSqTo(const CAIVectorMirror &dest) const; inline double quickDistTo(const CAIVectorMirror &dest) const; - + protected: inline void setX(const CAICoord &x) { _x=x; } inline void setY(const CAICoord &y) { _y=y; } diff --git a/code/ryzom/server/src/ai_service/child_container.h b/code/ryzom/server/src/ai_service/child_container.h index ab98d93af..0b5c79c4e 100644 --- a/code/ryzom/server/src/ai_service/child_container.h +++ b/code/ryzom/server/src/ai_service/child_container.h @@ -495,7 +495,7 @@ uint32 CAliasCont::getChildIndexByAlias(uint32 alias) const if (child!=NULL && child->getAlias()==alias) return (uint32)i; } - return ~0; + return std::numeric_limits::max(); } template diff --git a/code/ryzom/server/src/ai_service/commands.cpp b/code/ryzom/server/src/ai_service/commands.cpp index 7a4ff6f0d..641503b70 100644 --- a/code/ryzom/server/src/ai_service/commands.cpp +++ b/code/ryzom/server/src/ai_service/commands.cpp @@ -229,8 +229,9 @@ NLMISC_COMMAND(eventCreateNpcGroup, "create an event npc group", " return true; } - double x = atof(args[3].c_str()); - double y = atof(args[4].c_str()); + double x, y; + NLMISC::fromString(args[3], x); + NLMISC::fromString(args[4], y); double dispersionRadius = 10.; if (args.size()>5) @@ -1969,9 +1970,13 @@ NLMISC_COMMAND(displayVision3x3,"display 3x3 cell vision centred on a given coor } } + double dx, dy; + NLMISC::fromString(args[1], dx); + NLMISC::fromString(args[2], dy); + CAICoord x, y; - x=atof(args[1].c_str()); - y=atof(args[2].c_str()); + x = dx; + y = dy; log.displayNL("3x3 Vision around (%.3f,%.3f)", x.asDouble(), y.asDouble()); uint32 botCount=0; diff --git a/code/ryzom/server/src/ai_service/continent_inline.h b/code/ryzom/server/src/ai_service/continent_inline.h index 49c21248e..4ddf09c18 100644 --- a/code/ryzom/server/src/ai_service/continent_inline.h +++ b/code/ryzom/server/src/ai_service/continent_inline.h @@ -695,7 +695,7 @@ static CAIVector randomPos(double dispersionRadius) { return CAIVector(0., 0.); } - uint32 const maxLimit=((uint32)~0U)>>1; + uint32 const maxLimit=(std::numeric_limits::max())>>1; double rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[ double r = dispersionRadius*sqrt(rval); rval = (double)CAIS::rand32(maxLimit)/(double)maxLimit; // [0-1[ diff --git a/code/ryzom/server/src/ai_service/event_manager.h b/code/ryzom/server/src/ai_service/event_manager.h index ab49b8d68..731539051 100644 --- a/code/ryzom/server/src/ai_service/event_manager.h +++ b/code/ryzom/server/src/ai_service/event_manager.h @@ -17,6 +17,8 @@ #ifndef RYAI_EVENT_MANAGER_H #define RYAI_EVENT_MANAGER_H +#include + #include "event_reaction.h" #include "states.h" diff --git a/code/ryzom/server/src/ai_service/family_behavior.h b/code/ryzom/server/src/ai_service/family_behavior.h index 893282ae0..52d534e1c 100644 --- a/code/ryzom/server/src/ai_service/family_behavior.h +++ b/code/ryzom/server/src/ai_service/family_behavior.h @@ -210,7 +210,7 @@ class CFamilyBehavior void spawnBoss(NLMISC::TStringId outpostName); - uint32 energyScale (uint32 levelIndex=~0) const; + uint32 energyScale (uint32 levelIndex=std::numeric_limits::max()) const; void setModifier (const float &value, const uint32 &index) { diff --git a/code/ryzom/server/src/ai_service/generic_logic_action.cpp b/code/ryzom/server/src/ai_service/generic_logic_action.cpp index afd0f9b3c..e2c761619 100644 --- a/code/ryzom/server/src/ai_service/generic_logic_action.cpp +++ b/code/ryzom/server/src/ai_service/generic_logic_action.cpp @@ -1407,13 +1407,12 @@ public: return false; } - // check if its a number or a var. - //TODO: et les variables negatives? + // check if it's a number or a var. + //TODO: and negative values ? if ((str[0]<='9' && str[0]>='0')||(str[0]=='-')) // its a number { var.Type = constant; - double val = atof(str.c_str()); - var.Value = float(val); + NLMISC::fromString(str, var.Value); return true; } diff --git a/code/ryzom/server/src/ai_service/nf_helpers.h b/code/ryzom/server/src/ai_service/nf_helpers.h index 2b8ead4e6..dc9c7c345 100644 --- a/code/ryzom/server/src/ai_service/nf_helpers.h +++ b/code/ryzom/server/src/ai_service/nf_helpers.h @@ -161,7 +161,7 @@ public: if (_value==-1) // not for affectation. return; - if (_index==~0) // all indexs ? + if (_index==std::numeric_limits::max()) // all indexs ? { for (uint32 nrjIndex=0;nrjIndex<4;nrjIndex++) fb->setModifier (_value, nrjIndex); diff --git a/code/ryzom/server/src/ai_service/path_behaviors.h b/code/ryzom/server/src/ai_service/path_behaviors.h index 8c509ae9d..6684b2db3 100644 --- a/code/ryzom/server/src/ai_service/path_behaviors.h +++ b/code/ryzom/server/src/ai_service/path_behaviors.h @@ -168,11 +168,11 @@ public: // - This method adds the new object to the top of the CFollowPath singleton's context stack // parameters: // - contextName : an arbitrary string naming the context - // - maxSearchDepth : the value that the path finder search depth should be limitted to (default to ~0u meaning no limit) + // - maxSearchDepth : the value that the path finder search depth should be limitted to (default to std::numeric_limits::max() meaning no limit) // - forceMaxDepth : set this flag true to override previous limit with larger value // example: - // - ... Before we begin ... CFollowPath::_MaxSearchDepth = ~0u - // - CFollowPathContext context1("tata") : CFollowPath::_MaxSearchDepth => ~0u + // - ... Before we begin ... CFollowPath::_MaxSearchDepth = std::numeric_limits::max() + // - CFollowPathContext context1("tata") : CFollowPath::_MaxSearchDepth => std::numeric_limits::max() // - CFollowPathContext context2("tete",456) : CFollowPath::_MaxSearchDepth => 456 // - CFollowPathContext context3("titi",123) : CFollowPath::_MaxSearchDepth => 123 // - CFollowPathContext context4("toto",456) : CFollowPath::_MaxSearchDepth => 123 @@ -182,9 +182,9 @@ public: // - CFollowPathContext context5.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => 123 // - CFollowPathContext context4.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => 123 // - CFollowPathContext context3.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => 456 - // - CFollowPathContext context2.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => ~0u - // - CFollowPathContext context1.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => ~0u - CFollowPathContext(const char* contextName, uint32 maxSearchDepth=~0u, bool forceMaxDepth=false); + // - CFollowPathContext context2.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => std::numeric_limits::max() + // - CFollowPathContext context1.~CFollowPathContext() : CFollowPath::_MaxSearchDepth => std::numeric_limits::max() + CFollowPathContext(const char* contextName, uint32 maxSearchDepth=std::numeric_limits::max(), bool forceMaxDepth=false); // dtor // - This method removes the destroyed object from the CFollowPath singleton's context stack @@ -270,7 +270,7 @@ private: friend class CFollowPathContext; CFollowPathContext* _TopFollowPathContext; public: - uint32 getMaxSearchDepth() const { return (_TopFollowPathContext==NULL)? ~0u: _TopFollowPathContext->getMaxSearchDepth(); } + uint32 getMaxSearchDepth() const { return (_TopFollowPathContext==NULL)? std::numeric_limits::max(): _TopFollowPathContext->getMaxSearchDepth(); } const char* getContextName() const; }; diff --git a/code/ryzom/server/src/ai_service/state_instance.h b/code/ryzom/server/src/ai_service/state_instance.h index 94755c143..3ad6e6d55 100644 --- a/code/ryzom/server/src/ai_service/state_instance.h +++ b/code/ryzom/server/src/ai_service/state_instance.h @@ -185,7 +185,7 @@ protected: CAITimerExtended _StateTimeout; /// current state (index into manager's state vector) CAIState* _state; - /// variable set to request a state change (~0 otherwise) + /// variable set to request a state change (std::numeric_limits::max() otherwise) CAIState* _NextState; /// timer for timing punctual states diff --git a/code/ryzom/server/src/ai_share/16x16_layer.cpp b/code/ryzom/server/src/ai_share/16x16_layer.cpp index c820e4f7b..4e78cf54e 100644 --- a/code/ryzom/server/src/ai_share/16x16_layer.cpp +++ b/code/ryzom/server/src/ai_share/16x16_layer.cpp @@ -100,7 +100,7 @@ I16x16Layer *I16x16Layer::compress(I16x16Layer *layer, sint32 blank) map::iterator it = count.find(val); if (it == count.end()) - count.insert(make_pair(val, 1)); + count.insert(std::pair(val, 1)); else ++((*it).second); } diff --git a/code/ryzom/server/src/ai_share/world_map.cpp b/code/ryzom/server/src/ai_share/world_map.cpp index eae84acbf..f468c1144 100644 --- a/code/ryzom/server/src/ai_share/world_map.cpp +++ b/code/ryzom/server/src/ai_share/world_map.cpp @@ -1469,7 +1469,7 @@ bool CWorldMap::findAStarPath(CWorldPosition const& start, CWorldPosition const& uint father = (uint)nodes.size()-1; // Add start topology to visited nodes (father holds start topo node index for the moment) - visited.insert(make_pair(startTopo, father)); + visited.insert(std::pair(startTopo, father)); // Push start node in the heap with a zero cost heap.push(0.0f, father); @@ -1562,7 +1562,7 @@ bool CWorldMap::findAStarPath(CWorldPosition const& start, CWorldPosition const& // Add node to heap with a computed f(n)=g(n)+h(n) heap.push(distance + heuristic, child); // Add node to visited - visited.insert(make_pair(next, child)); + visited.insert(std::pair(next, child)); } } @@ -1633,7 +1633,7 @@ bool CWorldMap::findAStarPath(const CTopology::TTopologyId &start, const CTopolo uint father = (uint)nodes.size()-1; // add current to visited nodes - visited.insert(make_pair(startTopo, father)); + visited.insert(std::pair(startTopo, father)); heap.push(0.0f, father); bool found=false; @@ -1699,7 +1699,7 @@ bool CWorldMap::findAStarPath(const CTopology::TTopologyId &start, const CTopolo // add node to visited and to heap heap.push(heuristic, child); - visited.insert(make_pair(next, child)); + visited.insert(std::pair(next, child)); } } @@ -1767,7 +1767,7 @@ bool CWorldMap::findInsideAStarPath(CWorldPosition const& start, CWorldPosition uint father = (uint)nodes.size()-1; // Add start node to visited nodes (father holds start node index for the moment) - visited.insert(make_pair(startNode, father)); + visited.insert(std::pair(startNode, father)); // Push start node in the heap with a zero cost heap.push(0.0f, father); @@ -1854,7 +1854,7 @@ bool CWorldMap::findInsideAStarPath(CWorldPosition const& start, CWorldPosition // Add node to heap with a computed f(n)=g(n)+h(n) heap.push(distance + heuristic, child); // Add node to visited - visited.insert(make_pair(next, child)); + visited.insert(std::pair(next, child)); } } diff --git a/code/ryzom/server/src/backup_service/backup_service.cpp b/code/ryzom/server/src/backup_service/backup_service.cpp index aed50a32c..95c11d07a 100644 --- a/code/ryzom/server/src/backup_service/backup_service.cpp +++ b/code/ryzom/server/src/backup_service/backup_service.cpp @@ -718,7 +718,7 @@ void CBackupService::init() BSIsSlave = true; FileManager.forbidStall(); // I'm a slave, try to contact master - string host = MasterBSHost; + string host = MasterBSHost.get(); if (host.find (":") == string::npos) host += ":49990"; diff --git a/code/ryzom/server/src/backup_service/web_connection.cpp b/code/ryzom/server/src/backup_service/web_connection.cpp index 86a62902d..6afa8f885 100644 --- a/code/ryzom/server/src/backup_service/web_connection.cpp +++ b/code/ryzom/server/src/backup_service/web_connection.cpp @@ -209,10 +209,10 @@ void cbGetSaveList(CMemStream &msgin, TSockId host) explode(str, string("%%"), params, true); - string incrementalDir = IncrementalBackupDirectory; - string saveShardRoot = SaveShardRoot; - string templatePath = SaveTemplatePath; - string extList = SaveExtList; + string incrementalDir = IncrementalBackupDirectory.get(); + string saveShardRoot = SaveShardRoot.get(); + string templatePath = SaveTemplatePath.get(); + string extList = SaveExtList.get(); string shard; string userid; @@ -293,8 +293,8 @@ void cbRestoreSave(CMemStream &msgin, TSockId host) explode(str, string("%%"), params, true); - string saveShardRoot = SaveShardRoot; - string templatePath = SaveTemplatePath; + string saveShardRoot = SaveShardRoot.get(); + string templatePath = SaveTemplatePath.get(); string shard; string userid; @@ -368,9 +368,9 @@ void cbCopyOverSave(CMemStream &msgin, TSockId host) explode(str, string("%%"), params, true); - string saveShardRoot = SaveShardRoot; - string templatePath = SaveTemplatePath; - string extList = SaveExtList; + string saveShardRoot = SaveShardRoot.get(); + string templatePath = SaveTemplatePath.get(); + string extList = SaveExtList.get(); string shard; string userid; diff --git a/code/ryzom/server/src/dynamic_scenario_service/service.cpp b/code/ryzom/server/src/dynamic_scenario_service/service.cpp index 342a05c23..07c454566 100644 --- a/code/ryzom/server/src/dynamic_scenario_service/service.cpp +++ b/code/ryzom/server/src/dynamic_scenario_service/service.cpp @@ -56,8 +56,6 @@ namespace R2 // The ligo config NLLIGO::CLigoConfig* LigoConfigPtr; CR2LigoConfig R2LigoConfig; - - } diff --git a/code/ryzom/server/src/entities_game_service/admin.cpp b/code/ryzom/server/src/entities_game_service/admin.cpp index 6e06da000..22254c64b 100644 --- a/code/ryzom/server/src/entities_game_service/admin.cpp +++ b/code/ryzom/server/src/entities_game_service/admin.cpp @@ -4821,9 +4821,9 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " getSlotCount(); ++ i) { const CGameItemPtr itemPtr = inventory->getItem(i); - if( itemPtr != NULL ) + if ( itemPtr != NULL ) { - if( (itemPtr->getSheetId() == sheetId) && (itemPtr->quality() == quality) ) + if ( (itemPtr->getSheetId() == sheetId) && (itemPtr->quality() == quality) ) { numberItem += itemPtr->getStackSize(); } @@ -4841,9 +4841,9 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " getSlotCount(); ++ i) { const CGameItemPtr itemPtr = inventory->getItem(i); - if( itemPtr != NULL ) + if ( itemPtr != NULL ) { - if( (itemPtr->getSheetId() == sheetId) && (itemPtr->quality() == quality) ) + if ( (itemPtr->getSheetId() == sheetId) && (itemPtr->quality() == quality) ) { numberItem -= inventory->deleteStackItem(i, quantity); if(numberItem == 0) @@ -5053,7 +5053,8 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " getType()) + + if (creature == NULL || creatureSheetId == CSheetId::Unknown || creatureSheetId != creature->getType()) { if (send_url) c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=bad_sheet", getSalt()); @@ -5686,7 +5687,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " getHomeMainlandSessionId(), value)); - if (entityBase == 0) + if (entityBase == NULL) { // try to find the bot name vector aliases; @@ -5711,7 +5712,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " getState().X + sint32 (cos (entityBase->getState ().Heading) * 2000); y = entityBase->getState().Y + sint32 (sin (entityBase->getState ().Heading) * 2000); diff --git a/code/ryzom/server/src/entities_game_service/database_plr.cpp b/code/ryzom/server/src/entities_game_service/database_plr.cpp index 7cf0d2108..4b5fa84fd 100644 --- a/code/ryzom/server/src/entities_game_service/database_plr.cpp +++ b/code/ryzom/server/src/entities_game_service/database_plr.cpp @@ -1,3 +1,18 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . ///////////////////////////////////////////////////////////////// // WARNING : this is a generated file, don't change it ! @@ -347,7 +362,7 @@ void CBankAccessor_PLR::TUSER::init(ICDBStructNode *parent) node = parent->getNode( ICDBStructNode::CTextId("IS_INVISIBLE"), false ); nlassert(node != NULL); _IS_INVISIBLE = node; - + node = parent->getNode( ICDBStructNode::CTextId("COUNTER"), false ); nlassert(node != NULL); _COUNTER = node; @@ -3124,11 +3139,10 @@ void CBankAccessor_PLR::TPACK_ANIMAL::TBEAST::init(ICDBStructNode *parent, uint node = parent->getNode( ICDBStructNode::CTextId("DESPAWN"), false ); nlassert(node != NULL); _DESPAWN = node; - + node = parent->getNode( ICDBStructNode::CTextId("NAME"), false ); nlassert(node != NULL); _NAME = node; - // branch init diff --git a/code/ryzom/server/src/entities_game_service/database_plr.h b/code/ryzom/server/src/entities_game_service/database_plr.h index 38a394c88..67e0f7798 100644 --- a/code/ryzom/server/src/entities_game_service/database_plr.h +++ b/code/ryzom/server/src/entities_game_service/database_plr.h @@ -1,3 +1,18 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . #ifndef INCLUDED_DATABASE_PLR_H @@ -941,8 +956,6 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C void setIS_INVISIBLE(CCDBSynchronised &dbGroup, bool value, bool forceSending = false) { - - _setProp(dbGroup, _IS_INVISIBLE, value, forceSending); } @@ -958,7 +971,7 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C { return _IS_INVISIBLE; } - + void setCOUNTER(CCDBSynchronised &dbGroup, uint8 value, bool forceSending = false) { @@ -1300,13 +1313,14 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C { return _DODGE; } - TBRICK_TICK_RANGE &getBRICK_TICK_RANGE() + + TBRICK_TICK_RANGE &getBRICK_TICK_RANGE() { return _BRICK_TICK_RANGE; } - + }; - + class TTARGET { public: @@ -3457,8 +3471,6 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C void setMONEY(CCDBSynchronised &dbGroup, uint64 value, bool forceSending = false) { - - _setProp(dbGroup, _MONEY, value, forceSending); } @@ -4560,8 +4572,6 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C void setMONEY(CCDBSynchronised &dbGroup, uint64 value, bool forceSending = false) { - - _setProp(dbGroup, _MONEY, value, forceSending); } @@ -4572,14 +4582,12 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C return value; } - + ICDBStructNode *getMONEYCDBNode() { return _MONEY; } - }; - private: ICDBStructNode *_BranchNode; @@ -4602,11 +4610,8 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C return _BranchNode; } - void setMONEY(CCDBSynchronised &dbGroup, uint64 value, bool forceSending = false) { - - _setProp(dbGroup, _MONEY, value, forceSending); } @@ -6000,8 +6005,6 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C void setMONEY_SHEET(CCDBSynchronised &dbGroup, NLMISC::CSheetId value, bool forceSending = false) { - - _setProp(dbGroup, _MONEY_SHEET, value, forceSending); } @@ -8858,7 +8861,6 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C ICDBStructNode *_HUNGER; ICDBStructNode *_DESPAWN; ICDBStructNode *_NAME; - public: void init(ICDBStructNode *parent, uint index); @@ -9047,11 +9049,9 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C { return _DESPAWN; } - + void setNAME(CCDBSynchronised &dbGroup, uint32 value, bool forceSending = false) { - - _setProp(dbGroup, _NAME, value, forceSending); } @@ -9062,12 +9062,11 @@ inline void _getProp(const CCDBSynchronised &db, ICDBStructNode *node, NLMISC::C return value; } - + ICDBStructNode *getNAMECDBNode() { return _NAME; } - }; diff --git a/code/ryzom/server/src/entities_game_service/deposit.cpp b/code/ryzom/server/src/entities_game_service/deposit.cpp index 7d8000f4d..d4cd560ad 100644 --- a/code/ryzom/server/src/entities_game_service/deposit.cpp +++ b/code/ryzom/server/src/entities_game_service/deposit.cpp @@ -16,6 +16,7 @@ #include "stdpch.h" +#include #include "deposit.h" #include "player_manager/character.h" #include "player_manager/player_manager.h" diff --git a/code/ryzom/server/src/entities_game_service/dyn_chat_egs.cpp b/code/ryzom/server/src/entities_game_service/dyn_chat_egs.cpp index 90d41820f..98ec86a75 100644 --- a/code/ryzom/server/src/entities_game_service/dyn_chat_egs.cpp +++ b/code/ryzom/server/src/entities_game_service/dyn_chat_egs.cpp @@ -507,7 +507,7 @@ void CDynChatEGS::iosSetHideBubble(TChanID chan, bool hideBubble) void CDynChatEGS::iosSetUniversalChannel(TChanID chan, bool universalChannel) { CMessage msg("DYN_CHAT:SET_UNIVERSAL_CHANNEL"); - msg.serial(chan); + msg.serial(chan); msg.serial(universalChannel); sendMessageViaMirror( "IOS", msg); } diff --git a/code/ryzom/server/src/entities_game_service/fame_pd.cpp b/code/ryzom/server/src/entities_game_service/fame_pd.cpp index db2104c5d..2e201412a 100644 --- a/code/ryzom/server/src/entities_game_service/fame_pd.cpp +++ b/code/ryzom/server/src/entities_game_service/fame_pd.cpp @@ -516,7 +516,7 @@ void CFameContainerPD::pds__fetch(RY_PDS::CPData &data) if (rowIndex == RY_PDS::INVALID_ROW_INDEX || tableIndex == RY_PDS::INVALID_TABLE_INDEX) break; NLMISC::CSheetId __k; data.serial(__k); - _Entries.insert(std::make_pair(__k, CFameContainerEntryPD())); + _Entries.insert(std::pair(__k, CFameContainerEntryPD())); CFameContainerEntryPD* __o = &(_Entries[__k]); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); diff --git a/code/ryzom/server/src/entities_game_service/game_event_manager.cpp b/code/ryzom/server/src/entities_game_service/game_event_manager.cpp index 5346809a3..b95fb1ad4 100644 --- a/code/ryzom/server/src/entities_game_service/game_event_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/game_event_manager.cpp @@ -59,7 +59,7 @@ CGameEventManager::CGameEventManager() // ---------------------------------------------------------------------------- void CGameEventManager::init() { - string sFilename = GameEventFile; + string sFilename = GameEventFile.get(); sFilename = CPath::standardizePath(IService::getInstance()->WriteFilesDirectory) + sFilename; if (CFile::fileExists(sFilename)) @@ -302,7 +302,7 @@ void CGameEventManager::saveGameEventFile() { if( _InitOk ) { - string sFilename = GameEventFile; + string sFilename = GameEventFile.get(); sFilename = CPath::standardizePath(IService::getInstance()->WriteFilesDirectory) + sFilename; static CPersistentDataRecordRyzomStore pdr; diff --git a/code/ryzom/server/src/entities_game_service/guild_container_pd.cpp b/code/ryzom/server/src/entities_game_service/guild_container_pd.cpp index dea4e2a1d..7e025acdf 100644 --- a/code/ryzom/server/src/entities_game_service/guild_container_pd.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_container_pd.cpp @@ -298,7 +298,7 @@ void CGuildContainerPD::pds__fetch(RY_PDS::CPData &data) TGuildId __k; data.serial(__k); CGuildPD* __o = static_cast(PDSLib.create(tableIndex)); - _Guilds.insert(std::make_pair(__k, __o)); + _Guilds.insert(std::pair(__k, __o)); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); __o->pds__setParentUnnotified(this); diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp b/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp index 03a105445..c04347c08 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp @@ -559,7 +559,8 @@ void CGuildMemberModule::kickMember( uint16 index,uint8 session )const } // if the user is online reset its guild id CGuildMemberModule * module = NULL; - if ( member->getReferencingModule( module ) ) + + if (member->getReferencingModule(module)) { module->clearOnlineGuildProperties(); } @@ -568,7 +569,7 @@ void CGuildMemberModule::kickMember( uint16 index,uint8 session )const params[0].setEIdAIAlias( proxy.getId(), CAIAliasTranslator::getInstance()->getAIAlias(proxy.getId()) ); params[1].StringId = CEntityIdTranslator::getInstance()->getEntityNameStringId(member->getIngameEId()); sendMessageToGuildMembers("GUILD_KICK_MEMBER",params); - + guild->deleteMember( member ); } diff --git a/code/ryzom/server/src/entities_game_service/guild_pd.cpp b/code/ryzom/server/src/entities_game_service/guild_pd.cpp index 819ae72ad..1da40c221 100644 --- a/code/ryzom/server/src/entities_game_service/guild_pd.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_pd.cpp @@ -470,7 +470,7 @@ void CGuildPD::pds__fetch(RY_PDS::CPData &data) TCharacterId __k; data.serial(__k); CGuildMemberPD* __o = static_cast(PDSLib.create(tableIndex)); - _Members.insert(std::make_pair(__k, __o)); + _Members.insert(std::pair(__k, __o)); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); __o->pds__setParentUnnotified(this); diff --git a/code/ryzom/server/src/entities_game_service/mission_client_callbacks.cpp b/code/ryzom/server/src/entities_game_service/mission_client_callbacks.cpp index 7cc0bf32a..98d784e11 100644 --- a/code/ryzom/server/src/entities_game_service/mission_client_callbacks.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_client_callbacks.cpp @@ -236,6 +236,7 @@ void cbClientGroupAbandonMission( NLNET::CMessage& msgin, const std::string &ser MISLOG("user:%s cbClientGroupAbandonMission : Invalid team", userId.toString().c_str()); return; } + if ( team->getLeader() != userId ) { CCharacter::sendDynamicSystemMessage( user->getEntityRowId(), "REQ_LEADER_TO_ABANDON_MISSION" ); diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp index 941b31afa..d967e6971 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp @@ -767,7 +767,7 @@ class CMissionActionRecvItem : public IMissionAction freeSlotcount -= invTemp->getUsedSlotCount(); maxBulk -= invTemp->getInventoryBulk(); } - + if( (neededSlotCount <= freeSlotcount) && ( neededBulk + invBag->getInventoryBulk() <= maxBulk) ) { fail = false; @@ -862,7 +862,7 @@ class CMissionActionRecvItem : public IMissionAction } params[2].Int = _Item.getQuality(); } - + params[0].SheetId = _SheetId; params[1].Int = _Quantity; PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_ITEM", params); @@ -1050,7 +1050,7 @@ class CMissionActionRecvNamedItem : public IMissionAction sint16 neededSlotCount = (sint16) ceil( (float)_Quantity / itemTmp->getMaxStackSize() ); uint32 neededBulk = _Quantity * itemTmp->getStackBulk(); itemTmp.deleteItem(); - + bool fail = true; for ( uint i = 0; i < entities.size(); i++ ) { @@ -1067,15 +1067,15 @@ class CMissionActionRecvNamedItem : public IMissionAction freeSlotcount -= invTemp->getUsedSlotCount(); maxBulk -= invTemp->getInventoryBulk(); } - + if( (neededSlotCount <= freeSlotcount) && ( neededBulk + invBag->getInventoryBulk() <= maxBulk) ) { fail = false; break; } } - } + if( fail ) { CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() ); @@ -1274,7 +1274,6 @@ class CMissionActionDestroyItem : // If the "guild" parameter is not set, we destroy the items for the users if (!_Guild) { - for ( uint i = 0; i < entities.size(); i++ ) { CCharacter * user = PlayerManager.getChar( entities[i] ); @@ -1303,7 +1302,6 @@ class CMissionActionDestroyItem : PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_DESTROY_ITEM", params); } } - } // We destroy the item in the guild else @@ -1909,7 +1907,6 @@ class CMissionActionRecvMoney : public IMissionAction // If the guild parameter is not set we just divide the money and give it to each entity if (!_Guild) { - uint amount = _Amount / (uint)entities.size(); if ( amount == 0 || _Amount % entities.size() ) amount++; @@ -1924,7 +1921,6 @@ class CMissionActionRecvMoney : public IMissionAction PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_MONEY",params); } } - } // Else we give the money to the guild else @@ -2026,7 +2022,6 @@ class CMissionActionRecvFame : public IMissionAction // If there is no "guild" parameter we give the fame to every user if (!_Guild) { - for ( uint i = 0; i < entities.size(); i++ ) { CEntityId eid = TheDataset.getEntityId(entities[i]); @@ -2037,12 +2032,10 @@ class CMissionActionRecvFame : public IMissionAction if (character) character->sendEventForMissionAvailabilityCheck(); } - } // Else we just give it to the guild else { - if (entities.size() == 0) return; @@ -2072,7 +2065,6 @@ class CMissionActionRecvFame : public IMissionAction if (character) character->sendEventForMissionAvailabilityCheck(); } - } }; diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp index bab69042a..a821eef45 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_queue_manager.cpp @@ -48,7 +48,7 @@ CMissionQueueManager::CMissionQueueManager() // ---------------------------------------------------------------------------- void CMissionQueueManager::init() { - string sFilename = MissionQueueFile; + string sFilename = MissionQueueFile.get(); sFilename = Bsi.getLocalPath() + sFilename; if (CFile::fileExists(sFilename)) @@ -141,7 +141,7 @@ void CMissionQueueManager::saveToFile() if( _InitOk ) { - string sFilename = MissionQueueFile; + string sFilename = MissionQueueFile.get(); // save file via Backup Service (BS) try diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_template.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_template.cpp index 7e99059b9..1caefb340 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_template.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_template.cpp @@ -170,7 +170,6 @@ uint32 IMissionStepTemplate::sendStepText(CCharacter * user,const std::vector(__k, CActiveStepStatePD())); + _States.insert(std::pair(__k, CActiveStepStatePD())); CActiveStepStatePD* __o = &(_States[__k]); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); @@ -2353,7 +2353,7 @@ void CMissionPD::pds__fetch(RY_PDS::CPData &data) if (rowIndex == RY_PDS::INVALID_ROW_INDEX || tableIndex == RY_PDS::INVALID_TABLE_INDEX) break; uint32 __k; data.serial(__k); - _Steps.insert(std::make_pair(__k, CActiveStepPD())); + _Steps.insert(std::pair(__k, CActiveStepPD())); CActiveStepPD* __o = &(_Steps[__k]); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); @@ -2367,7 +2367,7 @@ void CMissionPD::pds__fetch(RY_PDS::CPData &data) if (rowIndex == RY_PDS::INVALID_ROW_INDEX || tableIndex == RY_PDS::INVALID_TABLE_INDEX) break; uint32 __k; data.serial(__k); - _Compass.insert(std::make_pair(__k, CMissionCompassPD())); + _Compass.insert(std::pair(__k, CMissionCompassPD())); CMissionCompassPD* __o = &(_Compass[__k]); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); @@ -2381,7 +2381,7 @@ void CMissionPD::pds__fetch(RY_PDS::CPData &data) if (rowIndex == RY_PDS::INVALID_ROW_INDEX || tableIndex == RY_PDS::INVALID_TABLE_INDEX) break; uint32 __k; data.serial(__k); - _StepsDone.insert(std::make_pair(__k, CDoneStepPD())); + _StepsDone.insert(std::pair(__k, CDoneStepPD())); CDoneStepPD* __o = &(_StepsDone[__k]); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); @@ -2395,7 +2395,7 @@ void CMissionPD::pds__fetch(RY_PDS::CPData &data) if (rowIndex == RY_PDS::INVALID_ROW_INDEX || tableIndex == RY_PDS::INVALID_TABLE_INDEX) break; uint32 __k; data.serial(__k); - _Teleports.insert(std::make_pair(__k, CMissionTeleportPD())); + _Teleports.insert(std::pair(__k, CMissionTeleportPD())); CMissionTeleportPD* __o = &(_Teleports[__k]); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); @@ -2409,7 +2409,7 @@ void CMissionPD::pds__fetch(RY_PDS::CPData &data) if (rowIndex == RY_PDS::INVALID_ROW_INDEX || tableIndex == RY_PDS::INVALID_TABLE_INDEX) break; uint32 __k; data.serial(__k); - _InsidePlaces.insert(std::make_pair(__k, CMissionInsidePlacePD())); + _InsidePlaces.insert(std::pair(__k, CMissionInsidePlacePD())); CMissionInsidePlacePD* __o = &(_InsidePlaces[__k]); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); @@ -2423,7 +2423,7 @@ void CMissionPD::pds__fetch(RY_PDS::CPData &data) if (rowIndex == RY_PDS::INVALID_ROW_INDEX || tableIndex == RY_PDS::INVALID_TABLE_INDEX) break; uint32 __k; data.serial(__k); - _OutsidePlaces.insert(std::make_pair(__k, CMissionOutsidePlacePD())); + _OutsidePlaces.insert(std::pair(__k, CMissionOutsidePlacePD())); CMissionOutsidePlacePD* __o = &(_OutsidePlaces[__k]); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); @@ -2437,7 +2437,7 @@ void CMissionPD::pds__fetch(RY_PDS::CPData &data) if (rowIndex == RY_PDS::INVALID_ROW_INDEX || tableIndex == RY_PDS::INVALID_TABLE_INDEX) break; uint32 __k; data.serial(__k); - _HandledAIGroups.insert(std::make_pair(__k, CHandledAIGroupPD())); + _HandledAIGroups.insert(std::pair(__k, CHandledAIGroupPD())); CHandledAIGroupPD* __o = &(_HandledAIGroups[__k]); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); @@ -3276,7 +3276,7 @@ void CMissionContainerPD::pds__fetch(RY_PDS::CPData &data) uint32 __k; data.serial(__k); CMissionPD* __o = static_cast(PDSLib.create(tableIndex)); - _Missions.insert(std::make_pair(__k, __o)); + _Missions.insert(std::pair(__k, __o)); PDSLib.setRowIndex(rowIndex, __o); __o->pds__fetch(data); __o->pds__setParentUnnotified(this); diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/faber_action.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/faber_action.cpp index 50a069b5e..c49a45429 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/faber_action.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/faber_action.cpp @@ -388,7 +388,7 @@ protected: // compute success factor sint deltaLvl; float successFactor = CFaberActionCommon::getSuccessFactor( character, phrase, deltaLvl ); - + // final item quality, depending of recommended skill of action used and lower quality of raw materials used and success factor of action uint16 finalItemQuality = max( (uint16)1, (uint16) (min(phrase->getLowerRmQuality(),(uint16)phrase->getRecommendedSkill()) * successFactor) ); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.cpp b/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.cpp index d54dbd694..44205d02a 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.cpp @@ -284,7 +284,7 @@ void CCDBStructNodeBranch::init( xmlNodePtr node, NLMISC::IProgressCallback &pro { // dealing with an array of entries uint countAsInt; - NLMISC::fromString(count, countAsInt); + NLMISC::fromString(count.str(), countAsInt); nlassert((const char *) count != NULL); for (uint i=0;igetMissionUniqueIdFromName( "ZORAI_NEWB_WELCOME_SHENG_WO_1" ); CAIAliasTranslator::getInstance()->getNPCAliasesFromName("welcomer_sheng_wo_1", bots); - break; + break; + default: + break; } } // other give him a rite intro mission diff --git a/code/ryzom/server/src/entities_game_service/player_manager/db_string_updater.h b/code/ryzom/server/src/entities_game_service/player_manager/db_string_updater.h index 059e7d765..7603c92e9 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/db_string_updater.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/db_string_updater.h @@ -53,6 +53,7 @@ class CDBStringUpdater : public NLMISC::CSingleton // hasher for the identifier struct THashDBStringLeaf { + enum { bucket_size = 4, min_buckets = 8, }; size_t operator()(const TBDStringLeaf &stringLeaf) const { return ((size_t)stringLeaf.ClientDB>>4) ^ ((size_t)stringLeaf.Node>>4); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player_manager.h b/code/ryzom/server/src/entities_game_service/player_manager/player_manager.h index 9f1643e84..ba0d1c306 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player_manager.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/player_manager.h @@ -48,9 +48,9 @@ namespace NLNET extern CGenericXmlMsgHeaderManager GenericMsgManager; -class CServiceIdHash +struct CServiceIdHash { -public: + enum { bucket_size = 4, min_buckets = 8, }; size_t operator () ( const NLNET::TServiceId &sid ) const { return sid.get(); } }; diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player_manager_interface.h b/code/ryzom/server/src/entities_game_service/player_manager/player_manager_interface.h index a18e1645a..3e5de3130 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player_manager_interface.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/player_manager_interface.h @@ -41,9 +41,9 @@ public: }; - class CUint32Hash + struct CUint32Hash { - public: + enum { bucket_size = 4, min_buckets = 8, }; size_t operator () ( const uint32 &i ) const { return i; } }; diff --git a/code/ryzom/server/src/entities_game_service/progression/progression_pve.h b/code/ryzom/server/src/entities_game_service/progression/progression_pve.h index 11d538ea4..2c9e9aba2 100644 --- a/code/ryzom/server/src/entities_game_service/progression/progression_pve.h +++ b/code/ryzom/server/src/entities_game_service/progression/progression_pve.h @@ -279,7 +279,6 @@ struct CCreatureTakenDamage { if ( PlayerInflictedDamage[i].TotalDamage > maxDmg ) { - nlinfo("set damage by player"); maxDmg = PlayerInflictedDamage[i].TotalDamage; index = (sint16)i; } diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_faction_reward_manager/pvp_faction_reward_manager.cpp b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_faction_reward_manager/pvp_faction_reward_manager.cpp index 85579dcf8..50b039522 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_faction_reward_manager/pvp_faction_reward_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_faction_reward_manager/pvp_faction_reward_manager.cpp @@ -1058,8 +1058,9 @@ NLMISC_COMMAND(getEffects, "get effects of a spire"," " ) return false; else { - float x = (float)atof(args[0].c_str()); - float y = (float)atof(args[1].c_str()); + float x, y; + NLMISC::fromString(args[0], x); + NLMISC::fromString(args[1], y); NLMISC::CVector vec( x, y, 0.0f ); @@ -1101,8 +1102,9 @@ NLMISC_COMMAND(buildSpirePos, "build a spire"," ") return true; } - float x = (float)atof(args[1].c_str()); - float y = (float)atof(args[2].c_str()); + float x, y; + NLMISC::fromString(args[1], x); + NLMISC::fromString(args[2], y); NLMISC::CVector vec( x, y, 0.0f ); @@ -1138,8 +1140,9 @@ NLMISC_COMMAND(destroySpirePos, "destroy a spire"," ") return false; else { - float x = (float)atof(args[0].c_str()); - float y = (float)atof(args[1].c_str()); + float x, y; + NLMISC::fromString(args[0], x); + NLMISC::fromString(args[1], y); NLMISC::CVector vec( x, y, 0.0f ); @@ -1178,8 +1181,9 @@ NLMISC_COMMAND(getEffectsPos, "get effects of a spire"," " ) return true; } - float x = (float)atof(args[1].c_str()); - float y = (float)atof(args[2].c_str()); + float x, y; + NLMISC::fromString(args[1], x); + NLMISC::fromString(args[2], y); NLMISC::CVector vec( x, y, 0.0f ); @@ -1265,8 +1269,9 @@ NLMISC_COMMAND(getRegionOwner, "display the faction which currently owns the reg return false; else { - float x = (float)atof(args[0].c_str()); - float y = (float)atof(args[1].c_str()); + float x, y; + NLMISC::fromString(args[0], x); + NLMISC::fromString(args[1], y); NLMISC::CVector vec( x, y, 0.0f ); @@ -1294,8 +1299,9 @@ NLMISC_COMMAND(getSpireStats, "display the status of spire in region correspondi return false; else { - float x = (float)atof(args[0].c_str()); - float y = (float)atof(args[1].c_str()); + float x, y; + NLMISC::fromString(args[0], x); + NLMISC::fromString(args[1], y); NLMISC::CVector vec( x, y, 0.0f ); diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp index 6beb7b1b2..7f42a671c 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp @@ -211,13 +211,16 @@ std::vector CPVPManager2::getCharacterChannels(CCharacter * user) result.clear(); // Add lang channel, should be first. - if (!user->getLangChannel().empty()) { + if (!user->getLangChannel().empty()) + { TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(user->getLangChannel()); if (it != _ExtraFactionChannel.end()) { result.push_back((*it).second); } - } else { + } + else + { TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("en"); if (it != _ExtraFactionChannel.end()) { diff --git a/code/ryzom/server/src/entities_game_service/shop_type/character_shopping_list.cpp b/code/ryzom/server/src/entities_game_service/shop_type/character_shopping_list.cpp index d23945d25..e024334c2 100644 --- a/code/ryzom/server/src/entities_game_service/shop_type/character_shopping_list.cpp +++ b/code/ryzom/server/src/entities_game_service/shop_type/character_shopping_list.cpp @@ -460,9 +460,9 @@ void CCharacterShoppingList::initPageToUpdate( uint32 nbSlotPerPage ) void CCharacterShoppingList::fillTradePage( uint16 session ) { /* -- Ajout de TRADING:*:PRICE_RETIRE (utile que si SELLER_TYPE == User ou ResaleAndUser). Note: Prix UNITAIRE (si MP, Ammo etc..) -- Si SELLER_TYPE==User seulement: Si PRICE==-1, alors cela veut dire " Item Sold " (pour afficher la liste des items vendus les plus récents) -- Note: TRADING:*:PRICE reste un Prix UNITAIRE (si MP, Ammo etc..) (cela devait déja être le cas) +- Added TRADING:*:PRICE_RETIRE (only useful if SELLER_TYPE == User or ResaleAndUser). Note: UNIT price (if Raw Mats, Ammo, etc..) +- If SELLER_TYPE==User only: if PRICE==-1, then it means " Item Sold " (to display list of more recent sold items) +- Note: TRADING:*:PRICE is wtill a UNIT price (if Raw Mats, Ammo, etc..) (it should already be the case) */ // get page to update if any diff --git a/code/ryzom/server/src/frontend_service/client_entity_id_translator.h b/code/ryzom/server/src/frontend_service/client_entity_id_translator.h index 0f18698c5..f80fbe983 100644 --- a/code/ryzom/server/src/frontend_service/client_entity_id_translator.h +++ b/code/ryzom/server/src/frontend_service/client_entity_id_translator.h @@ -89,10 +89,11 @@ public: private: - class CHash + struct CHash { - public: - size_t operator () ( const TEntityIndex& index ) const { return index.getIndex(); } + enum { bucket_size = 4, min_buckets = 8, }; + size_t operator () (const TEntityIndex& index) const { return index.getIndex(); } + bool operator() (const TEntityIndex& left, const TEntityIndex& right) { return left < right; } }; // table to map CEntityId to TCLEntityId diff --git a/code/ryzom/server/src/frontend_service/client_id_lookup.h b/code/ryzom/server/src/frontend_service/client_id_lookup.h index 3d6db560e..9c63a60a6 100644 --- a/code/ryzom/server/src/frontend_service/client_id_lookup.h +++ b/code/ryzom/server/src/frontend_service/client_id_lookup.h @@ -114,11 +114,11 @@ private: typedef std::vector TEntityIndexToClient; - class CIdHash + struct CIdHash { - public: - - size_t operator () ( NLMISC::CEntityId id ) const { return (uint32)id.getShortId(); } + enum { bucket_size = 4, min_buckets = 8, }; + size_t operator () (NLMISC::CEntityId id) const { return (uint32)id.getShortId(); } + bool operator() (const NLMISC::CEntityId& left, const NLMISC::CEntityId& right) { return left < right; } }; typedef CHashMap TIdToClientMap; diff --git a/code/ryzom/server/src/frontend_service/fe_types.h b/code/ryzom/server/src/frontend_service/fe_types.h index 747fd6f9e..d63ef1e42 100644 --- a/code/ryzom/server/src/frontend_service/fe_types.h +++ b/code/ryzom/server/src/frontend_service/fe_types.h @@ -69,16 +69,15 @@ typedef uint32 TUid; /** * CInetAddress hash function */ -class CInetAddressHashMapTraits +struct CInetAddressHashMapTraits { -public: - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; inline size_t operator() ( const NLNET::CInetAddress& x ) const { //return x.port(); return x.internalIPAddress(); } + bool operator() (const NLNET::CInetAddress& left, const NLNET::CInetAddress& right) { return left < right; } // bool operator() (const NLNET::CInetAddress &x1, const NLNET::CInetAddress &x2) const // { // return classId1 < classId2; diff --git a/code/ryzom/server/src/frontend_service/frontend_service.cpp b/code/ryzom/server/src/frontend_service/frontend_service.cpp index cbf4a5610..c973ebcfd 100644 --- a/code/ryzom/server/src/frontend_service/frontend_service.cpp +++ b/code/ryzom/server/src/frontend_service/frontend_service.cpp @@ -1862,7 +1862,7 @@ NLMISC_COMMAND( dumpImpulseStats, "Dump Impulse stat to XML log", " [[- if (reverse) comp = -comp; - result.push_back(std::make_pair(comp, client)); + result.push_back(std::pair(comp, client)); } if (ucriterion != 0 && !result.empty()) diff --git a/code/ryzom/server/src/frontend_service/vision_provider.h b/code/ryzom/server/src/frontend_service/vision_provider.h index 39d84fb2f..aaca90869 100644 --- a/code/ryzom/server/src/frontend_service/vision_provider.h +++ b/code/ryzom/server/src/frontend_service/vision_provider.h @@ -84,6 +84,8 @@ class CClientIdLookup; // Hash function: ClientId * 256 + CeId struct CHash { + static const size_t bucket_size = 4; + static const size_t min_buckets = 8; size_t operator() ( TPairClientSlot pair ) const { return (pair.ClientId << 8) + pair.Slot; } }; diff --git a/code/ryzom/server/src/gpm_service/commands.cpp b/code/ryzom/server/src/gpm_service/commands.cpp index 127074856..8e5c8d1b8 100644 --- a/code/ryzom/server/src/gpm_service/commands.cpp +++ b/code/ryzom/server/src/gpm_service/commands.cpp @@ -179,8 +179,8 @@ NLMISC_COMMAND(getPatatEntryIndex, "Get the patat entry index at a pos", "x, y") CVector pos; - pos.x = (float)atof(args[0].c_str()); - pos.y = (float)atof(args[1].c_str()); + NLMISC::fromString(args[0], pos.x); + NLMISC::fromString(args[1], pos.y); pos.z = 0; nlinfo("entryIndex(%.1f, %.1f) = %d", pos.x, pos.y, CWorldPositionManager::getEntryIndex(pos)); diff --git a/code/ryzom/server/src/gpm_service/world_position_manager.cpp b/code/ryzom/server/src/gpm_service/world_position_manager.cpp index 2c10878a6..9674541fc 100644 --- a/code/ryzom/server/src/gpm_service/world_position_manager.cpp +++ b/code/ryzom/server/src/gpm_service/world_position_manager.cpp @@ -504,7 +504,7 @@ void CWorldPositionManager::triggerSubscribe(NLNET::TServiceId serviceId, const STOP_IF(IsRingShard,"Illegal use of CWorldPositionManager on ring shard"); if (_PatatSubscribeManager.exist(name)) { - _PatatSubscribeManager.subscribe(serviceId, make_pair(name, id)); + _PatatSubscribeManager.subscribe(serviceId, std::pair(name, id)); } } @@ -2113,7 +2113,7 @@ void CWorldPositionManager::movePlayer(CWorldEntity *entity, sint32 x, sint32 y, { if (entity->PlayerInfos->DistanceHistory.size() >= 20) entity->PlayerInfos->DistanceHistory.pop_back(); - entity->PlayerInfos->DistanceHistory.push_front(make_pair(CVectorD(x*0.001, y*0.001, z*0.001), tick)); + entity->PlayerInfos->DistanceHistory.push_front(std::pair(CVectorD(x*0.001, y*0.001, z*0.001), tick)); } #endif @@ -3227,7 +3227,7 @@ void CWorldPositionManager::visionRequest(sint32 x, sint32 y, sint32 range, vect if (abs(x - entity->X) < range && abs(y - entity->Y) < range && (rrange = sqrt(sqr((x - entity->X)*0.001) + sqr((y - entity->Y)*0.001))) < frange) { - entities.push_back(make_pair(entity->Id, (sint32)(rrange*1000))); + entities.push_back(std::pair(entity->Id, (sint32)(rrange * 1000))); } } @@ -3240,7 +3240,7 @@ void CWorldPositionManager::visionRequest(sint32 x, sint32 y, sint32 range, vect if (abs(x - entity->X) < range && abs(y - entity->Y) < range && (rrange = sqrt(sqr((x - entity->X)*0.001) + sqr((y - entity->Y)*0.001))) < frange) { - entities.push_back(make_pair(entity->Id, (sint32)(rrange*1000))); + entities.push_back(std::pair(entity->Id, (sint32)(rrange * 1000))); } } } diff --git a/code/ryzom/server/src/gpm_service/world_position_manager.h b/code/ryzom/server/src/gpm_service/world_position_manager.h index 75ea9ead5..81209357c 100644 --- a/code/ryzom/server/src/gpm_service/world_position_manager.h +++ b/code/ryzom/server/src/gpm_service/world_position_manager.h @@ -137,10 +137,11 @@ public: //friend void CWorldEntity::createPrimitive(NLPACS::UMoveContainer *pMoveContainer, uint8 worldImage); friend void CWorldEntity::removePrimitive(); - class CEntityIdHash + struct CEntityIdHash { - public: - size_t operator () ( const NLMISC::CEntityId &id ) const { return (uint32)id.getShortId(); } + enum { bucket_size = 4, min_buckets = 8, }; + size_t operator () (const NLMISC::CEntityId &id) const { return (uint32)id.getShortId(); } + size_t operator () (const NLMISC::CEntityId &left, const NLMISC::CEntityId &right) const { return left < right; } }; /// Container of entities (all entities are referenced by this container diff --git a/code/ryzom/server/src/input_output_service/chat_manager.cpp b/code/ryzom/server/src/input_output_service/chat_manager.cpp index fbc38ead5..aedfa063f 100644 --- a/code/ryzom/server/src/input_output_service/chat_manager.cpp +++ b/code/ryzom/server/src/input_output_service/chat_manager.cpp @@ -94,21 +94,21 @@ void CChatManager::onServiceDown(const std::string &serviceShortName) switch (cg.Type) { - case CChatGroup::universe: - case CChatGroup::say: - case CChatGroup::shout: - continue; - case CChatGroup::team: - case CChatGroup::guild: - case CChatGroup::civilization: - case CChatGroup::territory: - case CChatGroup::tell: - case CChatGroup::arround: - case CChatGroup::system: - case CChatGroup::region: - case CChatGroup::dyn_chat: - groupToRemove.push_back(gid); - break; + case CChatGroup::universe: + case CChatGroup::say: + case CChatGroup::shout: + continue; + case CChatGroup::team: + case CChatGroup::guild: + case CChatGroup::civilization: + case CChatGroup::territory: + case CChatGroup::tell: + case CChatGroup::arround: + case CChatGroup::system: + case CChatGroup::region: + case CChatGroup::dyn_chat: + groupToRemove.push_back(gid); + break; } } @@ -121,7 +121,7 @@ void CChatManager::onServiceDown(const std::string &serviceShortName) // clear muted players table _MutedUsers.clear(); - + // clear the dyn chats _DynChat.removeAllChannels(); } @@ -151,9 +151,11 @@ bool CChatManager::checkClient( const TDataSetRow& id ) void CChatManager::addClient( const TDataSetRow& id ) { if (VerboseChatManagement) - nldebug("IOSCM: addClient : adding client %s:%x into chat manager and universe group.", + { + nldebug("IOSCM: addClient : adding client %s:%x into chat manager and universe group.", TheDataset.getEntityId(id).toString().c_str(), id.getIndex()); + } if(id.getIndex() == 0xffffff) { @@ -197,10 +199,11 @@ void CChatManager::addClient( const TDataSetRow& id ) void CChatManager::removeClient( const TDataSetRow& id ) { if (VerboseChatManagement) - nldebug("IOSCM: removeClient : removing the client %s:%x from chat manager !", + { + nldebug("IOSCM: removeClient : removing the client %s:%x from chat manager !", TheDataset.getEntityId(id).toString().c_str(), id.getIndex()); - + } TClientInfoCont::iterator itCl = _Clients.find( id ); if( itCl != _Clients.end() ) @@ -214,7 +217,7 @@ void CChatManager::removeClient( const TDataSetRow& id ) } else { - nlwarning("CChatManager::removeClient : The client %s:%x is unknown !", + nlwarning("CChatManager::removeClient : The client %s:%x is unknown !", TheDataset.getEntityId(id).toString().c_str(), id.getIndex()); } @@ -233,7 +236,7 @@ CChatClient& CChatManager::getClient( const TDataSetRow& id ) TClientInfoCont::iterator itCl = _Clients.find( id ); if( itCl != _Clients.end() ) { - return *(itCl->second); + return *(itCl->second); } else { @@ -259,15 +262,15 @@ void CChatManager::addGroup( TGroupId gId, CChatGroup::TGroupType gType, const s { if (!groupName.empty()) nldebug("IOSCM: addGroup : adding %s named chat group %s as '%s'", - CChatGroup::groupTypeToString(gType).c_str(), + CChatGroup::groupTypeToString(gType).c_str(), gId.toString().c_str(), groupName.c_str()); else nldebug("IOSCM: addGroup : adding %s anonymous chat group %s", - CChatGroup::groupTypeToString(gType).c_str(), + CChatGroup::groupTypeToString(gType).c_str(), gId.toString().c_str()); } - + map< TGroupId, CChatGroup >::iterator itGrp = _Groups.find( gId ); if( itGrp == _Groups.end() ) { @@ -290,7 +293,7 @@ void CChatManager::addGroup( TGroupId gId, CChatGroup::TGroupType gType, const s { nlwarning("CChatManager::addGroup : the group %s already exists", gId.toString().c_str()); } - + } // addGroup // @@ -302,8 +305,10 @@ void CChatManager::addGroup( TGroupId gId, CChatGroup::TGroupType gType, const s void CChatManager::removeGroup( TGroupId gId ) { if (VerboseChatManagement) + { nldebug("IOSCM: removeGroup : removing group %s", gId.toString().c_str()); + } map< TGroupId, CChatGroup >::iterator itGrp = _Groups.find( gId ); if( itGrp != _Groups.end() ) @@ -338,10 +343,12 @@ void CChatManager::removeGroup( TGroupId gId ) void CChatManager::addToGroup( TGroupId gId, const TDataSetRow &charId ) { if (VerboseChatManagement) + { nldebug("IOSCM: addtoGroup : adding player %s:%x to group %s", TheDataset.getEntityId(charId).toString().c_str(), charId.getIndex(), gId.toString().c_str()); + } map< TGroupId, CChatGroup >::iterator itGrp = _Groups.find( gId ); if( itGrp != _Groups.end() ) @@ -372,7 +379,7 @@ void CChatManager::addToGroup( TGroupId gId, const TDataSetRow &charId ) } else { - nlwarning("CChatManager::addToGroup : client %s:%x is unknown", + nlwarning("CChatManager::addToGroup : client %s:%x is unknown", TheDataset.getEntityId(charId).toString().c_str(), charId.getIndex()); // remove it from the group (don't leave bad client...) @@ -396,10 +403,12 @@ void CChatManager::addToGroup( TGroupId gId, const TDataSetRow &charId ) void CChatManager::removeFromGroup( TGroupId gId, const TDataSetRow &charId ) { if (VerboseChatManagement) + { nldebug("IOSCM: removeFromGroup : removing player %s:%x from group %s", TheDataset.getEntityId(charId).toString().c_str(), - charId.getIndex(), + charId.getIndex(), gId.toString().c_str()); + } map< TGroupId, CChatGroup >::iterator itGrp = _Groups.find( gId ); if( itGrp != _Groups.end() ) @@ -443,7 +452,7 @@ void CChatManager::removeFromGroup( TGroupId gId, const TDataSetRow &charId ) } // removeFromGroup // - + //----------------------------------------------- @@ -486,7 +495,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) } // CEntityId eid = TheDataset.getEntityId(sender); - // Get the char info + // Get the char info //WARNING: can be NULL CCharacterInfos *ci = IOS->getCharInfos(eid); @@ -525,7 +534,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) // clean up container _DestUsers.clear(); - + switch( itCl->second->getChatMode() ) { // dynamic group @@ -533,7 +542,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) case CChatGroup::say : { CChatGroup::TMemberCont::iterator itA; - for( itA = itCl->second->getAudience().Members.begin(); + for( itA = itCl->second->getAudience().Members.begin(); itA != itCl->second->getAudience().Members.end(); ++itA ) { @@ -566,7 +575,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) // so even after teleporting in a remote region the previous around people were still receiving // the messages. - TGroupId grpId = itCl->second->getRegionChatGroup(); + TGroupId grpId = itCl->second->getRegionChatGroup(); _DestUsers.push_back(grpId); _Log.displayNL("'%s' (%s) : \t\"%s\"", senderName.c_str(), groupNames[itCl->second->getChatMode()], ucstr.toString().c_str() ); @@ -599,7 +608,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) // } // } - TGroupId grpId = CEntityId(RYZOMID::chatGroup,0); + TGroupId grpId = CEntityId(RYZOMID::chatGroup, 0); _Log.displayNL("'%s' (%s) : \t\"%s\"", senderName.c_str(), groupNames[itCl->second->getChatMode()], ucstr.toString().c_str() ); _DestUsers.push_back(grpId); @@ -621,15 +630,15 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) TGroupId grpId = itCl->second->getGuildChatGroup(); _DestUsers.push_back(grpId); - _Log.displayNL("'%s' (%s) : \t\"%s\"", - senderName.c_str(), - groupNames[itCl->second->getChatMode()], + _Log.displayNL("'%s' (%s) : \t\"%s\"", + senderName.c_str(), + groupNames[itCl->second->getChatMode()], ucstr.toString().c_str() ); chatInGroup( grpId, ucstr, sender ); } break; case CChatGroup::dyn_chat: - { + { TChanID chanID = itCl->second->getDynChatChan(); CDynChatSession *session = _DynChat.getSession(chanID, sender); if (session) // player must have a session in that channel @@ -650,7 +659,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) if (!session->getChan()->getDontBroadcastPlayerInputs()) { - // add msg to the historic + // add msg to the historic CDynChatChan::CHistoricEntry entry; entry.String = ucstr; if (ci != NULL) @@ -671,15 +680,15 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) ucstring tmp("{no_bubble}"); if (ucstr.find(tmp) == ucstring::npos) { - tmp += ucstr; + tmp += ucstr; content.swap(tmp); } else { content = ucstr; } - } - + } + // broadcast to other client in the channel CDynChatSession *dcc = session->getChan()->getFirstSession(); @@ -687,7 +696,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) { sendChat(itCl->second->getChatMode(), dcc->getClient()->getID(), content, sender, chanID); dcc = dcc->getNextChannelSession(); // next session in this channel - } + } } else { @@ -702,11 +711,11 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) TPlayerInputForward pif; pif.ChanID = chanID; pif.Sender = sender; - pif.Content = ucstr; + pif.Content = ucstr; CMessage msgout( "DYN_CHAT:FORWARD"); msgout.serial(pif); - + CUnifiedNetwork::getInstance()->send(serviceId, msgout); } if (session->getChan()->getUnifiedChannel()) @@ -716,19 +725,19 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) IChatUnifierClient::getInstance()->sendUnifiedDynChat(session->getChan()->getID(), senderName, ucstr); } } - } + } } break; // static group default : nlwarning(" client %u chat in %s ! don't know how to handle it.", - sender.getIndex(), + sender.getIndex(), groupNames[itCl->second->getChatMode()]); /* { TGroupId grpId = itCl->second.getChatGroup(); _Log.displayNL("'%s' (%s) : \t\"%s\"", senderName.c_str(), groupNames[itCl->second.getChatMode()], ucstr.toString().c_str() ); - + chatInGroup( grpId, ucstr, sender ); } */ } @@ -736,8 +745,8 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) // log chat to PDS system // IOSPD::logChat(ucstr, itCl->second->getId(), _DestUsers); log_Chat_Chat(CChatGroup::groupTypeToString(itCl->second->getChatMode()), - TheDataset.getEntityId(sender), - ucstr.toUtf8(), + TheDataset.getEntityId(sender), + ucstr.toUtf8(), _DestUsers); } @@ -770,7 +779,7 @@ void CChatManager::chatInGroup( TGroupId& grpId, const ucstring& ucstr, const TD CMirrorPropValueRO instanceId( TheDataset, *itM, DSPropertyAI_INSTANCE ); // check the ai instance for region chat - if (chatGrp.Type != CChatGroup::region + if (chatGrp.Type != CChatGroup::region || instanceId == senderInstanceId) { // check homeSessionId for universe @@ -795,7 +804,7 @@ void CChatManager::chatInGroup( TGroupId& grpId, const ucstring& ucstr, const TD _DestUsers.push_back(TheDataset.getEntityId(*itM)); } } - } + } if (chatGrp.Type == CChatGroup::guild) { @@ -855,7 +864,7 @@ void CChatManager::farChatInGroup(TGroupId &grpId, uint32 homeSessionId, const u continue; } sendFarChat( itGrp->second.Type, *itM, text, senderName ); - } + } } else { @@ -885,7 +894,7 @@ void CChatManager::chat2( const TDataSetRow& sender, const std::string &phraseId case CChatGroup::shout : { CChatGroup::TMemberCont::iterator itA; - for( itA = itCl->second->getAudience().Members.begin(); + for( itA = itCl->second->getAudience().Members.begin(); itA != itCl->second->getAudience().Members.end(); ++itA ) { @@ -900,7 +909,7 @@ void CChatManager::chat2( const TDataSetRow& sender, const std::string &phraseId chatInGroup2( grpId, phraseId, sender ); } break; - + case CChatGroup::universe: { @@ -937,7 +946,7 @@ void CChatManager::chat2( const TDataSetRow& sender, const std::string &phraseId { nlwarning(" client %s:%x chat in mode %u ! don't know how to handle it.", TheDataset.getEntityId(sender).toString().c_str(), - sender.getIndex(), + sender.getIndex(), itCl->second->getChatMode()); } } @@ -973,7 +982,7 @@ void CChatManager::chatParam( const TDataSetRow& sender, const std::string &phra case CChatGroup::shout : { CChatGroup::TMemberCont::iterator itA; - for( itA = itCl->second->getAudience().Members.begin(); + for( itA = itCl->second->getAudience().Members.begin(); itA != itCl->second->getAudience().Members.end(); ++itA ) { @@ -988,7 +997,7 @@ void CChatManager::chatParam( const TDataSetRow& sender, const std::string &phra chatParamInGroup( grpId, phraseId, params, sender ); } break; - + case CChatGroup::universe: { @@ -1025,7 +1034,7 @@ void CChatManager::chatParam( const TDataSetRow& sender, const std::string &phra { nlwarning(" client %s:%x chat in mode %u ! don't know how to handle it.", TheDataset.getEntityId(sender).toString().c_str(), - sender.getIndex(), + sender.getIndex(), itCl->second->getChatMode()); } } @@ -1049,7 +1058,7 @@ void CChatManager::chat2Ex( const TDataSetRow& sender, uint32 phraseId) CEntityId eid = TheDataset.getEntityId(sender); if(_MutedUsers.find( eid ) != _MutedUsers.end()) { - nldebug("IOSCM: chat2Ex The player %s:%x is muted", + nldebug("IOSCM: chat2Ex The player %s:%x is muted", TheDataset.getEntityId(sender).toString().c_str(), sender.getIndex()); return; @@ -1061,7 +1070,7 @@ void CChatManager::chat2Ex( const TDataSetRow& sender, uint32 phraseId) case CChatGroup::shout : { CChatGroup::TMemberCont::iterator itA; - for( itA = itCl->second->getAudience().Members.begin(); + for( itA = itCl->second->getAudience().Members.begin(); itA != itCl->second->getAudience().Members.end(); ++itA ) { @@ -1076,7 +1085,7 @@ void CChatManager::chat2Ex( const TDataSetRow& sender, uint32 phraseId) chatInGroup2Ex( grpId, phraseId, sender ); } break; - + case CChatGroup::universe: { CEntityId eid = TheDataset.getEntityId(sender); @@ -1098,21 +1107,21 @@ void CChatManager::chat2Ex( const TDataSetRow& sender, uint32 phraseId) chatInGroup2Ex( grpId, phraseId, sender ); } break; - + case CChatGroup::guild: { TGroupId grpId = itCl->second->getGuildChatGroup(); chatInGroup2Ex( grpId, phraseId, sender ); } break; - - + + // static group default : { nlwarning(" client %s:%x chat in mode %u ! don't know how to handle it.", TheDataset.getEntityId(sender).toString().c_str(), - sender.getIndex(), + sender.getIndex(), itCl->second->getChatMode()); // TGroupId grpId = (*itCl).second.getChatGroup(); // chatInGroup2( grpId, phraseId, sender ); @@ -1141,7 +1150,7 @@ void CChatManager::chatInGroup2Ex( TGroupId& grpId, uint32 phraseId, const TData { CMirrorPropValueRO instanceId( TheDataset, *itM, DSPropertyAI_INSTANCE ); - if (chatGrp.Type != CChatGroup::region + if (chatGrp.Type != CChatGroup::region || instanceId == senderInstanceId) { const CEntityId &eid = TheDataset.getEntityId(*itM); @@ -1184,14 +1193,14 @@ void CChatManager::chatInGroup2( TGroupId& grpId, const std::string & phraseId, CMirrorPropValueRO instanceId( TheDataset, *itM, DSPropertyAI_INSTANCE ); // check the ai instance for region chat - if (chatGrp.Type != CChatGroup::region + if (chatGrp.Type != CChatGroup::region || instanceId == senderInstanceId) { const CEntityId &eid = TheDataset.getEntityId(*itM); if (eid.getType() == RYZOMID::player && std::find( excluded.begin(), excluded.end(), *itM ) == excluded.end() ) sendChat2( (*itGrp ).second.Type, *itM, phraseId, sender ); } - } + } if (chatGrp.Type == CChatGroup::guild) { CCharacterInfos *charInfos = IOS->getCharInfos(TheDataset.getEntityId(sender)); @@ -1232,7 +1241,7 @@ void CChatManager::chatParamInGroup( TGroupId& grpId, const std::string & phrase if (eid.getType() == RYZOMID::player && std::find( excluded.begin(), excluded.end(), *itM ) == excluded.end() ) sendChat2( (*itGrp ).second.Type, *itM, phraseId, sender ); } - } + } if (chatGrp.Type == CChatGroup::guild) { CCharacterInfos *charInfos = IOS->getCharInfos(TheDataset.getEntityId(sender)); @@ -1278,10 +1287,10 @@ void CChatManager::sendEmoteTextToAudience( const TDataSetRow& sender,const std TChanID oldChan = itCl->second->getDynChatChan(); itCl->second->setChatMode(CChatGroup::say); itCl->second->updateAudience(); - + // get audience around the emoting player CChatGroup::TMemberCont::iterator itA; - for( itA = itCl->second->getAudience().Members.begin(); + for( itA = itCl->second->getAudience().Members.begin(); itA != itCl->second->getAudience().Members.end(); ++itA ) { @@ -1329,10 +1338,10 @@ void CChatManager::sendEmoteCustomTextToAll( const TDataSetRow& sender, const uc TChanID oldChan = itCl->second->getDynChatChan(); itCl->second->setChatMode(CChatGroup::say); itCl->second->updateAudience(); - + // get audience around the emoting player CChatGroup::TMemberCont::iterator itA; - for( itA = itCl->second->getAudience().Members.begin(); + for( itA = itCl->second->getAudience().Members.begin(); itA != itCl->second->getAudience().Members.end(); ++itA ) { @@ -1347,7 +1356,7 @@ void CChatManager::sendEmoteCustomTextToAll( const TDataSetRow& sender, const uc TheDataset.getEntityId(sender).toString().c_str(), sender.getIndex()); } - + } @@ -1386,7 +1395,7 @@ void CChatManager::sendEmoteCustomTextToAll( const TDataSetRow& sender, const uc // bms.serial( index ); // bms.serial( infos->Str ); // } -// +// //// nldebug(" sending association [%s,%d] to %s",infos->Str.c_str(),index,receiver.toString().c_str()); // msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length()); // sendMessageViaMirror(frontendId, msgout); @@ -1406,7 +1415,7 @@ void CChatManager::sendEmoteCustomTextToAll( const TDataSetRow& sender, const uc // //----------------------------------------------- void CChatManager::sendChat( CChatGroup::TGroupType senderChatMode, const TDataSetRow &receiver, const ucstring& ucstr, const TDataSetRow &sender, TChanID chanID, const ucstring &senderName) -{ +{ //if( receiver != sender ) { CCharacterInfos * charInfos = NULL; @@ -1440,14 +1449,14 @@ void CChatManager::sendChat( CChatGroup::TGroupType senderChatMode, const TDataS } uint32 senderNameIndex; - // if the sender exists + // if the sender exists if( charInfos ) { senderNameIndex = charInfos->NameIndex; } else { - // if no sender, we use a special name + // if no sender, we use a special name ucstring senderName(""); senderNameIndex = SM->storeString( senderName ); } @@ -1466,14 +1475,14 @@ void CChatManager::sendChat( CChatGroup::TGroupType senderChatMode, const TDataS msgout.serial( channel ); CBitMemStream bms; GenericXmlMsgHeaderMngr.pushNameToStream( "STRING:CHAT", bms ); - + CChatMsg chatMsg; chatMsg.CompressedIndex = sender.getCompressedIndex(); chatMsg.SenderNameId = senderNameIndex; chatMsg.ChatMode = (uint8) senderChatMode; if (senderChatMode == CChatGroup::dyn_chat) - { - chatMsg.DynChatChanID = chanID; + { + chatMsg.DynChatChanID = chanID; } chatMsg.Content = ucstr; bms.serial( chatMsg ); @@ -1483,7 +1492,7 @@ void CChatManager::sendChat( CChatGroup::TGroupType senderChatMode, const TDataS chatMsg.Sender, receiver.toString().c_str(), chatMsg.ChatMode); - */ + */ msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length()); sendMessageViaMirror(TServiceId(receiverInfos->EntityId.getDynamicId()), msgout); } @@ -1500,7 +1509,7 @@ void CChatManager::sendChat( CChatGroup::TGroupType senderChatMode, const TDataS nlwarning(" The character %s:%x is unknown, no chat msg sent", TheDataset.getEntityId(receiver).toString().c_str(), receiver.getIndex()); - } + } } } // sendChat // @@ -1526,14 +1535,14 @@ void CChatManager::sendFarChat( CChatGroup::TGroupType senderChatMode, const TDa msgout.serial( channel ); CBitMemStream bms; GenericXmlMsgHeaderMngr.pushNameToStream( "STRING:CHAT", bms ); - + CChatMsg chatMsg; chatMsg.CompressedIndex = 0xFFFFF; chatMsg.SenderNameId = senderNameIndex; chatMsg.ChatMode = (uint8) senderChatMode; if (senderChatMode == CChatGroup::dyn_chat) - { - chatMsg.DynChatChanID = chanID; + { + chatMsg.DynChatChanID = chanID; } chatMsg.Content = ucstr; bms.serial( chatMsg ); @@ -1554,7 +1563,7 @@ void CChatManager::sendFarChat( CChatGroup::TGroupType senderChatMode, const TDa nlwarning(" The character %s:%x is unknown, no chat msg sent", TheDataset.getEntityId(receiver).toString().c_str(), receiver.getIndex()); - } + } } @@ -1584,7 +1593,7 @@ void CChatManager::sendChatParam( CChatGroup::TGroupType senderChatMode, const T { TVectorParamCheck params2; params2.resize( params.size() + 1); - // send the chat phrase to the client + // send the chat phrase to the client params2[0].Type = STRING_MANAGER::bot; params2[0].setEId( TheDataset.getEntityId(sender) ); uint32 first = 0, last = (uint32)params.size(); @@ -1643,7 +1652,7 @@ void CChatManager::sendChat2Ex( CChatGroup::TGroupType senderChatMode, const TDa msgout.serial( channel ); CBitMemStream bms; GenericXmlMsgHeaderMngr.pushNameToStream( "STRING:CHAT2", bms ); - + CChatMsg2 chatMsg; chatMsg.CompressedIndex = sender.getCompressedIndex(); chatMsg.SenderNameId = charInfos ? charInfos->NameIndex : 0; // empty string if there is no sender @@ -1651,7 +1660,7 @@ void CChatManager::sendChat2Ex( CChatGroup::TGroupType senderChatMode, const TDa chatMsg.PhraseId = phraseId; chatMsg.CustomTxt = customTxt; bms.serial( chatMsg ); - + msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length()); CUnifiedNetwork::getInstance()->send(TServiceId(receiverInfos->EntityId.getDynamicId()), msgout); } @@ -1677,9 +1686,9 @@ void CChatManager::sendChat2Ex( CChatGroup::TGroupType senderChatMode, const TDa // //----------------------------------------------- void CChatManager::sendChatCustomEmote( const TDataSetRow &sender, const TDataSetRow &receiver, const ucstring& ucstr ) -{ +{ TDataSetRow senderFake = TDataSetRow::createFromRawIndex( INVALID_DATASET_ROW ); - + CCharacterInfos * receiverInfos = IOS->getCharInfos( TheDataset.getEntityId(receiver) ); CCharacterInfos * senderInfos = IOS->getCharInfos( TheDataset.getEntityId(sender) ); if( receiverInfos ) @@ -1698,7 +1707,7 @@ void CChatManager::sendChatCustomEmote( const TDataSetRow &sender, const TDataSe { return; } - + // send the string to FE CMessage msgout( "IMPULS_CH_ID" ); uint8 channel = 1; @@ -1707,7 +1716,7 @@ void CChatManager::sendChatCustomEmote( const TDataSetRow &sender, const TDataSe msgout.serial( channel ); CBitMemStream bms; GenericXmlMsgHeaderMngr.pushNameToStream( "STRING:CHAT", bms ); - + CChatMsg chatMsg; chatMsg.CompressedIndex = senderFake.getCompressedIndex(); chatMsg.SenderNameId = 0; @@ -1785,7 +1794,7 @@ void CChatManager::tell2( const TDataSetRow& sender, const TDataSetRow& receiver TheDataset.getEntityId(receiver).toString().c_str() ); return; } - + // check if the sender is CSR or is not in the ignore list of the receiver if(senderInfos->HavePrivilege || !itCl->second->isInIgnoreList(sender) ) { @@ -1802,10 +1811,10 @@ void CChatManager::tell2( const TDataSetRow& sender, const TDataSetRow& receiver msgout.serial( channel ); CBitMemStream bms; GenericXmlMsgHeaderMngr.pushNameToStream( "STRING:TELL2", bms); - + bms.serial( senderInfos->NameIndex ); bms.serial( id); - + msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length()); CUnifiedNetwork::getInstance()->send(TServiceId(receiverInfos->EntityId.getDynamicId()), msgout); } @@ -1938,8 +1947,8 @@ void CChatManager::tell( const TDataSetRow& sender, const string& receiverIn, co */ _Log.displayNL("'%s' to '%s' (%s) : \t\"%s\"", senderName.c_str(), receiverName.c_str(), "tell", ucstr.toString().c_str() ); - - + + // if the client doesn't know this dynamic string(name of sender), we send it to him // send the string to FE CMessage msgout( "IMPULS_CH_ID" ); @@ -1948,12 +1957,12 @@ void CChatManager::tell( const TDataSetRow& sender, const string& receiverIn, co msgout.serial( channel ); CBitMemStream bms; GenericXmlMsgHeaderMngr.pushNameToStream( "STRING:TELL", bms); - + TDataSetIndex dsi = senderInfos->DataSetIndex.getCompressedIndex(); bms.serial( dsi ); bms.serial( senderInfos->NameIndex ); bms.serial( const_cast(ucstr) ); - + msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length()); sendMessageViaMirror(TServiceId(receiverInfos->EntityId.getDynamicId()), msgout); @@ -2088,8 +2097,8 @@ void CChatManager::farTell( const NLMISC::CEntityId &senderCharId, const ucstrin string receiverName = receiverInfos->Name.toString(); _Log.displayNL("'%s' to '%s' (%s) : \t\"%s\"", senderName.toUtf8().c_str(), receiverName.c_str(), "tell", ucstr.toString().c_str() ); - - + + // if the client doesn't know this dynamic string(name of sender), we send it to him // send the string to FE CMessage msgout( "IMPULS_CH_ID" ); @@ -2103,7 +2112,7 @@ void CChatManager::farTell( const NLMISC::CEntityId &senderCharId, const ucstrin ftm.SenderName = senderName; ftm.Text = ucstr; ftm.serial(bms); - + msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length()); sendMessageViaMirror(TServiceId(receiverInfos->EntityId.getDynamicId()), msgout); @@ -2134,19 +2143,19 @@ void CChatManager::displayChatClients(NLMISC::CLog &log) if (ci != NULL) { if (ci->EntityId.getType() == RYZOMID::player) - log.displayNL("'%s' %s:%x %s mode '%s'", - ci->Name.toString().c_str(), - ci->EntityId.toString().c_str(), - im->first.getIndex(), - im->second->isMuted()?"(muted)":"", + log.displayNL("'%s' %s:%x %s mode '%s'", + ci->Name.toString().c_str(), + ci->EntityId.toString().c_str(), + im->first.getIndex(), + im->second->isMuted()?"(muted)":"", CChatGroup::groupTypeToString(im->second->getChatMode()).c_str() ); } else { - log.displayNL("*no name* %s:%x %s mode '%s'", - ci->EntityId.toString().c_str(), - im->first.getIndex(), - im->second->isMuted()?"(muted)":"", + log.displayNL("*no name* %s:%x %s mode '%s'", + ci->EntityId.toString().c_str(), + im->first.getIndex(), + im->second->isMuted()?"(muted)":"", CChatGroup::groupTypeToString(im->second->getChatMode()).c_str() ); } } @@ -2157,17 +2166,17 @@ void CChatManager::displayChatGroup(NLMISC::CLog &log, TGroupId gid, CChatGroup { if (chatGroup.GroupName == CStringMapper::emptyId()) { - log.displayNL("Group : anonym (%s), %s : %u clients :", + log.displayNL("Group : anonym (%s), %s : %u clients :", gid.toString().c_str(), - CChatGroup::groupTypeToString(chatGroup.Type).c_str(), + CChatGroup::groupTypeToString(chatGroup.Type).c_str(), chatGroup.Members.size()); } else { - log.displayNL("Group : '%s' (%s), %s : %u clients :", + log.displayNL("Group : '%s' (%s), %s : %u clients :", CStringMapper::unmap(chatGroup.GroupName).c_str(), - gid.toString().c_str(), - CChatGroup::groupTypeToString(chatGroup.Type).c_str(), + gid.toString().c_str(), + CChatGroup::groupTypeToString(chatGroup.Type).c_str(), chatGroup.Members.size()); } @@ -2179,12 +2188,12 @@ void CChatManager::displayChatGroup(NLMISC::CLog &log, TGroupId gid, CChatGroup { CCharacterInfos *ci = IOS->getCharInfos(TheDataset.getEntityId(*first)); if (ci != NULL) - log.displayNL(" '%s' %s:%x", - ci->Name.toString().c_str(), + log.displayNL(" '%s' %s:%x", + ci->Name.toString().c_str(), ci->EntityId.toString().c_str(), first->getIndex()); else - log.displayNL(" *unknow* %s:%x", + log.displayNL(" *unknow* %s:%x", eid.toString().c_str(), first->getIndex()); } @@ -2262,13 +2271,13 @@ void CChatManager::displayChatAudience(NLMISC::CLog &log, const CEntityId &eid, { CCharacterInfos *ci = IOS->getCharInfos(TheDataset.getEntityId(*first)); if (ci != NULL) - log.displayNL(" '%s' %s:%x", - ci->Name.toString().c_str(), + log.displayNL(" '%s' %s:%x", + ci->Name.toString().c_str(), TheDataset.getEntityId(*first).toString().c_str(), first->getIndex()); - + else - log.displayNL(" *unknow* %s:%x", + log.displayNL(" *unknow* %s:%x", TheDataset.getEntityId(*first).toString().c_str(), first->getIndex()); } @@ -2301,9 +2310,9 @@ ucstring CChatManager::filterClientInputColorCode(ucstring &text) { ucstring result; result.reserve(text.size()); - + ucstring::size_type pos = 0; - + for (; pos < text.size(); ++pos) { if (text[pos] == '@' && pos < text.size()-1 && text[pos+1] == '{') @@ -2316,7 +2325,7 @@ ucstring CChatManager::filterClientInputColorCode(ucstring &text) result += text[pos]; } } - + return result; } @@ -2340,7 +2349,7 @@ ucstring CChatManager::filterClientInput(ucstring &text) bool lastIsWhite = false; for (; pos < text.size(); ++pos) { - bool currentIsWhite = (text[pos] == ' ' || text[pos] == '\t'); + bool currentIsWhite = (text[pos] == ' ' || text[pos] == '\t'); if (!(lastIsWhite && currentIsWhite)) { // any double white skipped @@ -2353,7 +2362,7 @@ ucstring CChatManager::filterClientInput(ucstring &text) hasBrackets = (text[pos-1] == '>') && (text[pos-5] == '<'); } - // Filter out '&' at the first non-whitespace position to remove + // Filter out '&' at the first non-whitespace position to remove // system color code (like '&SYS&' ) bool disallowAmpersand = (result.size() == 0) || hasBrackets; if (disallowAmpersand) diff --git a/code/ryzom/server/src/input_output_service/chat_manager.h b/code/ryzom/server/src/input_output_service/chat_manager.h index 9e2d20e8c..544dbfa2c 100644 --- a/code/ryzom/server/src/input_output_service/chat_manager.h +++ b/code/ryzom/server/src/input_output_service/chat_manager.h @@ -42,14 +42,14 @@ - + /** * CChatManager * \author Stephane Coutelas * \author Nevrax France * \date 2002 */ -class CChatManager +class CChatManager { public : @@ -72,7 +72,7 @@ public : */ void init( /*const std::string& staticDBFileName, const std::string& dynDBFileName*/ ); - /** A service has gone down + /** A service has gone down */ void onServiceDown(const std::string &serviceShortName); @@ -80,7 +80,7 @@ public : * Reset ChatLog management */ void resetChatLog(); - + /** * Check if the client is already registered in the chat manager. */ @@ -102,7 +102,7 @@ public : * \param id is the client character id */ CChatClient& getClient( const TDataSetRow& id ); //throw (EChatClient); - + /** * Return a reference on the static database */ @@ -195,7 +195,7 @@ public : void chat2( const TDataSetRow& sender, const std::string &phraseId ); - + /** * Transmit a chat message * \param sender is the id of the talking char @@ -334,7 +334,7 @@ public : private : - + typedef std::map< TDataSetRow, CChatClient*> TClientInfoCont; /// client infos TClientInfoCont _Clients; @@ -377,7 +377,7 @@ protected: friend void cbNpcTellEx( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId ); friend void cbDynChatServiceChat( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId ); friend void cbDynChatServiceTell( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId ); - + public: /** * Send a chat message @@ -389,7 +389,7 @@ public: * \param senderName Can be used to replace the sender name with a specific string */ void sendChat( CChatGroup::TGroupType senderChatMode, const TDataSetRow &receiver, const ucstring& ucstr, const TDataSetRow &sender = TDataSetRow(), TChanID chanID = NLMISC::CEntityId::Unknown, const ucstring &senderName = ucstring()); - + /** * Send a far chat message diff --git a/code/ryzom/server/src/input_output_service/string_manager_parser.cpp b/code/ryzom/server/src/input_output_service/string_manager_parser.cpp index 0cbfbf595..2aa3c896b 100644 --- a/code/ryzom/server/src/input_output_service/string_manager_parser.cpp +++ b/code/ryzom/server/src/input_output_service/string_manager_parser.cpp @@ -1356,7 +1356,7 @@ void CStringManager::mergeEntityWords(CEntityWords& dest, const CEntityWords& so std::map::const_iterator iti; for (iti=source._ColumnInfo.begin(); iti!=source._ColumnInfo.end(); ++iti) if (dest._ColumnInfo.find((*iti).first) == dest._ColumnInfo.end()) - extraColumns.push_back(std::make_pair((*iti).first, osz+(uint32)extraColumns.size())); + extraColumns.push_back(std::pair((*iti).first, osz + (uint32)extraColumns.size())); for (iti=source._RowInfo.begin(); iti!=source._RowInfo.end(); ++iti) if (dest._RowInfo.find((*iti).first) == dest._RowInfo.end()) diff --git a/code/ryzom/server/src/monitor_service/client.cpp b/code/ryzom/server/src/monitor_service/client.cpp index 6d761ba3e..ce2fdc5dc 100644 --- a/code/ryzom/server/src/monitor_service/client.cpp +++ b/code/ryzom/server/src/monitor_service/client.cpp @@ -273,7 +273,7 @@ void CMonitorClient::update () TYPE_NAME_STRING_ID id = Str[i]; std::map::iterator ite = StringMap.find (id); nlassert (ite != StringMap.end()); - strToSend.push_back( make_pair(id, &((*ite).second)) ); + strToSend.push_back(std::pair(id, &((*ite).second))); strTotalSize += 4+4+(uint)(*ite).second.size(); } diff --git a/code/ryzom/server/src/monitor_service/service_main.cpp b/code/ryzom/server/src/monitor_service/service_main.cpp index 84bbcbe86..bf092bbae 100644 --- a/code/ryzom/server/src/monitor_service/service_main.cpp +++ b/code/ryzom/server/src/monitor_service/service_main.cpp @@ -418,7 +418,9 @@ void clientAuthentication(CMessage &msgin, TSockId from, CCallbackNetBase &netba // fail the authentication // Do not send result immediatly to avoid a potential hacker // to try a dictionnary or that dort of things - BadLoginClients.insert(std::make_pair(NLMISC::CTime::getLocalTime() + LOGIN_RETRY_DELAY_IN_MILLISECONDS, Clients[i])); + BadLoginClients.insert(std::pair >( + NLMISC::CTime::getLocalTime() + LOGIN_RETRY_DELAY_IN_MILLISECONDS, + (NLMISC::CRefPtr)Clients[i])); Clients[i]->BadLogin =true; return; } diff --git a/code/ryzom/server/src/pd_lib/db_description_parser.cpp b/code/ryzom/server/src/pd_lib/db_description_parser.cpp index 175000cf2..55eb4a3d6 100644 --- a/code/ryzom/server/src/pd_lib/db_description_parser.cpp +++ b/code/ryzom/server/src/pd_lib/db_description_parser.cpp @@ -260,7 +260,7 @@ bool CDBDescriptionParser::loadType(xmlNodePtr node) return false; } - typeNode.EnumValues.push_back(make_pair(name, value)); + typeNode.EnumValues.push_back(std::pair(name, value)); if (typeNode.Dimension <= value) typeNode.Dimension = value; diff --git a/code/ryzom/server/src/pd_lib/pd_lib.cpp b/code/ryzom/server/src/pd_lib/pd_lib.cpp index f57a4be62..1a2cda9ba 100644 --- a/code/ryzom/server/src/pd_lib/pd_lib.cpp +++ b/code/ryzom/server/src/pd_lib/pd_lib.cpp @@ -571,7 +571,7 @@ void CPDSLib::update() CMessage* msgupd = new CMessage("PD_UPDATE"); msgupd->serial(_DatabaseId); msgupd->serial(_UpdateId); - _QueuedMessages.push_back(make_pair(_UpdateId, msgupd)); + _QueuedMessages.push_back(std::pair(_UpdateId, msgupd)); ++_UpdateId; // serial queue diff --git a/code/ryzom/server/src/pd_lib/pd_messages.cpp b/code/ryzom/server/src/pd_lib/pd_messages.cpp index 253855d46..b5e731d95 100644 --- a/code/ryzom/server/src/pd_lib/pd_messages.cpp +++ b/code/ryzom/server/src/pd_lib/pd_messages.cpp @@ -504,7 +504,7 @@ bool CUpdateLog::selectMessages(const CDBDescriptionParser& description, const N if (message.getType() == CDbMessage::PushContext) { - contextsStart.push_back(std::make_pair(msg, false)); + contextsStart.push_back(std::pair(msg, false)); } else if (message.getType() == CDbMessage::PopContext) { @@ -561,7 +561,7 @@ bool CUpdateLog::selectMessages(const CDBDescriptionParser& description, const s if (message.getType() == CDbMessage::PushContext) { - contextsStart.push_back(std::make_pair(msg, false)); + contextsStart.push_back(std::pair(msg, false)); } else if (message.getType() == CDbMessage::PopContext) { @@ -644,7 +644,7 @@ bool CUpdateLog::selectMessages(const CDBDescriptionParser& description, const N if (message.getType() == CDbMessage::PushContext) { - contextsStart.push_back(std::make_pair(msg, false)); + contextsStart.push_back(std::pair(msg, false)); } else if (message.getType() == CDbMessage::PopContext) { diff --git a/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp b/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp index 184d4bb7f..7a326dc67 100644 --- a/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp +++ b/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp @@ -64,7 +64,7 @@ void CPDStringMapper::setMapping(const std::string& str, uint32 id) return; } - its = _StringMap.insert(std::make_pair(lowMapStr, id)).first; + its = _StringMap.insert(std::pair(lowMapStr, id)).first; _IdMap[id] = its; } diff --git a/code/ryzom/server/src/pd_lib/pd_utils.h b/code/ryzom/server/src/pd_lib/pd_utils.h index 73a0268d8..85a183753 100644 --- a/code/ryzom/server/src/pd_lib/pd_utils.h +++ b/code/ryzom/server/src/pd_lib/pd_utils.h @@ -490,13 +490,16 @@ typedef std::vector TIndexList; struct CColumnIndexHashMapTraits { - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; + enum { bucket_size = 4, min_buckets = 8, }; CColumnIndexHashMapTraits() { } size_t operator() (const CColumnIndex &id) const - { - return id.hash(); - } + { + return id.hash(); + } + bool operator()(const CColumnIndex &left, const CColumnIndex &right) + { + return left < right; + } }; class CSetMap diff --git a/code/ryzom/server/src/pd_support_service/stat_user_file_list_builders.cpp b/code/ryzom/server/src/pd_support_service/stat_user_file_list_builders.cpp index 8f4f1e07f..45c172384 100644 --- a/code/ryzom/server/src/pd_support_service/stat_user_file_list_builders.cpp +++ b/code/ryzom/server/src/pd_support_service/stat_user_file_list_builders.cpp @@ -20,6 +20,7 @@ //------------------------------------------------------------------------------------------------- #include +#include #include "game_share/utils.h" #include "stat_file_list_builder_factory.h" #include "stat_globals.h" @@ -522,7 +523,7 @@ FILE_LIST_BUILDER(NewestFile,"remove all but the latest file for each account (a uint32 accountId= accountIds[i]; uint32& bestTime= bestTimes[accountId]; uint32 timeStamp= fdc[i].FileTimeStamp; - if (bestTime!=timeStamp || bestTime==~0u) + if (bestTime!=timeStamp || bestTime==std::numeric_limits::max()) { fdc.removeFile(i); continue; diff --git a/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.cpp b/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.cpp index 1656f34c1..1de6677cb 100644 --- a/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.cpp +++ b/code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service.cpp @@ -21,6 +21,7 @@ #include #include +#include #include "nel/misc/debug.h" #include "nel/misc/config_file.h" @@ -912,7 +913,7 @@ void cbLSChooseShard (CMessage &msgin, const std::string &serviceName, TServiceI } - string ret = lsChooseShard(userName, cookie, userPriv, userExtended, WS::TUserRole::ur_player, 0xffffffff, ~0); + string ret = lsChooseShard(userName, cookie, userPriv, userExtended, WS::TUserRole::ur_player, 0xffffffff, std::numeric_limits::max()); if (!ret.empty()) { diff --git a/code/ryzom/server/src/server_share/continent_container.h b/code/ryzom/server/src/server_share/continent_container.h index 7edfb0c96..6e65b3dc4 100644 --- a/code/ryzom/server/src/server_share/continent_container.h +++ b/code/ryzom/server/src/server_share/continent_container.h @@ -162,7 +162,7 @@ public: /// Init whole continent container void init(uint gridWidth, uint gridHeight, double primitiveMaxSize, uint nbWorldImages, const std::string &packedSheetsDirectory, double cellSize=0.0, bool loadPacsPrims = true); - + /// Build sheets void buildSheets(const std::string &packedSheetsDirectory); diff --git a/code/ryzom/server/src/server_share/logger_service_client.cpp b/code/ryzom/server/src/server_share/logger_service_client.cpp index e8174e0cd..d94834d12 100644 --- a/code/ryzom/server/src/server_share/logger_service_client.cpp +++ b/code/ryzom/server/src/server_share/logger_service_client.cpp @@ -238,8 +238,8 @@ namespace LGS // create the log context closing _LogInfos.push_back(TLogInfo()); _LogInfos.back().setLogName(contextName); - // tag as 'closing' with ~0 - _LogInfos.back().setTimeStamp(~0); + // tag as 'closing' with std::numeric_limits::max() + _LogInfos.back().setTimeStamp(std::numeric_limits::max()); } --_NbOpenContext; if (VerboseLogger) diff --git a/code/ryzom/server/src/server_share/msg_ai_service.h b/code/ryzom/server/src/server_share/msg_ai_service.h index bd4115f4a..13c6a3423 100644 --- a/code/ryzom/server/src/server_share/msg_ai_service.h +++ b/code/ryzom/server/src/server_share/msg_ai_service.h @@ -88,7 +88,7 @@ public: virtual void description () { className ("CUserEventMsg"); - property ("InstanceNumber", PropUInt32, uint32(~0), InstanceNumber); + property ("InstanceNumber", PropUInt32, std::numeric_limits::max(), InstanceNumber); property ("GrpAlias", PropUInt32, uint32(0xffffffff), GrpAlias); property ("EventId", PropUInt8, uint8(0xff), EventId); propertyCont ("Params", PropString, Params); @@ -133,7 +133,7 @@ public: virtual void description () { className ("CSetEscortTeamId"); - property ("InstanceNumber", PropUInt32, uint32(~0), InstanceNumber); + property ("InstanceNumber", PropUInt32, std::numeric_limits::max(), InstanceNumber); propertyCont ("Groups", PropUInt32, Groups); property ("TeamId", PropUInt16, CTEAM::InvalidTeamId, TeamId); } diff --git a/code/ryzom/server/src/server_share/mysql_wrapper.cpp b/code/ryzom/server/src/server_share/mysql_wrapper.cpp index 5b993b56e..3bb343314 100644 --- a/code/ryzom/server/src/server_share/mysql_wrapper.cpp +++ b/code/ryzom/server/src/server_share/mysql_wrapper.cpp @@ -116,7 +116,7 @@ namespace MSW if (MSWAutoReconnect) { addOption(MYSQL_OPT_RECONNECT, "1"); - } + } return _connect(); } diff --git a/code/ryzom/server/src/server_share/pet_interface_msg.h b/code/ryzom/server/src/server_share/pet_interface_msg.h index d2f9e64a2..f404a76ef 100644 --- a/code/ryzom/server/src/server_share/pet_interface_msg.h +++ b/code/ryzom/server/src/server_share/pet_interface_msg.h @@ -25,6 +25,7 @@ #include "game_share/synchronised_message.h" #include "game_share/mirror.h" +#include // Pet interface message class for AIS / EGS communication @@ -47,7 +48,7 @@ public: virtual void description () { className ("CPetSpawnMsg"); - property ("AIInstanceId", PropUInt32, (uint32)~0, AIInstanceId); + property ("AIInstanceId", PropUInt32, std::numeric_limits::max(), AIInstanceId); property ("SpawnMode", PropUInt16, (uint16)NEAR_PLAYER, SpawnMode); property ("CharacterMirrorRow", PropDataSetRow, TDataSetRow(), CharacterMirrorRow); property ("PetSheetId", PropSheetId, NLMISC::CSheetId::Unknown, PetSheetId); diff --git a/code/ryzom/server/src/server_share/r2_vision.cpp b/code/ryzom/server/src/server_share/r2_vision.cpp index 7433e9026..dd4b2a25d 100644 --- a/code/ryzom/server/src/server_share/r2_vision.cpp +++ b/code/ryzom/server/src/server_share/r2_vision.cpp @@ -147,8 +147,8 @@ namespace R2_VISION void CUniverse::createInstance(uint32 aiInstance, uint32 groupId) { - // just ignore attempts to create the ~0u instance - if (aiInstance==~0u) + // just ignore attempts to create the std::numeric_limits::max() instance + if (aiInstance==std::numeric_limits::max()) { return; } @@ -172,8 +172,8 @@ namespace R2_VISION void CUniverse::removeInstance(uint32 aiInstance) { - // just ignore attempts to remove the ~0u instance - if (aiInstance==~0u) + // just ignore attempts to remove the std::numeric_limits::max() instance + if (aiInstance==std::numeric_limits::max()) { return; } @@ -227,7 +227,7 @@ namespace R2_VISION SUniverseEntity& theEntity= _Entities[row]; // if the entity was already allocated then remove it - if (theEntity.AIInstance == ~0u) { return; } + if (theEntity.AIInstance == std::numeric_limits::max()) { return; } if ( theEntity.ViewerRecord) { @@ -325,8 +325,8 @@ namespace R2_VISION BOMB_IF(row>=_Entities.size(),NLMISC::toString("Ignoring attempt to set entity position with invalid row value: %d",row),return); // ensure that the new AIInstance exists - BOMB_IF(aiInstance!=~0u && (aiInstance>=_Instances.size() || _Instances[aiInstance]==NULL), - NLMISC::toString("ERROR: Failed to add entity %d to un-initialised instance: %d",row,aiInstance),aiInstance=~0u); + BOMB_IF(aiInstance!=std::numeric_limits::max() && (aiInstance>=_Instances.size() || _Instances[aiInstance]==NULL), + NLMISC::toString("ERROR: Failed to add entity %d to un-initialised instance: %d",row,aiInstance),aiInstance=std::numeric_limits::max()); // delegate to workhorse routine (converting y coordinate to +ve axis) _teleportEntity(dataSetRow,aiInstance,x,-y,invisibilityLevel); @@ -429,7 +429,7 @@ namespace R2_VISION SUniverseEntity& theEntity= _Entities[row]; // if the entity was already allocated then remove it - if (theEntity.AIInstance!=~0u) + if (theEntity.AIInstance!=std::numeric_limits::max()) { _removeEntity(dataSetRow); } @@ -455,7 +455,7 @@ namespace R2_VISION { // detach the entity from the instance it's currently in _Instances[theEntity.AIInstance]->removeEntity(theEntity); - theEntity.AIInstance= ~0u; + theEntity.AIInstance= std::numeric_limits::max(); theEntity.ViewerRecord= NULL; } } @@ -466,8 +466,8 @@ namespace R2_VISION SUniverseEntity& theEntity= _Entities[dataSetRow.getIndex()]; #ifdef NL_DEBUG - nlassert(theEntity.AIInstance==~0u || theEntity.AIInstance<_Instances.size()); - nlassert(theEntity.AIInstance==~0u || _Instances[theEntity.AIInstance]!=NULL); + nlassert(theEntity.AIInstance==std::numeric_limits::max() || theEntity.AIInstance<_Instances.size()); + nlassert(theEntity.AIInstance==std::numeric_limits::max() || _Instances[theEntity.AIInstance]!=NULL); #endif // if the entity is a viewer then move the view coordinates @@ -477,7 +477,7 @@ namespace R2_VISION } // if the entity is not currently in an AIInstance then stop here - if (theEntity.AIInstance==~0u) + if (theEntity.AIInstance==std::numeric_limits::max()) return; // set the instance entity record position @@ -498,10 +498,10 @@ namespace R2_VISION // set the new AIInstance value for the entity theEntity.AIInstance= aiInstance; - // if the aiInstance is set to ~0u (a reserved value) then we stop here - if (aiInstance==~0u) + // if the aiInstance is set to std::numeric_limits::max() (a reserved value) then we stop here + if (aiInstance==std::numeric_limits::max()) { - // clear out the vision for an entity in aiInstance ~0u + // clear out the vision for an entity in aiInstance std::numeric_limits::max() if (getEntity(dataSetRow)->ViewerRecord!=NULL) { TVision emptyVision(2); @@ -785,7 +785,7 @@ namespace R2_VISION // locate the old vision group (the one we're allocated to before isolation) uint32 visionId= viewerRecord->VisionId; NLMISC::CSmartPtr& oldVisionGroup= _VisionGroups[visionId]; - BOMB_IF(visionId>=_VisionGroups.size() ||oldVisionGroup==NULL,"Trying to remove entity from vision group with unknown vision id",viewerRecord->VisionId=~0u;return); + BOMB_IF(visionId>=_VisionGroups.size() ||oldVisionGroup==NULL,"Trying to remove entity from vision group with unknown vision id",viewerRecord->VisionId=std::numeric_limits::max();return); // if we're the only viewer then already isolated so just return if (oldVisionGroup->numViewers()==1) @@ -830,7 +830,7 @@ namespace R2_VISION if (viewerRecord!=NULL) { uint32 visionId= viewerRecord->VisionId; - BOMB_IF(visionId>=_VisionGroups.size() ||_VisionGroups[visionId]==NULL,"Trying to remove entity with unknown vision id",viewerRecord->VisionId=~0u;return); + BOMB_IF(visionId>=_VisionGroups.size() ||_VisionGroups[visionId]==NULL,"Trying to remove entity with unknown vision id",viewerRecord->VisionId=std::numeric_limits::max();return); _VisionGroups[visionId]->removeViewer(viewerRecord); } @@ -847,8 +847,8 @@ namespace R2_VISION _Entities.pop_back(); // invalidate the InstanceIndex value for the entity we just removed - entity.InstanceIndex=~0u; - entity.AIInstance=~0u; + entity.InstanceIndex=std::numeric_limits::max(); + entity.AIInstance=std::numeric_limits::max(); } void CInstance::release() @@ -899,11 +899,11 @@ namespace R2_VISION CVisionGroup::CVisionGroup() { - _XMin=~0u; + _XMin=std::numeric_limits::max(); _XMax=0; - _YMin=~0u; + _YMin=std::numeric_limits::max(); _YMax=0; - _VisionId=~0u; + _VisionId=std::numeric_limits::max(); // setup the dummy entry in the vision buffer _Vision.reserve(AllocatedVisionVectorSize); vectAppend(_Vision).DataSetRow= ZeroDataSetRow; @@ -923,8 +923,8 @@ namespace R2_VISION // ensure that the viewer wasn't aleady attached to another vision group #ifdef NL_DEBUG nlassert(viewer!=NULL); - nlassert(viewer->VisionId==~0u); - nlassert(viewer->VisionIndex==~0u); + nlassert(viewer->VisionId==std::numeric_limits::max()); + nlassert(viewer->VisionIndex==std::numeric_limits::max()); #endif TEST(("add viewer %d to grp %d",viewer->getViewerId().getIndex(),_VisionId)); @@ -961,8 +961,8 @@ namespace R2_VISION // pop the back entry off the vector and flag oursleves as unused _Viewers.pop_back(); - viewer->VisionId= ~0u; - viewer->VisionIndex= ~0u; + viewer->VisionId= std::numeric_limits::max(); + viewer->VisionIndex= std::numeric_limits::max(); // NOTE: after this the boundary may be out of date - this will be recalculated at the next // vision update so we don't take time to do it here @@ -1171,8 +1171,8 @@ namespace R2_VISION return; // calculate the bouding box for our viewers - uint32 xmin= ~0u; - uint32 ymin= ~0u; + uint32 xmin= std::numeric_limits::max(); + uint32 ymin= std::numeric_limits::max(); uint32 xmax= 0; uint32 ymax= 0; for (uint32 i=(uint32)_Viewers.size();i--;) @@ -1247,7 +1247,7 @@ namespace R2_VISION // reset the vision vector and add in the dummy entry with DataSetRow=0 _Vision.resize(AllocatedVisionVectorSize); _Vision[0].DataSetRow= ZeroDataSetRow; - _Vision[0].VisionSlot= ~0u; + _Vision[0].VisionSlot= std::numeric_limits::max(); // setup a vision slot iterator for filling in the vision buffer (=1 to skip passed the dummy entry) uint32 nextVisionSlot=1; @@ -1380,8 +1380,8 @@ namespace R2_VISION CViewer::CViewer() { - VisionId=~0u; - VisionIndex=~0u; + VisionId=std::numeric_limits::max(); + VisionIndex=std::numeric_limits::max(); _VisionResetCount= 0; } @@ -1399,7 +1399,7 @@ namespace R2_VISION // setup the dummy entry with DataSetRow=0 _Vision[0].DataSetRow= ZeroDataSetRow; - _Vision[0].VisionSlot= ~0u; + _Vision[0].VisionSlot= std::numeric_limits::max(); // setup the vision slots in reverse order from 254..0 (because they're popped from the back) _FreeVisionSlots.clear(); diff --git a/code/ryzom/server/src/server_share/r2_vision.h b/code/ryzom/server/src/server_share/r2_vision.h index 9bf3f7689..9872e606a 100644 --- a/code/ryzom/server/src/server_share/r2_vision.h +++ b/code/ryzom/server/src/server_share/r2_vision.h @@ -140,7 +140,7 @@ namespace R2_VISION // ctor SViewedEntity() { - VisionSlot=~0u; + VisionSlot=std::numeric_limits::max(); } }; @@ -196,15 +196,15 @@ namespace R2_VISION struct SUniverseEntity { TDataSetRow DataSetRow; // the complete data set row for the entity - uint32 AIInstance; // the id of the instance that we're currently in (~0u by default) + uint32 AIInstance; // the id of the instance that we're currently in (std::numeric_limits::max() by default) mutable uint32 InstanceIndex; // the index within the instance's _Entities vector NLMISC::CSmartPtr ViewerRecord; // pointer to the CViewer record for viewers (or NULL) // ctor SUniverseEntity() { - AIInstance=~0u; - InstanceIndex=~0u; + AIInstance=std::numeric_limits::max(); + InstanceIndex=std::numeric_limits::max(); } }; diff --git a/code/ryzom/server/src/server_share/used_continent.h b/code/ryzom/server/src/server_share/used_continent.h index 40b1eb6fc..412c133e3 100644 --- a/code/ryzom/server/src/server_share/used_continent.h +++ b/code/ryzom/server/src/server_share/used_continent.h @@ -61,12 +61,12 @@ public: bool isContinentUsed(const std::string &continentName) const; /** Return the static instance number associated with a continent name. - * If the continent name is unknow, return ~0 + * If the continent name is unknow, return std::numeric_limits::max() */ uint32 getInstanceForContinent(const std::string &continentName) const; /** Return the static instance number associated with a continent enum value - * If the continent name is unknow, return ~0 + * If the continent name is unknow, return std::numeric_limits::max() */ uint32 getInstanceForContinent(CONTINENT::TContinent continentEnum) const; diff --git a/code/ryzom/server/src/shard_unifier_service/character_sync.cpp b/code/ryzom/server/src/shard_unifier_service/character_sync.cpp index 3b1a8b995..29b404567 100644 --- a/code/ryzom/server/src/shard_unifier_service/character_sync.cpp +++ b/code/ryzom/server/src/shard_unifier_service/character_sync.cpp @@ -365,7 +365,7 @@ namespace CHARSYNC for (; first != last; ++first) { // default to no limit - uint32 limit=~0u; + uint32 limit=std::numeric_limits::max(); // if there's a limit in the limis map then use it instead... if (limitsMap.find(first->first)!=limitsMap.end()) diff --git a/code/ryzom/server/src/shard_unifier_service/name_manager.cpp b/code/ryzom/server/src/shard_unifier_service/name_manager.cpp index 5b50f6359..17b500f92 100644 --- a/code/ryzom/server/src/shard_unifier_service/name_manager.cpp +++ b/code/ryzom/server/src/shard_unifier_service/name_manager.cpp @@ -1138,7 +1138,7 @@ bool CNameManager::loadGuildsNamesFromTxt() // merge the first words until we have only 3 words while (words.size() > 3) { - words[0] += words[1]; + words[0] += " " + words[1]; words.erase(words.begin()+1); } BOMB_IF (words.size()!=3,"Invalid line "< +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . ///////////////////////////////////////////////////////////////// // WARNING : this is a generated file, don't change it ! @@ -303,7 +318,7 @@ namespace RSMGR } else if (cmd == NOPE::cc_instance_count) { - return _ObjectCache.size(); + return (uint32)_ObjectCache.size(); } // default return value @@ -321,7 +336,7 @@ namespace RSMGR TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end()); for (; first != last; ++first) { - nbReleased += first->second.size(); + nbReleased += (uint32)first->second.size(); } nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased); @@ -781,7 +796,7 @@ namespace RSMGR } else if (cmd == NOPE::cc_instance_count) { - return _ObjectCache.size(); + return (uint32)_ObjectCache.size(); } // default return value @@ -799,7 +814,7 @@ namespace RSMGR TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end()); for (; first != last; ++first) { - nbReleased += first->second.size(); + nbReleased += (uint32)first->second.size(); } nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased); diff --git a/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.h b/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.h index 50ef8e823..c33e4fe15 100644 --- a/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.h +++ b/code/ryzom/server/src/shard_unifier_service/nel_database_mapping.h @@ -1,3 +1,18 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . ///////////////////////////////////////////////////////////////// // WARNING : this is a generated file, don't change it ! @@ -610,7 +625,7 @@ namespace RSMGR }; - ///////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// // WARNING : this is a generated file, don't change it ! ///////////////////////////////////////////////////////////////// class CNelPermission @@ -661,7 +676,6 @@ namespace RSMGR setPersistentState(NOPE::os_dirty); _DomainId = value; - } } diff --git a/code/ryzom/server/src/tick_service/range_mirror_manager.cpp b/code/ryzom/server/src/tick_service/range_mirror_manager.cpp index f988ac054..2c92c738f 100644 --- a/code/ryzom/server/src/tick_service/range_mirror_manager.cpp +++ b/code/ryzom/server/src/tick_service/range_mirror_manager.cpp @@ -472,7 +472,7 @@ void CRangeList::acquireFirstRow() */ bool CRangeList::acquireRange( NLNET::TServiceId ownerServiceId, NLNET::TServiceId mirrorServiceId, sint32 nbRows, TDataSetIndex *first, TDataSetIndex *last ) { - TDataSetIndex prevlast(~0); + TDataSetIndex prevlast(std::numeric_limits::max()); TRangeList::iterator irl = _RangeList.begin(); // Find a compatible range diff --git a/code/ryzom/server/src/tick_service/range_mirror_manager.h b/code/ryzom/server/src/tick_service/range_mirror_manager.h index 6615a1c6a..ed12f706b 100644 --- a/code/ryzom/server/src/tick_service/range_mirror_manager.h +++ b/code/ryzom/server/src/tick_service/range_mirror_manager.h @@ -28,6 +28,7 @@ #include #include #include +#include namespace NLNET { @@ -46,7 +47,7 @@ class CRangeList public: /// Default constructor - CRangeList() : _TotalMaxRows(~0) { acquireFirstRow(); } + CRangeList() : _TotalMaxRows(std::numeric_limits::max()) { acquireFirstRow(); } /// Constructor CRangeList( sint32 totalMaxRows ) : _TotalMaxRows( totalMaxRows ) { acquireFirstRow(); } diff --git a/code/ryzom/server/src/tick_service/tick_service.cpp b/code/ryzom/server/src/tick_service/tick_service.cpp index 95f609571..4a64fdd7c 100644 --- a/code/ryzom/server/src/tick_service/tick_service.cpp +++ b/code/ryzom/server/src/tick_service/tick_service.cpp @@ -825,7 +825,7 @@ bool CTickService::loadGameCycle() /* * */ -CTickServiceGameCycleTimeMeasure::CTickServiceGameCycleTimeMeasure() : HistoryMain( CTickService::getInstance()->getServiceId(), NLNET::TServiceId(~0), false ) {} +CTickServiceGameCycleTimeMeasure::CTickServiceGameCycleTimeMeasure() : HistoryMain( CTickService::getInstance()->getServiceId(), NLNET::TServiceId(std::numeric_limits::max()), false ) {} /* @@ -904,7 +904,7 @@ void CTickServiceGameCycleTimeMeasure::displayStat( NLMISC::CLog *log, TTimeMeas uint divideBy = (HistoryMain.NbMeasures==0) ? 0 : ((stat==MHTSum) ? HistoryMain.NbMeasures : 1); HistoryMain.Stats[stat].displayStat( log, TickServiceTimeMeasureTypeToCString, divideBy ); { - CMirrorTimeMeasure gatheredStats [NbTimeMeasureHistoryStats] = { 0, ~0, 0 }; + CMirrorTimeMeasure gatheredStats [NbTimeMeasureHistoryStats] = { 0, std::numeric_limits::max(), 0 }; for ( std::vector::const_iterator ihm=HistoryByMirror.begin(); ihm!=HistoryByMirror.end(); ++ihm ) { log->displayRawNL( "\tMS-%hu, %u measures:", (*ihm).ServiceId.get(), (*ihm).NbMeasures ); @@ -921,7 +921,7 @@ void CTickServiceGameCycleTimeMeasure::displayStat( NLMISC::CLog *log, TTimeMeas } } { - CServiceTimeMeasure gatheredStats [NbTimeMeasureHistoryStats] = { 0, ~0, 0 }; + CServiceTimeMeasure gatheredStats [NbTimeMeasureHistoryStats] = { 0, std::numeric_limits::max(), 0 }; for ( std::vector::const_iterator ihs=HistoryByService.begin(); ihs!=HistoryByService.end(); ++ihs ) { log->displayRawNL( "\t%s (on MS-%hu), %u measures:", CUnifiedNetwork::getInstance()->getServiceUnifiedName( (*ihs).ServiceId ).c_str(), (*ihs).ParentServiceId.get(), (*ihs).NbMeasures ); diff --git a/code/ryzom/server/src/tick_service/tick_service.h b/code/ryzom/server/src/tick_service/tick_service.h index 5b07793a3..9abe079bc 100644 --- a/code/ryzom/server/src/tick_service/tick_service.h +++ b/code/ryzom/server/src/tick_service/tick_service.h @@ -113,7 +113,7 @@ public: NbMeasures = 0; Stats.resize( NbTimeMeasureHistoryStats ); Stats[MHTSum] = 0; - Stats[MHTMin] = ~0; + Stats[MHTMin] = std::numeric_limits::max(); Stats[MHTMax] = 0; } } diff --git a/code/ryzom/tools/client/CMakeLists.txt b/code/ryzom/tools/client/CMakeLists.txt index aabc3142c..0c42233cb 100644 --- a/code/ryzom/tools/client/CMakeLists.txt +++ b/code/ryzom/tools/client/CMakeLists.txt @@ -1,10 +1,9 @@ - IF(WITH_RYZOM_CLIENT) - ADD_SUBDIRECTORY( client_patcher ) - - IF( WITH_QT ) - ADD_SUBDIRECTORY( client_config_qt ) - ENDIF( WITH_QT ) -ENDIF(WITH_RYZOM_CLIENT) + ADD_SUBDIRECTORY(client_patcher) -ADD_SUBDIRECTORY( r2_islands_textures ) + IF(WITH_QT) + ADD_SUBDIRECTORY(client_config_qt) + ENDIF() +ENDIF() + +ADD_SUBDIRECTORY(r2_islands_textures) diff --git a/code/ryzom/tools/client/client_patcher/CMakeLists.txt b/code/ryzom/tools/client/client_patcher/CMakeLists.txt index e5b845e43..70857105e 100644 --- a/code/ryzom/tools/client/client_patcher/CMakeLists.txt +++ b/code/ryzom/tools/client/client_patcher/CMakeLists.txt @@ -12,6 +12,7 @@ ADD_EXECUTABLE(ryzom_client_patcher ${SRC}) INCLUDE_DIRECTORIES( ${LIBXML2_INCLUDE_DIR} ${CURL_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/ryzom/client/src ) @@ -20,6 +21,7 @@ TARGET_LINK_LIBRARIES(ryzom_client_patcher nelnet ryzom_gameshare ryzom_sevenzip + ${ZLIB_LIBRARIES} ${CURL_LIBRARIES}) IF(APPLE) diff --git a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp index 4f167ea9c..69f701054 100644 --- a/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp +++ b/code/ryzom/tools/client/r2_islands_textures/screenshot_islands.cpp @@ -1540,7 +1540,6 @@ void CScreenshotIslands::buildIslandsTextures() CIFile proxFS(proxFileName.c_str()); proxBitmap.load(proxFS); - // resize proximity bitmap CBitmap tempBitmap; int newWidth = islandBitmap.getWidth(); @@ -1568,7 +1567,7 @@ void CScreenshotIslands::buildIslandsTextures() // swap them proxBitmap.resize(newWidth, newHeight, proxBitmap.PixelFormat); proxBitmap.swap(tempBitmap); - + //proxBitmap.resample(newWidth, newHeight); diff --git a/code/ryzom/tools/leveldesign/CMakeLists.txt b/code/ryzom/tools/leveldesign/CMakeLists.txt index 9a56a2fac..399a71deb 100644 --- a/code/ryzom/tools/leveldesign/CMakeLists.txt +++ b/code/ryzom/tools/leveldesign/CMakeLists.txt @@ -1,4 +1,3 @@ - ADD_SUBDIRECTORY(uni_conv) ADD_SUBDIRECTORY(csv_transform) ADD_SUBDIRECTORY(icon_search) diff --git a/code/ryzom/tools/leveldesign/georges_convert/type_unit_double.cpp b/code/ryzom/tools/leveldesign/georges_convert/type_unit_double.cpp index 6244c0f4a..674f77cd6 100644 --- a/code/ryzom/tools/leveldesign/georges_convert/type_unit_double.cpp +++ b/code/ryzom/tools/leveldesign/georges_convert/type_unit_double.cpp @@ -203,7 +203,7 @@ void CTypeUnitDouble::SetLowLimit( const CStringEx _sxll ) void CTypeUnitDouble::SetHighLimit( const CStringEx _sxhl ) { sxhighlimit = _sxhl; - dhighlimit = atof( sxhighlimit.c_str() ); + NLMISC::fromString(sxhighlimit, dhighlimit); } } diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/configuration.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/configuration.cpp index 6af950eae..cd937688a 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/configuration.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/configuration.cpp @@ -53,7 +53,8 @@ namespace NLQT { { // load config QFile file(NLQT_CONFIG_FILE); - if (!file.exists()) { + if (!file.exists()) + { file.open( QIODevice::WriteOnly | QIODevice::Text ); file.write("GraphicsDrivers = { \"OpenGL\", \"Direct3D\" };"); file.write("\nSearchPaths = {\"\"};"); @@ -64,9 +65,12 @@ namespace NLQT { file.close(); } - try { + try + { ConfigFile.load(NLQT_CONFIG_FILE); - } catch(...) { + } + catch(...) + { } addLeveldesignPath(); @@ -213,16 +217,17 @@ namespace NLQT { uint listsize = tmpList->size(); for (uint i = 0; i < listsize; ++i) { - if(_progressCB) { - _progressCB->DisplayString = tmpList->at(i); - CPath::addSearchPath(tmpList->at(i), true, false, _progressCB); + if(_progressCB) + { + _progressCB->DisplayString = tmpList->at(i); + CPath::addSearchPath(tmpList->at(i), true, false, _progressCB); } else { - CProgressDialog pcb; - pcb.DisplayString = tmpList->at(i); - pcb.show(); - CPath::addSearchPath(tmpList->at(i), true, false, &pcb); + CProgressDialog pcb; + pcb.DisplayString = tmpList->at(i); + pcb.show(); + CPath::addSearchPath(tmpList->at(i), true, false, &pcb); } } if (!list) diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/formdelegate.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/formdelegate.cpp index bb91f8b62..25b8a1490 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/formdelegate.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/formdelegate.cpp @@ -60,7 +60,8 @@ namespace NLQT CFormItem* curItem = m->getItem(mp->mapToSource(index)); NLGEORGES::UFormElm *curElm = curItem->getFormElm(); - if (!curElm) { + if (!curElm) + { // TODO: create new Element return 0; } diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp index b5ab13ba3..f06bb537e 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp @@ -377,7 +377,8 @@ namespace NLQT nlinfo("CGeorgesTreeViewDialog::filterRows"); CGeorgesFormProxyModel * mp = dynamic_cast(_ui.treeView->model()); CGeorgesFormModel *m = dynamic_cast(mp->sourceModel()); - if (m) { + if (m) + { m->setShowParents(_ui.checkBoxParent->isChecked()); m->setShowDefaults(_ui.checkBoxDefaults->isChecked()); } diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp index 89cba843c..98c7b59e2 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georgesform_model.cpp @@ -352,7 +352,8 @@ namespace NLQT /******************************************************************************/ - void CGeorgesFormModel::loadFormData(UFormElm *root, CFormItem *parent) { + void CGeorgesFormModel::loadFormData(UFormElm *root, CFormItem *parent) + { if (!root) return; @@ -390,7 +391,8 @@ namespace NLQT elmtType = "Array"; if (elmt->isStruct()) elmtType = "Struct"; - if (elmt->isAtom()) { + if (elmt->isAtom()) + { elmtType = "Atom"; uint numDefinitions = 0; const UType *type = elmt->getType(); @@ -433,7 +435,8 @@ namespace NLQT tmpValue = v.c_str(); if (type->getType() == UType::SignedInt) { - if (QString("%1").arg(value.c_str()).toDouble() == tmpValue.toDouble()) { + if (QString("%1").arg(value.c_str()).toDouble() == tmpValue.toDouble()) + { value = l; break; } @@ -482,7 +485,8 @@ namespace NLQT } columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType; parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN)); - //if (parents.last()->childCount() > 0) { + //if (parents.last()->childCount() > 0) + //{ // parents << parents.last()->child(parents.last()->childCount()-1); //} loadFormData(elmt, parent->child(parent->childCount()-1)); @@ -549,7 +553,8 @@ namespace NLQT { if (elmt->isArray()) elmtType = "Array"; - if (elmt->isStruct()) { + if (elmt->isStruct()) + { elmtType = "Struct"; } if (elmt->isAtom()) @@ -593,28 +598,35 @@ namespace NLQT CFormItem *fi_dep = new CFormItem(_rootElm, QList() << "dependencies", _rootItem); _rootItem->appendChild(fi_dep); - if (!dfns.isEmpty()) { - CFormItem *fi_dfn = new CFormItem(_rootElm, QList() << "dfn", fi_dep); - fi_dep->appendChild(fi_dfn); - foreach(QString str, dfns) { - fi_dfn->appendChild(new CFormItem(_rootElm, QList() << str, fi_dfn)); - } - } - if (!typs.isEmpty()) { - CFormItem *fi_typ = new CFormItem(_rootElm, QList() << "typ", fi_dep); - fi_dep->appendChild(fi_typ); - foreach(QString str, typs) { - fi_typ->appendChild(new CFormItem(_rootElm, QList() << str, fi_typ)); - } - } - if (!_dependencies.isEmpty()) { - CFormItem *fi_other = new CFormItem(_rootElm, QList() << "other", fi_dep); - fi_dep->appendChild(fi_other); - foreach(QStringList list, _dependencies) { - foreach(QString str, list) { - fi_other->appendChild(new CFormItem(_rootElm, QList() << str, fi_other)); + if (!dfns.isEmpty()) + { + CFormItem *fi_dfn = new CFormItem(_rootElm, QList() << "dfn", fi_dep); + fi_dep->appendChild(fi_dfn); + foreach(QString str, dfns) + { + fi_dfn->appendChild(new CFormItem(_rootElm, QList() << str, fi_dfn)); + } } + if (!typs.isEmpty()) + { + CFormItem *fi_typ = new CFormItem(_rootElm, QList() << "typ", fi_dep); + fi_dep->appendChild(fi_typ); + foreach(QString str, typs) + { + fi_typ->appendChild(new CFormItem(_rootElm, QList() << str, fi_typ)); + } } + if (!_dependencies.isEmpty()) + { + CFormItem *fi_other = new CFormItem(_rootElm, QList() << "other", fi_dep); + fi_dep->appendChild(fi_other); + foreach(QStringList list, _dependencies) + { + foreach(QString str, list) + { + fi_other->appendChild(new CFormItem(_rootElm, QList() << str, fi_other)); + } + } }*/ } diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp index ef40f4dbc..8dbc2c18b 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp @@ -338,7 +338,8 @@ namespace NLQT _aboutQtAction->setStatusTip(tr("Show the Qt library's About box")); connect(_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); - for (int i = 0; i < MaxRecentFiles; ++i) { + for (int i = 0; i < MaxRecentFiles; ++i) + { recentFileActs[i] = new QAction(this); recentFileActs[i]->setVisible(false); connect(recentFileActs[i], SIGNAL(triggered()), diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/new_dialog.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/new_dialog.cpp index 499b06d94..f0a1fe351 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/new_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/new_dialog.cpp @@ -333,7 +333,8 @@ namespace NLQT return -1; } - void CGeorgesNewDialog::validateParentCombo() { + void CGeorgesNewDialog::validateParentCombo() + { // TODO: clear if no valid text //if (!_filelist.contains(_ui.parentLineEdit->text())) // _ui.parentLineEdit->clear(); diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/objectviewer_dialog.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/objectviewer_dialog.cpp index a47395cf6..e3c3d24e2 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/objectviewer_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/objectviewer_dialog.cpp @@ -77,7 +77,8 @@ namespace NLQT } } - void CObjectViewerDialog::topLevelChanged ( bool topLevel ) { + void CObjectViewerDialog::topLevelChanged ( bool topLevel ) + { //nldebug("topLevel:%d",topLevel); //_georges->init(); } @@ -100,7 +101,8 @@ namespace NLQT { //nldebug("%d %d",_nlw->width(), _nlw->height()); QDockWidget::resizeEvent(resizeEvent); - if (Modules::objViewInt()) { + if (Modules::objViewInt()) + { if (Modules::objViewInt()->getDriver()) Modules::objViewInt()->setSizeViewport(resizeEvent->size().width(), resizeEvent->size().height()); } diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/qt_displayer.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/qt_displayer.cpp index 07b338009..7c94e4fb0 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/qt_displayer.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/qt_displayer.cpp @@ -39,8 +39,8 @@ namespace NLQT ; } - CQtDisplayer::~CQtDisplayer() { - ; + CQtDisplayer::~CQtDisplayer() + { } void CQtDisplayer::setParam (QPlainTextEdit *dlgDebug, bool eraseLastLog) @@ -59,7 +59,8 @@ namespace NLQT QTextCharFormat format; - if (args.Date != 0 && !_Raw) { + if (args.Date != 0 && !_Raw) + { str += dateToHumanString(args.Date); needSpace = true; } @@ -76,27 +77,31 @@ namespace NLQT } // Write thread identifier - /*if ( args.ThreadId != 0 && !_Raw) { - if (needSpace) { str += " "; needSpace = false; } - str += NLMISC::toString(args.ThreadId); - needSpace = true; + /*if ( args.ThreadId != 0 && !_Raw) + { + if (needSpace) { str += " "; needSpace = false; } + str += NLMISC::toString(args.ThreadId); + needSpace = true; }*/ - /*if (!args.ProcessName.empty() && !_Raw) { - if (needSpace) { str += " "; needSpace = false; } - str += args.ProcessName; - needSpace = true; + /*if (!args.ProcessName.empty() && !_Raw) + { + if (needSpace) { str += " "; needSpace = false; } + str += args.ProcessName; + needSpace = true; }*/ - //if (args.FileName != NULL && !_Raw) { + //if (args.FileName != NULL && !_Raw) + //{ // if (needSpace) { str += " "; needSpace = false; } // str += NLMISC::CFile::getFilename(args.FileName); // needSpace = true; //} - /*if (args.Line != -1 && !_Raw) { - if (needSpace) { str += " "; needSpace = false; } - str += NLMISC::toString(args.Line); - needSpace = true; + /*if (args.Line != -1 && !_Raw) + { + if (needSpace) { str += " "; needSpace = false; } + str += NLMISC::toString(args.Line); + needSpace = true; }*/ if (args.FuncName != NULL && !_Raw) diff --git a/code/ryzom/tools/leveldesign/mp_generator/utils.h b/code/ryzom/tools/leveldesign/mp_generator/utils.h index 63148f61f..efa42149d 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/utils.h +++ b/code/ryzom/tools/leveldesign/mp_generator/utils.h @@ -17,6 +17,7 @@ #ifndef UTILS_H_ #define UTILS_H_ +#include // DtName must be the 1st one enum TDataCol { DtName, DtTitle, DtRMFamily, DtGroup, DtEcosystem, DtLevelZone, DtStatQuality, DtProp, DtCreature, DtCreaTitle, DtCraftSlotName, DtCraftCivSpec, DtColor, DtAverageEnergy, DtMaxLevel, DtCustomizedProperties, DtNbCols }; @@ -55,17 +56,17 @@ public: * Display the item as a row of a HTML table. * If (key!=previousKey) and (name==previousName), the row will not be displayed entirely to save space * - * \param keyColumn If not ~0, column used for sorting => this column displays only the field matching the key + * \param keyColumn If not std::numeric_limits::max(), column used for sorting => this column displays only the field matching the key * \param key The key used for sorting (see keyColumn) * \param previousKey Previous key - * \param nameColumn If not ~0, column used for the unique name (column must have exaclty one element) + * \param nameColumn If not std::numeric_limits::max(), column used for the unique name (column must have exaclty one element) * \param previousName Previous name */ - std::string toHTMLRow( uint32 keyColumn=~0, const string& key=string(), const string& previousKey=string(), - uint32 nameColumn=~0, const string& previousName=string() ) const + std::string toHTMLRow( uint32 keyColumn=std::numeric_limits::max(), const string& key=string(), const string& previousKey=string(), + uint32 nameColumn=std::numeric_limits::max(), const string& previousName=string() ) const { std::string s = ""; - bool lightMode = (nameColumn == ~0) ? false : ((key != previousKey) && (Fields[nameColumn][0] == previousName)); + bool lightMode = (nameColumn == std::numeric_limits::max()) ? false : ((key != previousKey) && (Fields[nameColumn][0] == previousName)); for ( uint32 c=0; c!=NC; ++c ) { s += ""; @@ -86,11 +87,11 @@ public: /// - std::string toCSVLine( char columnSeparator=',', string internalSeparator=" - ", uint32 keyColumn=~0, const string& key=string(), const string& previousKey=string(), - uint32 nameColumn=~0, const string& previousName=string() ) const + std::string toCSVLine( char columnSeparator=',', string internalSeparator=" - ", uint32 keyColumn=std::numeric_limits::max(), const string& key=string(), const string& previousKey=string(), + uint32 nameColumn=std::numeric_limits::max(), const string& previousName=string() ) const { std::string s; - bool lightMode = (nameColumn == ~0) ? false : ((key != previousKey) && (Fields[nameColumn][0] == previousName)); + bool lightMode = (nameColumn == std::numeric_limits::max()) ? false : ((key != previousKey) && (Fields[nameColumn][0] == previousName)); for ( uint32 c=0; c!=NC; ++c ) { if ( c == keyColumn ) diff --git a/code/ryzom/tools/leveldesign/prim_export/main.cpp b/code/ryzom/tools/leveldesign/prim_export/main.cpp index 86aeafa62..f9c33d953 100644 --- a/code/ryzom/tools/leveldesign/prim_export/main.cpp +++ b/code/ryzom/tools/leveldesign/prim_export/main.cpp @@ -629,7 +629,7 @@ void addPointPrimitive (CLandscape &landscape, const char *primFilename, uint32 string scaleText; float scale = 1; if (point->getPropertyByName ("scale", scaleText)) - scale = (float) atof (scaleText.c_str ()); + NLMISC::fromString(scaleText, scale); // Get zone coordinates sint x = (sint)floor (position.x / options.CellSize); @@ -654,7 +654,7 @@ void addPointPrimitive (CLandscape &landscape, const char *primFilename, uint32 // Get height if (!snap && point->getPropertyByName ("height", text)) - position.z = (float)atof(text.c_str()); + NLMISC::fromString(text, position.z); // *** Add the instance diff --git a/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp b/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp index e99b0eceb..279578293 100644 --- a/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp @@ -2595,8 +2595,8 @@ void CExport::transformAdditionnalIG (const std::string &name, const NLMISC::CMa inStream.close(); if (_ExportCB != NULL) { - _ExportCB->dispWarning("Error while reading " + igName); - _ExportCB->dispWarning(e.what()); + _ExportCB->dispWarning("Error while reading " + igName); + _ExportCB->dispWarning(e.what()); } } } diff --git a/code/ryzom/tools/make_anim_melee_impact/main.cpp b/code/ryzom/tools/make_anim_melee_impact/main.cpp index 10fdeb0ed..3f67edd5e 100644 --- a/code/ryzom/tools/make_anim_melee_impact/main.cpp +++ b/code/ryzom/tools/make_anim_melee_impact/main.cpp @@ -79,7 +79,7 @@ void CAnimCombatState::build(const string &line) { StateCode= line.substr(4, 2); string time= line.substr(10, 5); - MeanAnimTime= (float)atof(time.c_str()); + NLMISC::fromString(time, MeanAnimTime); } diff --git a/code/ryzom/tools/patch_gen/patch_gen_common.cpp b/code/ryzom/tools/patch_gen/patch_gen_common.cpp index 3d28a2439..2437c068e 100644 --- a/code/ryzom/tools/patch_gen/patch_gen_common.cpp +++ b/code/ryzom/tools/patch_gen/patch_gen_common.cpp @@ -19,6 +19,7 @@ //----------------------------------------------------------------------------- #include +#include #include "game_share/bnp_patch.h" #include "nel/misc/path.h" @@ -149,7 +150,7 @@ CPackageDescription::CPackageDescription() void CPackageDescription::clear() { - _NextVersionNumber= ~0u; + _NextVersionNumber= std::numeric_limits::max(); _VersionNumberReserved = false; _Categories.clear(); _IndexFileName.clear(); @@ -345,8 +346,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const if (packageIndex.getFile(i).versionCount()==1) { prevVersionFileName= _RootDirectory + "empty"; - NLMISC::COFile tmpFile(prevVersionFileName); - tmpFile.close(); + CFile::createEmptyFile(prevVersionFileName); usingTemporaryFile = true; deleteRefAfterDelta= false; } diff --git a/code/ryzom/tools/pd_parser/parser.cpp b/code/ryzom/tools/pd_parser/parser.cpp index 733bad4df..4b5e9f5c1 100644 --- a/code/ryzom/tools/pd_parser/parser.cpp +++ b/code/ryzom/tools/pd_parser/parser.cpp @@ -1189,7 +1189,7 @@ bool CEnumSimpleValueNode::prolog() uint i; for (i=0; iValues.push_back(make_pair(Names[i], CurrentValue)); + CurrentEnumNode->Values.push_back(std::pair(Names[i], CurrentValue)); } if (parent != NULL) ++(parent->CurrentValue); @@ -1214,7 +1214,7 @@ bool CEnumRangeNode::prolog() CurrentValue = 0; } - CurrentEnumNode->Values.push_back(make_pair(Name, CurrentValue)); + CurrentEnumNode->Values.push_back(std::pair(Name, CurrentValue)); return true; } @@ -1238,7 +1238,7 @@ bool CEnumRangeNode::epilog() if (!EndRange.empty()) { - CurrentEnumNode->Values.push_back(make_pair(EndRange, CurrentValue)); + CurrentEnumNode->Values.push_back(std::pair(EndRange, CurrentValue)); } return true; @@ -4709,7 +4709,7 @@ void CLogMsgNode::generateContent() CClassNode *cnd; if ( (tnd = getTypeNode(type, false)) ) { - pair::iterator, bool> res = params.insert(make_pair(name, tnd)); + pair::iterator, bool> res = params.insert(std::pair(name, tnd)); if (!res.second) error("log parameter '"+name+"' already defined"); @@ -4723,7 +4723,7 @@ void CLogMsgNode::generateContent() } else if ( (cnd = getClassNode(type, false)) ) { - pair::iterator, bool> res = params.insert(make_pair(name, cnd)); + pair::iterator, bool> res = params.insert(std::pair(name, cnd)); if (!res.second) error("log parameter '"+name+"' already defined"); @@ -4739,7 +4739,7 @@ void CLogMsgNode::generateContent() { CExtLogTypeNode* extnd = new CExtLogTypeNode(); extnd->ExtLogType = "string"; - pair::iterator, bool> res = params.insert(make_pair(name, extnd)); + pair::iterator, bool> res = params.insert(std::pair(name, extnd)); if (!res.second) error("log parameter '"+name+"' already defined"); diff --git a/code/ryzom/tools/server/CMakeLists.txt b/code/ryzom/tools/server/CMakeLists.txt index 982c47718..1f215ae94 100644 --- a/code/ryzom/tools/server/CMakeLists.txt +++ b/code/ryzom/tools/server/CMakeLists.txt @@ -1,4 +1,3 @@ - IF(WITH_LIGO) ADD_SUBDIRECTORY(ai_build_wmap) ENDIF(WITH_LIGO) diff --git a/code/ryzom/tools/server/ai_build_wmap/build_proximity_maps.cpp b/code/ryzom/tools/server/ai_build_wmap/build_proximity_maps.cpp index a15f8c6d3..f5b6af644 100644 --- a/code/ryzom/tools/server/ai_build_wmap/build_proximity_maps.cpp +++ b/code/ryzom/tools/server/ai_build_wmap/build_proximity_maps.cpp @@ -32,6 +32,8 @@ // AI share #include "ai_share/world_map.h" +// STL +#include //------------------------------------------------------------------------------------------------- // using namespaces... @@ -237,8 +239,8 @@ CProximityZone::CProximityZone(uint32 scanWidth,uint32 scanHeight,sint32 xOffset _MaxOffset = scanWidth * scanHeight -1; - _XMin = ~0u; - _YMin = ~0u; + _XMin = std::numeric_limits::max(); + _YMin = std::numeric_limits::max(); _XMax = 0; _YMax = 0; } @@ -386,7 +388,7 @@ void CProximityMapBuffer::load(const std::string& name) } } // setup the next pixel in the output buffers... - _Buffer[y*_ScanWidth+x]= (isAccessible? 0: (TBufferEntry)~0u); + _Buffer[y*_ScanWidth+x]= (isAccessible? 0: (TBufferEntry)std::numeric_limits::max()); } } } @@ -471,7 +473,7 @@ void CProximityMapBuffer::_prepareBufferForZoneProximityMap(const CProximityZone uint32 zoneWidth= zone.getZoneWidth(); uint32 zoneHeight= zone.getZoneHeight(); zoneBuffer.clear(); - zoneBuffer.resize(zoneWidth*zoneHeight,(TBufferEntry)~0u); + zoneBuffer.resize(zoneWidth*zoneHeight,(TBufferEntry)std::numeric_limits::max()); // setup the buffer's accessible points and prime vects[0] with the set of accessible points in the zone buffer for (uint32 i=0;i &islands, float camSpeed texturedMaterial.setDoubleSided(true); texturedMaterial.setZFunc(CMaterial::lessequal); // - uint currWorldIndex = ~0; + uint currWorldIndex = std::numeric_limits::max(); bool newPosWanted = true; // std::vector zones; diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/ingame_templates/settings.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/ingame_templates/settings.tpl index 4e94e633c..50d47d680 100644 --- a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/ingame_templates/settings.tpl +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/ingame_templates/settings.tpl @@ -1,161 +1,161 @@ -{block name=content} - - - - - - - - -
- - - - -
- - - - - {if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1} - {if $userPermission eq 1} - - - {else if $userPermission eq 2 } - - - {else if $userPermission eq 3 } - - - {/if} - {/if} - -
Browse UserSend TicketMake ModeratorMake AdminDemote to UserMake AdminDemote to UserDemote to Moderator
-
-
- - - - - - - - - - - - -

Change Settings of {$target_username}

- - - - - - - - - - - - -
- - -
-
- - - -
- - -
- - -
- -

Change Password

- -
- - {if !isset($changesOther) or $changesOther eq "FALSE"} - - - -

- - {/if} - - - -
- Current Password: - - - {if isset($MATCH_ERROR) and $MATCH_ERROR eq "TRUE"}The password is incorrect{/if} -
- New Password: - - - {if isset($NEWPASSWORD_ERROR) and $NEWPASSWORD_ERROR eq "TRUE"}{$newpass_error_message}{/if} -
- Confirm New Password: - - - {if isset($CNEWPASSWORD_ERROR) and $CNEWPASSWORD_ERROR eq "TRUE"}{$confirmnewpass_error_message}{/if} -
- {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "OK"} -

- The password has been changed! -

- {/if} - - - - - -

- -
- -
-
-
- - -
- - -
-

Change Email

- -
- - -
- New Email: - - - {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if} -
- {if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "OK"} -

- The email has been changed! -

- {/if} - - - -

- -

- -
-
-
-
- - - -{/block} - +{block name=content} + + + + + + + + +
+ + + + +
+ + + + + {if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1} + {if $userPermission eq 1} + + + {else if $userPermission eq 2 } + + + {else if $userPermission eq 3 } + + + {/if} + {/if} + +
Browse UserSend TicketMake ModeratorMake AdminDemote to UserMake AdminDemote to UserDemote to Moderator
+
+
+ + + + + + + + + + + + +

Change Settings of {$target_username}

+ + + + + + + + + + + + +
+ + +
+
+ + + +
+ + +
+ + +
+ +

Change Password

+ +
+ + {if !isset($changesOther) or $changesOther eq "FALSE"} + + + +

+ + {/if} + + + +
+ Current Password: + + + {if isset($MATCH_ERROR) and $MATCH_ERROR eq "TRUE"}The password is incorrect{/if} +
+ New Password: + + + {if isset($NEWPASSWORD_ERROR) and $NEWPASSWORD_ERROR eq "TRUE"}{$newpass_error_message}{/if} +
+ Confirm New Password: + + + {if isset($CNEWPASSWORD_ERROR) and $CNEWPASSWORD_ERROR eq "TRUE"}{$confirmnewpass_error_message}{/if} +
+ {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "OK"} +

+ The password has been changed! +

+ {/if} + + + + + +

+ +
+ +
+
+
+ + +
+ + +
+

Change Email

+ +
+ + +
+ New Email: + + + {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if} +
+ {if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "OK"} +

+ The email has been changed! +

+ {/if} + + + +

+ +

+ +
+
+
+
+ + + +{/block} + diff --git a/code/ryzom/tools/translation_tools/main.cpp b/code/ryzom/tools/translation_tools/main.cpp index 9eba8c8da..30054ffbd 100644 --- a/code/ryzom/tools/translation_tools/main.cpp +++ b/code/ryzom/tools/translation_tools/main.cpp @@ -95,16 +95,6 @@ const std::string historyDir("history/"); string diffVersion; -#ifndef NL_OS_WINDOWS -char* itoa(int val, char *buffer, int base){ - static char buf[32] = {0}; - int i = 30; - for(; val && i ; --i, val /= base) - buf[i] = "0123456789abcdef"[val % base]; - return &buf[i+1]; -} -#endif // NL_OS_WINDOWS - #ifdef NL_DEBUG # define LOG nldebug #else @@ -969,7 +959,6 @@ public: void onChanged(uint addIndex, uint refIndex, TPhraseDiffContext &context) { ucstring chg; - char temp[1024]; // check what is changed. if (context.Addition[addIndex].Parameters != context.Reference[refIndex].Parameters) chg += "// Parameter list changed." + nl; @@ -980,11 +969,11 @@ public: for (uint i=0; i tempV; tempV.push_back(context.Reference[refIndex]); ucstring tempT = preparePhraseFile(tempV, false); CI18N::removeCComment(tempT); - phrase.Comments = ucstring(temp) + nl + phrase.Comments; + phrase.Comments = ucstring("// DIFF CHANGED ") + toString(addIndex) + nl + phrase.Comments; phrase.Comments = phrase.Comments + ucstring("/* OLD VALUE : ["+nl) + tabLines(1, tempT) +nl + "] */" + nl; phrase.Comments = phrase.Comments + chg; @@ -2682,7 +2669,6 @@ void CMakePhraseDiff2::onRemove(uint addIndex, uint refIndex, TPhraseDiffContext void CMakePhraseDiff2::onChanged(uint addIndex, uint refIndex, TPhraseDiffContext &context) { ucstring chg; - char temp[1024]; // check what is changed. if (context.Addition[addIndex].Parameters != context.Reference[refIndex].Parameters) chg += "// Parameter list changed." + nl; @@ -2693,11 +2679,11 @@ void CMakePhraseDiff2::onChanged(uint addIndex, uint refIndex, TPhraseDiffContex for (uint i=0; i tempV; tempV.push_back(context.Reference[refIndex]); ucstring tempT = preparePhraseFile(tempV, false); CI18N::removeCComment(tempT); - phrase.Comments = ucstring(temp) + nl + phrase.Comments; + phrase.Comments = ucstring("// DIFF CHANGED ") + toString(addIndex) + nl + phrase.Comments; phrase.Comments = phrase.Comments + ucstring("/* OLD VALUE : ["+nl) + tabLines(1, tempT) +nl + "] */" + nl; phrase.Comments = phrase.Comments + chg; diff --git a/code/snowballs2/client/src/snowballs_client.cpp b/code/snowballs2/client/src/snowballs_client.cpp index 7e019412b..059960922 100644 --- a/code/snowballs2/client/src/snowballs_client.cpp +++ b/code/snowballs2/client/src/snowballs_client.cpp @@ -1264,6 +1264,7 @@ sint main(int argc, char **argv) { // use log.log if NEL_LOG_IN_FILE and SBCLIENT_USE_LOG_LOG defined as 1 createDebug(NULL, SBCLIENT_USE_LOG_LOG, false); + INelContext::getInstance().setWindowedApplication(true); #if SBCLIENT_USE_LOG // create snowballs_client.log diff --git a/code/studio/src/main.cpp b/code/studio/src/main.cpp index dc1e7efb6..e126e258a 100644 --- a/code/studio/src/main.cpp +++ b/code/studio/src/main.cpp @@ -120,6 +120,7 @@ int main(int argc, char **argv) { // use log.log if NEL_LOG_IN_FILE and NLQT_USE_LOG_LOG defined as 1 NLMISC::createDebug(NULL, NLQT_USE_LOG_LOG, false); + NLMISC::INelContext::getInstance().setWindowedApplication(true); #if NLQT_USE_LOG // create NLQT_LOG_FILE // filedisplayer only deletes the 001 etc diff --git a/code/web/private_php/ams/autoload/ticket_user.php b/code/web/private_php/ams/autoload/ticket_user.php index 6de69ccdd..a52ffaec8 100644 --- a/code/web/private_php/ams/autoload/ticket_user.php +++ b/code/web/private_php/ams/autoload/ticket_user.php @@ -20,8 +20,18 @@ class Ticket_User{ * @param $permission the permission that will be given to the user. 1=user, 2=mod, 3=admin */ public static function createTicketUser( $extern_id, $permission) { - $dbl = new DBLayer("lib"); - $dbl->insert("ticket_user",array('TUserId' => $extern_id, 'Permission' => $permission, 'ExternId' => $extern_id)); + try { + //make connection with and put into db + $dbl = new DBLayer("lib"); + $dbl->insert("ticket_user",array('TUserId' => $extern_id, 'Permission' => $permission, 'ExternId' => $extern_id)); + } + catch (PDOException $e) { + //oh noooz... + //error_log(print_r($e, true)); + //print_r($e); + echo "Problem creating user in database!"; + } + } diff --git a/code/web/private_php/ams/ingame_templates/register.tpl b/code/web/private_php/ams/ingame_templates/register.tpl index 7f34e8639..0f1d683a8 100644 --- a/code/web/private_php/ams/ingame_templates/register.tpl +++ b/code/web/private_php/ams/ingame_templates/register.tpl @@ -1,118 +1,118 @@ -{config_load file="ams_lib.conf" section="setup"} -
- {$title} -
- -
- {$welcome_message} -
- - {if $userRegistration == '0'|| $userRegistration == '1'} - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {if isset($TAC_ERROR) && $TAC_ERROR eq "TRUE"}{/if} - - -
{$username_tag} - - {if isset($USERNAME_ERROR) && $USERNAME_ERROR eq "TRUE"}{$USERNAME}{/if}
{$password_tag} - - {if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}{$PASSWORD}{/if}
{$cpassword_tag} - {if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}{$CPASSWORD}{/if}
{$email_tag} - - {if isset($EMAIL_ERROR) && $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if}
{$tac_tag}{$tac_message}
-
- -
- -
- - {/if} - -
- -
- {$username_tooltip} -
- - -
- {$password_message} -
- -
- {$cpassword_message} -
- -
- {$email_message} -
- -
+{config_load file="ams_lib.conf" section="setup"} +
+ {$title} +
+ +
+ {$welcome_message} +
+ + {if $userRegistration == '0'|| $userRegistration == '1'} + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {if isset($TAC_ERROR) && $TAC_ERROR eq "TRUE"}{/if} + + +
{$username_tag} + + {if isset($USERNAME_ERROR) && $USERNAME_ERROR eq "TRUE"}{$USERNAME}{/if}
{$password_tag} + + {if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}{$PASSWORD}{/if}
{$cpassword_tag} + {if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}{$CPASSWORD}{/if}
{$email_tag} + + {if isset($EMAIL_ERROR) && $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if}
{$tac_tag}{$tac_message}
+
+ +
+ +
+ + {/if} + +
+ +
+ {$username_tooltip} +
+ + +
+ {$password_message} +
+ +
+ {$cpassword_message} +
+ +
+ {$email_message} +
+ +
diff --git a/code/web/private_php/ams/ingame_templates/settings.tpl b/code/web/private_php/ams/ingame_templates/settings.tpl index e256e4429..6049bddba 100644 --- a/code/web/private_php/ams/ingame_templates/settings.tpl +++ b/code/web/private_php/ams/ingame_templates/settings.tpl @@ -1,247 +1,247 @@ -{block name=content} - - - - - - - - -
- - - - -
- - - - - {if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1} - {if $userPermission eq 1} - - - {else if $userPermission eq 2 } - - - {else if $userPermission eq 3 } - - - {/if} - {/if} - -
Browse UserSend TicketMake ModeratorMake AdminDemote to UserMake AdminDemote to UserDemote to Moderator
-
-
- - - - - - - - - - - - -

Change Settings of {$target_username}

- - - - - - - - - - - - -
- - -
-
- - - - - -
- - -
- - -
- -

Change Password

- -
- - {if !isset($changesOther) or $changesOther eq "FALSE"} - - - -

- - {/if} - - - -
- Current Password: - - - {if isset($MATCH_ERROR) and $MATCH_ERROR eq "TRUE"}The password is incorrect{/if} -
- New Password: - - - {if isset($NEWPASSWORD_ERROR) and $NEWPASSWORD_ERROR eq "TRUE"}{$newpass_error_message}{/if} -
- Confirm New Password: - - - {if isset($CNEWPASSWORD_ERROR) and $CNEWPASSWORD_ERROR eq "TRUE"}{$confirmnewpass_error_message}{/if} -
- {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "OK"} -

- The password has been changed! -

- {/if} - - - - - -

- -
- -
-
-
- - -
- - -
-

Change Email

- -
- - -
- New Email: - - - {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if} -
- {if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "OK"} -

- The email has been changed! -

- {/if} - - - -

- -

- -
-
-
- - -
- - -
-

Change Info

-
- - - - - - - - - - - - - - - - - - - - -
Firstname:
Lastname:
Country:
Gender -
- {if isset($info_updated) and $info_updated eq "OK"} -

- The Info has been updated! -

- {/if} - - - - -

- -

-
- -
-
-
- - -
- - -
-

Ticket-Update Mail Settings

-
- - -
- Receive ticket updates - - -
- - - -

- -

-
- -
-
-
-
- - - -{/block} - +{block name=content} + + + + + + + + +
+ + + + +
+ + + + + {if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1} + {if $userPermission eq 1} + + + {else if $userPermission eq 2 } + + + {else if $userPermission eq 3 } + + + {/if} + {/if} + +
Browse UserSend TicketMake ModeratorMake AdminDemote to UserMake AdminDemote to UserDemote to Moderator
+
+
+ + + + + + + + + + + + +

Change Settings of {$target_username}

+ + + + + + + + + + + + +
+ + +
+
+ + + + + +
+ + +
+ + +
+ +

Change Password

+ +
+ + {if !isset($changesOther) or $changesOther eq "FALSE"} + + + +

+ + {/if} + + + +
+ Current Password: + + + {if isset($MATCH_ERROR) and $MATCH_ERROR eq "TRUE"}The password is incorrect{/if} +
+ New Password: + + + {if isset($NEWPASSWORD_ERROR) and $NEWPASSWORD_ERROR eq "TRUE"}{$newpass_error_message}{/if} +
+ Confirm New Password: + + + {if isset($CNEWPASSWORD_ERROR) and $CNEWPASSWORD_ERROR eq "TRUE"}{$confirmnewpass_error_message}{/if} +
+ {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "OK"} +

+ The password has been changed! +

+ {/if} + + + + + +

+ +
+ +
+
+
+ + +
+ + +
+

Change Email

+ +
+ + +
+ New Email: + + + {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if} +
+ {if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "OK"} +

+ The email has been changed! +

+ {/if} + + + +

+ +

+ +
+
+
+ + +
+ + +
+

Change Info

+
+ + + + + + + + + + + + + + + + + + + + +
Firstname:
Lastname:
Country:
Gender +
+ {if isset($info_updated) and $info_updated eq "OK"} +

+ The Info has been updated! +

+ {/if} + + + + +

+ +

+
+ +
+
+
+ + +
+ + +
+

Ticket-Update Mail Settings

+
+ + +
+ Receive ticket updates + + +
+ + + +

+ +

+
+ +
+
+
+
+ + + +{/block} + diff --git a/code/web/private_php/setup/sql/nel_ams_lib_00007.sql b/code/web/private_php/setup/sql/nel_ams_lib_00007.sql new file mode 100644 index 000000000..748793e66 --- /dev/null +++ b/code/web/private_php/setup/sql/nel_ams_lib_00007.sql @@ -0,0 +1,2 @@ +INSERT INTO `settings` (`idSettings`, `Setting`, `Value`) VALUES +(2, 'Domain_Auto_Add', '1'); \ No newline at end of file diff --git a/code/web/public_php/admin/templates/default/index_login.tpl b/code/web/public_php/admin/templates/default/index_login.tpl index f62a03998..7b18df28e 100644 --- a/code/web/public_php/admin/templates/default/index_login.tpl +++ b/code/web/public_php/admin/templates/default/index_login.tpl @@ -1,25 +1,25 @@ - -{include file="page_header_light.tpl"} - -

Shard Administration Website

- -

Use login: guest and password: guest to login.

- - - - - - - - - - - - - - - -
Login:
Password:
  -
- -{include file="page_footer_light.tpl"} + +{include file="page_header_light.tpl"} + +

Shard Administration Website

+ +

Use login: guest and password: guest to login.

+ + + + + + + + + + + + + + + +
Login:
Password:
  +
+ +{include file="page_footer_light.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_actions.tpl b/code/web/public_php/admin/templates/default/tool_actions.tpl index a8c9e614a..3ceacb946 100644 --- a/code/web/public_php/admin/templates/default/tool_actions.tpl +++ b/code/web/public_php/admin/templates/default/tool_actions.tpl @@ -1,6 +1,6 @@ - -{include file="page_header.tpl"} - - - -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + + + +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_administration_applications.tpl b/code/web/public_php/admin/templates/default/tool_administration_applications.tpl index 824d34325..45dc12839 100644 --- a/code/web/public_php/admin/templates/default/tool_administration_applications.tpl +++ b/code/web/public_php/admin/templates/default/tool_administration_applications.tpl @@ -1,115 +1,115 @@ - -{include file="page_header.tpl"} - - - - - - -
{$tool_alert_message} - - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - - - - - -
- - - - - - - - - - - - - -{section name=application loop=$tool_application_list} -{cycle assign="trclass" values="row1,row0"} - - - - - - - - - -{/section} -
Applications
IDNameURIRestrictionIconOrderVisible
{$tool_application_list[application].application_id}{$tool_application_list[application].application_name}{$tool_application_list[application].application_uri}{$tool_application_list[application].application_restriction}{$tool_application_list[application].application_icon}{$tool_application_list[application].application_order}{if $tool_application_list[application].application_visible == 1}Yes{else}No{/if}
-
- - - - - -{if $tool_application_edit_data.application_id} - - - - -{/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Applications Details
Id :
Name :
URI :
Restriction :
Icon :
Order :
Visible : - -
  - -{if $tool_application_edit_data.application_id} - - -{else} - - -{/if} - -
-
- -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + + + + + + +
{$tool_alert_message} + + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + + + + + +
+ + + + + + + + + + + + + +{section name=application loop=$tool_application_list} +{cycle assign="trclass" values="row1,row0"} + + + + + + + + + +{/section} +
Applications
IDNameURIRestrictionIconOrderVisible
{$tool_application_list[application].application_id}{$tool_application_list[application].application_name}{$tool_application_list[application].application_uri}{$tool_application_list[application].application_restriction}{$tool_application_list[application].application_icon}{$tool_application_list[application].application_order}{if $tool_application_list[application].application_visible == 1}Yes{else}No{/if}
+
+ + + + + +{if $tool_application_edit_data.application_id} + + + + +{/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Applications Details
Id :
Name :
URI :
Restriction :
Icon :
Order :
Visible : + +
  + +{if $tool_application_edit_data.application_id} + + +{else} + + +{/if} + +
+
+ +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_administration_domains.tpl b/code/web/public_php/admin/templates/default/tool_administration_domains.tpl index 3262aee9d..fa61386a5 100644 --- a/code/web/public_php/admin/templates/default/tool_administration_domains.tpl +++ b/code/web/public_php/admin/templates/default/tool_administration_domains.tpl @@ -1,185 +1,185 @@ - -{include file="page_header.tpl"} - - - - - - -
{$tool_alert_message} - - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - -{section name=domain loop=$tool_domain_list} -{cycle assign="trclass" values="row1,row0"} - - - - - - - - - - - - - - -{/section} -
Domains
IDNameApplicationAS HostAS PortMFS WebRRD PathLAS Admin PathLAS Local PathRing DBCS DBHD Check
{$tool_domain_list[domain].domain_id}{$tool_domain_list[domain].domain_name}{$tool_domain_list[domain].domain_application}{$tool_domain_list[domain].domain_as_host}{$tool_domain_list[domain].domain_as_port}{$tool_domain_list[domain].domain_mfs_web}{$tool_domain_list[domain].domain_rrd_path}{$tool_domain_list[domain].domain_las_admin_path}{$tool_domain_list[domain].domain_las_local_path}{if $tool_domain_list[domain].domain_sql_string != ''}True{else}False{/if}{if $tool_domain_list[domain].domain_cs_sql_string != ''}True{else}False{/if}{if $tool_domain_list[domain].domain_hd_check == 1}Yes{else}No{/if}
-
- - - - - -{if $tool_domain_edit_data.domain_id} - - - - -{/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Domain Details
Id :
Name :
Application :
AS Host :
AS Port :
MFS Web :
RRD Path :
LAS Admin Path :
LAS Local Path :
Ring DB String :
CS DB String :
HD Check : - -
  - -{if $tool_domain_edit_data.domain_id} - - -{else} - - -{/if} - -
- -{if $tool_domain_nel_data} -
- - - - - - - - - - - - - - - - - - - - - - - -
Domain Data
ID :
Name :
Status : -
  - - -
-{/if} - -
- -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + + + + + + +
{$tool_alert_message} + + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +{section name=domain loop=$tool_domain_list} +{cycle assign="trclass" values="row1,row0"} + + + + + + + + + + + + + + +{/section} +
Domains
IDNameApplicationAS HostAS PortMFS WebRRD PathLAS Admin PathLAS Local PathRing DBCS DBHD Check
{$tool_domain_list[domain].domain_id}{$tool_domain_list[domain].domain_name}{$tool_domain_list[domain].domain_application}{$tool_domain_list[domain].domain_as_host}{$tool_domain_list[domain].domain_as_port}{$tool_domain_list[domain].domain_mfs_web}{$tool_domain_list[domain].domain_rrd_path}{$tool_domain_list[domain].domain_las_admin_path}{$tool_domain_list[domain].domain_las_local_path}{if $tool_domain_list[domain].domain_sql_string != ''}True{else}False{/if}{if $tool_domain_list[domain].domain_cs_sql_string != ''}True{else}False{/if}{if $tool_domain_list[domain].domain_hd_check == 1}Yes{else}No{/if}
+
+ + + + + +{if $tool_domain_edit_data.domain_id} + + + + +{/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Domain Details
Id :
Name :
Application :
AS Host :
AS Port :
MFS Web :
RRD Path :
LAS Admin Path :
LAS Local Path :
Ring DB String :
CS DB String :
HD Check : + +
  + +{if $tool_domain_edit_data.domain_id} + + +{else} + + +{/if} + +
+ +{if $tool_domain_nel_data} +
+ + + + + + + + + + + + + + + + + + + + + + + +
Domain Data
ID :
Name :
Status : +
  + + +
+{/if} + +
+ +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_administration_groups.tpl b/code/web/public_php/admin/templates/default/tool_administration_groups.tpl index 3dedf7067..be7235734 100644 --- a/code/web/public_php/admin/templates/default/tool_administration_groups.tpl +++ b/code/web/public_php/admin/templates/default/tool_administration_groups.tpl @@ -1,334 +1,334 @@ - -{include file="page_header.tpl"} - - - - - - -
{$tool_alert_message} - - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - - - - - -
- - - - - - - - - - - -{section name=group loop=$tool_group_list} -{cycle assign="trclass" values="row1,row0"} - - - - - - - -{/section} -
Groups
IDNameLevelDefaultActive
{$tool_group_list[group].group_id}{$tool_group_list[group].group_name}{$tool_group_list[group].group_level_name}{if $tool_group_list[group].group_default == 1}Yes{else}No{/if}{if $tool_group_list[group].group_active == 1}Yes{else}No{/if}
- -{if $tool_group_user_list} -
- - - - - - - - - - - - - -{section name=user loop=$tool_group_user_list} -{cycle assign="trclass2" values="row1,row0"} - - - - -{if $tool_group_user_list[user].user_logged_last > 0} - -{else} - -{/if} - - - -{/section} -
Accounts
IDLoginCreatedLast LoggedNum LogsActive
{$tool_group_user_list[user].user_id}{$tool_group_user_list[user].user_name}{$tool_group_user_list[user].user_created|date_format:"%Y/%m/%d %H:%M:%S"}{$tool_group_user_list[user].user_logged_last|date_format:"%Y/%m/%d %H:%M:%S"}never{$tool_group_user_list[user].user_logged_count}{if $tool_group_user_list[user].user_active == 1}Yes{else}No{/if}
-{/if} - -
- - - - - -{if $tool_group_edit_data.group_id} - - - - -{/if} - - - - - - - - - - - - - - - - - - - - - -
Group Details
Id :
Name :
Level : - -
Default : - -
Active : - -
  - -{if $tool_group_edit_data.group_id} - - -{else} - - -{/if} - -
- -{if $tool_group_edit_data.group_id} - -
- - - - - - - - - - - - - - -
Default Domain
Domains : - -
  - - -
- -{if $tool_group_edit_data.group_default_domain_id > 0} -
- - - - - - - - - - - - - - -
Default Shard
Shards : - -
  - - -
-{/if} - -
- - - - - - - - - - - - - - -
Default Application
Application : - -
  - - -
- -
- - - - - - - - - - - - - - -
Application Access
Applications : - -
  - - -
- -
- - - - - - - - - - - - - - -
Domain Access
Domains : - -
  - - -
- -
- - - - - - - - - - - - - - -
Shard Access
Shards : - -
  - - -
- -{/if} - -
- -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + + + + + + +
{$tool_alert_message} + + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + + + + + +
+ + + + + + + + + + + +{section name=group loop=$tool_group_list} +{cycle assign="trclass" values="row1,row0"} + + + + + + + +{/section} +
Groups
IDNameLevelDefaultActive
{$tool_group_list[group].group_id}{$tool_group_list[group].group_name}{$tool_group_list[group].group_level_name}{if $tool_group_list[group].group_default == 1}Yes{else}No{/if}{if $tool_group_list[group].group_active == 1}Yes{else}No{/if}
+ +{if $tool_group_user_list} +
+ + + + + + + + + + + + + +{section name=user loop=$tool_group_user_list} +{cycle assign="trclass2" values="row1,row0"} + + + + +{if $tool_group_user_list[user].user_logged_last > 0} + +{else} + +{/if} + + + +{/section} +
Accounts
IDLoginCreatedLast LoggedNum LogsActive
{$tool_group_user_list[user].user_id}{$tool_group_user_list[user].user_name}{$tool_group_user_list[user].user_created|date_format:"%Y/%m/%d %H:%M:%S"}{$tool_group_user_list[user].user_logged_last|date_format:"%Y/%m/%d %H:%M:%S"}never{$tool_group_user_list[user].user_logged_count}{if $tool_group_user_list[user].user_active == 1}Yes{else}No{/if}
+{/if} + +
+ + + + + +{if $tool_group_edit_data.group_id} + + + + +{/if} + + + + + + + + + + + + + + + + + + + + + +
Group Details
Id :
Name :
Level : + +
Default : + +
Active : + +
  + +{if $tool_group_edit_data.group_id} + + +{else} + + +{/if} + +
+ +{if $tool_group_edit_data.group_id} + +
+ + + + + + + + + + + + + + +
Default Domain
Domains : + +
  + + +
+ +{if $tool_group_edit_data.group_default_domain_id > 0} +
+ + + + + + + + + + + + + + +
Default Shard
Shards : + +
  + + +
+{/if} + +
+ + + + + + + + + + + + + + +
Default Application
Application : + +
  + + +
+ +
+ + + + + + + + + + + + + + +
Application Access
Applications : + +
  + + +
+ +
+ + + + + + + + + + + + + + +
Domain Access
Domains : + +
  + + +
+ +
+ + + + + + + + + + + + + + +
Shard Access
Shards : + +
  + + +
+ +{/if} + +
+ +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_administration_logs.tpl b/code/web/public_php/admin/templates/default/tool_administration_logs.tpl index a2f537a8e..b44d3719b 100644 --- a/code/web/public_php/admin/templates/default/tool_administration_logs.tpl +++ b/code/web/public_php/admin/templates/default/tool_administration_logs.tpl @@ -1,56 +1,56 @@ - -{include file="page_header.tpl"} - - - - - - -
{$tool_alert_message} - - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - -
- - - - - - - - - - -{section name=log loop=$tool_log_list} - - - - - - -{/section} - - - -
Logs
IDUserDateAction
{$tool_log_list[log].logs_id}{$tool_log_list[log].logs_user_name}{$tool_log_list[log].logs_date|date_format:"%Y/%m/%d %H:%M:%S"}{$tool_log_list[log].logs_data}
-|<    -<    -Page {$tool_log_page_current} / {$tool_log_page_total}    ->    ->| -
-
- -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + + + + + + +
{$tool_alert_message} + + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + +
+ + + + + + + + + + +{section name=log loop=$tool_log_list} + + + + + + +{/section} + + + +
Logs
IDUserDateAction
{$tool_log_list[log].logs_id}{$tool_log_list[log].logs_user_name}{$tool_log_list[log].logs_date|date_format:"%Y/%m/%d %H:%M:%S"}{$tool_log_list[log].logs_data}
+|<    +<    +Page {$tool_log_page_current} / {$tool_log_page_total}    +>    +>| +
+
+ +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_administration_restarts.tpl b/code/web/public_php/admin/templates/default/tool_administration_restarts.tpl index 37e856f09..d31e4a65e 100644 --- a/code/web/public_php/admin/templates/default/tool_administration_restarts.tpl +++ b/code/web/public_php/admin/templates/default/tool_administration_restarts.tpl @@ -1,172 +1,172 @@ - -{include file="page_header.tpl"} - - - - - - -
{$tool_alert_message} - - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - - - - - -
- - - - - - - - - - -{section name=restart loop=$tool_restart_list} -{cycle assign="trclass" values="row1,row0"} - - - - - - -{/section} -
Restart Groups
IDNameListOrder
{$tool_restart_list[restart].restart_group_id}{$tool_restart_list[restart].restart_group_name}{$tool_restart_list[restart].restart_group_list}{$tool_restart_list[restart].restart_group_order}
-
- - - - - -{if $tool_restart_edit_data.restart_group_id} - - - - -{/if} - - - - - - - - - - - - - - - - - -
Restart Group Details
Id :
Name :
Services :
Order :
  - -{if $tool_restart_edit_data.restart_group_id} - - -{else} - - -{/if} - -
-
- -
- - - - - - - - - -
- - - - - - - - - - -{section name=msg loop=$tool_message_list} -{cycle assign="trclass" values="row1,row0"} - - - - - - -{/section} -
Restart Messages
IDLanguageNameValue
{$tool_message_list[msg].restart_message_id}{$tool_message_list[msg].restart_message_lang}{$tool_message_list[msg].restart_message_name}{$tool_message_list[msg].restart_message_value}
-
- - - - - -{if $tool_message_edit_data.restart_message_id} - - - - -{/if} - - - - - - - - - - - - - - - - - -
Restart Message Details
Id :
Name :
Value :
Language : - -
  - -{if $tool_message_edit_data.restart_message_id } - - -{else} - - -{/if} - -
-
- - -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + + + + + + +
{$tool_alert_message} + + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + + + + + +
+ + + + + + + + + + +{section name=restart loop=$tool_restart_list} +{cycle assign="trclass" values="row1,row0"} + + + + + + +{/section} +
Restart Groups
IDNameListOrder
{$tool_restart_list[restart].restart_group_id}{$tool_restart_list[restart].restart_group_name}{$tool_restart_list[restart].restart_group_list}{$tool_restart_list[restart].restart_group_order}
+
+ + + + + +{if $tool_restart_edit_data.restart_group_id} + + + + +{/if} + + + + + + + + + + + + + + + + + +
Restart Group Details
Id :
Name :
Services :
Order :
  + +{if $tool_restart_edit_data.restart_group_id} + + +{else} + + +{/if} + +
+
+ +
+ + + + + + + + + +
+ + + + + + + + + + +{section name=msg loop=$tool_message_list} +{cycle assign="trclass" values="row1,row0"} + + + + + + +{/section} +
Restart Messages
IDLanguageNameValue
{$tool_message_list[msg].restart_message_id}{$tool_message_list[msg].restart_message_lang}{$tool_message_list[msg].restart_message_name}{$tool_message_list[msg].restart_message_value}
+
+ + + + + +{if $tool_message_edit_data.restart_message_id} + + + + +{/if} + + + + + + + + + + + + + + + + + +
Restart Message Details
Id :
Name :
Value :
Language : + +
  + +{if $tool_message_edit_data.restart_message_id } + + +{else} + + +{/if} + +
+
+ + +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_administration_shards.tpl b/code/web/public_php/admin/templates/default/tool_administration_shards.tpl index c5ebdc00f..03ceb06b9 100644 --- a/code/web/public_php/admin/templates/default/tool_administration_shards.tpl +++ b/code/web/public_php/admin/templates/default/tool_administration_shards.tpl @@ -1,110 +1,110 @@ - -{include file="page_header.tpl"} - - - - - - -
{$tool_alert_message} - - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - - - - - -
- - - - - - - - - - - -{section name=shard loop=$tool_shard_list} -{cycle assign="trclass" values="row1,row0"} - - - - - - - -{/section} -
Shards
IDNameShard IDDomainLanguage
{$tool_shard_list[shard].shard_id}{$tool_shard_list[shard].shard_name}{$tool_shard_list[shard].shard_as_id}{$tool_shard_list[shard].domain_name}{$tool_shard_list[shard].shard_lang}
-
- - - - - -{if $tool_shard_edit_data.shard_id} - - - - -{/if} - - - - - - - - - - - - - - - - - - - - - -
Shard Details
Id :
Name :
Shard ID :
Domain : - -
Language : - -
  - -{if $tool_shard_edit_data.shard_id} - - -{else} - - -{/if} - -
-
- -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + + + + + + +
{$tool_alert_message} + + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + + + + + +
+ + + + + + + + + + + +{section name=shard loop=$tool_shard_list} +{cycle assign="trclass" values="row1,row0"} + + + + + + + +{/section} +
Shards
IDNameShard IDDomainLanguage
{$tool_shard_list[shard].shard_id}{$tool_shard_list[shard].shard_name}{$tool_shard_list[shard].shard_as_id}{$tool_shard_list[shard].domain_name}{$tool_shard_list[shard].shard_lang}
+
+ + + + + +{if $tool_shard_edit_data.shard_id} + + + + +{/if} + + + + + + + + + + + + + + + + + + + + + +
Shard Details
Id :
Name :
Shard ID :
Domain : + +
Language : + +
  + +{if $tool_shard_edit_data.shard_id} + + +{else} + + +{/if} + +
+
+ +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_administration_users.tpl b/code/web/public_php/admin/templates/default/tool_administration_users.tpl index d2d81a85b..5950d21ca 100644 --- a/code/web/public_php/admin/templates/default/tool_administration_users.tpl +++ b/code/web/public_php/admin/templates/default/tool_administration_users.tpl @@ -1,207 +1,207 @@ - -{include file="page_header.tpl"} - - - - - - -
{$tool_alert_message} - - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - - - - - -
- - - - - - - - - - - - - -{section name=user loop=$tool_user_list} -{cycle assign="trclass" values="row1,row0"} - - - - - -{if $tool_user_list[user].user_logged_last > 0} - -{else} - -{/if} - - - -{/section} -
Accounts
IDLoginGroupCreatedLast LoggedNum LogsActive
{$tool_user_list[user].user_id}{$tool_user_list[user].user_name}{$tool_user_list[user].user_group_name}{$tool_user_list[user].user_created|date_format:"%Y/%m/%d %H:%M:%S"}{$tool_user_list[user].user_logged_last|date_format:"%Y/%m/%d %H:%M:%S"}never{$tool_user_list[user].user_logged_count}{if $tool_user_list[user].user_active == 1}Yes{else}No{/if}
-
- - - - - -{if $tool_user_edit_data.user_id} - - - - -{/if} - - - - - - - - - - - - - - - - - - - - - -
Account Details
Id :
Name :
Password :
Group : - -
Active : - -
  - -{if $tool_user_edit_data.user_id} - - -{else} - - -{/if} - -
- -{if $tool_user_edit_data.user_id} - -
- - - - - - - - - - - - - - -
Application Access
Applications : - -
  - - -
- -
- - - - - - - - - - - - - - -
Domain Access
Domains : - -
  - - -
- -
- - - - - - - - - - - - - - -
Shard Access {if $tool_domain_list[domain].domain_disabled}(group){/if}
Shards : - -
  - - {* *} - -
- -{/if} - -
- -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + + + + + + +
{$tool_alert_message} + + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + + + + + +
+ + + + + + + + + + + + + +{section name=user loop=$tool_user_list} +{cycle assign="trclass" values="row1,row0"} + + + + + +{if $tool_user_list[user].user_logged_last > 0} + +{else} + +{/if} + + + +{/section} +
Accounts
IDLoginGroupCreatedLast LoggedNum LogsActive
{$tool_user_list[user].user_id}{$tool_user_list[user].user_name}{$tool_user_list[user].user_group_name}{$tool_user_list[user].user_created|date_format:"%Y/%m/%d %H:%M:%S"}{$tool_user_list[user].user_logged_last|date_format:"%Y/%m/%d %H:%M:%S"}never{$tool_user_list[user].user_logged_count}{if $tool_user_list[user].user_active == 1}Yes{else}No{/if}
+
+ + + + + +{if $tool_user_edit_data.user_id} + + + + +{/if} + + + + + + + + + + + + + + + + + + + + + +
Account Details
Id :
Name :
Password :
Group : + +
Active : + +
  + +{if $tool_user_edit_data.user_id} + + +{else} + + +{/if} + +
+ +{if $tool_user_edit_data.user_id} + +
+ + + + + + + + + + + + + + +
Application Access
Applications : + +
  + + +
+ +
+ + + + + + + + + + + + + + +
Domain Access
Domains : + +
  + + +
+ +
+ + + + + + + + + + + + + + +
Shard Access {if $tool_domain_list[domain].domain_disabled}(group){/if}
Shards : + +
  + + {* *} + +
+ +{/if} + +
+ +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_graphs.tpl b/code/web/public_php/admin/templates/default/tool_graphs.tpl index 24e2d4eaa..9dcd896a5 100644 --- a/code/web/public_php/admin/templates/default/tool_graphs.tpl +++ b/code/web/public_php/admin/templates/default/tool_graphs.tpl @@ -1,274 +1,274 @@ - -{include file="page_header.tpl"} - -{literal} - -{/literal} - - - - - -
- - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - - - - - -
- -{if $tool_domain_selected && $tool_shard_selected} - - - - - - - - -{if $tool_refresh_rate > 0} - - - -{/if} - -
Refresh
- -
- - -
-
-{/if} - - - - - -{section name=domain loop=$tool_domain_list} - - - -{/section} -
Domains
{$tool_domain_list[domain].domain_name}
- -{if $tool_domain_selected} -
- - - - -{section name=shard loop=$tool_shard_list} -{if $tool_domain_selected == $tool_shard_list[shard].shard_domain_id} - - - -{/if} -{/section} -
Shards
{$tool_shard_list[shard].shard_name}
- -{if $tool_frame_list} - -{/if} - -{if $tool_graph_list} -
- - - - -{section name=gvar loop=$tool_graph_variables} - - - - - -{assign var="var_name" value=$tool_graph_variables[gvar]} -{section name=gdata loop=$tool_graph_datas.$var_name} - - - - - -{/section} -{/section} -
Graphs
{$tool_graph_variables[gvar]}High
{$tool_graph_datas.$var_name[gdata].service}{if $tool_graph_datas.$var_name[gdata].high_file != ''}Yes{else}No{/if}
-{/if} - -{/if} - -
  - -{if $tool_domain_error} - - - - -
{$tool_domain_error}
-{elseif !$tool_domain_selected} - - - - -
You need to select a domain.
-{else} -{if $tool_as_error} - - - - -
{$tool_as_error}
-
-{/if} - - - - - -
-{if $tool_rrd_output} -{section name=rrd loop=$tool_rrd_output} - {$tool_rrd_output[rrd].desc}
-
-{/section} -{/if} -
-{if $tool_rrd_high_output} -{section name=rrd loop=$tool_rrd_high_output} - {$tool_rrd_high_output[rrd].desc}
-{if $tool_rrd_high_output[rrd].img != ''} -
-{/if} -{/section} -{/if} -
-{/if} - -
- - -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + +{literal} + +{/literal} + + + + + +
+ + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + + + + + +
+ +{if $tool_domain_selected && $tool_shard_selected} + + + + + + + + +{if $tool_refresh_rate > 0} + + + +{/if} + +
Refresh
+ +
+ + +
+
+{/if} + + + + + +{section name=domain loop=$tool_domain_list} + + + +{/section} +
Domains
{$tool_domain_list[domain].domain_name}
+ +{if $tool_domain_selected} +
+ + + + +{section name=shard loop=$tool_shard_list} +{if $tool_domain_selected == $tool_shard_list[shard].shard_domain_id} + + + +{/if} +{/section} +
Shards
{$tool_shard_list[shard].shard_name}
+ +{if $tool_frame_list} + +{/if} + +{if $tool_graph_list} +
+ + + + +{section name=gvar loop=$tool_graph_variables} + + + + + +{assign var="var_name" value=$tool_graph_variables[gvar]} +{section name=gdata loop=$tool_graph_datas.$var_name} + + + + + +{/section} +{/section} +
Graphs
{$tool_graph_variables[gvar]}High
{$tool_graph_datas.$var_name[gdata].service}{if $tool_graph_datas.$var_name[gdata].high_file != ''}Yes{else}No{/if}
+{/if} + +{/if} + +
  + +{if $tool_domain_error} + + + + +
{$tool_domain_error}
+{elseif !$tool_domain_selected} + + + + +
You need to select a domain.
+{else} +{if $tool_as_error} + + + + +
{$tool_as_error}
+
+{/if} + + + + + +
+{if $tool_rrd_output} +{section name=rrd loop=$tool_rrd_output} + {$tool_rrd_output[rrd].desc}
+
+{/section} +{/if} +
+{if $tool_rrd_high_output} +{section name=rrd loop=$tool_rrd_high_output} + {$tool_rrd_high_output[rrd].desc}
+{if $tool_rrd_high_output[rrd].img != ''} +
+{/if} +{/section} +{/if} +
+{/if} + +
+ + +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_graphs_ccu.tpl b/code/web/public_php/admin/templates/default/tool_graphs_ccu.tpl index db9051058..2a9cf3f21 100644 --- a/code/web/public_php/admin/templates/default/tool_graphs_ccu.tpl +++ b/code/web/public_php/admin/templates/default/tool_graphs_ccu.tpl @@ -1,230 +1,230 @@ - -{include file="page_header.tpl"} - -{literal} - -{/literal} - - - - - -
- - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - - - - - -
- -{if $tool_domain_selected && $tool_frame_selected} - - - - - - - - -{if $tool_refresh_rate > 0} - - - -{/if} - -
Refresh
- -
- - -
-
-{/if} - - - - - -{section name=domain loop=$tool_domain_list} - - - -{/section} -
Domains
{$tool_domain_list[domain].domain_name}
- -{if $tool_domain_selected} -
- - - - -{section name=frame loop=$tool_frame_list} - - - -{/section} -
Time Frame
{$tool_frame_list[frame].title}
- -{/if} - -
  - -{if $tool_domain_error} - - - - -
{$tool_domain_error}
-{elseif !$tool_domain_selected} - - - - -
You need to select a domain.
-{elseif !$tool_frame_selected} - - - - -
You need to select a time frame.
-{else} -{if $tool_as_error} - - - - -
{$tool_as_error}
-
-{/if} - - - - -
-{if $tool_rrd_output} -{section name=rrd loop=$tool_rrd_output} - {$tool_rrd_output[rrd].desc}
-
-{/section} -{/if} -
-{/if} - -
- - -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + +{literal} + +{/literal} + + + + + +
+ + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + + + + + +
+ +{if $tool_domain_selected && $tool_frame_selected} + + + + + + + + +{if $tool_refresh_rate > 0} + + + +{/if} + +
Refresh
+ +
+ + +
+
+{/if} + + + + + +{section name=domain loop=$tool_domain_list} + + + +{/section} +
Domains
{$tool_domain_list[domain].domain_name}
+ +{if $tool_domain_selected} +
+ + + + +{section name=frame loop=$tool_frame_list} + + + +{/section} +
Time Frame
{$tool_frame_list[frame].title}
+ +{/if} + +
  + +{if $tool_domain_error} + + + + +
{$tool_domain_error}
+{elseif !$tool_domain_selected} + + + + +
You need to select a domain.
+{elseif !$tool_frame_selected} + + + + +
You need to select a time frame.
+{else} +{if $tool_as_error} + + + + +
{$tool_as_error}
+
+{/if} + + + + +
+{if $tool_rrd_output} +{section name=rrd loop=$tool_rrd_output} + {$tool_rrd_output[rrd].desc}
+
+{/section} +{/if} +
+{/if} + +
+ + +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_graphs_hires.tpl b/code/web/public_php/admin/templates/default/tool_graphs_hires.tpl index 67288ac95..54d784934 100644 --- a/code/web/public_php/admin/templates/default/tool_graphs_hires.tpl +++ b/code/web/public_php/admin/templates/default/tool_graphs_hires.tpl @@ -1,252 +1,252 @@ - -{include file="page_header.tpl"} - -{literal} - -{/literal} - - - - - -
- - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - - - - - -
- -{if $tool_domain_selected && $tool_shard_selected && $tool_frame_selected} - - - - - - - - -{if $tool_refresh_rate > 0} - - - -{/if} - -
Refresh
- -
- - -
-
-{/if} - - - - - -{section name=domain loop=$tool_domain_list} - - - -{/section} -
Domains
{$tool_domain_list[domain].domain_name}
- -{if $tool_domain_selected} -
- - - - -{section name=shard loop=$tool_shard_list} -{if $tool_domain_selected == $tool_shard_list[shard].shard_domain_id} - - - -{/if} -{/section} -
Shards
{$tool_shard_list[shard].shard_name}
- -
- - - - -{section name=frame loop=$tool_frame_list} - - - -{/section} -
Time Frame
{$tool_frame_list[frame].title}
- -{/if} - -
  - -{if $tool_domain_error} - - - - -
{$tool_domain_error}
-{elseif !$tool_domain_selected} - - - - -
You need to select a domain.
-{elseif !$tool_shard_selected} - - - - -
You need to select a shard.
-{elseif !$tool_frame_selected} - - - - -
You need to select a time frame.
-{else} -{if $tool_as_error} - - - - -
{$tool_as_error}
-
-{/if} - - - - -
-{if $tool_rrd_high_output} -{section name=rrd loop=$tool_rrd_high_output} - {$tool_rrd_high_output[rrd].desc}
-{if $tool_rrd_high_output[rrd].img != ''} -
-{/if} -{/section} -{/if} -
-{/if} - -
- - -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + +{literal} + +{/literal} + + + + + +
+ + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + + + + + +
+ +{if $tool_domain_selected && $tool_shard_selected && $tool_frame_selected} + + + + + + + + +{if $tool_refresh_rate > 0} + + + +{/if} + +
Refresh
+ +
+ + +
+
+{/if} + + + + + +{section name=domain loop=$tool_domain_list} + + + +{/section} +
Domains
{$tool_domain_list[domain].domain_name}
+ +{if $tool_domain_selected} +
+ + + + +{section name=shard loop=$tool_shard_list} +{if $tool_domain_selected == $tool_shard_list[shard].shard_domain_id} + + + +{/if} +{/section} +
Shards
{$tool_shard_list[shard].shard_name}
+ +
+ + + + +{section name=frame loop=$tool_frame_list} + + + +{/section} +
Time Frame
{$tool_frame_list[frame].title}
+ +{/if} + +
  + +{if $tool_domain_error} + + + + +
{$tool_domain_error}
+{elseif !$tool_domain_selected} + + + + +
You need to select a domain.
+{elseif !$tool_shard_selected} + + + + +
You need to select a shard.
+{elseif !$tool_frame_selected} + + + + +
You need to select a time frame.
+{else} +{if $tool_as_error} + + + + +
{$tool_as_error}
+
+{/if} + + + + +
+{if $tool_rrd_high_output} +{section name=rrd loop=$tool_rrd_high_output} + {$tool_rrd_high_output[rrd].desc}
+{if $tool_rrd_high_output[rrd].img != ''} +
+{/if} +{/section} +{/if} +
+{/if} + +
+ + +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_graphs_tech.tpl b/code/web/public_php/admin/templates/default/tool_graphs_tech.tpl index c1c96d189..79299b7ab 100644 --- a/code/web/public_php/admin/templates/default/tool_graphs_tech.tpl +++ b/code/web/public_php/admin/templates/default/tool_graphs_tech.tpl @@ -1,250 +1,250 @@ - -{include file="page_header.tpl"} - -{literal} - -{/literal} - - - - - -
- - - {section name=onemenu loop=$tool_menu} - - {/section} - -
{$tool_menu[onemenu].title}
-
- -
- - - - - - - - - -
- -{if $tool_domain_selected && $tool_shard_selected && $tool_frame_selected} - - - - - - - - -{if $tool_refresh_rate > 0} - - - -{/if} - -
Refresh
- -
- - -
-
-{/if} - - - - - -{section name=domain loop=$tool_domain_list} - - - -{/section} -
Domains
{$tool_domain_list[domain].domain_name}
- -{if $tool_domain_selected} -
- - - - -{section name=shard loop=$tool_shard_list} -{if $tool_domain_selected == $tool_shard_list[shard].shard_domain_id} - - - -{/if} -{/section} -
Shards
{$tool_shard_list[shard].shard_name}
- -
- - - - -{section name=frame loop=$tool_frame_list} - - - -{/section} -
Time Frame
{$tool_frame_list[frame].title}
- -{/if} - -
  - -{if $tool_domain_error} - - - - -
{$tool_domain_error}
-{elseif !$tool_domain_selected} - - - - -
You need to select a domain.
-{elseif !$tool_shard_selected} - - - - -
You need to select a shard.
-{elseif !$tool_frame_selected} - - - - -
You need to select a time frame.
-{else} -{if $tool_as_error} - - - - -
{$tool_as_error}
-
-{/if} - - - - -
-{if $tool_rrd_output} -{section name=rrd loop=$tool_rrd_output} - {$tool_rrd_output[rrd].desc}
-
-{/section} -{/if} -
-{/if} - -
- - -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + +{literal} + +{/literal} + + + + + +
+ + + {section name=onemenu loop=$tool_menu} + + {/section} + +
{$tool_menu[onemenu].title}
+
+ +
+ + + + + + + + + +
+ +{if $tool_domain_selected && $tool_shard_selected && $tool_frame_selected} + + + + + + + + +{if $tool_refresh_rate > 0} + + + +{/if} + +
Refresh
+ +
+ + +
+
+{/if} + + + + + +{section name=domain loop=$tool_domain_list} + + + +{/section} +
Domains
{$tool_domain_list[domain].domain_name}
+ +{if $tool_domain_selected} +
+ + + + +{section name=shard loop=$tool_shard_list} +{if $tool_domain_selected == $tool_shard_list[shard].shard_domain_id} + + + +{/if} +{/section} +
Shards
{$tool_shard_list[shard].shard_name}
+ +
+ + + + +{section name=frame loop=$tool_frame_list} + + + +{/section} +
Time Frame
{$tool_frame_list[frame].title}
+ +{/if} + +
  + +{if $tool_domain_error} + + + + +
{$tool_domain_error}
+{elseif !$tool_domain_selected} + + + + +
You need to select a domain.
+{elseif !$tool_shard_selected} + + + + +
You need to select a shard.
+{elseif !$tool_frame_selected} + + + + +
You need to select a time frame.
+{else} +{if $tool_as_error} + + + + +
{$tool_as_error}
+
+{/if} + + + + +
+{if $tool_rrd_output} +{section name=rrd loop=$tool_rrd_output} + {$tool_rrd_output[rrd].desc}
+
+{/section} +{/if} +
+{/if} + +
+ + +{include file="page_footer.tpl"} diff --git a/code/web/public_php/admin/templates/default/tool_notes.tpl b/code/web/public_php/admin/templates/default/tool_notes.tpl index 56a35c4cf..e0e04106d 100644 --- a/code/web/public_php/admin/templates/default/tool_notes.tpl +++ b/code/web/public_php/admin/templates/default/tool_notes.tpl @@ -1,164 +1,164 @@ - -{include file="page_header.tpl"} - -{literal} - - - -{/literal} - - - - - -
{$tool_alert_message}
- -
- - - - - - - - - - -
- - - - - - - - - - -{if $restriction_tool_notes_global} - -{/if} - - {section name=note loop=$tool_note_list} - - - - - - -{if $restriction_tool_notes_global} - -{/if} - - {/section} -
Notes
IDTitleModeLast UpdateActiveGlobal
{$tool_note_list[note].note_id}{$tool_note_list[note].note_title}{if $tool_note_list[note].note_mode == 0}Text{else}Popup{/if}{$tool_note_list[note].note_date|date_format:"%Y/%m/%d %H:%M:%S"}{if $tool_note_list[note].note_active == 1}Yes{else}No{/if}{if $tool_note_list[note].note_global == 1}Yes{else}No{/if}
-
  - - - - - -{if $tool_note_edit_data.note_id} - - - - -{/if} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{if $restriction_tool_notes_global} - - - - -{/if} - - - - - -
Notes Details
Id :
Title :
Mode :
Text :
URI :
Restriction :
Active : - -
Global : - -
  - -{if $tool_note_edit_data.note_id} - - -{else} - - -{/if} - -
-
- - -{include file="page_footer.tpl"} + +{include file="page_header.tpl"} + +{literal} + + + +{/literal} + + + + + +
{$tool_alert_message}
+ +
+ + + + + + + + + + +
+ + + + + + + + + + +{if $restriction_tool_notes_global} + +{/if} + + {section name=note loop=$tool_note_list} + + + + + + +{if $restriction_tool_notes_global} + +{/if} + + {/section} +
Notes
IDTitleModeLast UpdateActiveGlobal
{$tool_note_list[note].note_id}{$tool_note_list[note].note_title}{if $tool_note_list[note].note_mode == 0}Text{else}Popup{/if}{$tool_note_list[note].note_date|date_format:"%Y/%m/%d %H:%M:%S"}{if $tool_note_list[note].note_active == 1}Yes{else}No{/if}{if $tool_note_list[note].note_global == 1}Yes{else}No{/if}
+
  + + + + + +{if $tool_note_edit_data.note_id} + + + + +{/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{if $restriction_tool_notes_global} + + + + +{/if} + + + + + +
Notes Details
Id :
Title :
Mode :
Text :
URI :
Restriction :
Active : + +
Global : + +
  + +{if $tool_note_edit_data.note_id} + + +{else} + + +{/if} + +
+
+ + +{include file="page_footer.tpl"} diff --git a/code/web/public_php/ams/templates/forgot_password.tpl b/code/web/public_php/ams/templates/forgot_password.tpl index 80bea346b..f6fae04d1 100644 --- a/code/web/public_php/ams/templates/forgot_password.tpl +++ b/code/web/public_php/ams/templates/forgot_password.tpl @@ -1,54 +1,54 @@ -{extends file="layout.tpl"} -{block name=content} - -
- -
- -
- -
-{/block} - - +{extends file="layout.tpl"} +{block name=content} + +
+ +
+ +
+ +
+{/block} + + diff --git a/code/web/public_php/ams/templates/register.tpl b/code/web/public_php/ams/templates/register.tpl index 24aac42a2..f14ef9a6c 100644 --- a/code/web/public_php/ams/templates/register.tpl +++ b/code/web/public_php/ams/templates/register.tpl @@ -1,124 +1,124 @@ -{extends file="layout.tpl"} -{block name=content} - -
- -
- -
- -
-{/block} - - +{extends file="layout.tpl"} +{block name=content} + +
+ +
+ +
+ +
+{/block} + + diff --git a/code/web/public_php/ams/templates/reset_password.tpl b/code/web/public_php/ams/templates/reset_password.tpl index 4c5bca351..57d0567ff 100644 --- a/code/web/public_php/ams/templates/reset_password.tpl +++ b/code/web/public_php/ams/templates/reset_password.tpl @@ -1,66 +1,66 @@ -{extends file="layout.tpl"} -{block name=content} - -
- -
- -
- -
-{/block} - - +{extends file="layout.tpl"} +{block name=content} + +
+ +
+ +
+ +
+{/block} + + diff --git a/code/web/public_php/ams/templates/settings.tpl b/code/web/public_php/ams/templates/settings.tpl index 94883c9de..0e04cab17 100644 --- a/code/web/public_php/ams/templates/settings.tpl +++ b/code/web/public_php/ams/templates/settings.tpl @@ -1,382 +1,382 @@ -{block name=content} -
-
-
-
- Change Password -
-
-
-
- Change Password - - {if !isset($changesOther) or $changesOther eq "FALSE"} -
- -
-
- - - {if isset($MATCH_ERROR) and $MATCH_ERROR eq "TRUE"}The password is incorrect{/if} -
-
-
- {/if} -
- -
-
- - - {if isset($NEWPASSWORD_ERROR) and $NEWPASSWORD_ERROR eq "TRUE"}{$newpass_error_message}{/if} -
-
-
- -
- -
-
- - - {if isset($CNEWPASSWORD_ERROR) and $CNEWPASSWORD_ERROR eq "TRUE"}{$confirmnewpass_error_message}{/if} -
-
-
- - - - {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "OK"} -
- The password has been changed! -
- {/if} - - {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "SHARDOFF"} -
- The password has been changed, though the shard seems offline, it may take some time to see the change on the shard. -
- {/if} - - - -
- -
- -
-
-
-
-
-
-
- - {if $permission != '1'} -
-
-
- Add User -
-
-
-
- Add User - -
- -
-
- - - {if isset($USERNAME_ERROR) and $USERNAME_ERROR eq "TRUE"}{$USERNAME}{/if} -
-
-
- -
- -
-
- - - {if isset($PASSWORD_ERROR) and $PASSWORD_ERROR eq "TRUE"}{$PASSWORD}{/if} -
-
-
- -
- -
-
- - - {if isset($CPASSWORD_ERROR) and $CPASSWORD_ERROR eq "TRUE"}{$CPASSWORD}{/if} -
-
-
- -
- -
-
- - - {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE" and isset($do)}{$EMAIL}{/if} -
-
-
- - - {if isset($SUCCESS_ADD) and $SUCCESS_ADD eq "ok"} -
- The user has been created! -
- {/if} - - {if isset($SUCCESS_ADD) and $SUCCESS_ADD eq "shardoffline"} -
- The user is created, though the shard seems offline, it may take some time to see the change on the shard. -
- {/if} - - - -
- -
- -
-
-
-
-
-
-
- {/if} - -
-
-
- Change Email -
-
-
-
- Change Email -
- -
-
- - - {if isset($CEMAIL_ERROR) and $CEMAIL_ERROR eq "TRUE"}{$EMAIL}{/if} - -
-
-
- - - {if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "OK"} -
- The email has been changed! -
- {/if} - - {if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "SHARDOFF"} -
- The email has been changed, though the shard seems offline, it may take some time to see the change on the shard. -
- {/if} - - - -
- -
- -
-
-
-
-
-
-
- -
-
-
- Ticket updates -
- - -
-
-
- Ticket-Update Mail Settings - -
- -
- -
- -
- - - -
- -
- -
-
-
-
-
-
-
- -
-
-
- Change Info -
-
-
-
- Change Info - -
- -
-
- - -
-
-
- -
- -
-
- - -
-
-
- -
- -
- -
-
- -
- -
- -
- -
- -
-
- - {if isset($info_updated) and $info_updated eq "OK"} -
- The Info has been updated! -
- {/if} - - - -
- -
- -
-
-
-
-
-
-
- - {if $permission == '3'} -
-
-
- User Registration -
-
-
-
- User Registration - -
-
- -
- -
- -
- -
-
- - - -
- -
- -
-
-
-
-
-
-
- {/if} - -
- - - -{/block} - +{block name=content} +
+
+
+
+ Change Password +
+
+
+
+ Change Password + + {if !isset($changesOther) or $changesOther eq "FALSE"} +
+ +
+
+ + + {if isset($MATCH_ERROR) and $MATCH_ERROR eq "TRUE"}The password is incorrect{/if} +
+
+
+ {/if} +
+ +
+
+ + + {if isset($NEWPASSWORD_ERROR) and $NEWPASSWORD_ERROR eq "TRUE"}{$newpass_error_message}{/if} +
+
+
+ +
+ +
+
+ + + {if isset($CNEWPASSWORD_ERROR) and $CNEWPASSWORD_ERROR eq "TRUE"}{$confirmnewpass_error_message}{/if} +
+
+
+ + + + {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "OK"} +
+ The password has been changed! +
+ {/if} + + {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "SHARDOFF"} +
+ The password has been changed, though the shard seems offline, it may take some time to see the change on the shard. +
+ {/if} + + + +
+ +
+ +
+
+
+
+
+
+
+ + {if $permission != '1'} +
+
+
+ Add User +
+
+
+
+ Add User + +
+ +
+
+ + + {if isset($USERNAME_ERROR) and $USERNAME_ERROR eq "TRUE"}{$USERNAME}{/if} +
+
+
+ +
+ +
+
+ + + {if isset($PASSWORD_ERROR) and $PASSWORD_ERROR eq "TRUE"}{$PASSWORD}{/if} +
+
+
+ +
+ +
+
+ + + {if isset($CPASSWORD_ERROR) and $CPASSWORD_ERROR eq "TRUE"}{$CPASSWORD}{/if} +
+
+
+ +
+ +
+
+ + + {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE" and isset($do)}{$EMAIL}{/if} +
+
+
+ + + {if isset($SUCCESS_ADD) and $SUCCESS_ADD eq "ok"} +
+ The user has been created! +
+ {/if} + + {if isset($SUCCESS_ADD) and $SUCCESS_ADD eq "shardoffline"} +
+ The user is created, though the shard seems offline, it may take some time to see the change on the shard. +
+ {/if} + + + +
+ +
+ +
+
+
+
+
+
+
+ {/if} + +
+
+
+ Change Email +
+
+
+
+ Change Email +
+ +
+
+ + + {if isset($CEMAIL_ERROR) and $CEMAIL_ERROR eq "TRUE"}{$EMAIL}{/if} + +
+
+
+ + + {if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "OK"} +
+ The email has been changed! +
+ {/if} + + {if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "SHARDOFF"} +
+ The email has been changed, though the shard seems offline, it may take some time to see the change on the shard. +
+ {/if} + + + +
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+ Ticket updates +
+ + +
+
+
+ Ticket-Update Mail Settings + +
+ +
+ +
+ +
+ + + +
+ +
+ +
+
+
+
+
+
+
+ +
+
+
+ Change Info +
+
+
+
+ Change Info + +
+ +
+
+ + +
+
+
+ +
+ +
+
+ + +
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ + {if isset($info_updated) and $info_updated eq "OK"} +
+ The Info has been updated! +
+ {/if} + + + +
+ +
+ +
+
+
+
+
+
+
+ + {if $permission == '3'} +
+
+
+ User Registration +
+
+
+
+ User Registration + +
+
+ +
+ +
+ +
+ +
+
+ + + +
+ +
+ +
+
+
+
+
+
+
+ {/if} + +
+ + + +{/block} + diff --git a/code/web/public_php/crash_report/config.inc.php b/code/web/public_php/crash_report/config.inc.php new file mode 100644 index 000000000..fe4b3e928 --- /dev/null +++ b/code/web/public_php/crash_report/config.inc.php @@ -0,0 +1,30 @@ + +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +class BugReportConfig +{ + static public $dbhost = "localhost"; + static public $dbport = "3306"; + static public $dbdb = "bugs"; + static public $dbuser = "bugs"; + static public $dbpw = "bugs"; +} + +?> diff --git a/code/web/public_php/crash_report/log.inc.php b/code/web/public_php/crash_report/log.inc.php new file mode 100644 index 000000000..71deee24f --- /dev/null +++ b/code/web/public_php/crash_report/log.inc.php @@ -0,0 +1,45 @@ + +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +/// Simple file logger class +class Logger +{ + private $lf = NULL; + + function __construct() + { + $this->lf = fopen( 'log.txt', 'a' ); + if( $this->lf === FALSE ) + exit( 1 ); + } + + function __destruct() + { + fclose( $this->lf ); + } + + public function log( $msg ) + { + $date = date( "[M d, Y H:i:s] " ); + fwrite( $this->lf, $date . $msg . "\n" ); + } +} + +?> diff --git a/code/web/public_php/crash_report/submit.php b/code/web/public_php/crash_report/submit.php new file mode 100644 index 000000000..d20214d11 --- /dev/null +++ b/code/web/public_php/crash_report/submit.php @@ -0,0 +1,112 @@ + +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +require_once( 'config.inc.php' ); +require_once( 'log.inc.php' ); + +/// Example web application that takes bug reports from the bug reporter Qt app +class BugReportGatherApp +{ + private $db = NULL; + private $logger = NULL; + + function __construct() + { + $this->logger = new Logger(); + } + + private function logPOSTVars() + { + $report = ""; + $descr = ""; + $email = ""; + + if( isset( $_POST[ 'report' ] ) ) + $report = $_POST[ 'report' ]; + + if( isset( $_POST[ 'descr' ] ) ) + $descr = $_POST[ 'descr' ]; + + if( isset( $_POST[ 'email' ] ) ) + $email = $_POST[ 'email' ]; + + $this->logger->log( 'report: ' . "\n" . $report ); + $this->logger->log( 'description: ' . "\n" . $descr ); + $this->logger->log( 'email: ' . "\n" . $email ); + } + + private function buildQuery() + { + $report = ""; + $descr = ""; + $email = ""; + + if( isset( $_POST[ 'report' ] ) ) + $report = $_POST[ 'report' ]; + + if( isset( $_POST[ 'descr' ] ) ) + $descr = $_POST[ 'descr' ]; + + if( isset( $_POST[ 'email' ] ) ) + $email = $_POST[ 'email' ]; + + $report = $this->db->real_escape_string( $report ); + $descr = $this->db->real_escape_string( $descr ); + $email = $this->db->real_escape_string( $email ); + + + $q = "INSERT INTO `bugs` (`report`,`description`,`email`) VALUES ("; + $q .= "'$report',"; + $q .= "'$descr',"; + $q .= "'$email')"; + + return $q; + } + + public function exec() + { + //$this->logPOSTVars(); + + $this->db = new mysqli( BugReportConfig::$dbhost, BugReportConfig::$dbuser, BugReportConfig::$dbpw, BugReportConfig::$dbdb, BugReportConfig::$dbport ); + if( mysqli_connect_error() ) + { + $this->logger->log( "Connection error :(" ); + $this->logger->log( mysqli_connect_error() ); + return; + } + + $q = $this->buildQuery(); + $result = $this->db->query( $q ); + if( $result !== TRUE ) + { + $this->logger->log( "Query failed :(" ); + $this->logger->log( 'Query: ' . $q ); + $this->logPOSTVars(); + } + + $this->db->close(); + } +} + + +$app = new BugReportGatherApp(); +$app->exec(); + +?> diff --git a/code/web/public_php/setup/database.php b/code/web/public_php/setup/database.php index 3e195f2b8..6137cb00f 100644 --- a/code/web/public_php/setup/database.php +++ b/code/web/public_php/setup/database.php @@ -6,7 +6,7 @@ $db_nel_tool = 2; // Support $db_nel_ams = 2; -$db_nel_ams_lib = 6; +$db_nel_ams_lib = 7; // Domain $db_ring_domain = 1; diff --git a/code/web/public_php/setup/install.php b/code/web/public_php/setup/install.php index 49fc0b3a7..438a5c332 100644 --- a/code/web/public_php/setup/install.php +++ b/code/web/public_php/setup/install.php @@ -42,6 +42,20 @@ require_once('setup/version.php'); $continue = false; } } + + if ($continue) { + try { + if (!in_array("mysql",PDO::getAvailableDrivers(),TRUE)) + { + throw new PDOException ("Cannot work without a proper database setting up"); + } + } + catch (PDOException $pdoEx) + { + printalert("danger", "PHP PDO seems to be missing the mysql driver"); + $continue = false; + } + } // Validate basics if ($continue) {