Merged in nimetu/ryzomcore/issue-221 (pull request #100)

improve chatlog file (issue #221)
This commit is contained in:
Jan Boon 2015-02-22 11:01:08 +01:00
commit 9afb02343f
144 changed files with 1881 additions and 746 deletions

View file

@ -1,7 +1,7 @@
#-----------------------------------------------------------------------------
#
# NeL
# Authors: Nevrax and the NeL Community
# Ryzom Core
# Authors: Nevrax and the Ryzom Core Community
# Version: 0.11.2
#
# Notes:
@ -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)
@ -228,30 +234,31 @@ IF(WITH_NEL_TESTS)
ENDIF(WITH_NEL_TESTS)
# packaging information
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NeL MMORPG Framework")
SET(CPACK_PACKAGE_VENDOR "NeL")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ryzom Core MMORPG Framework")
SET(CPACK_PACKAGE_VENDOR "Ryzom Core")
SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
SET(CPACK_PACKAGE_VERSION_MAJOR "${NL_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}")
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/")
SET(CPACK_PACKAGE_EXECUTABLES "nel${NL_VERSION}" "nel")
SET(CPACK_PACKAGE_EXECUTABLES "ryzomcore${NL_VERSION}" "ryzomcore")
SET(CPACK_SET_DESTDIR TRUE)
# NSIS Specific Packing Setup
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "NeL")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "RyzomCore")
SET(CPACK_NSIS_MODIFY_PATH "ON")
SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp)
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} NeL")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} RyzomCore")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki")
SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com")
## Source Packages
SET(CPACK_PACKAGE_FILE_NAME "nel-${NL_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "nel-${NL_VERSION}")
SET(CPACK_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
IF(WIN32)
#SET(CPACK_GENERATOR "NSIS")
SET(CPACK_GENERATOR "NSIS;ZIP")

View file

@ -26,63 +26,46 @@ IF(TARGET_CPU STREQUAL "armv7")
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(LIBRARY_ARCHITECTURE "armeabi")
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "x86")
SET(LIBRARY_ARCHITECTURE "x86")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
SET(TOOLCHAIN_ARCH "x86")
SET(TOOLCHAIN_PREFIX "x86")
SET(GCC_TOOLCHAIN_PREFIX "x86")
SET(TOOLCHAIN_BIN_PREFIX "i686")
SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "mips")
SET(LIBRARY_ARCHITECTURE "mips")
SET(CMAKE_SYSTEM_PROCESSOR "mips")
SET(TOOLCHAIN_ARCH "mips")
SET(TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
SET(MINIMUM_NDK_TARGET 9)
ENDIF(TARGET_CPU STREQUAL "armv7")
SET(ANDROID_COMPILER "GCC")
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
SET(ANDROID_COMPILER "clang")
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
SET(CLANG ON)
ELSE()
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
ENDIF()
IF(NOT NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF(NOT NDK_TARGET)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${TOOLCHAIN_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND NDK_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
ENDFOREACH(_TOOLCHAIN_VERSION)
ENDIF(_TOOLCHAIN_VERSIONS)
IF(NOT NDK_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF(NOT NDK_TOOLCHAIN_VERSIONS)
IF(NDK_TOOLCHAIN_VERSION)
LIST(FIND NDK_TOOLCHAIN_VERSIONS "${NDK_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(_INDEX EQUAL -1)
ELSE(NDK_TOOLCHAIN_VERSION)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(NDK_TOOLCHAIN_VERSION)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${NDK_TOOLCHAIN_VERSION}")
IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows")
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
@ -94,33 +77,73 @@ ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-${NDK_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
MACRO(SEARCH_TOOLCHAIN _COMPILER)
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF()
ENDFOREACH()
ENDIF()
IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF()
IF(${_COMPILER}_TOOLCHAIN_VERSIONS)
LIST(FIND ${_COMPILER}_TOOLCHAIN_VERSIONS "${${_COMPILER}_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
ENDIF()
ELSE()
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
ENDIF()
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF()
ENDMACRO()
IF(CLANG)
SEARCH_TOOLCHAIN(CLANG)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use clang ${CLANG_TOOLCHAIN_VERSION}")
ENDIF()
SEARCH_TOOLCHAIN(GCC)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
IF(NOT EXISTS "${TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF(NOT EXISTS "${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android toolchain in ${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}")
# include dirs
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
IF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# NDK version >= 8b
SET(STL_DIR "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# Determine bin prefix for toolchain
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
IF(_TOOLCHAIN_BIN_PREFIXES)
LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX)
STRING(REGEX REPLACE "${TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
STRING(REGEX REPLACE "${GCC_TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
ENDIF(_TOOLCHAIN_BIN_PREFIXES)
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
@ -128,22 +151,48 @@ SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include")
SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a")
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
MESSAGE(STATUS "STL include dir: ${STL_INCLUDE_DIR}")
MESSAGE(STATUS "STL library dir: ${STL_LIBRARY_DIR}")
SET(CMAKE_FIND_ROOT_PATH ${CLANG_TOOLCHAIN_ROOT} ${GCC_TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
INCLUDE_DIRECTORIES(${STL_INCLUDE_DIR} ${STL_INCLUDE_CPU_DIR})
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
SET(${_NAME} ${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX})
IF("${_BINARY}" MATCHES "clang")
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
ELSE()
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ENDIF()
ENDMACRO(SET_TOOLCHAIN_BINARY)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
# Force the compilers to GCC for Android
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
IF(CLANG)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang)
MESSAGE(STATUS "Using clang compiler")
ELSE()
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
MESSAGE(STATUS "Using GCC compiler")
ENDIF()
SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip)
SET_TOOLCHAIN_BINARY(CMAKE_AR ar)
SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld)
SET_TOOLCHAIN_BINARY(CMAKE_NM nm)
SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy)
SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump)
SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib)

View file

@ -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 <iconv.h>
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 <iconv.h>
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
)

View file

@ -57,13 +57,15 @@ ENDMACRO(DETECT_EXPRESS_VERSION)
IF(MSVC12)
DETECT_VC_VERSION("12.0")
SET(MSVC_TOOLSET "120")
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")
IF(NOT MSVC11_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
@ -71,6 +73,7 @@ ELSEIF(MSVC11)
ENDIF(NOT MSVC11_REDIST_DIR)
ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0")
SET(MSVC_TOOLSET "100")
IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
@ -78,8 +81,10 @@ ELSEIF(MSVC10)
ENDIF(NOT MSVC10_REDIST_DIR)
ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0")
SET(MSVC_TOOLSET "90")
ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0")
SET(MSVC_TOOLSET "80")
ENDIF(MSVC12)
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable

View file

@ -13,7 +13,7 @@
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE)
ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ELSE()
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
PATH_SUFFIXES mysql
@ -33,7 +33,7 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
ELSE(WIN32 AND MSVC)
ELSE()
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient
PATHS
/usr/lib
@ -51,31 +51,30 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
)
ENDIF(WIN32 AND MSVC)
ENDIF()
IF(MYSQL_INCLUDE_DIR)
IF(MYSQL_LIBRARY_RELEASE)
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE})
IF(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_DEBUG})
ELSE(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_RELEASE})
ENDIF(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE} debug ${MYSQL_LIBRARY_DEBUG})
ELSE()
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY_RELEASE})
ENDIF()
FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
ENDIF(MYSQL_LIBRARY_RELEASE)
ENDIF(MYSQL_INCLUDE_DIR)
ENDIF()
ENDIF()
ENDIF()
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE)
MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ELSE()
SET(MYSQL_FOUND FALSE)
MESSAGE(STATUS "MySQL not found.")
ENDIF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ENDIF()
MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG)
ENDIF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ENDIF()

View file

@ -55,10 +55,12 @@ FIND_LIBRARY(SQUISH_LIBRARY_DEBUG
IF(SQUISH_INCLUDE_DIR)
IF(SQUISH_LIBRARY_RELEASE)
SET(SQUISH_FOUND "YES")
SET(SQUISH_LIBRARIES "optimized;${SQUISH_LIBRARY_RELEASE}")
IF(SQUISH_LIBRARY_DEBUG)
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_DEBUG}")
ELSE(SQUISH_LIBRARY_DEBUG)
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_RELEASE}")
MESSAGE("Debug Squish NOT found, using the release version!")
ENDIF(SQUISH_LIBRARY_DEBUG)
ENDIF(SQUISH_LIBRARY_RELEASE)
ENDIF(SQUISH_INCLUDE_DIR)

View file

@ -68,6 +68,10 @@ ENDIF(WINSDKCURRENT_VERSION_INCLUDE)
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
IF(NOT WINSDKENV_DIR)
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
ENDIF(NOT WINSDKENV_DIR)
MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
# Search version in headers
@ -78,7 +82,6 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
)
IF(_MSI_FILE)
# Look for Windows SDK 8.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8")
@ -181,7 +184,7 @@ MACRO(USE_CURRENT_WINSDK)
# Look for Windows.h because there are several paths
IF(EXISTS ${_INCLUDE}/Windows.h)
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK from include environment variable in ${WINSDK_DIR}")
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
BREAK()
ENDIF(EXISTS ${_INCLUDE}/Windows.h)
ENDFOREACH(_INCLUDE)
@ -280,6 +283,13 @@ FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
${WINSDK_DIR}/Include
)
# directory where OpenGL headers are found
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
HINTS
${WINSDK_DIR}/Include/gl
${WINSDK_DIR}/Include
)
# directory where all libraries are found
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
HINTS
@ -303,7 +313,7 @@ FIND_PROGRAM(WINSDK_MIDL midl
IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND ON)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR})
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR} ${WINSDK_OPENGL_INCLUDE_DIR})
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS})

View file

@ -13,38 +13,44 @@ IF(SOURCE_DIR)
IF(NOT ROOT_DIR AND SOURCE_DIR)
SET(ROOT_DIR ${SOURCE_DIR})
ENDIF(NOT ROOT_DIR AND SOURCE_DIR)
ENDIF()
IF(NOT SOURCE_DIR AND ROOT_DIR)
SET(SOURCE_DIR ${ROOT_DIR})
ENDIF(NOT SOURCE_DIR AND ROOT_DIR)
ELSE(SOURCE_DIR)
ENDIF()
ELSE()
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
ENDIF(SOURCE_DIR)
ENDIF()
MACRO(NOW RESULT)
IF (WIN32)
EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME)
IF(NOT DATETIME MATCHES "ERROR")
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
ENDIF(NOT DATETIME MATCHES "ERROR")
ENDIF()
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
ELSE (WIN32)
ELSE()
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} "0000-00-00 00:00:00")
ENDIF (WIN32)
ENDIF()
ENDMACRO(NOW)
IF(EXISTS "${ROOT_DIR}/.svn/")
FIND_PACKAGE(Subversion)
FIND_PACKAGE(Subversion QUIET)
IF(SUBVERSION_FOUND)
Subversion_WC_INFO(${ROOT_DIR} ER)
SET(REVISION ${ER_WC_REVISION})
ENDIF(SUBVERSION_FOUND)
FIND_PACKAGE(TortoiseSVN QUIET)
IF(TORTOISESVN_FOUND)
TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION)
ENDIF(TORTOISESVN_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.svn/")
IF(EXISTS "${ROOT_DIR}/.hg/")
@ -55,8 +61,8 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
SET(REVISION ${ER_WC_REVISION})
SET(CHANGESET ${ER_WC_CHANGESET})
SET(BRANCH ${ER_WC_BRANCH})
ENDIF(MERCURIAL_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.hg/")
ENDIF()
ENDIF()
# if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION)
@ -64,8 +70,8 @@ IF(SOURCE_DIR AND NOT DEFINED REVISION)
IF(EXISTS ${REVISION_FILE})
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
MESSAGE(STATUS "Read revision ${REVISION} from file")
ENDIF(EXISTS ${REVISION_FILE})
ENDIF(SOURCE_DIR AND NOT DEFINED REVISION)
ENDIF()
ENDIF()
IF(SOURCE_DIR AND DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
@ -73,5 +79,5 @@ IF(SOURCE_DIR AND DEFINED REVISION)
NOW(BUILD_DATE)
CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different
ENDIF(EXISTS ${SOURCE_DIR}/revision.h.in)
ENDIF(SOURCE_DIR AND DEFINED REVISION)
ENDIF()
ENDIF()

View file

@ -6,6 +6,9 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
# Declare CMAKE_CONFIGURATION_TYPES before PROJECT
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
###
# Helper macro that generates .pc and installs it.
# Argument: name - the name of the .pc package, e.g. "nel-pacs.pc"
@ -252,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 )
@ -385,8 +398,6 @@ MACRO(NL_SETUP_BUILD)
# Debug = NL_DEBUG
# Release = NL_RELEASE
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(NL_BUILD_MODE "NL_DEBUG")
ELSE(CMAKE_BUILD_TYPE MATCHES "Debug")
@ -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")

View file

@ -218,7 +218,7 @@ protected:
date*= previous->OODeltaTime;
NLMISC::clamp(date, 0,1);
date = this->ease(previous, date);
date = this->ease(previous, (float)date);
float hb[4];
this->computeHermiteBasis(date, hb);

View file

@ -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);

View file

@ -55,9 +55,7 @@ namespace NLGUI
static void forceLink();
protected:
sint64 getVal() { if (_Modulo == 0) return (_Number.getSInt64() / _Divisor);
else return (_Number.getSInt64() / _Divisor)%_Modulo; }
sint64 getVal();
protected:

View file

@ -283,6 +283,10 @@ namespace NLGUI
sint32 _ViewTextDeltaX;
CViewText* getVT() const{ return _ViewText; }
void createViewText();
private:
void setupDisplayText();
void makeTopWindow();

View file

@ -0,0 +1,53 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2014 Laszlo Kis-Adam
// 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 <http://www.gnu.org/licenses/>.
#ifndef GROUP_EDITBOX_DECOR
#define GROUP_EDITBOX_DECOR
#include "nel/gui/group_editbox.h"
namespace NLGUI
{
/// Decorated CGroupEditBox
class CGroupEditBoxDecor : public CGroupEditBox
{
public:
DECLARE_UI_CLASS( CGroupEditBoxDecor )
CGroupEditBoxDecor( const TCtorParam &param );
~CGroupEditBoxDecor();
void moveBy( sint32 x, sint32 y );
void setIdRecurse( const std::string &newID );
std::string getProperty( const std::string &name ) const;
void setProperty( const std::string &name, const std::string &value );
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
bool parse( xmlNodePtr cur, CInterfaceGroup *parent );
void draw();
void updateCoords();
static void forceLink();
private:
class EBDPrivate *_Pvt;
};
}
#endif

View file

@ -17,7 +17,6 @@
#ifndef CL_GROUP_HTML_H
#define CL_GROUP_HTML_H
#define CURL_STATICLIB 1
#include <curl/curl.h>
#include "nel/misc/types_nl.h"

View file

@ -117,6 +117,7 @@ namespace NLGUI
editorSelected = false;
serializable = true;
_EditorSelectable = true;
}
// dtor
@ -531,9 +532,16 @@ namespace NLGUI
/// Aligns the element to the other element specified
void alignTo( CInterfaceElement *other );
/// Specifies if the widget can be selected in the editor
void setEditorSelectable( bool b ){ _EditorSelectable = b; }
/// Tells if the widget can be selected in the editor
bool isEditorSelectable() const{ return _EditorSelectable; }
protected:
bool editorSelected;
bool _EditorSelectable;
static bool editorMode;

View file

@ -47,6 +47,15 @@ namespace NLGUI
_VolatileValue = NULL;
}
/// Tells if this property has a value
bool hasValue() const
{
if( _VolatileValue != NULL )
return true;
else
return false;
}
NLMISC::CCDBNodeLeaf* getNodePtr() const
{
return _VolatileValue;

View file

@ -25,6 +25,8 @@ extern "C"
#include "WWWInit.h"
}
#include "nel/misc/rgba.h"
namespace NLGUI
{
class CCtrlBaseButton;

View file

@ -28,7 +28,11 @@
# endif
#elif defined(NL_OS_UNIX)
# include <pthread.h> // PThread
# include <semaphore.h> // PThread POSIX semaphores
# ifdef NL_OS_MAC
# include <dispatch/dispatch.h>
# else
# include <semaphore.h> // PThread POSIX semaphores
# endif
# include <unistd.h>
# define __forceinline
# ifdef NL_OS_MAC
@ -532,8 +536,10 @@ private:
#ifdef NL_OS_WINDOWS
TNelRtlCriticalSection _Cs;
#elif defined NL_OS_UNIX
sem_t _Sem;
#elif defined(NL_OS_MAC)
dispatch_semaphore_t _Sem;
#elif defined(NL_OS_UNIX)
sem_t _Sem;
#else
# error "No fair mutex implementation for this OS"
#endif

View file

@ -507,6 +507,13 @@ public:
*/
static bool makePathRelative (const char *basePath, std::string &relativePath);
/** Make path absolute
* \param relativePath - The relative path
* \param directory - the directory to which the path is relative to
* returns the absolute path, or empty if something went wrong.
*/
static std::string makePathAbsolute (const std::string &relativePath, const std::string &directory );
/** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning.
*/
static void addIgnoredDoubleFile(const std::string &ignoredFile);

View file

@ -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<const std::string&>(s1);
}
#endif // NL_COMP_VC10
#endif
} // NLMISC

View file

@ -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

View file

@ -54,6 +54,9 @@
# ifdef _MSC_VER
# define NL_COMP_VC
# if _MSC_VER >= 1700
# 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 <hash_map>
# include <hash_set>
# define CHashMap ::std::hash_map
# define CHashSet ::std::hash_set
# define CHashMultiMap ::std::hash_multimap
#elif defined(NL_COMP_GCC) // GCC4
# include <ext/hash_map>
# include <ext/hash_set>

View file

@ -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; }

View file

@ -109,10 +109,6 @@ void UDriver::purgeMemory()
// ***************************************************************************
// ***************************************************************************
bool CDriverUser::_StaticInit= false;
// ***************************************************************************
CDriverUser::CDriverUser (uintptr_t windowIcon, TDriver driver, emptyProc exitFunc)
{
@ -122,16 +118,7 @@ CDriverUser::CDriverUser (uintptr_t windowIcon, TDriver driver, emptyProc exitFu
nlassert((uint)IDriver::iconCount == (uint)UDriver::iconCount);
// Static Initialisation.
if(!_StaticInit)
{
_StaticInit= true;
// Register basic serial.
NL3D::registerSerial3d();
// Register basic csene.
CScene::registerBasics();
}
NL3D::init3d();
_Driver = NULL;

View file

@ -19,19 +19,35 @@
#include "nel/3d/init_3d.h"
#include <cfloat>
#include "nel/3d/scene.h"
#include "nel/3d/register_3d.h"
namespace
{
static bool _Initialized = false;
}
namespace NL3D
{
void init3d ()
{
if( _Initialized )
return;
// Init for windows
#ifdef NL_OS_WINDOWS
// Enable FPU exceptions
// Enable divid by zero and overflow exception
_control87 (_EM_INVALID|_EM_DENORMAL/*|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM);
//_control87 (_EM_INVALID|_EM_DENORMAL/*|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM);
#endif // NL_OS_WINDOWS
NL3D::registerSerial3d();
CScene::registerBasics();
_Initialized = true;
}
} // NL3D

View file

@ -17,7 +17,86 @@
#include "std3d.h"
#include "nel/3d/vertex_program_parse.h"
enum TArguments
{
#ifdef NL_LITTLE_ENDIAN
ADD = 1094992928,
ARL = 1095912480,
BFC0 = 1111900976,
BFC1 = 1111900977,
COL0 = 1129270320,
COL1 = 1129270321,
DP3 = 1146106656,
DP4 = 1146106912,
DST = 1146311712,
END = 1162757152,
EXP = 1163415584,
EXPP = 1163415632,
FOGC = 1179600707,
HPOS = 1213222739,
LIT = 1279874080,
LOG = 1280263968,
MAD = 1296122912,
MAX = 1296128032,
MIN = 1296649760,
MOV = 1297045024,
MUL = 1297435680,
NRML = 1314016588,
OPOS = 1330663251,
PSIZ = 1347635546,
RCP = 1380143136,
RSQ = 1381191968,
SGE = 1397179680,
SLT = 1397511200,
TEX0 = 1413830704,
TEX1 = 1413830705,
TEX2 = 1413830706,
TEX3 = 1413830707,
TEX4 = 1413830708,
TEX5 = 1413830709,
TEX6 = 1413830710,
TEX7 = 1413830711,
WGHT = 1464289364,
#else
ADD = 541344833,
ARL = 541872705,
BFC0 = 809715266,
BFC1 = 826492482,
COL0 = 810307395,
COL1 = 827084611,
DP3 = 540233796,
DP4 = 540299332,
DST = 542397252,
END = 541347397,
EXP = 542136389,
EXPP = 1347442757,
FOGC = 1128746822,
HPOS = 1397706824,
LIT = 542394700,
LOG = 541544268,
MAD = 541344077,
MAX = 542654797,
MIN = 542001485,
MOV = 542527309,
MUL = 541873485,
NRML = 1280135758,
OPOS = 1397706831,
PSIZ = 1514754896,
RCP = 542131026,
RSQ = 542200658,
SGE = 541411155,
SLT = 542395475,
TEX0 = 811091284,
TEX1 = 827868500,
TEX2 = 844645716,
TEX3 = 861422932,
TEX4 = 878200148,
TEX5 = 894977364,
TEX6 = 911754580,
TEX7 = 928531796,
WGHT = 1414022999,
#endif
};
//=====================================
bool CVPParser::parseWriteMask(uint &mask, std::string &errorOutput)
@ -256,23 +335,23 @@ bool CVPParser::parseInputRegister(CVPOperand &operand, std::string &errorOutput
strValue |= ((uint32) *_CurrChar) << (8 * (3 - k));
++_CurrChar;
}
switch (strValue)
switch ((TArguments)strValue)
{
case 'OPOS': operand.Value.InputRegisterValue = CVPOperand::IPosition; break;
case 'WGHT': operand.Value.InputRegisterValue = CVPOperand::IWeight; break;
case 'NRML': operand.Value.InputRegisterValue = CVPOperand::INormal; break;
case 'COL0': operand.Value.InputRegisterValue = CVPOperand::IPrimaryColor; break;
case 'COL1': operand.Value.InputRegisterValue = CVPOperand::ISecondaryColor; break;
case 'FOGC': operand.Value.InputRegisterValue = CVPOperand::IFogCoord; break;
case OPOS: operand.Value.InputRegisterValue = CVPOperand::IPosition; break;
case WGHT: operand.Value.InputRegisterValue = CVPOperand::IWeight; break;
case NRML: operand.Value.InputRegisterValue = CVPOperand::INormal; break;
case COL0: operand.Value.InputRegisterValue = CVPOperand::IPrimaryColor; break;
case COL1: operand.Value.InputRegisterValue = CVPOperand::ISecondaryColor; break;
case FOGC: operand.Value.InputRegisterValue = CVPOperand::IFogCoord; break;
// texture argument
case 'TEX0':
case 'TEX1':
case 'TEX2':
case 'TEX3':
case 'TEX4':
case 'TEX5':
case 'TEX6':
case 'TEX7':
case TEX0:
case TEX1:
case TEX2:
case TEX3:
case TEX4:
case TEX5:
case TEX6:
case TEX7:
operand.Value.InputRegisterValue = (CVPOperand::EInputRegister) (((CVPOperand::ITex0 + strValue) & 0xff) - '0');
break;
default:
@ -384,23 +463,23 @@ bool CVPParser::parseOutputRegister(CVPOperand &operand, std::string &errorOutpu
++_CurrChar;
}
// convert to enum
switch(strValue)
switch((TArguments)strValue)
{
case 'HPOS': operand.Value.OutputRegisterValue = CVPOperand::OHPosition; break;
case 'COL0': operand.Value.OutputRegisterValue = CVPOperand::OPrimaryColor; break;
case 'COL1': operand.Value.OutputRegisterValue = CVPOperand::OSecondaryColor; break;
case 'BFC0': operand.Value.OutputRegisterValue = CVPOperand::OBackFacePrimaryColor; break;
case 'BFC1': operand.Value.OutputRegisterValue = CVPOperand::OBackFaceSecondaryColor; break;
case 'FOGC': operand.Value.OutputRegisterValue = CVPOperand::OFogCoord; break;
case 'PSIZ': operand.Value.OutputRegisterValue = CVPOperand::OPointSize; break;
case 'TEX0': operand.Value.OutputRegisterValue = CVPOperand::OTex0; break;
case 'TEX1': operand.Value.OutputRegisterValue = CVPOperand::OTex1; break;
case 'TEX2': operand.Value.OutputRegisterValue = CVPOperand::OTex2; break;
case 'TEX3': operand.Value.OutputRegisterValue = CVPOperand::OTex3; break;
case 'TEX4': operand.Value.OutputRegisterValue = CVPOperand::OTex4; break;
case 'TEX5': operand.Value.OutputRegisterValue = CVPOperand::OTex5; break;
case 'TEX6': operand.Value.OutputRegisterValue = CVPOperand::OTex6; break;
case 'TEX7': operand.Value.OutputRegisterValue = CVPOperand::OTex7; break;
case HPOS: operand.Value.OutputRegisterValue = CVPOperand::OHPosition; break;
case COL0: operand.Value.OutputRegisterValue = CVPOperand::OPrimaryColor; break;
case COL1: operand.Value.OutputRegisterValue = CVPOperand::OSecondaryColor; break;
case BFC0: operand.Value.OutputRegisterValue = CVPOperand::OBackFacePrimaryColor; break;
case BFC1: operand.Value.OutputRegisterValue = CVPOperand::OBackFaceSecondaryColor; break;
case FOGC: operand.Value.OutputRegisterValue = CVPOperand::OFogCoord; break;
case PSIZ: operand.Value.OutputRegisterValue = CVPOperand::OPointSize; break;
case TEX0: operand.Value.OutputRegisterValue = CVPOperand::OTex0; break;
case TEX1: operand.Value.OutputRegisterValue = CVPOperand::OTex1; break;
case TEX2: operand.Value.OutputRegisterValue = CVPOperand::OTex2; break;
case TEX3: operand.Value.OutputRegisterValue = CVPOperand::OTex3; break;
case TEX4: operand.Value.OutputRegisterValue = CVPOperand::OTex4; break;
case TEX5: operand.Value.OutputRegisterValue = CVPOperand::OTex5; break;
case TEX6: operand.Value.OutputRegisterValue = CVPOperand::OTex6; break;
case TEX7: operand.Value.OutputRegisterValue = CVPOperand::OTex7; break;
default:
errorOutput = "Can't read index for output register.";
return false;
@ -753,9 +832,9 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
{
instrStr |= (uint32) ' ';
}
switch (instrStr)
switch ((TArguments)instrStr)
{
case 'ARL ':
case ARL:
instr.Opcode = CVPInstruction::ARL;
if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar())
@ -764,7 +843,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
return false;
}
break;
case 'RSQ ':
case RSQ:
instr.Opcode = CVPInstruction::RSQ;
if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar())
@ -773,8 +852,8 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
return false;
}
break;
case 'EXP ':
case 'EXPP':
case EXP:
case EXPP:
instr.Opcode = CVPInstruction::EXPP;
if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar())
@ -789,7 +868,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
return false;
}*/
break;
case 'LOG ':
case LOG:
instr.Opcode = CVPInstruction::LOG;
if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar())
@ -805,7 +884,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
}
*/
break;
case 'RCP ':
case RCP:
instr.Opcode = CVPInstruction::RCP;
if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar())
@ -815,60 +894,60 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
}
break;
/////////////////
case 'MOV ':
case MOV:
instr.Opcode = CVPInstruction::MOV;
if (!parseOp2(instr, errorOutput)) return false;
break;
case 'LIT ':
case LIT:
instr.Opcode = CVPInstruction::LIT;
if (!parseOp2(instr, errorOutput)) return false;
break;
/////////////////
case 'MAD ':
case MAD:
instr.Opcode = CVPInstruction::MAD;
if (!parseOp4(instr, errorOutput)) return false;
break;
/////////////////
case 'ADD ':
case ADD:
instr.Opcode = CVPInstruction::ADD;
if (!parseOp3(instr, errorOutput)) return false;
break;
/////////////////
case 'MUL ':
case MUL:
instr.Opcode = CVPInstruction::MUL;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'DP3 ':
case DP3:
instr.Opcode = CVPInstruction::DP3;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'DP4 ':
case DP4:
instr.Opcode = CVPInstruction::DP4;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'DST ':
case DST:
instr.Opcode = CVPInstruction::DST;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'MIN ':
case MIN:
instr.Opcode = CVPInstruction::MIN;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'MAX ':
case MAX:
instr.Opcode = CVPInstruction::MAX;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'SLT ':
case SLT:
instr.Opcode = CVPInstruction::SLT;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'SGE ':
case SGE:
instr.Opcode = CVPInstruction::SGE;
if (!parseOp3(instr, errorOutput)) return false;
break;
/////////////////
case 'END ':
case END:
endEncountered = true;
return true;
break;

View file

@ -73,7 +73,7 @@ pair<string, uint32> CZoneSearch::getZoneName(uint x, uint y, uint cx, uint cy)
sprintf(name, "%d_%c%c.zonel", zoneY, firstLetter, secondLetter);
return make_pair<string, uint32>(string(name), distance);
return std::pair<string, uint32>(string(name), distance);
}

View file

@ -231,7 +231,7 @@ bool CFormElm::isAtom () const
const CType* CFormElm::getType ()
{
warning (false, "getType", "This node is not an atom.");
return 0;
return NULL;
}
// ***************************************************************************

View file

@ -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 "")

View file

@ -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<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(prop));
CInterfaceGroup *group = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(prop.str()));
if(group == NULL)
group = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(this->getId(), prop));
group = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(this->getId(), prop.str()));
if(group != NULL)
setTarget (group);

View file

@ -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())

View file

@ -121,7 +121,7 @@ namespace NLGUI
{
sint64 i;
if( fromString( value, i ) )
_Divisor = i;
_Modulo = i;
return;
}
else
@ -249,5 +249,16 @@ namespace NLGUI
{
}
sint64 CDBViewNumber::getVal()
{
if( !_Number.hasValue() )
return 0;
if( _Modulo == 0 )
return _Number.getSInt64() / _Divisor;
else
return ( _Number.getSInt64() / _Divisor ) % _Modulo;
}
}

View file

@ -157,14 +157,17 @@ namespace NLGUI
// ***************************************************************************
void CDBViewQuantity::draw ()
{
// change text
sint32 val= _Number.getSInt32();
sint32 valMax= _NumberMax.getSInt32();
if(_Cache!=val || _CacheMax!=valMax)
if( _Number.hasValue() && _NumberMax.hasValue() )
{
_Cache= val;
_CacheMax=valMax;
buildTextFromCache();
// change text
sint32 val= _Number.getSInt32();
sint32 valMax= _NumberMax.getSInt32();
if(_Cache!=val || _CacheMax!=valMax)
{
_Cache= val;
_CacheMax=valMax;
buildTextFromCache();
}
}
// parent call

View file

@ -1337,6 +1337,11 @@ namespace NLGUI
// if click, and not frozen, then get the focus
if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftdown && !_Frozen)
{
if( getEditorMode() )
{
return CViewBase::handleEvent( event );
}
_SelectingText = true;
stopParentBlink();
CWidgetManager::getInstance()->setCaptureKeyboard (this);
@ -1532,36 +1537,45 @@ namespace NLGUI
CInterfaceGroup::clearViews();
}
// ----------------------------------------------------------------------------
void CGroupEditBox::createViewText()
{
nlwarning("Interface: CGroupEditBox: text 'edit_text' missing or bad type");
nlwarning( "Trying to create a new 'edit_text' for %s", getId().c_str() );
_ViewText = dynamic_cast< CViewText* >( CInterfaceFactory::createClass( "text" ) );
if( _ViewText == NULL )
{
nlwarning( "Failed to create new 'edit_text' for %s", getId().c_str() );
return;
}
_ViewText->setParent( this );
_ViewText->setIdRecurse( "edit_text" );
_ViewText->setHardText( "" );
_ViewText->setPosRef( Hotspot_ML );
_ViewText->setParentPosRef( Hotspot_ML );
addView( _ViewText );
sint32 w,h;
w = std::max( sint32( _ViewText->getFontWidth() * _ViewText->getText().size() ), getW() );
h = std::max( sint32( _ViewText->getFontHeight() ), getH() );
setH( h );
setW( w );
}
// ----------------------------------------------------------------------------
void CGroupEditBox::setup()
{
// bind to the controls
_ViewText = dynamic_cast<CViewText *>(CInterfaceGroup::getView("edit_text"));
if( _ViewText == NULL )
_ViewText = dynamic_cast<CViewText *>(CInterfaceGroup::getView("edit_text"));
if(_ViewText == NULL)
{
nlwarning("Interface: CGroupEditBox: text 'edit_text' missing or bad type");
if( editorMode )
{
nlwarning( "Trying to create a new 'edit_text' for %s", getId().c_str() );
_ViewText = dynamic_cast< CViewText* >( CInterfaceFactory::createClass( "text" ) );
if( _ViewText != NULL )
{
_ViewText->setParent( this );
_ViewText->setIdRecurse( "edit_text" );
_ViewText->setHardText( "sometext" );
_ViewText->setPosRef( Hotspot_TL );
_ViewText->setParentPosRef( Hotspot_TL );
addView( _ViewText );
setH( _ViewText->getFontHeight() );
setW( _ViewText->getFontWidth() * _ViewText->getText().size() );
}
else
nlwarning( "Failed to create new 'edit_text' for %s", getId().c_str() );
}
}
createViewText();
_ViewText->setEditorSelectable( false );
// For MultiLine editbox, clip the end space, else weird when edit space at end of line (nothing happens)
if(_ViewText)

View file

@ -0,0 +1,380 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2014 Laszlo Kis-Adam
// 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 <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "nel/gui/group_editbox_decor.h"
#include "nel/gui/view_bitmap.h"
#include "nel/gui/view_text.h"
namespace NLGUI
{
class EBDPrivate
{
public:
enum Textures
{
BG,
L,
R,
TM,
BM,
TL,
TR,
BL,
BR,
TCOUNT
};
EBDPrivate()
{
for( int i = 0; i < TCOUNT; i++ )
{
_Textures.push_back( new CViewBitmap( CViewBase::TCtorParam() ) );
}
}
~EBDPrivate()
{
for( int i = 0; i < _Textures.size(); i++ )
delete _Textures[ i ];
_Textures.clear();
}
void draw()
{
for( int i = 0; i < _Textures.size(); i++ )
{
CViewBitmap *bm = _Textures[ i ];
bm->draw();
}
}
void updateCoords()
{
for( int i = 0; i < _Textures.size(); i++ )
{
CViewBitmap *bm = _Textures[ i ];
bm->fitTexture();
}
// W and H parameters depend on the sizes of the other textures
// Negative sizes mean that the sizes are that much smaller than the parent
sint32 w,h;
h = _Textures[ TL ]->getHReal() + _Textures[ BL ]->getHReal();
h *= -1;
_Textures[ L ]->setH( h );
h = _Textures[ TR ]->getHReal() + _Textures[ BR ]->getHReal();
h *= -1;
_Textures[ R ]->setH( h );
w = _Textures[ TL ]->getWReal() + _Textures[ TR ]->getWReal();
w *= -1;
_Textures[ TM ]->setW( w );
w = _Textures[ BL ]->getWReal() + _Textures[ BR ]->getWReal();
w *= -1;
_Textures[ BM ]->setW( w );
h = _Textures[ TM ]->getHReal() + _Textures[ BM ]->getHReal();
h *= -1;
w = _Textures[ L ]->getWReal() + _Textures[ R ]->getWReal();
w *= -1;
_Textures[ BG ]->setW( w );
_Textures[ BG ]->setH( h );
for( int i = 0; i < _Textures.size(); i++ )
{
CViewBitmap *bm = _Textures[ i ];
bm->updateCoords();
}
}
void setup( CInterfaceGroup *parent )
{
for( int i = 0; i < _Textures.size(); i++ )
{
CViewBitmap *bm = _Textures[ i ];
bm->setParent( parent );
bm->setParentPos( parent );
bm->setParentSize( parent );
bm->setEditorSelectable( false );
}
_Textures[ TL ]->setPosRef( Hotspot_TL );
_Textures[ TL ]->setParentPosRef( Hotspot_TL );
_Textures[ TM ]->setPosRef( Hotspot_TM );
_Textures[ TM ]->setParentPosRef( Hotspot_TM );
_Textures[ TM ]->setScale( true );
_Textures[ TM ]->setSizeRef( "w" );
_Textures[ TR ]->setPosRef( Hotspot_TR );
_Textures[ TR ]->setParentPosRef( Hotspot_TR );
_Textures[ BL ]->setPosRef( Hotspot_BL );
_Textures[ BL ]->setParentPosRef( Hotspot_BL );
_Textures[ BM ]->setPosRef( Hotspot_BM );
_Textures[ BM ]->setParentPosRef( Hotspot_BM );
_Textures[ BM ]->setScale( true );
_Textures[ BM ]->setSizeRef( "w" );
_Textures[ BR ]->setPosRef( Hotspot_BR );
_Textures[ BR ]->setParentPosRef( Hotspot_BR );
_Textures[ L ]->setPosRef( Hotspot_ML );
_Textures[ L ]->setParentPosRef( Hotspot_ML );
_Textures[ L ]->setScale( true );
_Textures[ L ]->setSizeRef( "h" );
_Textures[ R ]->setPosRef( Hotspot_MR );
_Textures[ R ]->setParentPosRef( Hotspot_MR );
_Textures[ R ]->setScale( true );
_Textures[ R ]->setSizeRef( "h" );
_Textures[ BG ]->setPosRef( Hotspot_MM );
_Textures[ BG ]->setParentPosRef( Hotspot_MM );
_Textures[ BG ]->setScale( true );
_Textures[ BG ]->setSizeRef( "wh" );
}
std::vector< CViewBitmap* > _Textures;
};
NLMISC_REGISTER_OBJECT( CViewBase, CGroupEditBoxDecor, std::string, "edit_box_decor" );
CGroupEditBoxDecor::CGroupEditBoxDecor( const TCtorParam &param ) :
CGroupEditBox( param )
{
_Pvt = new EBDPrivate();
_Pvt->setup( this );
createViewText();
getVT()->setSerializable( false );
getVT()->setEditorSelectable( false );
}
CGroupEditBoxDecor::~CGroupEditBoxDecor()
{
delete _Pvt;
_Pvt = NULL;
}
void CGroupEditBoxDecor::moveBy( sint32 x, sint32 y )
{
CInterfaceElement::moveBy( x, y );
_Pvt->updateCoords();
}
void CGroupEditBoxDecor::setIdRecurse( const std::string &newID )
{
CInterfaceElement::setIdRecurse( newID );
_ViewText->setIdRecurse( _ViewText->getShortId() );
}
std::string CGroupEditBoxDecor::getProperty( const std::string &name ) const
{
if( name == "tx_tl" )
{
return _Pvt->_Textures[ EBDPrivate::TL ]->getTexture();
}
else
if( name == "tx_tm" )
{
return _Pvt->_Textures[ EBDPrivate::TM ]->getTexture();
}
else
if( name == "tx_tr" )
{
return _Pvt->_Textures[ EBDPrivate::TR ]->getTexture();
}
else
if( name == "tx_bl" )
{
return _Pvt->_Textures[ EBDPrivate::BL ]->getTexture();
}
else
if( name == "tx_bm" )
{
return _Pvt->_Textures[ EBDPrivate::BM ]->getTexture();
}
else
if( name == "tx_br" )
{
return _Pvt->_Textures[ EBDPrivate::BR ]->getTexture();
}
else
if( name == "tx_l" )
{
return _Pvt->_Textures[ EBDPrivate::L ]->getTexture();
}
else
if( name == "tx_r" )
{
return _Pvt->_Textures[ EBDPrivate::R ]->getTexture();
}
else
if( name == "tx_bg" )
{
return _Pvt->_Textures[ EBDPrivate::BG ]->getTexture();
}
else
return CGroupEditBox::getProperty( name );
}
void CGroupEditBoxDecor::setProperty( const std::string &name, const std::string &value )
{
if( name == "tx_tl" )
{
_Pvt->_Textures[ EBDPrivate::TL ]->setTexture( value );
}
else
if( name == "tx_tm" )
{
_Pvt->_Textures[ EBDPrivate::TM ]->setTexture( value );
}
else
if( name == "tx_tr" )
{
_Pvt->_Textures[ EBDPrivate::TR ]->setTexture( value );
}
else
if( name == "tx_bl" )
{
_Pvt->_Textures[ EBDPrivate::BL ]->setTexture( value );
}
else
if( name == "tx_bm" )
{
_Pvt->_Textures[ EBDPrivate::BM ]->setTexture( value );
}
else
if( name == "tx_br" )
{
_Pvt->_Textures[ EBDPrivate::BR ]->setTexture( value );
}
else
if( name == "tx_l" )
{
_Pvt->_Textures[ EBDPrivate::L ]->setTexture( value );
}
else
if( name == "tx_r" )
{
_Pvt->_Textures[ EBDPrivate::R ]->setTexture( value );
}
else
if( name == "tx_bg" )
{
_Pvt->_Textures[ EBDPrivate::BG ]->setTexture( value );
}
else
CGroupEditBox::setProperty( name, value );
}
xmlNodePtr CGroupEditBoxDecor::serialize( xmlNodePtr parentNode, const char *type ) const
{
xmlNodePtr node = CGroupEditBox::serialize( parentNode, type );
if( node == NULL )
return NULL;
xmlSetProp( node, BAD_CAST "type", BAD_CAST "edit_box_decor" );
xmlSetProp( node, BAD_CAST "tx_tl", BAD_CAST _Pvt->_Textures[ EBDPrivate::TL ]->getTexture().c_str() );
xmlSetProp( node, BAD_CAST "tx_tr", BAD_CAST _Pvt->_Textures[ EBDPrivate::TR ]->getTexture().c_str() );
xmlSetProp( node, BAD_CAST "tx_tm", BAD_CAST _Pvt->_Textures[ EBDPrivate::TM ]->getTexture().c_str() );
xmlSetProp( node, BAD_CAST "tx_bl", BAD_CAST _Pvt->_Textures[ EBDPrivate::BL ]->getTexture().c_str() );
xmlSetProp( node, BAD_CAST "tx_bm", BAD_CAST _Pvt->_Textures[ EBDPrivate::BM ]->getTexture().c_str() );
xmlSetProp( node, BAD_CAST "tx_br", BAD_CAST _Pvt->_Textures[ EBDPrivate::BR ]->getTexture().c_str() );
xmlSetProp( node, BAD_CAST "tx_l", BAD_CAST _Pvt->_Textures[ EBDPrivate::L ]->getTexture().c_str() );
xmlSetProp( node, BAD_CAST "tx_r", BAD_CAST _Pvt->_Textures[ EBDPrivate::R ]->getTexture().c_str() );
xmlSetProp( node, BAD_CAST "tx_bg", BAD_CAST _Pvt->_Textures[ EBDPrivate::BG ]->getTexture().c_str() );
return node;
}
bool CGroupEditBoxDecor::parse( xmlNodePtr cur, CInterfaceGroup *parent )
{
if( !CGroupEditBox::parse( cur, parent ) )
return false;
CXMLAutoPtr prop;
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_tl" );
if( prop )
_Pvt->_Textures[ EBDPrivate::TL ]->setTexture( ( const char* )prop );
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_tm" );
if( prop )
_Pvt->_Textures[ EBDPrivate::TM ]->setTexture( ( const char* )prop );
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_tr" );
if( prop )
_Pvt->_Textures[ EBDPrivate::TR ]->setTexture( ( const char* )prop );
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_bl" );
if( prop )
_Pvt->_Textures[ EBDPrivate::BL ]->setTexture( ( const char* )prop );
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_bm" );
if( prop )
_Pvt->_Textures[ EBDPrivate::BM ]->setTexture( ( const char* )prop );
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_br" );
if( prop )
_Pvt->_Textures[ EBDPrivate::BR ]->setTexture( ( const char* )prop );
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_l" );
if( prop )
_Pvt->_Textures[ EBDPrivate::L ]->setTexture( ( const char* )prop );
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_r" );
if( prop )
_Pvt->_Textures[ EBDPrivate::R ]->setTexture( ( const char* )prop );
prop = ( char* ) xmlGetProp( cur, BAD_CAST "tx_bg" );
if( prop )
_Pvt->_Textures[ EBDPrivate::BG ]->setTexture( ( const char* )prop );
getVT()->setIdRecurse( "edit_text" );
return true;
}
void CGroupEditBoxDecor::draw()
{
CGroupEditBox::draw();
_Pvt->draw();
}
void CGroupEditBoxDecor::updateCoords()
{
sint32 tw = _Pvt->_Textures[ EBDPrivate::L ]->getWReal();
getVT()->setX( tw + 1 );
CGroupEditBox::updateCoords();
_Pvt->updateCoords();
}
void CGroupEditBoxDecor::forceLink()
{
}
}

View file

@ -2200,7 +2200,7 @@ namespace NLGUI
if( editorMode )
_Extends = std::string( (const char*)prop );
CGroupMenu *gm = dynamic_cast<CGroupMenu *>(CWidgetManager::getInstance()->getElementFromId(prop));
CGroupMenu *gm = dynamic_cast<CGroupMenu *>(CWidgetManager::getInstance()->getElementFromId(prop.str()));
if (!gm)
{
gm = dynamic_cast<CGroupMenu *>(CWidgetManager::getInstance()->getElementFromId("ui:interface:" + std::string((const char*)prop)));

View file

@ -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;

View file

@ -1771,7 +1771,7 @@ namespace NLGUI
{
CInterfaceExprValue res;
if (CInterfaceExpr::eval(ptrVal2, res))
if (CInterfaceExpr::eval(ptrVal2.str(), res))
{
if (!res.toString())
{

View file

@ -21,7 +21,7 @@
extern "C"
{
/* Library Includes */
/* Library Includes */
#include "wwwsys.h"
#include "WWWUtil.h"
#include "WWWCore.h"
@ -41,8 +41,9 @@ using namespace NLMISC;
extern "C"
{
/* Final states have negative value */
typedef enum _FileState {
/* Final states have negative value */
typedef enum _FileState
{
FS_RETRY = -4,
FS_ERROR = -3,
FS_NO_DATA = -2,
@ -57,26 +58,29 @@ typedef enum _FileState {
} FileState;
/* This is the context structure for the this module */
typedef struct _file_info {
FileState state; /* Current state of the connection */
char * local; /* Local representation of file name */
struct stat stat_info; /* Contains actual file chosen */
typedef struct _file_info
{
FileState state; /* Current state of the connection */
char * local; /* Local representation of file name */
struct stat stat_info; /* Contains actual file chosen */
HTNet * net;
HTTimer * timer;
} file_info;
struct _HTStream {
struct _HTStream
{
const HTStreamClass * isa;
};
struct _HTInputStream {
struct _HTInputStream
{
const HTInputStreamClass * isa;
HTChannel * ch;
HTHost * host;
char * write; /* Last byte written */
char * read; /* Last byte read */
char * write; /* Last byte written */
char * read; /* Last byte read */
int b_read;
char data [INPUT_BUFFER_SIZE]; /* buffer */
char data [INPUT_BUFFER_SIZE]; /* buffer */
};
PRIVATE int FileCleanup (HTRequest *req, int status)
@ -96,7 +100,7 @@ PRIVATE int FileCleanup (HTRequest *req, int status)
}
/*
** Remove if we have registered a timer function as a callback
** Remove if we have registered a timer function as a callback
*/
if (file->timer)
{
@ -123,10 +127,8 @@ PUBLIC int HTLoadNeLFile (SOCKET soc, HTRequest * request)
HTNet * net = HTRequest_net(request);
HTParentAnchor * anchor = HTRequest_anchor(request);
HTTRACE(PROT_TRACE, "HTLoadFile.. Looking for `%s\'\n" _
HTAnchor_physical(anchor));
if ((file = (file_info *) HT_CALLOC(1, sizeof(file_info))) == NULL)
HT_OUTOFMEM((char*)"HTLoadFILE");
HTTRACE(PROT_TRACE, "HTLoadFile.. Looking for `%s\'\n" _ HTAnchor_physical(anchor));
if ((file = (file_info *) HT_CALLOC(1, sizeof(file_info))) == NULL) HT_OUTOFMEM("HTLoadFILE");
file->state = FS_BEGIN;
file->net = net;
HTNet_setContext(net, file);
@ -139,8 +141,8 @@ PUBLIC int HTLoadNeLFile (SOCKET soc, HTRequest * request)
PRIVATE int ReturnEvent (HTTimer * timer, void * param, HTEventType /* type */)
{
file_info * file = (file_info *) param;
if (timer != file->timer)
HTDEBUGBREAK((char*)"File timer %p not in sync\n" _ timer);
if (timer != file->timer) HTDEBUGBREAK("File timer %p not in sync\n" _ timer);
HTTRACE(PROT_TRACE, "HTLoadFile.. Continuing %p with timer %p\n" _ file _ timer);
/*
@ -163,7 +165,7 @@ PUBLIC int HTNeLFileOpen (HTNet * net, char * local, HTLocalMode /* mode */)
if (!fp->open (local))
{
HTRequest_addSystemError(request, ERR_FATAL, errno, NO, (char*)"CIFile::open");
HTRequest_addSystemError(request, ERR_FATAL, errno, NO, "CIFile::open");
return HT_ERROR;
}
@ -186,7 +188,7 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
{
/* Interrupted */
HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED,
NULL, 0, (char*)"HTLoadFile");
NULL, 0, "HTLoadFile");
FileCleanup(request, HT_INTERRUPTED);
return HT_OK;
}
@ -202,7 +204,7 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
/* We only support safe (GET, HEAD, etc) methods for the moment */
if (!HTMethod_isSafe(HTRequest_method(request))) {
HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_ALLOWED,
NULL, 0, (char*)"HTLoadFile");
NULL, 0, "HTLoadFile");
file->state = FS_ERROR;
break;
}
@ -234,166 +236,188 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
/* Create a new host object and link it to the net object */
{
HTHost * host = NULL;
if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR;
HTNet_setHost(net, host);
if (HTHost_addNet(host, net) == HT_PENDING) {
HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n");
/* move to the hack state */
file->state = FS_PENDING;
return HT_OK;
}
HTHost * host = NULL;
if ((host = HTHost_new("localhost", 0)) == NULL) return HT_ERROR;
HTNet_setHost(net, host);
if (HTHost_addNet(host, net) == HT_PENDING)
{
HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n");
/* move to the hack state */
file->state = FS_PENDING;
return HT_OK;
}
}
file->state = FS_DO_CN;
break;
case FS_PENDING:
{
HTHost * host = NULL;
if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR;
HTNet_setHost(net, host);
if (HTHost_addNet(host, net) == HT_PENDING) {
HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n");
file->state = FS_PENDING;
return HT_OK;
}
HTHost * host = NULL;
if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR;
HTNet_setHost(net, host);
if (HTHost_addNet(host, net) == HT_PENDING)
{
HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n");
file->state = FS_PENDING;
return HT_OK;
}
}
file->state = FS_DO_CN;
break;
case FS_DO_CN:
if (HTRequest_negotiation(request) &&
HTMethod_isSafe(HTRequest_method(request))) {
HTMethod_isSafe(HTRequest_method(request)))
{
HTAnchor_setPhysical(anchor, file->local);
HTTRACE(PROT_TRACE, "Load File... Found `%s\'\n" _ file->local);
}
else
{
if (HT_STAT(file->local, &file->stat_info) == -1)
{
HTTRACE(PROT_TRACE, "Load File... Not found `%s\'\n" _ file->local);
HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND, NULL, 0, "HTLoadFile");
file->state = FS_ERROR;
break;
}
}
HTAnchor_setPhysical(anchor, file->local);
HTTRACE(PROT_TRACE, "Load File... Found `%s\'\n" _ file->local);
} else {
if (HT_STAT(file->local, &file->stat_info) == -1) {
HTTRACE(PROT_TRACE, "Load File... Not found `%s\'\n" _ file->local);
HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND,
NULL, 0, (char*)"HTLoadFile");
file->state = FS_ERROR;
if (((file->stat_info.st_mode) & S_IFMT) == S_IFDIR)
{
if (HTRequest_method(request) == METHOD_GET)
{
file->state = FS_PARSE_DIR;
}
else
{
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile");
file->state = FS_NO_DATA;
}
break;
}
}
if (((file->stat_info.st_mode) & S_IFMT) == S_IFDIR) {
if (HTRequest_method(request) == METHOD_GET)
file->state = FS_PARSE_DIR;
else {
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT,
NULL, 0, (char*)"HTLoadFile");
file->state = FS_NO_DATA;
}
break;
}
{
BOOL editable = FALSE;
HTBind_getAnchorBindings(anchor);
if (editable) HTAnchor_appendAllow(anchor, METHOD_PUT);
BOOL editable = FALSE;
HTBind_getAnchorBindings(anchor);
if (editable) HTAnchor_appendAllow(anchor, METHOD_PUT);
/* Set the file size */
CIFile nelFile;
if (nelFile.open (file->local))
{
file->stat_info.st_size = nelFile.getFileSize();
}
nelFile.close();
/* Set the file size */
CIFile nelFile;
if (nelFile.open (file->local))
{
file->stat_info.st_size = nelFile.getFileSize();
}
nelFile.close();
if (file->stat_info.st_size)
HTAnchor_setLength(anchor, file->stat_info.st_size);
if (file->stat_info.st_size)
HTAnchor_setLength(anchor, file->stat_info.st_size);
/* Set the file last modified time stamp */
if (file->stat_info.st_mtime > 0)
HTAnchor_setLastModified(anchor, file->stat_info.st_mtime);
/* Set the file last modified time stamp */
if (file->stat_info.st_mtime > 0)
HTAnchor_setLastModified(anchor, file->stat_info.st_mtime);
/* Check to see if we can edit it */
if (!editable && !file->stat_info.st_size) {
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT,
NULL, 0, (char*)"HTLoadFile");
file->state = FS_NO_DATA;
} else {
file->state = (HTRequest_method(request)==METHOD_GET) ?
FS_NEED_OPEN_FILE : FS_GOT_DATA;
}
/* Check to see if we can edit it */
if (!editable && !file->stat_info.st_size)
{
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile");
file->state = FS_NO_DATA;
}
else
{
file->state = (HTRequest_method(request)==METHOD_GET) ? FS_NEED_OPEN_FILE : FS_GOT_DATA;
}
}
break;
case FS_NEED_OPEN_FILE:
status = HTNeLFileOpen(net, file->local, HT_FB_RDONLY);
if (status == HT_OK) {
if (status == HT_OK)
{
HTStream * rstream = HTStreamStack(HTAnchor_format(anchor),
HTRequest_outputFormat(request),
HTRequest_outputStream(request),
request, YES);
HTNet_setReadStream(net, rstream);
HTRequest_setOutputConnected(request, YES);
}
{
HTOutputStream * output = HTNet_getOutput(net, NULL, 0);
HTRequest_setInputStream(request, (HTStream *) output);
}
if (HTRequest_isSource(request) && !HTRequest_destinationsReady(request))
return HT_OK;
HTRequest_addError(request, ERR_INFO, NO, HTERR_OK, NULL, 0,
(char*)"HTLoadFile");
file->state = FS_NEED_BODY;
if (HTEvent_isCallbacksRegistered()) {
if (!HTRequest_preemptive(request)) {
if (!HTNet_preemptive(net)) {
HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n");
HTHost_register(HTNet_host(net), net, HTEvent_READ);
} else if (!file->timer) {
HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n");
file->timer =
HTTimer_new(NULL, ReturnEvent, file, 1, YES, NO);
{
HTStream * rstream = HTStreamStack(HTAnchor_format(anchor),
HTRequest_outputFormat(request),
HTRequest_outputStream(request),
request, YES);
HTNet_setReadStream(net, rstream);
HTRequest_setOutputConnected(request, YES);
}
return HT_OK;
{
HTOutputStream * output = HTNet_getOutput(net, NULL, 0);
HTRequest_setInputStream(request, (HTStream *) output);
}
if (HTRequest_isSource(request) && !HTRequest_destinationsReady(request)) return HT_OK;
HTRequest_addError(request, ERR_INFO, NO, HTERR_OK, NULL, 0, "HTLoadFile");
file->state = FS_NEED_BODY;
if (HTEvent_isCallbacksRegistered())
{
if (!HTRequest_preemptive(request))
{
if (!HTNet_preemptive(net))
{
HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n");
HTHost_register(HTNet_host(net), net, HTEvent_READ);
}
else if (!file->timer)
{
HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n");
file->timer = HTTimer_new(NULL, ReturnEvent, file, 1, YES, NO);
}
return HT_OK;
}
}
}
} else if (status == HT_WOULD_BLOCK || status == HT_PENDING)
return HT_OK;
else {
HTRequest_addError(request, ERR_INFO, NO, HTERR_INTERNAL,
NULL, 0, (char*)"HTLoadFile");
file->state = FS_ERROR; /* Error or interrupt */
else if (status == HT_WOULD_BLOCK || status == HT_PENDING)
{
return HT_OK;
}
else
{
HTRequest_addError(request, ERR_INFO, NO, HTERR_INTERNAL, NULL, 0, "HTLoadFile");
file->state = FS_ERROR; /* Error or interrupt */
}
break;
case FS_NEED_BODY:
case FS_NEED_BODY:
status = HTHost_read(HTNet_host(net), net);
if (status == HT_WOULD_BLOCK)
return HT_OK;
else if (status == HT_LOADED || status == HT_CLOSED) {
file->state = FS_GOT_DATA;
} else {
HTRequest_addError(request, ERR_INFO, NO, HTERR_FORBIDDEN,
NULL, 0, (char*)"HTLoadFile");
file->state = FS_ERROR;
{
return HT_OK;
}
else if (status == HT_LOADED || status == HT_CLOSED)
{
file->state = FS_GOT_DATA;
}
else
{
HTRequest_addError(request, ERR_INFO, NO, HTERR_FORBIDDEN, NULL, 0, "HTLoadFile");
file->state = FS_ERROR;
}
break;
case FS_TRY_FTP:
{
char *url = HTAnchor_physical(anchor);
HTAnchor *anchor;
char *newname = NULL;
StrAllocCopy(newname, "ftp:");
if (!strncmp(url, "file:", 5))
StrAllocCat(newname, url+5);
else
StrAllocCat(newname, url);
anchor = HTAnchor_findAddress(newname);
HTRequest_setAnchor(request, anchor);
HT_FREE(newname);
FileCleanup(request, HT_IGNORE);
return HTLoad(request, YES);
char *url = HTAnchor_physical(anchor);
HTAnchor *anchor;
char *newname = NULL;
StrAllocCopy(newname, "ftp:");
if (!strncmp(url, "file:", 5))
{
StrAllocCat(newname, url+5);
}
else
{
StrAllocCat(newname, url);
}
anchor = HTAnchor_findAddress(newname);
HTRequest_setAnchor(request, anchor);
HT_FREE(newname);
FileCleanup(request, HT_IGNORE);
return HTLoad(request, YES);
}
break;
@ -461,7 +485,8 @@ PRIVATE int HTNeLReader_read (HTInputStream * me)
{
HTAlertCallback * cbf = HTAlert_find(HT_PROG_READ);
HTNet_addBytesRead(net, me->b_read);
if (cbf) {
if (cbf)
{
int tr = HTNet_bytesRead(net);
(*cbf)(net->request, HT_PROG_READ, HT_MSG_NULL, NULL, &tr, NULL);
}
@ -472,18 +497,28 @@ PRIVATE int HTNeLReader_read (HTInputStream * me)
/* Now push the data down the stream */
if ((status = (*net->readStream->isa->put_block)
(net->readStream, me->data, me->b_read)) != HT_OK) {
if (status == HT_WOULD_BLOCK) {
(net->readStream, me->data, me->b_read)) != HT_OK)
{
if (status == HT_WOULD_BLOCK)
{
HTTRACE(PROT_TRACE, "ANSI read... Target WOULD BLOCK\n");
return HT_WOULD_BLOCK;
} else if (status == HT_PAUSE) {
}
else if (status == HT_PAUSE)
{
HTTRACE(PROT_TRACE, "ANSI read... Target PAUSED\n");
return HT_PAUSE;
} else if (status > 0) { /* Stream specific return code */
}
else if (status > 0)
{
/* Stream specific return code */
HTTRACE(PROT_TRACE, "ANSI read... Target returns %d\n" _ status);
me->write = me->data + me->b_read;
return status;
} else { /* We have a real error */
}
else
{
/* We have a real error */
HTTRACE(PROT_TRACE, "ANSI read... Target ERROR\n");
return status;
}
@ -506,13 +541,15 @@ PRIVATE int HTNeLReader_close (HTInputStream * me)
HTNet * net = HTHost_getReadNet(me->host);
if (net && net->readStream) {
if ((status = (*net->readStream->isa->_free)(net->readStream))==HT_WOULD_BLOCK)
return HT_WOULD_BLOCK;
net->readStream = NULL;
if (net && net->readStream)
{
if ((status = (*net->readStream->isa->_free)(net->readStream))==HT_WOULD_BLOCK) return HT_WOULD_BLOCK;
net->readStream = NULL;
}
HTTRACE(STREAM_TRACE, "Socket read. FREEING....\n");
HT_FREE(me);
return status;
}
@ -540,7 +577,8 @@ PRIVATE int HTNeLReader_free (HTInputStream * me)
}
HTNet * net = HTHost_getReadNet(me->host);
if (net && net->readStream) {
if (net && net->readStream)
{
int status = (*net->readStream->isa->_free)(net->readStream);
if (status == HT_OK) net->readStream = NULL;
return status;
@ -551,7 +589,8 @@ PRIVATE int HTNeLReader_free (HTInputStream * me)
PRIVATE int HTNeLReader_abort (HTInputStream * me, HTList * /* e */)
{
HTNet * net = HTHost_getReadNet(me->host);
if (net && net->readStream) {
if (net && net->readStream)
{
int status = (*net->readStream->isa->abort)(net->readStream, NULL);
if (status != HT_IGNORE) net->readStream = NULL;
}
@ -560,7 +599,7 @@ PRIVATE int HTNeLReader_abort (HTInputStream * me, HTList * /* e */)
PRIVATE const HTInputStreamClass HTNeLReader =
{
(char*)"SocketReader",
"SocketReader",
HTNeLReader_flush,
HTNeLReader_free,
HTNeLReader_abort,
@ -569,20 +608,20 @@ PRIVATE const HTInputStreamClass HTNeLReader =
HTNeLReader_consumed
};
PUBLIC HTInputStream * HTNeLReader_new (HTHost * host, HTChannel * ch,
void * /* param */, int /* mode */)
PUBLIC HTInputStream * HTNeLReader_new (HTHost * host, HTChannel * ch, void * /* param */, int /* mode */)
{
if (host && ch) {
HTInputStream * me = HTChannel_input(ch);
if (me == NULL) {
if ((me=(HTInputStream *) HT_CALLOC(1, sizeof(HTInputStream))) == NULL)
HT_OUTOFMEM((char*)"HTNeLReader_new");
me->isa = &HTNeLReader;
me->ch = ch;
me->host = host;
HTTRACE(STREAM_TRACE, "Reader...... Created reader stream %p\n" _ me);
}
return me;
if (host && ch)
{
HTInputStream * me = HTChannel_input(ch);
if (me == NULL)
{
if ((me=(HTInputStream *) HT_CALLOC(1, sizeof(HTInputStream))) == NULL) HT_OUTOFMEM("HTNeLReader_new");
me->isa = &HTNeLReader;
me->ch = ch;
me->host = host;
HTTRACE(STREAM_TRACE, "Reader...... Created reader stream %p\n" _ me);
}
return me;
}
return NULL;
}

View file

@ -20,6 +20,7 @@
#include "nel/gui/dbview_number.h"
#include "nel/gui/dbview_quantity.h"
#include "nel/gui/view_pointer.h"
#include "nel/gui/group_editbox_decor.h"
namespace NLGUI
{
@ -39,5 +40,6 @@ namespace NLGUI
force_link_dbgroup_select_number_cpp();
force_link_dbgroup_combo_box_cpp();
force_link_group_wheel_cpp();
CGroupEditBoxDecor::forceLink();
}
}

View file

@ -2436,6 +2436,9 @@ namespace NLGUI
CCtrlBase *ctrl= _CtrlsUnderPointer[i];
if (ctrl && ctrl->isCapturable() && ctrl->isInGroup( pNewCurrentWnd ) )
{
if( CInterfaceElement::getEditorMode() && !ctrl->isEditorSelectable() )
continue;
uint d = ctrl->getDepth( pNewCurrentWnd );
if (d > nMaxDepth)
{
@ -2454,6 +2457,9 @@ namespace NLGUI
CViewBase *v = _ViewsUnderPointer[i];
if( ( v != NULL ) && v->isInGroup( pNewCurrentWnd ) )
{
if( CInterfaceElement::getEditorMode() && !v->isEditorSelectable() )
continue;
_CapturedView = v;
captured = true;
break;

View file

@ -1499,7 +1499,7 @@ void cf_setVar (NLMISC::CConfigFile::CVar &Var, cf_value Val)
switch (Val.Type)
{
case NLMISC::CConfigFile::CVar::T_REAL: Var.IntValues.push_back ((int)Val.Real); break;
case NLMISC::CConfigFile::CVar::T_STRING: Var.IntValues.push_back (atoi(Val.String)); break;
case NLMISC::CConfigFile::CVar::T_STRING: { int val = 0; NLMISC::fromString(Val.String, val); Var.IntValues.push_back(val); break; }
default: break;
}
break;
@ -1507,7 +1507,7 @@ void cf_setVar (NLMISC::CConfigFile::CVar &Var, cf_value Val)
switch (Val.Type)
{
case NLMISC::CConfigFile::CVar::T_INT: Var.RealValues.push_back ((double)Val.Int); break;
case NLMISC::CConfigFile::CVar::T_STRING: Var.RealValues.push_back (atof(Val.String)); break;
case NLMISC::CConfigFile::CVar::T_STRING: { double val = 0.0; NLMISC::fromString(Val.String, val); Var.RealValues.push_back(val); break; }
default: break;
}
break;

View file

@ -517,7 +517,7 @@ void cf_setVar (NLMISC::CConfigFile::CVar &Var, cf_value Val)
switch (Val.Type)
{
case NLMISC::CConfigFile::CVar::T_REAL: Var.IntValues.push_back ((int)Val.Real); break;
case NLMISC::CConfigFile::CVar::T_STRING: Var.IntValues.push_back (atoi(Val.String)); break;
case NLMISC::CConfigFile::CVar::T_STRING: { int val = 0; NLMISC::fromString(Val.String, val); Var.RealValues.push_back(val); break; }
default: break;
}
break;
@ -525,7 +525,7 @@ void cf_setVar (NLMISC::CConfigFile::CVar &Var, cf_value Val)
switch (Val.Type)
{
case NLMISC::CConfigFile::CVar::T_INT: Var.RealValues.push_back ((double)Val.Int); break;
case NLMISC::CConfigFile::CVar::T_STRING: Var.RealValues.push_back (atof(Val.String)); break;
case NLMISC::CConfigFile::CVar::T_STRING: { double val = 0.0; NLMISC::fromString(Val.String, val); Var.RealValues.push_back(val); break; }
default: break;
}
break;

View file

@ -2337,7 +2337,7 @@ YY_RULE_SETUP
if (!cf_Ignore)
{
cflval.Val.Type = T_REAL;
cflval.Val.Real = atof (yytext);
NLMISC::fromString(yytext, cflval.Val.Real);
DEBUG_PRINTF("lex: real '%s' '%f\n", yytext, cflval.Val.Real);
return REAL;
}

View file

@ -85,8 +85,12 @@ double CConfigFile::CVar::asDouble (int index) const
if (index >= (int)IntValues.size () || index < 0) throw EBadSize (Name, (int)IntValues.size (), index);
return (double)IntValues[index];
case T_STRING:
{
if (index >= (int)StrValues.size () || index < 0) throw EBadSize (Name, (int)StrValues.size (), index);
return atof(StrValues[index].c_str());
double val;
NLMISC::fromString(StrValues[index], val);
return val;
}
default:
if (index >= (int)RealValues.size () || index < 0) throw EBadSize (Name, (int)RealValues.size (), index);
return RealValues[index];

View file

@ -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 <windows.h>
# include <direct.h>
# include <tchar.h>
# include <imagehlp.h>
@ -59,6 +39,21 @@
# include <errno.h>
#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"
#define NL_NO_DEBUG_FILES 1
using namespace std;

View file

@ -18,6 +18,10 @@
#include "nel/misc/types_nl.h"
#ifndef NL_OS_WINDOWS
# define IsDebuggerPresent() false
#endif
#ifdef NL_OS_WINDOWS
# include <io.h>
# include <fcntl.h>
@ -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 <windows.h>
#else
# define IsDebuggerPresent() false
#endif
#include "nel/misc/displayer.h"
using namespace std;

View file

@ -103,7 +103,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];

View file

@ -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 <windows.h>
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
@ -406,13 +397,21 @@ void CUnfairMutex::leave()
*/
CFairMutex::CFairMutex()
{
#ifdef NL_OS_MAC
_Sem = dispatch_semaphore_create(1);
#else
sem_init( const_cast<sem_t*>(&_Sem), 0, 1 );
#endif
}
CFairMutex::CFairMutex( const std::string &name )
{
#ifdef NL_OS_MAC
_Sem = dispatch_semaphore_create(1);
#else
sem_init( const_cast<sem_t*>(&_Sem), 0, 1 );
#endif
}
@ -421,7 +420,11 @@ CFairMutex::CFairMutex( const std::string &name )
*/
CFairMutex::~CFairMutex()
{
#ifdef NL_OS_MAC
dispatch_release(_Sem);
#else
sem_destroy( const_cast<sem_t*>(&_Sem) ); // needs that no thread is waiting on the semaphore
#endif
}
@ -430,7 +433,11 @@ CFairMutex::~CFairMutex()
*/
void CFairMutex::enter()
{
#ifdef NL_OS_MAC
dispatch_semaphore_wait(_Sem, DISPATCH_TIME_FOREVER);
#else
sem_wait( const_cast<sem_t*>(&_Sem) );
#endif
}
@ -439,7 +446,11 @@ void CFairMutex::enter()
*/
void CFairMutex::leave()
{
#ifdef NL_OS_MAC
dispatch_semaphore_signal(_Sem);
#else
sem_post( const_cast<sem_t*>(&_Sem) );
#endif
}

View file

@ -858,6 +858,8 @@ string getname (dirent *de)
void CPath::getPathContent (const string &path, bool recurse, bool wantDir, bool wantFile, vector<string> &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<string> &result, class IProgressCallback *progressCallBack, bool showEverything)
@ -960,8 +962,6 @@ void CFileContainer::getPathContent (const string &path, bool recurse, bool want
progressCallBack->popCropedValues ();
}
}
sort(result.begin(), result.end());
}
void CPath::removeAllAlternativeSearchPath ()
@ -2544,6 +2544,57 @@ bool CPath::makePathRelative (const char *basePath, std::string &relativePath)
return false;
}
std::string CPath::makePathAbsolute( const std::string &relativePath, const std::string &directory )
{
if( relativePath.empty() )
return "";
if( directory.empty() )
return "";
#ifdef NL_OS_WINDOWS
// Windows network address. Eg.: \\someshare\path
if( ( relativePath[ 0 ] == '\\' ) && ( relativePath[ 1 ] == '\\' ) )
return relativePath;
// Normal Windows absolute path. Eg.: C:\something
//
if( isalpha( relativePath[ 0 ] ) && ( relativePath[ 1 ] == ':' ) && ( ( relativePath[ 2 ] == '\\' ) || ( relativePath[ 2 ] == '/' ) ) )
return relativePath;
#else
// Unix filesystem absolute path
if( relativePath[ 0 ] == '/' )
return relativePath;
#endif
// Add a slash to the directory if necessary.
// If the relative path starts with dots we need a slash.
// If the relative path starts with a slash we don't.
// If it starts with neither, we need a slash.
bool needSlash = true;
char c = relativePath[ 0 ];
if( ( c == '\\' ) || ( c == '/' ) )
needSlash = false;
bool hasSlash = false;
std::string npath = directory;
c = npath[ npath.size() - 1 ];
if( ( c == '\\' ) || ( c == '/' ) )
hasSlash = true;
if( needSlash && !hasSlash )
npath += '/';
else
if( hasSlash && !needSlash )
npath.resize( npath.size() - 1 );
// Now build the new absolute path
npath += relativePath;
npath = standardizePath( npath, false );
return npath;
}
bool CFile::setRWAccess(const std::string &filename)
{
#ifdef NL_OS_WINDOWS

View file

@ -43,8 +43,10 @@
#include <vector>
#ifdef _WIN32
# ifndef __MINGW32__
#define NOMINMAX
# define _WIN32_WINDOWS 0x0410
# ifndef NL_COMP_MINGW
# define WINVER 0x0400
# define NOMINMAX
# endif
# include <WinSock2.h>
# include <windows.h>

View file

@ -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();
}

View file

@ -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 <windows.h>
# include <direct.h>
#elif defined NL_OS_UNIX
# include <unistd.h>

View file

@ -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 <winsock2.h>

View file

@ -2253,7 +2253,7 @@ bool NLPACS::CLocalRetriever::checkSurfaceIntegrity(uint surf, NLMISC::CVector t
for (k=0; k+1<ochain.getVertices().size(); ++k)
{
edges.push_back(make_pair<CVector2s, CVector2s>(ochain[k], ochain[k+1]));
edges.push_back(std::pair<CVector2s, CVector2s>(ochain[k], ochain[k+1]));
}
}
}

View file

@ -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})

View file

@ -185,7 +185,7 @@ namespace NLQT
NL3D::CBloomEffect::instance().setDriver(_Driver);
NL3D::CBloomEffect::instance().setScene(_Scene);
NL3D::CBloomEffect::instance().init(!_Direct3D);
NL3D::CBloomEffect::instance().init();
//NL3D::CBloomEffect::instance().setDensityBloom(Modules::config().getConfigFile().getVar("BloomDensity").asInt());
//NL3D::CBloomEffect::instance().setSquareBloom(Modules::config().getConfigFile().getVar("BloomSquare").asBool());
}
@ -366,7 +366,7 @@ namespace NLQT
// Render the scene.
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
{
NL3D::CBloomEffect::instance().initBloom();
NL3D::CBloomEffect::instance().init();
}
_Driver->clearBuffers(_BackgroundColor);
}
@ -378,8 +378,7 @@ namespace NLQT
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
{
NL3D::CBloomEffect::instance().endBloom();
NL3D::CBloomEffect::instance().endInterfacesDisplayBloom();
NL3D::CBloomEffect::instance().applyBloom();
}
}

View file

@ -70,7 +70,6 @@ void CColorModifier::convertBitmap(NLMISC::CBitmap &destBitmap, const NLMISC::CB
// blend to the destination by using the mask alpha
result.blendFromui(*dest, result, mask->R);
/// keep alpha from the source
dest->R = result.R;
@ -78,7 +77,6 @@ void CColorModifier::convertBitmap(NLMISC::CBitmap &destBitmap, const NLMISC::CB
dest->B = result.B;
dest->A = src->A;
++ mask;
++ src;
++ dest;

View file

@ -163,7 +163,7 @@ void readFormId( string& outputFileName )
map<string,uint8>::iterator itFT = FileTypeToId.find(fileType);
if( itFT == FileTypeToId.end() )
{
FileTypeToId.insert( make_pair(fileType,fid.FormIDInfos.Type) );
FileTypeToId.insert( std::pair<std::string, uint8>(fileType,fid.FormIDInfos.Type) );
}
}
else

View file

@ -379,7 +379,7 @@ int main(int argc, char *argv[])
CSString subFileName = parser.leftCrop(sizeof(" <nel:xml_file name=")-1);
subFileName = subFileName.matchDelimiters(false, false, true, false);
subFileName = subFileName.unquoteIfQuoted();
subFileName = dirName+"/"+subFileName;
subFileName = dirName + "/" + subFileName.c_str();
printf("Extracting file '%s'...\n", CFile::getFilename(subFileName).c_str());
// open the output file

View file

@ -990,7 +990,7 @@ void processGlobalRetriever()
{
if (Verbose)
nlinfo("unlink: %s", unlinkstr.c_str());
faultyInstances.insert(make_pair<uint, CFaultyInstance>(i, fi));
faultyInstances.insert(std::pair<uint, CFaultyInstance>(i, fi));
}
}
@ -1046,7 +1046,7 @@ void processGlobalRetriever()
{
if (Verbose)
nlinfo("after fix: unlink: %s", unlinkstr.c_str());
faultyInstances.insert(make_pair<uint, CFaultyInstance>(i, fi));
faultyInstances.insert(std::pair<uint, CFaultyInstance>(i, fi));
}
}
}

View file

@ -83,6 +83,7 @@ INCLUDE_DIRECTORIES(
${LUABIND_INCLUDE_DIR}
${LIBWWW_INCLUDE_DIR}
${CURL_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
)
TARGET_LINK_LIBRARIES(ryzom_client

View file

@ -45,20 +45,20 @@ void CHairSet::init (NLMISC::IProgressCallback &progress)
progress.progress ((float)k/(float)numHairItem);
const CItemSheet *item = SheetMngr.getItem(SLOTTYPE::HEAD_SLOT, k);
if( (item) && (!item->getShape().empty()) )
if (item && !item->getShape().empty())
{
std::string itemName = NLMISC::toLower(item->getShape());
if (item->getShape().find("cheveux", 0) != std::string::npos)
{
// get race
uint16 race = (uint16) itemName[1] | ((uint16) itemName[0] << 8);
switch(race)
std::string itemName = NLMISC::toLower(item->getShape());
// fortunately, first character of each race is distinct
switch(itemName[0])
{
case 'ma': _Hairs[Matis].push_back(k); break;
case 'tr': _Hairs[Tryker].push_back(k); break;
case 'zo': _Hairs[Zorai].push_back(k); break;
case 'fy': _Hairs[Fyros].push_back(k); break;
case 'm': _Hairs[Matis].push_back(k); break;
case 't': _Hairs[Tryker].push_back(k); break;
case 'z': _Hairs[Zorai].push_back(k); break;
case 'f': _Hairs[Fyros].push_back(k); break;
}
}
}

View file

@ -15,7 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#define CURL_STATICLIB 1
#include <curl/curl.h>
#include "http_client_curl.h"

View file

@ -568,7 +568,7 @@ void listStereoDisplayDevices(std::vector<NL3D::CStereoDeviceInfo> &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)
{

View file

@ -797,7 +797,7 @@ void CCharacter3D::setup (const SCharacter3DSetup &c3ds)
}
// Instance skin color
if (c3ds.People != -1)
if (c3ds.People != EGSPD::CPeople::Undefined)
if ((c3ds.People != _CurrentSetup.People) || bInstanceRebuilt || bQualityRebuilt)
{
if (!_Instances[i].empty())

View file

@ -604,7 +604,11 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
pos = newmsg.find(ucstring("}"));
prefix += " ";
}
newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1);
if (pos == ucstring::npos)
newmsg = prefix + newmsg;
else
newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1);
// Add dynchannel number and optionally name before text if user channel
CCDBNodeLeaf* node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false);
@ -615,7 +619,11 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
prefix = title.empty() ? ucstring("") : ucstring(" ") + title;
pos = newmsg.find(ucstring("] "));
newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos);
if (pos == ucstring::npos)
newmsg = prefix + newmsg;
else
newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos);
}
}
break;

View file

@ -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;
}
@ -456,7 +456,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr
else
{
// must not have so much brick type, else must change code!
nlassert(brickType<32);
// nlassert(brickType<32);
// Ok set the bit associated
_BrickTypeBitField|= 1<<brickType;

View file

@ -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);

View file

@ -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);

View file

@ -22,6 +22,7 @@
#include "../user_entity.h"
#include "../entities.h"
#include "interface_manager.h"
#include "user_agent.h"
// used for login cookie to be sent to the web server
#include "../net_manager.h"
@ -157,7 +158,7 @@ struct CWebigNotificationThread : public NLMISC::IRunnable
if(!Curl) return;
curl_easy_setopt(Curl, CURLOPT_COOKIEFILE, "");
curl_easy_setopt(Curl, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(Curl, CURLOPT_USERAGENT, "Ryzom");
curl_easy_setopt(Curl, CURLOPT_USERAGENT, getUserAgent().c_str());
curl_easy_setopt(Curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(Curl, CURLOPT_WRITEFUNCTION, writeDataFromCurl);
//nlinfo("ctor CWebigNotificationThread");

View file

@ -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<CInterface3DScene*>(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;
}

View file

@ -467,8 +467,8 @@ CInterfaceManager::CInterfaceManager()
CGroupHTML::options.trustedDomains = ClientCfg.WebIgTrustedDomains;
CGroupHTML::options.languageCode = ClientCfg.getHtmlLanguageCode();
CGroupHTML::options.appName = "Ryzom";
CGroupHTML::options.appVersion = getUserAgent();
CGroupHTML::options.appName = getUserAgentName();
CGroupHTML::options.appVersion = getUserAgentVersion();
NLGUI::CDBManager::getInstance()->resizeBanks( NB_CDB_BANKS );
interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater();
@ -2925,7 +2925,7 @@ void CInterfaceManager::initEmotes()
CSkillManager *pSM = CSkillManager::getInstance();
betaTester = pSM->isTitleUnblocked(CHARACTER_TITLE::FBT);
string previousMind = "";
string previousMind;
CGroupSubMenu *pFirstMenu = 0;
for (list<CEmoteEntry>::const_iterator it = entries.begin(); it != entries.end(); it++)

View file

@ -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;
}

View file

@ -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;

View file

@ -1080,12 +1080,12 @@ float CPatchManager::getCurrentFileProgress() const
}
// ****************************************************************************
void CPatchManager::setRWAccess (const string &filename)
void CPatchManager::setRWAccess (const string &filename, bool bThrowException)
{
ucstring s = CI18N::get("uiSetAttrib") + " " + filename;
setState(true, s);
if (!NLMISC::CFile::setRWAccess(filename))
if (!NLMISC::CFile::setRWAccess(filename) && bThrowException)
{
s = CI18N::get("uiAttribErr") + " " + filename + " (" + toString(errno) + "," + strerror(errno) + ")";
setState(true, s);
@ -1363,7 +1363,7 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de
// create the local file
if (NLMISC::CFile::fileExists(dest))
{
setRWAccess(dest);
setRWAccess(dest, false);
NLMISC::CFile::deleteFile(dest.c_str());
}
FILE *fp = fopen (dest.c_str(), "wb");
@ -1504,7 +1504,7 @@ void CPatchManager::decompressFile (const string &filename)
}
string dest = filename.substr(0, filename.size ()-4);
setRWAccess(dest);
setRWAccess(dest, false);
//if(isVerboseLog()) nlinfo("Calling fopen('%s','wb')", dest.c_str());
FILE *fp = fopen (dest.c_str(), "wb");
if (fp == NULL)
@ -1578,7 +1578,7 @@ void CPatchManager::applyDate (const string &sFilename, uint32 nDate)
{
// _utimbuf utb;
// utb.actime = utb.modtime = nDate;
setRWAccess(sFilename);
setRWAccess(sFilename, false);
ucstring s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + toString(NLMISC::CFile::getFileModificationDate (sFilename)) +
" -> " + toString(nDate);
setState(true,s);
@ -3447,6 +3447,7 @@ bool CPatchManager::extract(const std::string& patchPath,
ok = true;
}
}
if (!ok)
{
// nothing to extract
@ -3456,16 +3457,21 @@ bool CPatchManager::extract(const std::string& patchPath,
// extract
uint nblab = 0;
pPM->deleteFile(updateBatchFilename, false, false);
FILE *fp = fopen (updateBatchFilename.c_str(), "wt");
if (fp == 0)
{
string err = toString("Can't open file '%s' for writing: code=%d %s (error code 29)", updateBatchFilename.c_str(), errno, strerror(errno));
throw Exception (err);
}
#ifdef NL_OS_WINDOWS
fprintf(fp, "@echo off\n");
fprintf(fp, "ping 127.0.0.1 -n 7 -w 1000 > nul\n"); // wait
#else
// TODO: for Linux and OS X
#endif
// Unpack files with category ExtractPath non empty
for (uint32 j = 0; j < sourceFilename.size(); ++j)
@ -3492,21 +3498,32 @@ bool CPatchManager::extract(const std::string& patchPath,
string DstPath = CPath::standardizeDosPath(extractPath[j]);
string DstName = DstPath + vFilenames[fff];
NLMISC::CFile::createDirectoryTree(extractPath[j]);
// this file must be moved
// this file must be moved
#ifdef NL_OS_WINDOWS
fprintf(fp, ":loop%u\n", nblab);
fprintf(fp, "attrib -r -a -s -h %s\n", DstName.c_str());
fprintf(fp, "del %s\n", DstName.c_str());
fprintf(fp, "if exist %s goto loop%u\n", DstName.c_str(), nblab);
fprintf(fp, "move %s %s\n", SrcName.c_str(), DstPath.c_str());
#else
// TODO: for Linux and OS X
#endif
nblab++;
}
}
}
}
#ifdef NL_OS_WINDOWS
fprintf(fp, "start %s %%1 %%2 %%3\n", execName.c_str());
#else
// TODO: for Linux and OS X
#endif
fclose(fp);
if (stopFun)

View file

@ -302,7 +302,7 @@ private:
/// Read the description of the highest client version file found
void readClientVersionAndDescFile();
void setRWAccess (const std::string &filename);
void setRWAccess (const std::string &filename, bool bThrowException=true);
std::string deleteFile (const std::string &filename, bool bThrowException=true, bool bWarning=true);

View file

@ -85,7 +85,7 @@ static std::string sizeToHumanStd(uint64 size)
static std::string getVideoInfoDeviceName()
{
uint64 version;
std::string ret = "";
std::string ret;
bool ok = CSystemInfo::getVideoInfo(ret, version);
if (ok)
{

View file

@ -920,7 +920,7 @@ std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAd
std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest)
{
std::string colorCode = "";
std::string colorCode;
if (src.size() >= 3)
{
uint startPos = 0;

View file

@ -4130,7 +4130,7 @@ void CNetManagerMulti::init( const std::string& cookie, const std::string& addr
//
uint32 ShardId = 0;
std::string WebServer = "";
std::string WebServer;

View file

@ -564,7 +564,7 @@ void CDisplayerVisualEntity::updateWorldMapPresence()
_MapDeco.setDisplayedInstance(getDisplayedInstance(), true);
// retrieve icon from the displayed object (lua code)
CLuaState &ls = getEditor().getLua();
std::string texName = "";
std::string texName;
{
CLuaStackChecker lsc(&ls);
if (getDisplayedInstance()->getLuaProjection().callMethodByNameNoThrow("getSelectBarIcon", 0, 1))
@ -984,7 +984,7 @@ void CDisplayerVisualEntity::updateName()
break;
}
}
std::string firstPart = "";
std::string firstPart;
if(actNb>0)
firstPart = CI18N::get("uiR2EDDefaultActTitle").toString() + " " + NLMISC::toString(actNb);

View file

@ -1116,12 +1116,12 @@ void CClientEditionModule::startingScenario(class NLNET::IModuleProxy * /* serve
uint32 myUserId = NetMngr.getUserId();
std::string connectionState = "";
std::string connectionState;
if (myUserId == (charId>>4) || ClientCfg.Local)
{
std::string errorMsg = "";
std::string errorMsg;
CObject* hlScenario = _Scenario->getHighLevel();
hlData.setData(hlScenario); // clone before modify by translateFeatures
@ -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;
@ -2425,10 +2425,10 @@ bool CClientEditionModule::addToLoadList( const std::string& filename, CScenario
void CClientEditionModule::loadScenarioSucceded(const std::string& filename, const std::string& body, const CScenarioValidator::TValues& values)
{
//H_AUTO(R2_CClientEditionModule_loadScenarioSucceded)
string initialIsland="", initialEntryPoint="", initialSeason = "";
string creatorMD5 = "", modifiedByMD5="";
string name = "";
string locked = "";
string initialIsland, initialEntryPoint, initialSeason;
string creatorMD5, modifiedByMD5;
string name;
string locked;
for(uint i=0; i<values.size(); i++)
{
const std::pair<std::string, std::string>& pair = values[i];

View file

@ -834,7 +834,7 @@ sint CComLuaModule::luaRequestEraseNode(lua_State* state)
if (args>2) { luaL_checknumber(state, 3); }
std::string instanceId(lua_tostring(state, 1));
std::string attrName = "";
std::string attrName;
sint position = -1;
if (args>1){ attrName = lua_tostring(state, 2);}
if (args>2){ position = static_cast<sint>(lua_tonumber(state, 3));}
@ -1255,7 +1255,7 @@ CObject* CComLuaModule::getObjectFromLua(lua_State* state, sint idx)
lua_pushnil(state);
while (lua_next(state, -2) != 0)
{
std::string key = "";
std::string key;
if ( lua_type(state, -2) == LUA_TSTRING)
{
key = lua_tostring(state, -2);
@ -1285,7 +1285,7 @@ CObject* CComLuaModule::getObjectFromLua(lua_State* state, sint idx)
CObject* CComLuaModule::loadLocal(const std::string& filename, const CScenarioValidator::TValues& values)
{
CScenarioValidator::TValues::const_iterator first(values.begin()), last(values.end());
std::string name = "";
std::string name;
for (; first != last; ++first)
{
if (first->first == "Name" ) { name = first->second; }
@ -1347,7 +1347,7 @@ bool CComLuaModule::loadUserComponent(const std::string& filename)
CObject* CComLuaModule::loadFromBuffer(const std::string& data, const std::string& filename, const CScenarioValidator::TValues& values)
{
CScenarioValidator::TValues::const_iterator first(values.begin()), last(values.end());
std::string name = "";
std::string name;
for (; first != last; ++first)
{
if (first->first == "Name" ) { name = first->second; }

View file

@ -267,7 +267,7 @@ void CDynamicMapClient::save(const std::string& /* filename */)
void CDynamicMapClient::saveRtData(const std::string& filename)
{
//H_AUTO(R2_CDynamicMapClient_saveRtData)
std::string name = "";
std::string name;
name += filename;
//std::ostringstream out2;
std::string out2;

View file

@ -21,7 +21,6 @@
#include "session_browser.h"
#include "game_share/ring_session_manager_itf.h"
#include "nel/gui/lua_helper.h"
using namespace NLGUI;
#include "far_tp.h"
class CSessionBrowserImpl : public CSessionBrowser,
@ -37,7 +36,7 @@ public:
* - RingAccessPoint:onConnectionClosed()
* - RingAccessPoint:onConnectionFailed()
*/
void init(CLuaState *ls);
void init(NLGUI::CLuaState *ls);
// from CSessionBrowser
virtual void on_connectionFailed();
virtual void on_connectionClosed();
@ -99,17 +98,17 @@ public:
static const std::string &getFrontEndAddress();
private:
CLuaState::TRefPtr _Lua;
static int luaGetRingSessionList(CLuaState &ls);
static int luaGetRingCharList(CLuaState &ls);
static int luaJoinRingSession(CLuaState &ls);
static int luaCheckRingAccess(CLuaState &ls);
static int luaGetFileHeader(CLuaState &ls);
static int luaGetRingStats(CLuaState &ls);
static int luaGetScenarioScores(CLuaState &ls);
static int luaUpdateScenarioScores(CLuaState &ls);
static int luaGetSessionAverageScores(CLuaState &ls);
static int luaGetScenarioAverageScores(CLuaState &ls);
NLGUI::CLuaState::TRefPtr _Lua;
static int luaGetRingSessionList(NLGUI::CLuaState &ls);
static int luaGetRingCharList(NLGUI::CLuaState &ls);
static int luaJoinRingSession(NLGUI::CLuaState &ls);
static int luaCheckRingAccess(NLGUI::CLuaState &ls);
static int luaGetFileHeader(NLGUI::CLuaState &ls);
static int luaGetRingStats(NLGUI::CLuaState &ls);
static int luaGetScenarioScores(NLGUI::CLuaState &ls);
static int luaUpdateScenarioScores(NLGUI::CLuaState &ls);
static int luaGetSessionAverageScores(NLGUI::CLuaState &ls);
static int luaGetScenarioAverageScores(NLGUI::CLuaState &ls);
// Call a method inside the 'RingAccessPoint' lua table
void callRingAccessPointMethod(const char *name, int numArg, int numResult);
void callRingCharTrackingMethod(const char *name, int numArg, int numResult);

View file

@ -21,7 +21,7 @@
#include "game_share/ryzom_version.h"
#ifdef HAVE_REVISION_H
#if defined(RYZOM_COMPATIBILITY_VERSION) && defined(HAVE_REVISION_H)
#include "revision.h"
#endif
@ -45,6 +45,16 @@
#endif
std::string getUserAgent()
{
return getUserAgentName() + "/" + getUserAgentVersion();
}
std::string getUserAgentName()
{
return "Ryzom";
}
std::string getUserAgentVersion()
{
static std::string s_userAgent;
@ -52,8 +62,9 @@ std::string getUserAgent()
{
char buffer[256];
#ifdef REVISION
sprintf(buffer, "%s.%s-%s-%s", RYZOM_VERSION, REVISION, RYZOM_SYSTEM, RYZOM_ARCH);
#if defined(REVISION) && defined(RYZOM_COMPATIBILITY_VERSION)
// we don't need RYZOM_VERSION if we already have a numeric form a.b.c, we just need to append revision to it
sprintf(buffer, "%s.%s-%s-%s", RYZOM_COMPATIBILITY_VERSION, REVISION, RYZOM_SYSTEM, RYZOM_ARCH);
#else
sprintf(buffer, "%s-%s-%s", RYZOM_VERSION, RYZOM_SYSTEM, RYZOM_ARCH);
#endif

View file

@ -18,6 +18,8 @@
#define CL_USER_AGENT_H
std::string getUserAgent();
std::string getUserAgentName();
std::string getUserAgentVersion();
#endif // CL_USER_AGENT_H

View file

@ -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");

View file

@ -43,7 +43,7 @@ namespace BRICK_TYPE
TIMED_ACTION,
BRICK_TYPE_COUNT,
BONUS,
UNKNOWN
UNKNOWN // Warning: Shouldn't exceed 32
};

View file

@ -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 <block_name>' but found: "+line, ++errors;continue);
DROP_IF(_CurrentInfoBlock == NULL, context + "Expecting 'define <block_name>' 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)

View file

@ -51,6 +51,7 @@ public:
enum TPeople
{
Undefined = -1,
Humanoid = 0,
Playable = 0,
Fyros = 0,

View file

@ -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;

View file

@ -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<result.size();++i)

View file

@ -11,4 +11,8 @@ NL_ADD_LIB_SUFFIX(ryzom_adminmodules)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(ryzom_adminmodules ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp)
ENDIF(WITH_PCH)
INSTALL(TARGETS ryzom_adminmodules LIBRARY DESTINATION ${RYZOM_LIB_PREFIX} ARCHIVE DESTINATION ${RYZOM_LIB_PREFIX} COMPONENT libraries)

View file

@ -18,6 +18,7 @@
// WARNING : this is a generated file, don't change it !
/////////////////////////////////////////////////////////////////
#include "stdpch.h"
#include "admin_modules_itf.h"
namespace ADMIN

View file

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "nel/misc/singleton.h"
#include "nel/net/module.h"
#include "nel/net/module_builder_parts.h"

View file

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "nel/misc/singleton.h"
#include <time.h>
#include "nel/misc/path.h"
@ -573,7 +574,7 @@ namespace ADMIN
time_t t = now;
fprintf(fp, "AESReportDate=%s", ::ctime(&t));
fprintf(fp, "NBService=%u\n", _ServiceStates.size());
fprintf(fp, "NBService=%u\n", (uint)_ServiceStates.size());
// output state of each service
TServiceStates::iterator first(_ServiceStates.begin()), last(_ServiceStates.end());
for (; first != last; ++first)

View file

@ -14,6 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "nel/misc/types_nl.h"
#include <time.h>
#include "nel/misc/file.h"

View file

@ -0,0 +1,17 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#include "stdpch.h"

Some files were not shown because too many files have changed in this diff Show more