Merge with default

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 11 years ago
commit ce798c4bf1

@ -111,10 +111,11 @@ IF(WITH_STATIC)
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC) SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB}) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
# on Mac OS X libxml2 requieres iconv # on Mac OS X libxml2 requires iconv and liblzma
IF(APPLE) IF(APPLE)
FIND_PACKAGE(Iconv REQUIRED) FIND_PACKAGE(Iconv REQUIRED)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES}) FIND_PACKAGE(LibLZMA REQUIRED)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES} ${LIBLZMA_LIBRARIES})
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
ENDIF(APPLE) ENDIF(APPLE)
ENDIF(WITH_STATIC) ENDIF(WITH_STATIC)

@ -34,18 +34,18 @@ ENDIF(MSVC)
MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
SET(${_out_compile_flags} ${${_flags_var_name}} ) SET(_FLAGS ${${_flags_var_name}} )
IF(NOT MSVC) IF(NOT MSVC)
GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE)
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
LIST(APPEND ${_out_compile_flags} "-fPIC") LIST(APPEND _FLAGS "-fPIC")
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
ENDIF(NOT MSVC) ENDIF(NOT MSVC)
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES ) GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES )
FOREACH(item ${DIRINC}) FOREACH(item ${DIRINC})
LIST(APPEND ${_out_compile_flags} " ${_PCH_include_prefix}\"${item}\"") LIST(APPEND _FLAGS " ${_PCH_include_prefix}\"${item}\"")
ENDFOREACH(item) ENDFOREACH(item)
# Required for CMake 2.6 # Required for CMake 2.6
@ -57,13 +57,32 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
LIST(APPEND ${_out_compile_flags} ${GLOBAL_DEFINITIONS}) LIST(APPEND _FLAGS ${GLOBAL_DEFINITIONS})
LIST(APPEND ${_out_compile_flags} ${_directory_flags}) LIST(APPEND _FLAGS ${_directory_flags})
LIST(APPEND ${_out_compile_flags} ${_directory_definitions}) LIST(APPEND _FLAGS ${_directory_definitions})
LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS}) LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
# Format definitions # Format definitions
SEPARATE_ARGUMENTS(${_out_compile_flags}) SEPARATE_ARGUMENTS(_FLAGS)
IF(CLANG)
SET(_IGNORE_NEXT OFF)
FOREACH(item ${_FLAGS})
IF(_IGNORE_NEXT)
SET(_IGNORE_NEXT OFF)
ELSE(_IGNORE_NEXT)
IF(item MATCHES "^-Xarch")
SET(_IGNORE_NEXT ON)
ELSEIF(item MATCHES "^-arch")
SET(_IGNORE_NEXT ON)
ELSE(item MATCHES "^-Xarch")
LIST(APPEND ${_out_compile_flags} ${item})
ENDIF(item MATCHES "^-Xarch")
ENDIF(_IGNORE_NEXT)
ENDFOREACH(item)
ELSE(CLANG)
SET(${_out_compile_flags} ${_FLAGS})
ENDIF(CLANG)
ENDMACRO(_PCH_GET_COMPILE_FLAGS) ENDMACRO(_PCH_GET_COMPILE_FLAGS)
MACRO(_PCH_GET_PDB_FILENAME out_filename _target) MACRO(_PCH_GET_PDB_FILENAME out_filename _target)

@ -13,11 +13,7 @@ ENDIF(NOT CMAKE_BUILD_TYPE)
MACRO(NL_GEN_PC name) MACRO(NL_GEN_PC name)
IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}") CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}")
IF(CMAKE_LIBRARY_ARCHITECTURE) INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION ${NL_LIB_PREFIX}/pkgconfig)
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig)
ELSE(CMAKE_LIBRARY_ARCHITECTURE)
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/pkgconfig)
ENDIF(CMAKE_LIBRARY_ARCHITECTURE)
ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
ENDMACRO(NL_GEN_PC) ENDMACRO(NL_GEN_PC)
@ -250,16 +246,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
### ###
# Optional support # Optional support
### ###
# Check if CMake is launched from a Debian packaging script
SET(DEB_HOST_GNU_CPU $ENV{DEB_HOST_GNU_CPU})
# Don't strip if generating a .deb
IF(DEB_HOST_GNU_CPU)
OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" ON )
ELSE(DEB_HOST_GNU_CPU)
OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" OFF) OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" OFF)
ENDIF(DEB_HOST_GNU_CPU)
IF(WIN32) IF(WIN32)
OPTION(WITH_STLPORT "With STLport support." ON ) OPTION(WITH_STLPORT "With STLport support." ON )
@ -340,6 +327,11 @@ MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
OPTION(WITH_SNOWBALLS_SERVER "Build Snowballs Services" ON ) OPTION(WITH_SNOWBALLS_SERVER "Build Snowballs Services" ON )
ENDMACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) ENDMACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
MACRO(ADD_PLATFORM_FLAGS _FLAGS)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} ${_FLAGS}")
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} ${_FLAGS}")
ENDMACRO(ADD_PLATFORM_FLAGS)
MACRO(NL_SETUP_BUILD) MACRO(NL_SETUP_BUILD)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
@ -372,9 +364,6 @@ MACRO(NL_SETUP_BUILD)
ENDIF(HOST_CPU MATCHES "amd64") ENDIF(HOST_CPU MATCHES "amd64")
# Determine target CPU # Determine target CPU
IF(NOT TARGET_CPU)
SET(TARGET_CPU $ENV{DEB_HOST_GNU_CPU})
ENDIF(NOT TARGET_CPU)
# If not specified, use the same CPU as host # If not specified, use the same CPU as host
IF(NOT TARGET_CPU) IF(NOT TARGET_CPU)
@ -387,9 +376,6 @@ MACRO(NL_SETUP_BUILD)
SET(TARGET_CPU "x86") SET(TARGET_CPU "x86")
ENDIF(TARGET_CPU MATCHES "amd64") ENDIF(TARGET_CPU MATCHES "amd64")
# DEB_HOST_ARCH_ENDIAN is 'little' or 'big'
# DEB_HOST_ARCH_BITS is '32' or '64'
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
SET(CLANG ON) SET(CLANG ON)
MESSAGE(STATUS "Using Clang compiler") MESSAGE(STATUS "Using Clang compiler")
@ -427,79 +413,120 @@ MACRO(NL_SETUP_BUILD)
ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}") ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
# Use values from environment variables # Use values from environment variables
SET(PLATFORM_CFLAGS "$ENV{CFLAGS} ${PLATFORM_CFLAGS}") SET(PLATFORM_CFLAGS "$ENV{CFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CFLAGS}")
SET(PLATFORM_CXXFLAGS "$ENV{CXXFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CXXFLAGS}")
SET(PLATFORM_LINKFLAGS "$ENV{LDFLAGS} ${PLATFORM_LINKFLAGS}") SET(PLATFORM_LINKFLAGS "$ENV{LDFLAGS} ${PLATFORM_LINKFLAGS}")
# Remove -g and -O flag because we are managing them ourself # Remove -g and -O flag because we are managing them ourself
STRING(REPLACE "-g" "" PLATFORM_CFLAGS ${PLATFORM_CFLAGS}) STRING(REPLACE "-g" "" PLATFORM_CFLAGS ${PLATFORM_CFLAGS})
STRING(REPLACE "-g" "" PLATFORM_CXXFLAGS ${PLATFORM_CXXFLAGS})
STRING(REGEX REPLACE "-O[0-9s]" "" PLATFORM_CFLAGS ${PLATFORM_CFLAGS}) STRING(REGEX REPLACE "-O[0-9s]" "" PLATFORM_CFLAGS ${PLATFORM_CFLAGS})
STRING(REGEX REPLACE "-O[0-9s]" "" PLATFORM_CXXFLAGS ${PLATFORM_CXXFLAGS})
# Strip spaces # Strip spaces
STRING(STRIP ${PLATFORM_CFLAGS} PLATFORM_CFLAGS) STRING(STRIP ${PLATFORM_CFLAGS} PLATFORM_CFLAGS)
STRING(STRIP ${PLATFORM_CXXFLAGS} PLATFORM_CXXFLAGS)
STRING(STRIP ${PLATFORM_LINKFLAGS} PLATFORM_LINKFLAGS) STRING(STRIP ${PLATFORM_LINKFLAGS} PLATFORM_LINKFLAGS)
IF(NOT CMAKE_OSX_ARCHITECTURES)
IF(TARGET_CPU STREQUAL "x86_64") IF(TARGET_CPU STREQUAL "x86_64")
SET(TARGET_X64 1) SET(TARGET_X64 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86_64")
ELSEIF(TARGET_CPU STREQUAL "x86") ELSEIF(TARGET_CPU STREQUAL "x86")
SET(TARGET_X86 1) SET(TARGET_X86 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86") ELSEIF(TARGET_CPU STREQUAL "armv7s")
SET(TARGET_ARM 1)
SET(TARGET_ARMV7S 1)
ELSEIF(TARGET_CPU STREQUAL "armv7")
SET(TARGET_ARM 1)
SET(TARGET_ARMV7 1)
ELSEIF(TARGET_CPU STREQUAL "armv6")
SET(TARGET_ARM 1)
SET(TARGET_ARMV6 1)
ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(TARGET_ARM 1)
SET(TARGET_ARMV5 1)
ELSEIF(TARGET_CPU STREQUAL "arm") ELSEIF(TARGET_CPU STREQUAL "arm")
SET(TARGET_ARM 1) SET(TARGET_ARM 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_ARM")
ENDIF(TARGET_CPU STREQUAL "x86_64") ENDIF(TARGET_CPU STREQUAL "x86_64")
ENDIF(NOT CMAKE_OSX_ARCHITECTURES)
# Fix library paths suffixes for Debian MultiArch # Fix library paths suffixes for Debian MultiArch
SET(DEBIAN_MULTIARCH $ENV{DEB_HOST_MULTIARCH}) IF(LIBRARY_ARCHITECTURE)
SET(CMAKE_LIBRARY_PATH /lib/${LIBRARY_ARCHITECTURE} /usr/lib/${LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH})
IF(DEBIAN_MULTIARCH)
SET(CMAKE_LIBRARY_ARCHITECTURE ${DEBIAN_MULTIARCH})
ENDIF(DEBIAN_MULTIARCH)
IF(CMAKE_LIBRARY_ARCHITECTURE)
SET(CMAKE_LIBRARY_PATH /lib/${CMAKE_LIBRARY_ARCHITECTURE} /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH})
IF(TARGET_X64) IF(TARGET_X64)
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64) SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64)
ENDIF(TARGET_X64) ENDIF(TARGET_X64)
IF(TARGET_X86) IF(TARGET_X86)
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32) SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32)
ENDIF(TARGET_X86) ENDIF(TARGET_X86)
ENDIF(CMAKE_LIBRARY_ARCHITECTURE) ENDIF(LIBRARY_ARCHITECTURE)
IF(APPLE AND NOT IOS)
SET(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH})
SET(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
ENDIF(APPLE AND NOT IOS)
IF(TARGET_ARM)
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-DHAVE_ARMV7")
ENDIF(TARGET_ARMV7)
IF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-HAVE_ARMV6")
ENDIF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-DHAVE_ARM")
ENDIF(TARGET_ARM)
IF(TARGET_X86)
ADD_PLATFORM_FLAGS("-DHAVE_X86")
ENDIF(TARGET_X86)
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-DHAVE_X64 -DHAVE_X86_64")
ENDIF(TARGET_X64)
IF(WITH_LOGGING)
ADD_PLATFORM_FLAGS("-DENABLE_LOGS")
ENDIF(WITH_LOGGING)
IF(MSVC) IF(MSVC)
IF(MSVC10) IF(MSVC10)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2010, but custom optimizations don't exist # /Ox is working with VC++ 2010, but custom optimizations don't exist
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Od /Ob1") SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC90) ELSEIF(MSVC90)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# don't use a /O[012x] flag if you want custom optimizations # don't use a /O[012x] flag if you want custom optimizations
SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") SET(RELEASE_CFLAGS "/Ob2 /Oi /Ot /Oy /GT /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Ob1") SET(DEBUG_CFLAGS "/Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC80) ELSEIF(MSVC80)
ADD_PLATFORM_FLAGS("/Gy- /Wp64")
# don't use a /O[012x] flag if you want custom optimizations # don't use a /O[012x] flag if you want custom optimizations
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again # without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Od /Ob1") SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}")
ELSE(MSVC10) ELSE(MSVC10)
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF(MSVC10) ENDIF(MSVC10)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zm1000 /MP /Gy-") ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250")
IF(TARGET_X64) IF(TARGET_X64)
# Fix a bug with Intellisense # Fix a bug with Intellisense
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64") ADD_PLATFORM_FLAGS("/D_WIN64")
# Fix a compilation error for some big C++ files # Fix a compilation error for some big C++ files
SET(MIN_OPTIMIZATIONS "${MIN_OPTIMIZATIONS} /bigobj") SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} /bigobj")
ELSE(TARGET_X64) ELSE(TARGET_X64)
# Allows 32 bits applications to use 3 GB of RAM # Allows 32 bits applications to use 3 GB of RAM
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE")
ENDIF(TARGET_X64) ENDIF(TARGET_X64)
# Exceptions are only set for C++ # Exceptions are only set for C++
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa") SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /EHa")
IF(WITH_SYMBOLS) IF(WITH_SYMBOLS)
SET(NL_RELEASE_CFLAGS "/Zi ${NL_RELEASE_CFLAGS}") SET(NL_RELEASE_CFLAGS "/Zi ${NL_RELEASE_CFLAGS}")
@ -508,54 +535,146 @@ MACRO(NL_SETUP_BUILD)
SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}") SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}")
ENDIF(WITH_SYMBOLS) ENDIF(WITH_SYMBOLS)
SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS} ${NL_DEBUG_CFLAGS}") SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${SPEED_OPTIMIZATIONS} ${NL_RELEASE_CFLAGS}") SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}")
SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt /INCREMENTAL:YES ${NL_DEBUG_LINKFLAGS}") SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt /INCREMENTAL:YES ${NL_DEBUG_LINKFLAGS}")
SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}") SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}")
IF(WITH_WARNINGS)
SET(DEBUG_CFLAGS "/W4 ${DEBUG_CFLAGS}")
ELSE(WITH_WARNINGS)
SET(DEBUG_CFLAGS "/W3 ${DEBUG_CFLAGS}")
ENDIF(WITH_WARNINGS)
ELSE(MSVC) ELSE(MSVC)
IF(WIN32) IF(WIN32)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWIN32 -D_WIN32") ADD_PLATFORM_FLAGS("-DWIN32 -D_WIN32")
IF(CLANG)
ADD_PLATFORM_FLAGS("-nobuiltininc")
ENDIF(CLANG)
ENDIF(WIN32) ENDIF(WIN32)
IF(TARGET_ARM)
ADD_PLATFORM_FLAGS("-mthumb")
ENDIF(TARGET_ARM)
IF(APPLE) IF(APPLE)
IF(TARGET_CPU STREQUAL "x86") IF(IOS)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch i386") SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE PATH "" FORCE)
ENDIF(TARGET_CPU STREQUAL "x86") ELSE(IOS)
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE PATH "" FORCE)
ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
ENDIF(IOS)
IF(TARGET_CPU STREQUAL "x86_64") IF(XCODE)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch x86_64") IF(IOS)
ENDIF(TARGET_CPU STREQUAL "x86_64") SET(CMAKE_OSX_SYSROOT "iphoneos" CACHE PATH "" FORCE)
ELSE(APPLE) ELSE(IOS)
IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") # SET(CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m32 -march=i686") ENDIF(IOS)
ENDIF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") ELSE(XCODE)
IF(CMAKE_OSX_ARCHITECTURES)
SET(TARGETS_COUNT 0)
SET(_ARCHS)
FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES})
IF(_ARCH STREQUAL "i386")
SET(_ARCHS "${_ARCHS} i386")
SET(TARGET_X86 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSEIF(_ARCH STREQUAL "x86_64")
SET(_ARCHS "${_ARCHS} x86_64")
SET(TARGET_X64 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSEIF(_ARCH STREQUAL "armv7")
SET(_ARCHS "${_ARCHS} armv7")
SET(TARGET_ARMV7 1)
SET(TARGET_ARM 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSEIF(_ARCH STREQUAL "armv6")
SET(_ARCHS "${_ARCHS} armv6")
SET(TARGET_ARMV6 1)
SET(TARGET_ARM 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSE(_ARCH STREQUAL "i386")
SET(_ARCHS "${_ARCHS} unknwon(${_ARCH})")
ENDIF(_ARCH STREQUAL "i386")
ENDFOREACH(_ARCH)
MESSAGE(STATUS "Compiling under Mac OS X for ${TARGETS_COUNT} architectures: ${_ARCHS}")
ELSE(CMAKE_OSX_ARCHITECTURES)
SET(TARGETS_COUNT 1)
ENDIF(CMAKE_OSX_ARCHITECTURES)
IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") IF(TARGETS_COUNT EQUAL 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m64") IF(TARGET_ARM)
ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") IF(TARGET_ARMV7S)
ENDIF(APPLE) ADD_PLATFORM_FLAGS("-arch armv7s")
ENDIF(TARGET_ARMV7S)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -D_REENTRANT -pipe -Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing") IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-arch armv7")
ENDIF(TARGET_ARMV7)
IF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") IF(TARGET_ARMV6)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -ansi") ADD_PLATFORM_FLAGS("-arch armv6")
ENDIF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") ENDIF(TARGET_ARMV6)
IF(WITH_COVERAGE) IF(TARGET_ARMV5)
SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}") ADD_PLATFORM_FLAGS("-arch armv5")
ENDIF(WITH_COVERAGE) ENDIF(TARGET_ARMV5)
ENDIF(TARGET_ARM)
IF(APPLE) IF(TARGET_X86)
SET(PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}") ADD_PLATFORM_FLAGS("-arch i386")
ENDIF(APPLE) ENDIF(TARGET_X86)
IF(APPLE AND XCODE) IF(TARGET_X64)
# SET(CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE) ADD_PLATFORM_FLAGS("-arch x86_64")
ELSEIF(APPLE AND NOT XCODE) ENDIF(TARGET_X64)
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) ELSE(TARGETS_COUNT EQUAL 1)
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6") IF(TARGET_ARMV6)
ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) ADD_PLATFORM_FLAGS("-Xarch_armv6 -mthumb -Xarch_armv6 -DHAVE_ARM -Xarch_armv6 -DHAVE_ARMV6")
ENDIF(TARGET_ARMV6)
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-Xarch_armv7 -mthumb -Xarch_armv7 -DHAVE_ARM -Xarch_armv7 -DHAVE_ARMV7")
ENDIF(TARGET_ARMV7)
IF(TARGET_X86)
ADD_PLATFORM_FLAGS("-arch i386 -Xarch_i386 -DHAVE_X86")
ENDIF(TARGET_X86)
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-arch x86_64 -Xarch_x86_64 -DHAVE_X64 -Xarch_x86_64 -DHAVE_X86_64")
ENDIF(TARGET_X64)
ENDIF(TARGETS_COUNT EQUAL 1)
IF(IOS)
IF(IOS_VERSION)
PARSE_VERSION_STRING(${IOS_VERSION} IOS_VERSION_MAJOR IOS_VERSION_MINOR IOS_VERSION_PATCH)
CONVERT_VERSION_NUMBER(${IOS_VERSION_MAJOR} ${IOS_VERSION_MINOR} ${IOS_VERSION_PATCH} IOS_VERSION_NUMBER)
ADD_PLATFORM_FLAGS("-D__IPHONE_OS_VERSION_MIN_REQUIRED=${IOS_VERSION_NUMBER}")
ENDIF(IOS_VERSION)
IF(CMAKE_IOS_SYSROOT)
ADD_PLATFORM_FLAGS("-isysroot${CMAKE_IOS_SYSROOT}")
ADD_PLATFORM_FLAGS("-miphoneos-version-min=${IOS_VERSION}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-iphoneos_version_min,${IOS_VERSION}")
ENDIF(CMAKE_IOS_SYSROOT)
IF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86)
IF(TARGETS_COUNT EQUAL 1)
ADD_PLATFORM_FLAGS("-arch i386")
ELSE(TARGETS_COUNT EQUAL 1)
SET(XARCH "-Xarch_i386 ")
ENDIF(TARGETS_COUNT EQUAL 1)
# Always force -mmacosx-version-min to override environement variable
ADD_PLATFORM_FLAGS("${XARCH}-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86)
ELSE(IOS)
FOREACH(_SDK ${_CMAKE_OSX_SDKS}) FOREACH(_SDK ${_CMAKE_OSX_SDKS})
IF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk") IF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
SET(CMAKE_OSX_SYSROOT ${_SDK} CACHE PATH "" FORCE) SET(CMAKE_OSX_SYSROOT ${_SDK} CACHE PATH "" FORCE)
@ -563,33 +682,57 @@ MACRO(NL_SETUP_BUILD)
ENDFOREACH(_SDK) ENDFOREACH(_SDK)
IF(CMAKE_OSX_SYSROOT) IF(CMAKE_OSX_SYSROOT)
SET(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CFLAGS}") ADD_PLATFORM_FLAGS("-isysroot ${CMAKE_OSX_SYSROOT}")
ELSE(CMAKE_OSX_SYSROOT) ELSE(CMAKE_OSX_SYSROOT)
MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated") MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated")
ENDIF(CMAKE_OSX_SYSROOT) ENDIF(CMAKE_OSX_SYSROOT)
IF(CMAKE_OSX_ARCHITECTURES) # Always force -mmacosx-version-min to override environement variable
FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES}) ADD_PLATFORM_FLAGS("-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch ${_ARCH}") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDFOREACH(_ARCH) ENDIF(IOS)
ENDIF(CMAKE_OSX_ARCHITECTURES)
IF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names")
IF(HAVE_FLAG_SEARCH_PATHS_FIRST) IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
SET(PLATFORM_LINKFLAGS "-Wl,-search_paths_first ${PLATFORM_LINKFLAGS}") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-search_paths_first")
ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST) ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST)
ENDIF(APPLE AND XCODE) ENDIF(XCODE)
ELSE(APPLE)
IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
ADD_PLATFORM_FLAGS("-m32 -march=i686")
ENDIF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
ADD_PLATFORM_FLAGS("-m64")
ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
ENDIF(APPLE)
ADD_PLATFORM_FLAGS("-D_REENTRANT -pipe -fno-strict-aliasing")
IF(WITH_COVERAGE)
ADD_PLATFORM_FLAGS("-fprofile-arcs -ftest-coverage")
ENDIF(WITH_COVERAGE)
IF(WITH_WARNINGS)
ADD_PLATFORM_FLAGS("-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused")
IF(CLANG)
ADD_PLATFORM_FLAGS("-std=gnu99")
ELSE(CLANG)
ADD_PLATFORM_FLAGS("-ansi")
ENDIF(CLANG)
ENDIF(WITH_WARNINGS)
IF(APPLE)
ADD_PLATFORM_FLAGS("-gdwarf-2")
ENDIF(APPLE)
# Fix "relocation R_X86_64_32 against.." error on x64 platforms # Fix "relocation R_X86_64_32 against.." error on x64 platforms
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS) IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
SET(PLATFORM_CFLAGS "-fPIC ${PLATFORM_CFLAGS}") ADD_PLATFORM_FLAGS("-fPIC")
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS) ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} -ftemplate-depth-48") SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")
IF(NOT APPLE) IF(NOT APPLE)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed") SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed")
@ -685,11 +828,11 @@ MACRO(NL_SETUP_PREFIX_PATHS)
## Allow override of install_prefix/lib path. ## Allow override of install_prefix/lib path.
IF(NOT NL_LIB_PREFIX) IF(NOT NL_LIB_PREFIX)
IF(CMAKE_LIBRARY_ARCHITECTURE) IF(LIBRARY_ARCHITECTURE)
SET(NL_LIB_PREFIX "lib/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") SET(NL_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
ELSE(CMAKE_LIBRARY_ARCHITECTURE) ELSE(LIBRARY_ARCHITECTURE)
SET(NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.") SET(NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
ENDIF(CMAKE_LIBRARY_ARCHITECTURE) ENDIF(LIBRARY_ARCHITECTURE)
ENDIF(NOT NL_LIB_PREFIX) ENDIF(NOT NL_LIB_PREFIX)
NL_MAKE_ABSOLUTE_PREFIX(NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX) NL_MAKE_ABSOLUTE_PREFIX(NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX)
@ -698,11 +841,11 @@ MACRO(NL_SETUP_PREFIX_PATHS)
IF(WIN32) IF(WIN32)
SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.") SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.")
ELSE(WIN32) ELSE(WIN32)
IF(CMAKE_LIBRARY_ARCHITECTURE) IF(LIBRARY_ARCHITECTURE)
SET(NL_DRIVER_PREFIX "lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.") SET(NL_DRIVER_PREFIX "lib/${LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.")
ELSE(CMAKE_LIBRARY_ARCHITECTURE) ELSE(LIBRARY_ARCHITECTURE)
SET(NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers.") SET(NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers.")
ENDIF(CMAKE_LIBRARY_ARCHITECTURE) ENDIF(LIBRARY_ARCHITECTURE)
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(NOT NL_DRIVER_PREFIX) ENDIF(NOT NL_DRIVER_PREFIX)
NL_MAKE_ABSOLUTE_PREFIX(NL_DRIVER_PREFIX NL_DRIVER_ABSOLUTE_PREFIX) NL_MAKE_ABSOLUTE_PREFIX(NL_DRIVER_PREFIX NL_DRIVER_ABSOLUTE_PREFIX)
@ -752,11 +895,11 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS)
## Allow override of install_prefix/lib path. ## Allow override of install_prefix/lib path.
IF(NOT RYZOM_LIB_PREFIX) IF(NOT RYZOM_LIB_PREFIX)
IF(CMAKE_LIBRARY_ARCHITECTURE) IF(LIBRARY_ARCHITECTURE)
SET(RYZOM_LIB_PREFIX "lib/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") SET(RYZOM_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
ELSE(CMAKE_LIBRARY_ARCHITECTURE) ELSE(LIBRARY_ARCHITECTURE)
SET(RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.") SET(RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
ENDIF(CMAKE_LIBRARY_ARCHITECTURE) ENDIF(LIBRARY_ARCHITECTURE)
ENDIF(NOT RYZOM_LIB_PREFIX) ENDIF(NOT RYZOM_LIB_PREFIX)
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_LIB_PREFIX RYZOM_LIB_ABSOLUTE_PREFIX) NL_MAKE_ABSOLUTE_PREFIX(RYZOM_LIB_PREFIX RYZOM_LIB_ABSOLUTE_PREFIX)
@ -793,7 +936,10 @@ MACRO(SETUP_EXTERNAL)
IF(VC_ROOT_DIR MATCHES "registry") IF(VC_ROOT_DIR MATCHES "registry")
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE) GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE)
IF(VC_ROOT_DIR MATCHES "registry") IF(VC_ROOT_DIR MATCHES "registry")
FILE(TO_CMAKE_PATH $ENV{VS100COMNTOOLS} VC_ROOT_DIR) SET(VS100COMNTOOLS $ENV{VS100COMNTOOLS})
IF(VS100COMNTOOLS)
FILE(TO_CMAKE_PATH ${VS100COMNTOOLS} VC_ROOT_DIR)
ENDIF(VS100COMNTOOLS)
IF(NOT VC_ROOT_DIR) IF(NOT VC_ROOT_DIR)
MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!") MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!")
ENDIF(NOT VC_ROOT_DIR) ENDIF(NOT VC_ROOT_DIR)

@ -297,8 +297,8 @@ public:
void swap(CBitmap &other); void swap(CBitmap &other);
/** /**
* Read a bitmap(TGA or DDS) from an IStream. * Read a bitmap(TGA, JPEG, PNG or DDS) from an IStream.
* Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and * Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5), PNG, JPEG and
* uncompressed TGA (24 and 32 bits). * uncompressed TGA (24 and 32 bits).
* \param IStream The stream must be in reading mode. * \param IStream The stream must be in reading mode.
* \param mipMapSkip if the file is a DDS with mipMap. N=mipMapSkip mipmaps are skipped. * \param mipMapSkip if the file is a DDS with mipMap. N=mipMapSkip mipmaps are skipped.
@ -310,7 +310,7 @@ public:
/** /**
* Determinate the bitmap size from a bitmap(TGA or DDS) from an IStream. load just header of the file. * Determinate the bitmap size from a bitmap(TGA or DDS) from an IStream. load just header of the file.
* Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and * Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5), PNG, JPEG and
* uncompressed TGA (24 and 32 bits). * uncompressed TGA (24 and 32 bits).
* NB: at the end, f is seeked to begin. * NB: at the end, f is seeked to begin.
* \param IStream The stream must be in reading mode. * \param IStream The stream must be in reading mode.

@ -193,7 +193,7 @@ void SCloudTextureClamp::init (uint32 nWidth, uint32 nHeight, uint32 nDepth, con
Mem = new uint8[NbW*Width*NbH*Height]; Mem = new uint8[NbW*Width*NbH*Height];
uint32 i, j; uint32 i, j;
if (filename == "") if (filename.empty())
{ {
// No filename so init with default // No filename so init with default
for (i = 0; i < NbW; ++i) for (i = 0; i < NbW; ++i)

@ -307,7 +307,7 @@ void CCluster::serial (NLMISC::IStream&f)
_SoundGroupId = CStringMapper::map(soundGroup); _SoundGroupId = CStringMapper::map(soundGroup);
f.serial(envFxName); f.serial(envFxName);
if (envFxName == "") if (envFxName.empty())
envFxName = "no fx"; envFxName = "no fx";
_EnvironmentFxId = CStringMapper::map(envFxName); _EnvironmentFxId = CStringMapper::map(envFxName);
} }

@ -17,7 +17,7 @@
#include "stdopengl.h" #include "stdopengl.h"
#include "driver_opengl.h" #include "driver_opengl.h"
#ifdef NL_OS_UNIX #if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
# include <X11/Xatom.h> # include <X11/Xatom.h>
# ifdef HAVE_XRENDER # ifdef HAVE_XRENDER
# include <X11/extensions/Xrender.h> # include <X11/extensions/Xrender.h>
@ -25,7 +25,7 @@
# ifdef HAVE_XCURSOR # ifdef HAVE_XCURSOR
# include <X11/Xcursor/Xcursor.h> # include <X11/Xcursor/Xcursor.h>
# endif // HAVE_XCURSOR # endif // HAVE_XCURSOR
#endif // NL_OS_UNIX #endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
#include "nel/misc/mouse_device.h" #include "nel/misc/mouse_device.h"
#include "nel/misc/di_event_emitter.h" #include "nel/misc/di_event_emitter.h"

@ -237,7 +237,7 @@ void CZoneLoadingTask::run(void)
{ {
// Lookup the zone // Lookup the zone
string zonePathLookup = CPath::lookup (_ZoneName, false, false, true); string zonePathLookup = CPath::lookup (_ZoneName, false, false, true);
if (zonePathLookup == "") if (zonePathLookup.empty())
zonePathLookup = _ZoneName; zonePathLookup = _ZoneName;
CZone *ZoneTmp = new CZone; CZone *ZoneTmp = new CZone;

@ -80,7 +80,7 @@ CMessageRecorder::CMessageRecorder() : _RecordAll(true)
*/ */
CMessageRecorder::~CMessageRecorder() CMessageRecorder::~CMessageRecorder()
{ {
if ( _Filename != "" ) if ( !_Filename.empty() )
{ {
nldebug( "MR:%s: End of recording", _Filename.c_str() ); nldebug( "MR:%s: End of recording", _Filename.c_str() );
} }

@ -89,7 +89,7 @@ void CVarPath::decode ()
string val = getToken (); string val = getToken ();
if (val == "") if (val.empty())
return; return;
if (val == "[" ) if (val == "[" )
@ -105,7 +105,7 @@ void CVarPath::decode ()
osbnb++; osbnb++;
// end of token // end of token
if (val == "") if (val.empty())
{ {
nlwarning ("VP: Bad VarPath '%s', suppose it s an empty varpath", RawVarPath.c_str()); nlwarning ("VP: Bad VarPath '%s', suppose it s an empty varpath", RawVarPath.c_str());
Destination.clear (); Destination.clear ();
@ -143,7 +143,7 @@ void CVarPath::decode ()
Destination.push_back (make_pair(RawVarPath, string(""))); Destination.push_back (make_pair(RawVarPath, string("")));
return; return;
} }
else if (val != "." && val != "" && val != "=") else if (val != "." && !val.empty() && val != "=")
{ {
nlwarning ("VP: Malformated VarPath '%s' before position %d", RawVarPath.c_str (), TokenPos); nlwarning ("VP: Malformated VarPath '%s' before position %d", RawVarPath.c_str (), TokenPos);
return; return;

@ -142,7 +142,7 @@ public:
for (i=0; i<num; ++i) for (i=0; i<num; ++i)
{ {
std::string fname = NLMISC::CPath::lookup(_NamePrefix + "_" + NLMISC::toString(i) + ".lr", false, true); std::string fname = NLMISC::CPath::lookup(_NamePrefix + "_" + NLMISC::toString(i) + ".lr", false, true);
if (fname == "") if (fname.empty())
continue; continue;
NLMISC::CIFile f(fname); NLMISC::CIFile f(fname);

@ -413,7 +413,7 @@ void CSoundPage::apply()
nlassert( _Tree ); nlassert( _Tree );
if ( m_Filename != "" ) if ( !m_Filename.empty() )
{ {
CString s = ((CSource_sounds_builderDlg*)GetOwner())->SoundName( _HItem ) + " (" + m_Filename + ")"; CString s = ((CSource_sounds_builderDlg*)GetOwner())->SoundName( _HItem ) + " (" + m_Filename + ")";
_Tree->SetItemText( _HItem, s ); _Tree->SetItemText( _HItem, s );

@ -364,7 +364,7 @@ CString CSource_sounds_builderDlg::SoundName( HTREEITEM hitem )
{ {
CString s = m_Tree.GetItemText( hitem ); CString s = m_Tree.GetItemText( hitem );
sint last; sint last;
if ( s != "" ) if ( !s.empty() )
{ {
if ( s[s.GetLength()-1] == '*' ) if ( s[s.GetLength()-1] == '*' )
{ {
@ -425,13 +425,13 @@ void CSource_sounds_builderDlg::OnSave()
} }
nameset.insert( (*ips)->getName() ); nameset.insert( (*ips)->getName() );
} }
if ( duplicates != "" ) if ( !duplicates.empty() )
{ {
CString s; CString s;
s.Format( "Warning: the following names are duplicates. The first occurence of each one was not written in the output file. Correct the names and save again:\n\n%s", duplicates.c_str() ); s.Format( "Warning: the following names are duplicates. The first occurence of each one was not written in the output file. Correct the names and save again:\n\n%s", duplicates.c_str() );
AfxMessageBox( s, MB_ICONWARNING ); AfxMessageBox( s, MB_ICONWARNING );
} }
if ( blanksounds != "" ) if ( !blanksounds.empty() )
{ {
CString s; CString s;
s.Format( "Warning: the following sounds have no wave file specified:\n\n%s", blanksounds.c_str() ); s.Format( "Warning: the following sounds have no wave file specified:\n\n%s", blanksounds.c_str() );
@ -569,7 +569,7 @@ void CSource_sounds_builderDlg::OnImport()
if ( hitem == NULL ) if ( hitem == NULL )
{ {
string sname = string(name); string sname = string(name);
if ( sname != "" ) // prevent from taking blank names if ( !sname.empty() ) // prevent from taking blank names
{ {
AddSound( sname.c_str() ); AddSound( sname.c_str() );
} }

@ -105,7 +105,7 @@ CAnimatedSceneObject::CAnimatedSceneObject( const string& ObjectName, const stri
} }
// load skeleton, bind mesh and init position, rotation, cluster // load skeleton, bind mesh and init position, rotation, cluster
if(_SkeletonName != "" ) if(!_SkeletonName.empty())
{ {
_Skeleton = Scene->createSkeleton(_SkeletonName); _Skeleton = Scene->createSkeleton(_SkeletonName);
if( _Skeleton == NULL ) if( _Skeleton == NULL )
@ -340,12 +340,12 @@ void CAnimatedSceneObject::resetInitialPos( void )
// Destructor // Destructor
CAnimatedSceneObject::~CAnimatedSceneObject() CAnimatedSceneObject::~CAnimatedSceneObject()
{ {
if( _Instance != NULL && _MeshName != "" ) if( _Instance != NULL && !_MeshName.empty() )
{ {
Scene->deleteInstance( _Instance ); Scene->deleteInstance( _Instance );
} }
if( _Skeleton != NULL && _SkeletonName != "" ) if( _Skeleton != NULL && !_SkeletonName.empty() )
{ {
Scene->deleteSkeleton( _Skeleton ); Scene->deleteSkeleton( _Skeleton );
} }

@ -777,7 +777,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
sint32 dstPhraseId= pCSDst->getSPhraseId(); sint32 dstPhraseId= pCSDst->getSPhraseId();
sint32 dstMacroId= pCSDst->getMacroId(); sint32 dstMacroId= pCSDst->getMacroId();
if ((src == "") && (CHandlerPhraseMemoryCopy::haveLastPhraseElement)) if (src.empty() && (CHandlerPhraseMemoryCopy::haveLastPhraseElement))
{ {
// get the slot ids from save // get the slot ids from save
srcIsMacro= CHandlerPhraseMemoryCopy::isMacro; srcIsMacro= CHandlerPhraseMemoryCopy::isMacro;
@ -1611,7 +1611,7 @@ public:
virtual void execute(CCtrlBase * /* pCaller */, const string &Params) virtual void execute(CCtrlBase * /* pCaller */, const string &Params)
{ {
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
CCDBNodeLeaf *node= pIM->getDbProp("UI:PHRASE:SELECT_MEMORY_", false); CCDBNodeLeaf *node= pIM->getDbProp("UI:PHRASE:SELECT_MEMORY", false);
if(node) if(node)
{ {
sint32 val; sint32 val;

@ -1563,7 +1563,7 @@ bool CInterfaceManager::loadConfig (const string &filename)
CIFile f; CIFile f;
string sFileName; string sFileName;
sFileName = NLMISC::CPath::lookup (filename, false); sFileName = NLMISC::CPath::lookup (filename, false);
if (sFileName == "" || !f.open(sFileName)) if (sFileName.empty() || !f.open(sFileName))
return false; return false;

@ -43,7 +43,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet *
{ {
CSString eff = pIS->Consumable.Properties[i]; CSString eff = pIS->Consumable.Properties[i];
if (eff == "") if (eff.empty())
continue; continue;
// Get name id of effect // Get name id of effect

@ -1228,7 +1228,7 @@ void CLuaIHM::createLuaEnumTable(CLuaState &ls, const std::string &str)
p = s.splitTo('.', true); p = s.splitTo('.', true);
while (p.size() > 0) while (p.size() > 0)
{ {
if (path == "") if (path.empty())
path = p; path = p;
else else
path += "." + p; path += "." + p;

@ -707,7 +707,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
SGlobalTexture gt; SGlobalTexture gt;
// Load texture file // Load texture file
string filename = CPath::lookup (textureFileName, false); string filename = CPath::lookup (textureFileName, false);
if (filename == "") return; if (filename.empty()) return;
CIFile ifTmp; CIFile ifTmp;
if (ifTmp.open(filename)) if (ifTmp.open(filename))
CBitmap::loadSize (ifTmp, gt.Width, gt.Height); CBitmap::loadSize (ifTmp, gt.Width, gt.Height);
@ -724,7 +724,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
// Load uv file // Load uv file
CIFile iFile; CIFile iFile;
filename = CPath::lookup (uvFileName, false); filename = CPath::lookup (uvFileName, false);
if (filename == "") return; if (filename.empty()) return;
if (!iFile.open(filename)) return; if (!iFile.open(filename)) return;
_GlobalTextures.push_back (gt); _GlobalTextures.push_back (gt);
@ -866,7 +866,7 @@ sint32 CViewRenderer::createTexture (const std::string &sGlobalTextureName,
SGlobalTexture gtTmp; SGlobalTexture gtTmp;
gtTmp.FromGlobaleTexture = false; gtTmp.FromGlobaleTexture = false;
string filename = CPath::lookup (sLwrGTName, false); string filename = CPath::lookup (sLwrGTName, false);
if (filename == "") return -1; if (filename.empty()) return -1;
CIFile ifTmp; CIFile ifTmp;
if (ifTmp.open(filename)) if (ifTmp.open(filename))
{ {

@ -139,7 +139,7 @@ UInstanceGroup *getCluster(const UGlobalPosition &gp)
return 0; return 0;
const string &strPos = GR->getIdentifier(gp); const string &strPos = GR->getIdentifier(gp);
if(strPos == "") if(strPos.empty())
return 0; return 0;
// try to find the ig in the loaded ig map // try to find the ig in the loaded ig map
std::map<std::string, UInstanceGroup *>::const_iterator igIt = IGLoaded.find(strlwr(strPos)); std::map<std::string, UInstanceGroup *>::const_iterator igIt = IGLoaded.find(strlwr(strPos));

@ -6603,7 +6603,7 @@ NLMISC::CVectorD getVectorD(const CObject *obj)
CObject *buildVector(const NLMISC::CVectorD &vector, const std::string &instanceId /*= ""*/) CObject *buildVector(const NLMISC::CVectorD &vector, const std::string &instanceId /*= ""*/)
{ {
CObject *table; CObject *table;
if (instanceId == "") if (instanceId.empty())
{ {
table = getEditor().getDMC().newComponent("Position"); table = getEditor().getDMC().newComponent("Position");
table->set("x", vector.x); table->set("x", vector.x);

@ -165,7 +165,7 @@ void CSessionBrowser::run()
} }
disconnected: disconnected:
// unconnected, waiting for message to send // disconnected, waiting for message to send
while (adaptor->_SendQueue.empty()) while (adaptor->_SendQueue.empty())
{ {
nlSleep(100); nlSleep(100);

@ -470,7 +470,7 @@ protected:
/// display nodes /// display nodes
void xmlDisplay() void xmlDisplay()
{ {
std::string ntype = (Name == "" ? "client_messages_description" : NbBits == 0 ? "leaf" : "branch"); std::string ntype = (Name.empty() ? "client_messages_description" : NbBits == 0 ? "leaf" : "branch");
nlinfo("<%s name=\"%s\" description=\"%s\">", ntype.c_str(), Name.c_str(), Description.c_str()); nlinfo("<%s name=\"%s\" description=\"%s\">", ntype.c_str(), Name.c_str(), Description.c_str());

@ -483,7 +483,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si
nlassert(index != -1); nlassert(index != -1);
instanceId = parent->getAttr("InstanceId")->toString(); instanceId = parent->getAttr("InstanceId")->toString();
attrName = parent->getKey(index); attrName = parent->getKey(index);
if (attrName == "") if (attrName.empty())
{ {
position = index; position = index;
} }
@ -501,7 +501,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si
nlassert(index2 != -1); nlassert(index2 != -1);
sint32 index = parent->findIndex(this); sint32 index = parent->findIndex(this);
nlassert(index != -1); nlassert(index != -1);
if (parent2->getKey(index2) == "") if (parent2->getKey(index2).empty())
{ {
nlassert(0); // TMP : want to see if may possibly happen nlassert(0); // TMP : want to see if may possibly happen
return false; return false;
@ -602,7 +602,7 @@ bool CObjectString::set(const std::string& key, const std::string & value)
bool CObjectString::setObject(const std::string& key, CObject* value) bool CObjectString::setObject(const std::string& key, CObject* value)
{ {
//H_AUTO(R2_CObjectString_setObject) //H_AUTO(R2_CObjectString_setObject)
BOMB_IF( key != "" || ! (value->isString() || value->isNumber()) , "Try to set the a sub value of an object that does not allowed it", return false); BOMB_IF( !key.empty() || ! (value->isString() || value->isNumber()) , "Try to set the a sub value of an object that does not allowed it", return false);
bool canSet = set(key, value->toString()); bool canSet = set(key, value->toString());
if (canSet) if (canSet)
{ {
@ -1092,7 +1092,7 @@ void CObjectTable::doSerialize(std::string& out, CSerializeContext& context) co
if ( _Value[i].second->isString("Name") if ( _Value[i].second->isString("Name")
&& _Value[i].second->isString("LocationId") && _Value[i].second->isString("LocationId")
&& _Value[i].second->toString("Name") == "Permanent" && _Value[i].second->toString("Name") == "Permanent"
&& _Value[i].second->toString("LocationId") == "") && _Value[i].second->toString("LocationId").empty())
{ {
isDefault = true; isDefault = true;
} }
@ -1248,7 +1248,7 @@ bool CObjectTable::setObject(const std::string& key, CObject* value)
//H_AUTO(R2_CObjectTable_setObject) //H_AUTO(R2_CObjectTable_setObject)
CHECK_TABLE_INTEGRITY CHECK_TABLE_INTEGRITY
value->setGhost(this->getGhost()); value->setGhost(this->getGhost());
if (key == "") if (key.empty())
{ {
clear(); clear();

@ -406,7 +406,7 @@ void CScenarioEntryPoints::loadFromXMLFile()
nlinfo("Different packages for island '%s' in file %s", island, _EntryPointsFilename.c_str()); nlinfo("Different packages for island '%s' in file %s", island, _EntryPointsFilename.c_str());
} }
} }
if(package == "") if(package.empty())
nlinfo("no 'package' tag in %s island", island); nlinfo("no 'package' tag in %s island", island);
else else
completeIsland.Package = CSString(package); completeIsland.Package = CSString(package);

@ -8,7 +8,7 @@
AESAliasName = "bms_master"; AESAliasName = "bms_master";
Paths = { Paths += {
".", ".",
"../common/data_leveldesign", "../common/data_leveldesign",
}; };

@ -16,6 +16,7 @@ WebPort = 49898;
BSReadState = 1; BSReadState = 1;
// ---- service custom variables (used by CVariable class) // ---- service custom variables (used by CVariable class)
// Port for the Layer 3 interface of the backup service // Port for the Layer 3 interface of the backup service

@ -96,4 +96,5 @@ WriteFilesDirectory = "data_shard";
// ---- service custom variables (used by ConfigFile class) // ---- service custom variables (used by ConfigFile class)
// ---- service custom variables (used by CVariable class) // ---- service custom variables (used by CVariable class)

@ -100,6 +100,7 @@ summon :DEV:SGM:GM:VG:SG:EM: // Summon a player in front of the CSR: <pla
targetInfos :DEV:SGM:GM:EM: // Give infos on the target targetInfos :DEV:SGM:GM:EM: // Give infos on the target
teamInvite // Send a team invite to a player character teamInvite // Send a team invite to a player character
connectUserChannel // Connect to User Channel Chat connectUserChannel // Connect to User Channel Chat
connectLangChannel // Connect to Lang Channel Chat
webExecCommand // Execute web command (need HMAC signature) webExecCommand // Execute web command (need HMAC signature)
webDelCommandsIds // Delete web transactions for web_app webDelCommandsIds // Delete web transactions for web_app
webAddCommandsIds // Add web command transactions for web_app webAddCommandsIds // Add web command transactions for web_app

@ -1,5 +1,5 @@
<xml> <xml>
<_Date type="UINT32" value="0"/> <UTC__Date type="UINT32" value="0"/>
<_Name type="STRING" value=""/> <_Name type="STRING" value=""/>
<_EventFaction1Name type="STRING" value=""/> <_EventFaction1Name type="STRING" value=""/>
<_EventFaction2Name type="STRING" value=""/> <_EventFaction2Name type="STRING" value=""/>

@ -74,6 +74,7 @@ BotNameTranslationFile = "bot_names.txt";
// depending on the shard main language. // depending on the shard main language.
EventFactionTranslationFile = "event_factions.txt"; EventFactionTranslationFile = "event_factions.txt";
// ---- service custom variables (used by CVariable class) // ---- service custom variables (used by CVariable class)
// Activate/deactivate debugging of missing paremeter replacement // Activate/deactivate debugging of missing paremeter replacement

@ -8,6 +8,7 @@ DontUseNS = 1;
// ---- service custom variables (used by ConfigFile class) // ---- service custom variables (used by ConfigFile class)
// ---- service custom variables (used by CVariable class) // ---- service custom variables (used by CVariable class)
WebRootDirectory = "save_shard/www"; WebRootDirectory = "save_shard/www";

@ -46,4 +46,5 @@ HomeMainlandNames =
// The max number of ring points (aka ring access) for each ecosystem // The max number of ring points (aka ring access) for each ecosystem
MaxRingPoints = "A1:D7:F7:J8:L6:R13"; MaxRingPoints = "A1:D7:F7:J8:L6:R13";
// ---- service custom variables (used by CVariable class) // ---- service custom variables (used by CVariable class)

@ -126,7 +126,7 @@ SystemCmd = {};
ReadTranslationWork = 0; ReadTranslationWork = 0;
TranslationWorkPath = "translation/work"; TranslationWorkPath = "translation/work";
//Paths = { "data_leveldesign/leveldesign/Game_elem" }; //Paths += { "data_leveldesign/leveldesign/Game_elem" };
// Global shard bot name translation file. You sould overide this // Global shard bot name translation file. You sould overide this
// in input_output_service.cfg to specialize the file // in input_output_service.cfg to specialize the file

@ -128,7 +128,7 @@ static bool LookupShopType(std::string name,std::vector<uint32> &shopList)
uint i; uint i;
for ( i=0; i < cvShopType.size(); ++i ) for ( i=0; i < cvShopType.size(); ++i )
{ {
if ( cvShopType.asString(i) != "" ) if ( !cvShopType.asString(i).empty() )
{ {
// make sure the string doesn't turn up more than once in input data // make sure the string doesn't turn up more than once in input data
for (uint j=0;j<ShopTypeNames.size();++j) for (uint j=0;j<ShopTypeNames.size();++j)

@ -532,7 +532,10 @@ static CMessage getFileClassImp( CMessage& msgin)
for (uint j=0; j<classes[i].size(); ++j) for (uint j=0; j<classes[i].size(); ++j)
{ {
std::string rfile = getBackupFileName(classes[i][j].File); std::string rfile = classes[i][j].File;
// if there's wildcard, the file is already full so we don't need to add again the backup path or we ll have "save_shard/save_shard/..." that is not valid
if (!CFile::isExists(rfile))
rfile = getBackupFileName(classes[i][j].File);
fdc.addFile(classes[i][j].File, CFile::getFileModificationDate(rfile),CFile::getFileSize(rfile)); fdc.addFile(classes[i][j].File, CFile::getFileModificationDate(rfile),CFile::getFileSize(rfile));
} }
} }

@ -181,6 +181,7 @@ AdminCommandsInit[] =
"validateRespawnPoint", true, "validateRespawnPoint", true,
"summonPet", true, "summonPet", true,
"connectUserChannel", true, "connectUserChannel", true,
"connectLangChannel", true,
"updateTarget", true, "updateTarget", true,
"resetName", true, "resetName", true,
"showOnline", true, "showOnline", true,
@ -1126,6 +1127,8 @@ ENTITY_VARIABLE(Position, "Position of a player (in meter) <eid> <posx>,<posy>[,
vector<string> res; vector<string> res;
sint32 x = 0, y = 0, z = 0; sint32 x = 0, y = 0, z = 0;
sint32 cell = 0;
if (get) if (get)
{ {
x = e->getState().X() / 1000; x = e->getState().X() / 1000;
@ -1229,6 +1232,10 @@ ENTITY_VARIABLE(Position, "Position of a player (in meter) <eid> <posx>,<posy>[,
x = entityBase->getState().X + sint32 (cos (entityBase->getState ().Heading) * 2000); x = entityBase->getState().X + sint32 (cos (entityBase->getState ().Heading) * 2000);
y = entityBase->getState().Y + sint32 (sin (entityBase->getState ().Heading) * 2000); y = entityBase->getState().Y + sint32 (sin (entityBase->getState ().Heading) * 2000);
z = entityBase->getState().Z; z = entityBase->getState().Z;
TDataSetRow dsr = entityBase->getEntityRowId();
CMirrorPropValueRO<TYPE_CELL> mirrorCell( TheDataset, dsr, DSPropertyCELL );
cell = mirrorCell;
} }
} }
} }
@ -1258,11 +1265,11 @@ ENTITY_VARIABLE(Position, "Position of a player (in meter) <eid> <posx>,<posy>[,
// season included // season included
uint8 season; uint8 season;
NLMISC::fromString(res[3], season); NLMISC::fromString(res[3], season);
c->teleportCharacter(x,y,z,true, false, 0.f, 0xFF, 0, season); c->teleportCharacter(x,y,z,true, false, 0.f, 0xFF, cell, season);
} }
else else
{ {
c->teleportCharacter(x,y,z,true); c->teleportCharacter(x,y,z,true, false, 0.f, 0xFF, cell);
} }
if ( cont ) if ( cont )
@ -2960,7 +2967,7 @@ void audit(const CAdminCommand *cmd, const string &rawCommand, const CEntityId &
string host = varHost->asString(); string host = varHost->asString();
string page = varPage->asString(); string page = varPage->asString();
if (host == "" || page == "") if (host.empty() || page.empty())
return; return;
char params[1024]; char params[1024];
@ -3780,7 +3787,7 @@ NLMISC_COMMAND( monitorMissions, "monitor a player missions", "<CSR id><player n
CHECK_RIGHT( c,target ); CHECK_RIGHT( c,target );
// CSR must have no missions to monitor a player // CSR must have no missions to monitor a player
if ( c->getMissionsBegin() == c->getMissionsEnd() ) if ( c->getMissionsBegin() != c->getMissionsEnd() )
{ {
CCharacter::sendDynamicSystemMessage( c->getEntityRowId() , "CSR_HAS_MISSION" ); CCharacter::sendDynamicSystemMessage( c->getEntityRowId() , "CSR_HAS_MISSION" );
return true; return true;
@ -4014,8 +4021,6 @@ NLMISC_COMMAND (unmuteUniverse, "unmute the univers chat", "<csr id><player name
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
NLMISC_COMMAND (setGMGuild, "set the current GM guild", "") NLMISC_COMMAND (setGMGuild, "set the current GM guild", "")
{ {
if ( args.size() != 1 )
return false;
GET_CHARACTER; GET_CHARACTER;
uint32 guildId = c->getGuildId(); uint32 guildId = c->getGuildId();
CGuildManager::getInstance()->setGMGuild( guildId ); CGuildManager::getInstance()->setGMGuild( guildId );
@ -4450,8 +4455,8 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
CPVPManager2 *inst = CPVPManager2::getInstance(); CPVPManager2 *inst = CPVPManager2::getInstance();
string pass; string pass;
string name = args[1]; string name = toLower(args[1]);
TChanID channel = CPVPManager2::getInstance()->getUserDynChannel(name); TChanID channel = inst->getUserDynChannel(name);
if (args.size() < 3) if (args.size() < 3)
pass = toLower(name); pass = toLower(name);
@ -4499,6 +4504,38 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
} }
NLMISC_COMMAND (connectLangChannel, "Connect to lang channel", "<user id> <lang>")
{
if ((args.size() < 2) || (args.size() > 3))
return false;
GET_CHARACTER
CPVPManager2 *inst = CPVPManager2::getInstance();
string action;
string lang = args[1];
if (lang != "en" && lang != "fr" && lang != "de" && lang != "ru" && lang != "es")
return false;
TChanID channel = inst->getFactionDynChannel(lang);
if (channel != DYN_CHAT_INVALID_CHAN)
{
if (!c->getLangChannel().empty()) {
TChanID current_channel = inst->getFactionDynChannel(c->getLangChannel());
inst->removeFactionChannelForCharacter(current_channel, c);
}
inst->addFactionChannelToCharacter(channel, c, true);
c->setLangChannel(lang);
return true;
}
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal = lang;
CCharacter::sendDynamicSystemMessage( eid, "EGS_CHANNEL_INVALID_NAME", params );
return false;
}
NLMISC_COMMAND (updateTarget, "Update current target", "<user id>") NLMISC_COMMAND (updateTarget, "Update current target", "<user id>")
{ {
GET_CHARACTER GET_CHARACTER
@ -4601,9 +4638,15 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
GET_CHARACTER GET_CHARACTER
bool new_check = false; bool new_check = false;
if (args.size() >= 6 && args[5] == "1") bool new_separator = false;
// New check using HMagic
if (args.size() >= 6 && (args[5] == "1" || args[5] == "3"))
new_check = true; new_check = true;
// New separator "|"
if (args.size() >= 6 && (args[5] == "2" || args[5] == "3"))
new_separator = true;
bool next_step = false; bool next_step = false;
if (args.size() >= 7 && args[6] == "1") if (args.size() >= 7 && args[6] == "1")
next_step = true; next_step = true;
@ -4680,6 +4723,9 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
} }
std::vector<std::string> command_args; std::vector<std::string> command_args;
if (new_separator)
NLMISC::splitString(command, "|", command_args);
else
NLMISC::splitString(command, "!", command_args); NLMISC::splitString(command, "!", command_args);
if (command_args.empty()) if (command_args.empty())
return false; return false;
@ -5317,8 +5363,10 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
uint32 value; uint32 value;
fromString(command_args[2], value); fromString(command_args[2], value);
if (target)
target->setHairColor(value); target->setHairColor(value);
else
return false;
} }
//************************************************* //*************************************************
@ -5468,12 +5516,35 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
//************************************************* //*************************************************
//***************** set_title //***************** set_title
//************************************************* //*************************************************
// /a webExecCommand debug 1 set_title!toto hmac 0
else if (command_args[0] == "set_title") else if (command_args[0] == "set_title")
{ {
if (command_args.size () != 2) return false; if (command_args.size () != 2) return false;
TDataSetRow row = c->getEntityRowId(); TDataSetRow row = c->getEntityRowId();
ucstring name = ucstring(c->getName().toString()+"$"+command_args[1]+"$"); c->setNewTitle(command_args[1]);
string fullname = c->getName().toString()+"$"+command_args[1]+"#"+c->getTagPvPA()+"#"+c->getTagPvPB()+"#"+c->getTagA()+"#"+c->getTagB()+"$";
ucstring name;
name.fromUtf8(fullname);
NLNET::CMessage msgout("CHARACTER_NAME");
msgout.serial(row);
msgout.serial(name);
sendMessageViaMirror("IOS", msgout);
}
//*************************************************
//***************** set_tag
//*************************************************
else if (command_args[0] == "set_tag") {
if (command_args.size () != 3) return false;
TDataSetRow row = c->getEntityRowId();
if (command_args[1] == "pvpA") c->setTagPvPA(command_args[2]);
if (command_args[1] == "pvpB") c->setTagPvPB(command_args[2]);
if (command_args[1] == "A") c->setTagA(command_args[2]);
if (command_args[1] == "B") c->setTagB(command_args[2]);
string fullname = c->getName().toString()+"$"+c->getNewTitle()+"#"+c->getTagPvPA()+"#"+c->getTagPvPB()+"#"+c->getTagA()+"#"+c->getTagB()+"$";
ucstring name;
name.fromUtf8(fullname);
NLNET::CMessage msgout("CHARACTER_NAME"); NLNET::CMessage msgout("CHARACTER_NAME");
msgout.serial(row); msgout.serial(row);
msgout.serial(name); msgout.serial(name);
@ -5500,6 +5571,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
vector<string> res; vector<string> res;
sint32 x = 0, y = 0, z = 0; sint32 x = 0, y = 0, z = 0;
float h = 0; float h = 0;
sint32 cell;
if ( value.find(',') != string::npos ) // Position x,y,z,a if ( value.find(',') != string::npos ) // Position x,y,z,a
{ {
explode (value, string(","), res); explode (value, string(","), res);
@ -5591,6 +5663,10 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
y = entityBase->getState().Y + sint32 (sin (entityBase->getState ().Heading) * 2000); y = entityBase->getState().Y + sint32 (sin (entityBase->getState ().Heading) * 2000);
z = entityBase->getState().Z; z = entityBase->getState().Z;
h = entityBase->getState().Heading; h = entityBase->getState().Heading;
TDataSetRow dsr = entityBase->getEntityRowId();
CMirrorPropValueRO<TYPE_CELL> mirrorCell( TheDataset, dsr, DSPropertyCELL );
cell = mirrorCell;
} }
} }
} }
@ -5620,7 +5696,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
c->applyRespawnEffects(); c->applyRespawnEffects();
} }
c->teleportCharacter(x,y,z,allowPetTp,true,h); c->teleportCharacter(x,y,z,allowPetTp,true,h,0xFF,cell);
if ( cont ) if ( cont )
{ {
@ -5903,6 +5979,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_faction_points", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_faction_points", getSalt());
return true;
} }
} }
else if (action=="set") else if (action=="set")
@ -5941,6 +6018,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{ {
if (send_url) if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_pvp_points", getSalt()); c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_pvp_points", getSalt());
return true;
} }
} }
else if (action=="set") else if (action=="set")
@ -5957,6 +6035,51 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
} }
} }
//*************************************************
//***************** ios
//*************************************************
else if (command_args[0] == "ios")
{
if (command_args.size() < 4)
return false;
string action = command_args[1]; // single_phrase
if (action == "single_phrase")
{
string phraseName = command_args[2];
ucstring phraseContent = phraseName;
ucstring phraseText;
phraseText.fromUtf8(command_args[3]);
phraseContent += "(){[";
phraseContent += phraseText;
phraseContent += "]}";
string msgname = "SET_PHRASE";
bool withLang = false;
string lang = "";
if (command_args.size() == 5)
{
lang = command_args[3];
if (lang != "all")
{
withLang = true;
msgname = "SET_PHRASE_LANG";
}
}
NLNET::CMessage msgout(msgname);
msgout.serial(phraseName);
msgout.serial(phraseContent);
if (withLang)
msgout.serial(lang);
sendMessageViaMirror("IOS", msgout);
return true;
}
}
//************************************************* //*************************************************
//***************** missions //***************** missions
//************************************************* //*************************************************
@ -6921,7 +7044,7 @@ NLMISC_COMMAND(setChanHistoricSize, "Set size of the historic for a localized ch
// add a client to a channel // add a client to a channel
NLMISC_COMMAND(addChanClient, "add a client to a channel", "<client name or user id><string name of the channel localized name>[1=Read/Write,0=ReadOnly(default)]") NLMISC_COMMAND(addChanClient, "add a client to a channel", "<client name or user id><string name of the channel localized name>[1=Read/Write,0=ReadOnly(default)]")
{ {
if (args.size() != 2) return false; if (args.size() < 2 || args.size() > 3) return false;
GET_CHARACTER GET_CHARACTER
TChanID chanID = DynChatEGS.getChanIDFromName(args[1]); TChanID chanID = DynChatEGS.getChanIDFromName(args[1]);
if (chanID == DYN_CHAT_INVALID_CHAN) if (chanID == DYN_CHAT_INVALID_CHAN)

@ -89,7 +89,15 @@ bool IBuildingPhysical::addUser(CCharacter * user, uint16 roomIdx, uint16 ownerI
return false; return false;
} }
if (user->currentHp() <= 0 )
{
nlwarning("<BUILDING>user %s is dead",user->getId().toString().c_str());
return false;
}
CCharacter *owner; CCharacter *owner;
if (ownerIdx < _Players.size()) if (ownerIdx < _Players.size())
{ {
owner = PlayerManager.getChar(_Players[ownerIdx] ); owner = PlayerManager.getChar(_Players[ownerIdx] );

@ -2078,7 +2078,7 @@ void cbClientSit( NLNET::CMessage& msgin, const std::string &serviceName, NLNET:
} }
// client send a command to chang guild motd // client send a command to change guild motd
void cbClientGuildMotd( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId ) void cbClientGuildMotd( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{ {
H_AUTO(cbClientGuildMotd); H_AUTO(cbClientGuildMotd);
@ -2737,7 +2737,7 @@ void cbClientSetCharacterTitle( NLNET::CMessage& msgin, const std::string & serv
} }
// kxu: TODO: check validity of title chosen by player // kxu: TODO: check validity of title chosen by player
c->setTitle( (CHARACTER_TITLE::ECharacterTitle) title ); c->setNewTitle(CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)title));
c->registerName(); c->registerName();
} }

@ -117,7 +117,7 @@ void CGenNpcDescMsgImp::callback (const std::string &serviceName, NLNET::TServic
//if the creature has a user model and if the user model's script contains parse errors, change //if the creature has a user model and if the user model's script contains parse errors, change
//the creature's name to <usermodelId:ERROR> //the creature's name to <usermodelId:ERROR>
if (_UserModelId != "" && CDynamicSheetManager::getInstance()->scriptErrors(_PrimAlias, _UserModelId) == true) if (!_UserModelId.empty() && CDynamicSheetManager::getInstance()->scriptErrors(_PrimAlias, _UserModelId) == true)
{ {
TDataSetRow row = creature->getEntityRowId(); TDataSetRow row = creature->getEntityRowId();
ucstring name; ucstring name;

@ -4321,41 +4321,7 @@ NLMISC_COMMAND(setAllSkillsToValue,"set all skills to value","<entity id(id:type
if( e ) if( e )
{ {
log.displayNL("Player %s skills are all set to value %u", id.toString().c_str(), value); log.displayNL("Player %s skills are all set to value %u", id.toString().c_str(), value);
// get pointer on static skills tree definition e->setSkillsToValue(value);
CSheetId sheet("skills.skill_tree");
const CStaticSkillsTree * SkillsTree = CSheets::getSkillsTreeForm( sheet );
nlassert( SkillsTree );
for(int i = 0; i < SKILLS::NUM_SKILLS; ++i )
{
CSkills &skills = e->getSkills();
skills._Skills[ i ].Base = min( value, (sint32)SkillsTree->SkillsTree[ i ].MaxSkillValue );
skills._Skills[ i ].Current = skills._Skills[ i ].Base;
skills._Skills[ i ].MaxLvlReached = skills._Skills[ i ].Base;
// update all parent skill with new max children
SKILLS::ESkills skillUpdated = (SKILLS::ESkills)i;
while( SkillsTree->SkillsTree[ skillUpdated ].ParentSkill != SKILLS::unknown )
{
if( skills._Skills[ i ].Base > skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxLvlReached )
{
skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxLvlReached = skills._Skills[ i ].Base;
skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].Base = min( skills._Skills[ skillUpdated ].Base, (sint32)SkillsTree->SkillsTree[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxSkillValue );
skillUpdated = SkillsTree->SkillsTree[ skillUpdated ].ParentSkill;
}
else
{
break;
}
}
// e->_PropertyDatabase.x_setProp( string("CHARACTER_INFO:SKILLS:") + NLMISC::toStringEnum( i ) + string(":SKILL"), skills._Skills[ i ].Base );
CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setSKILL(e->_PropertyDatabase, checkedCast<uint16>(skills._Skills[ i ].Base) );
// e->_PropertyDatabase.x_setProp( string("CHARACTER_INFO:SKILLS:") + NLMISC::toStringEnum( i ) + string(":BaseSKILL"), skills._Skills[ i ].Base );
CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setBaseSKILL(e->_PropertyDatabase, checkedCast<uint16>(skills._Skills[ i ].Base) );
}
} }
else else
{ {

@ -237,6 +237,16 @@ void CGuild::setMOTD( const std::string& motd, const NLMISC::CEntityId& eId)
nlwarning("<CGuildMemberModule::setMOTD>%s invalid member id %s",eId.toString().c_str()); nlwarning("<CGuildMemberModule::setMOTD>%s invalid member id %s",eId.toString().c_str());
return; return;
} }
if ( motd == "?" )
{
// Show the old MOTD
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal= _MessageOfTheDay;
CCharacter::sendDynamicMessageToChatGroup(user->getEntityRowId(), "GMOTD", CChatGroup::guild, params);
return;
}
EGSPD::CGuildGrade::TGuildGrade memberGrade = member->getGrade(); EGSPD::CGuildGrade::TGuildGrade memberGrade = member->getGrade();
if( memberGrade >= EGSPD::CGuildGrade::Member) if( memberGrade >= EGSPD::CGuildGrade::Member)
{ {
@ -255,9 +265,10 @@ void CGuild::setMOTD( const std::string& motd, const NLMISC::CEntityId& eId)
if(!_MessageOfTheDay.empty()) if(!_MessageOfTheDay.empty())
{ {
// Show new MOTD to all members
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal); SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal= _MessageOfTheDay; params[0].Literal= _MessageOfTheDay;
CCharacter::sendDynamicMessageToChatGroup(user->getEntityRowId(), "GMOTD", CChatGroup::guild, params); sendMessageToGuildChat("GMOTD", params);
} }
} }
else else
@ -1408,6 +1419,25 @@ void CGuild::sendMessageToGuildMembers( const std::string & msg, const TVectorP
IGuildUnifier::getInstance()->sendMessageToGuildMembers(this, msg, params); IGuildUnifier::getInstance()->sendMessageToGuildMembers(this, msg, params);
} }
//----------------------------------------------------------------------------
void CGuild::sendMessageToGuildChat( const std::string & msg, const TVectorParamCheck & params )const
{
for ( std::map< EGSPD::TCharacterId, EGSPD::CGuildMemberPD*>::const_iterator it = getMembersBegin(); it != getMembersEnd(); ++it )
{
CGuildMember * member = EGS_PD_CAST<CGuildMember*>( (*it).second );
EGS_PD_AST( member );
// continue if the player is offline
CGuildMemberModule * module = NULL;
if ( member->getReferencingModule(module) )
{
CGuildCharProxy proxy;
module->getProxy(proxy);
proxy.sendDynamicMessageToChatGroup(msg, CChatGroup::guild, params);
}
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CGuild::setMemberClientDB( CGuildMember* member ) void CGuild::setMemberClientDB( CGuildMember* member )
{ {

@ -165,6 +165,8 @@ public:
void addMemberToGuildChat(CGuildMember *member); void addMemberToGuildChat(CGuildMember *member);
/// send a message to all members /// send a message to all members
void sendMessageToGuildMembers( const std::string & msg, const TVectorParamCheck & params = TVectorParamCheck() )const; void sendMessageToGuildMembers( const std::string & msg, const TVectorParamCheck & params = TVectorParamCheck() )const;
/// send a message to all members in guild chat
void sendMessageToGuildChat( const std::string & msg, const TVectorParamCheck & params = TVectorParamCheck() )const;
/// set information relative to a member in the guild client database /// set information relative to a member in the guild client database
void setMemberClientDB( CGuildMember* member ); void setMemberClientDB( CGuildMember* member );
/// return the best online user /// return the best online user

@ -215,10 +215,8 @@ class CMissionStepKillFauna : public IMissionStepTemplate
ret.clear(); ret.clear();
ret.resize( _SubSteps.size() ); ret.resize( _SubSteps.size() );
for ( uint i = 0; i < _SubSteps.size(); i++ ) for ( uint i = 0; i < _SubSteps.size(); i++ )
{
ret[i] = _SubSteps[i].Quantity; ret[i] = _SubSteps[i].Quantity;
} }
}
virtual void getTextParams( uint & nbSubSteps,const std::string* & textPtr,TVectorParamCheck& retParams, const std::vector<uint32>& subStepStates) virtual void getTextParams( uint & nbSubSteps,const std::string* & textPtr,TVectorParamCheck& retParams, const std::vector<uint32>& subStepStates)
{ {

@ -121,7 +121,7 @@ NLMISC_COMMAND(outpostSimulateTimer0End, "", "<outpost_id> [<absolute end time>
if (args.size()>1) if (args.size()>1)
{ {
NLMISC::fromString(args[1], endTime); NLMISC::fromString(args[1], endTime);
if (args[1][0]=='+') if (args[1].find('+')==0)
endTime += CTime::getSecondsSince1970(); endTime += CTime::getSecondsSince1970();
} }
if (endTime==0) endTime = 1; if (endTime==0) endTime = 1;
@ -144,7 +144,7 @@ NLMISC_COMMAND(outpostSimulateTimer1End, "", "<outpost_id> [<absolute end time>
if (args.size()>1) if (args.size()>1)
{ {
NLMISC::fromString(args[1], endTime); NLMISC::fromString(args[1], endTime);
if (args[1][0]=='+') if (args[1].find('+')==0)
endTime += CTime::getSecondsSince1970(); endTime += CTime::getSecondsSince1970();
} }
if (endTime==0) endTime = 1; if (endTime==0) endTime = 1;
@ -167,7 +167,7 @@ NLMISC_COMMAND(outpostSimulateTimer2End, "", "<outpost_id> [<absolute end time>
if (args.size()>1) if (args.size()>1)
{ {
NLMISC::fromString(args[1], endTime); NLMISC::fromString(args[1], endTime);
if (args[1][0]=='+') if (args[1].find('+')==0)
endTime += CTime::getSecondsSince1970(); endTime += CTime::getSecondsSince1970();
} }
if (endTime==0) endTime = 1; if (endTime==0) endTime = 1;

@ -281,7 +281,7 @@ public:
} }
else else
{ {
c->wearRightHandItem(); c->wearRightHandItem(phrase->getMps().size()/10);
// report Xp Gain unless used tool is worned // report Xp Gain unless used tool is worned
PROGRESSIONPVE::CCharacterProgressionPVE::getInstance()->actionReport( report, true, false ); PROGRESSIONPVE::CCharacterProgressionPVE::getInstance()->actionReport( report, true, false );

@ -249,6 +249,14 @@ bool CFaberPhrase::validate()
return false; return false;
} }
// check quality of right hand item (need be >= Recommended (level of item))
if (rightHandItem->recommended()+49 < _Recommended)
{
PHRASE_UTILITIES::sendDynamicSystemMessage(_ActorRowId, "CRAFT_NEED_RECOMMENDED_CRAFTING_TOOL");
return false;
}
// entities cant craft if in combat // entities cant craft if in combat
/* commented as test of right hand item is now made... /* commented as test of right hand item is now made...
TDataSetRow entityRowId = CPhraseManager::getInstance().getEntityEngagedMeleeBy( _ActorRowId ); TDataSetRow entityRowId = CPhraseManager::getInstance().getEntityEngagedMeleeBy( _ActorRowId );
@ -697,7 +705,7 @@ void CFaberPhrase::stop()
} // stop // } // stop //
NLMISC_COMMAND(simuCraft, "Simulation de craft pour verifier les probabilités de reusir un item","<Nb simulations><level skill><item quality>") NLMISC_COMMAND(simuCraft, "Craft simulation to verify probabilities to succesfully craft an item","<Nb simulations><level skill><item quality>")
{ {
if (args.size() != 3) if (args.size() != 3)
return false; return false;

@ -544,6 +544,15 @@ bool CFgExtractionPhrase::validate()
return false; // has disappeared return false; // has disappeared
} }
// test if tool have enough quality
sint depositQ = (sint)harvestSource->forageSite()->deposit()->maxQuality();
if ((depositQ > 0) && (item->recommended()+49 < depositQ))
{
PHRASE_UTILITIES::sendDynamicSystemMessage(_ActorRowId, "FORAGE_TOOL_QUALITY_TOO_LOW");
return false;
}
// Check the distance from the player to the source (ignoring Z because for tunnel case, player couldn't target the source) // Check the distance from the player to the source (ignoring Z because for tunnel case, player couldn't target the source)
const CEntityState& state = player->getState(); const CEntityState& state = player->getState();
CVector2f playerPos( (float)state.X / 1000.0f, (float)state.Y / 1000.0f ); CVector2f playerPos( (float)state.X / 1000.0f, (float)state.Y / 1000.0f );

@ -675,6 +675,9 @@ CCharacter::CCharacter(): CEntityBase(false),
_FriendVisibility = VisibleToAll; _FriendVisibility = VisibleToAll;
_LangChannel = "en";
_NewTitle = "Refugee";
initDatabase(); initDatabase();
} // CCharacter // } // CCharacter //
@ -699,6 +702,7 @@ void CCharacter::clear()
_ForbidAuraUseStartDate=0; _ForbidAuraUseStartDate=0;
_ForbidAuraUseEndDate=0; _ForbidAuraUseEndDate=0;
_Title= CHARACTER_TITLE::Refugee; _Title= CHARACTER_TITLE::Refugee;
_NewTitle = "Refugee";
SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatModel,0); SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatModel,0);
SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatColor,0); SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatColor,0);
@ -3851,9 +3855,9 @@ void CCharacter::sendBetaTesterStatus()
sendReservedTitleStatus( CHARACTER_TITLE::FBT, p->isBetaTester() ); sendReservedTitleStatus( CHARACTER_TITLE::FBT, p->isBetaTester() );
if (!p->isBetaTester() && _Title == CHARACTER_TITLE::FBT) if (!p->isBetaTester() && _NewTitle == "FBT")
{ {
_Title = CHARACTER_TITLE::Refugee; _NewTitle = "Refugee";
registerName(); registerName();
} }
} }
@ -3869,9 +3873,9 @@ void CCharacter::sendWindermeerStatus()
sendReservedTitleStatus( CHARACTER_TITLE::WIND, p->isWindermeerCommunity() ); sendReservedTitleStatus( CHARACTER_TITLE::WIND, p->isWindermeerCommunity() );
if ( !p->isWindermeerCommunity() && _Title == CHARACTER_TITLE::WIND) if ( !p->isWindermeerCommunity() && _NewTitle == "WIND")
{ {
_Title = CHARACTER_TITLE::Refugee; _NewTitle = "Refugee";
registerName(); registerName();
} }
} }
@ -6963,12 +6967,12 @@ double CCharacter::addXpToSkillInternal( double XpGain, const std::string& ContS
CBankAccessor_PLR::getCHARACTER_INFO().getRING_XP_CATALYSER().setCount(_PropertyDatabase, checkedCast<uint16>(ringCatalyserCount) ); CBankAccessor_PLR::getCHARACTER_INFO().getRING_XP_CATALYSER().setCount(_PropertyDatabase, checkedCast<uint16>(ringCatalyserCount) );
} }
} }
}
if (!p->isTrialPlayer()) if (!p->isTrialPlayer())
{ {
xpBonus = XpGain; xpBonus = XpGain;
} }
}
XpGain += xpBonus + ringXpBonus; XpGain += xpBonus + ringXpBonus;
@ -7081,7 +7085,7 @@ double CCharacter::addXpToSkillInternal( double XpGain, const std::string& ContS
SM_STATIC_PARAMS_3(paramsP, STRING_MANAGER::skill, STRING_MANAGER::integer, STRING_MANAGER::integer); SM_STATIC_PARAMS_3(paramsP, STRING_MANAGER::skill, STRING_MANAGER::integer, STRING_MANAGER::integer);
paramsP[0].Enum = skillEnum; paramsP[0].Enum = skillEnum;
paramsP[1].Int = max((sint32)1, sint32(100*XpGain) ); paramsP[1].Int = max((sint32)1, sint32(100*XpGain) );
paramsP[2].Int = max((sint32)1, sint32(100*(XpGain - (xpBonus+ringXpBonus))) ); paramsP[2].Int = max((sint32)1, sint32(100*(XpGain - xpBonus - ringXpBonus)));
PHRASE_UTILITIES::sendDynamicSystemMessage(_EntityRowId, "XP_CATALYSER_PROGRESS_NORMAL_GAIN", paramsP); PHRASE_UTILITIES::sendDynamicSystemMessage(_EntityRowId, "XP_CATALYSER_PROGRESS_NORMAL_GAIN", paramsP);
if( xpBonus > 0 ) if( xpBonus > 0 )
@ -7329,11 +7333,18 @@ double CCharacter::addXpToSkillInternal( double XpGain, const std::string& ContS
return XpGainRemainder; return XpGainRemainder;
} }
//----------------------------------------------- //-----------------------------------------------
// CCharacter::setSkillTreeToMaxValue Set skill tree of character to max value of each skill // CCharacter::setSkillTreeToMaxValue Set skill tree of character to max value of each skill
//----------------------------------------------- //-----------------------------------------------
void CCharacter::setSkillsToMaxValue() void CCharacter::setSkillsToMaxValue()
{
setSkillsToValue(-1);
}
//-----------------------------------------------
// CCharacter::setSkillTreeToMaxValue Set skill tree of character to max value of each skill
//-----------------------------------------------
void CCharacter::setSkillsToValue(const sint32& value)
{ {
// get pointer on static skills tree definition // get pointer on static skills tree definition
CSheetId sheet("skills.skill_tree"); CSheetId sheet("skills.skill_tree");
@ -7342,15 +7353,30 @@ void CCharacter::setSkillsToMaxValue()
for( uint i = 0; i < SKILLS::NUM_SKILLS; ++i ) for( uint i = 0; i < SKILLS::NUM_SKILLS; ++i )
{ {
_Skills._Skills[ i ].Base = SkillsTree->SkillsTree[ i ].MaxSkillValue; _Skills._Skills[ i ].Base = (value < 0) ? SkillsTree->SkillsTree[ i ].MaxSkillValue : min( value, (sint32)SkillsTree->SkillsTree[ i ].MaxSkillValue );
_Skills._Skills[ i ].Current = SkillsTree->SkillsTree[ i ].MaxSkillValue + _Skills._Skills[ i ].Modifier; _Skills._Skills[ i ].Current = SkillsTree->SkillsTree[ i ].MaxSkillValue + _Skills._Skills[ i ].Modifier;
// _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SKILLS.Skill[i], _Skills._Skills[ i ].Current ); _Skills._Skills[ i ].MaxLvlReached = _Skills._Skills[ i ].Current;
CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setSKILL(_PropertyDatabase, checkedCast<uint16>(_Skills._Skills[ i ].Current) );
// _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SKILLS.BaseSkill[i], _Skills._Skills[ i ].Base );
CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setBaseSKILL(_PropertyDatabase, checkedCast<uint16>(_Skills._Skills[ i ].Base) ); CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setBaseSKILL(_PropertyDatabase, checkedCast<uint16>(_Skills._Skills[ i ].Base) );
CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setSKILL(_PropertyDatabase, checkedCast<uint16>(_Skills._Skills[ i ].Current) );
// update all parent skill with new max children
SKILLS::ESkills skillUpdated = (SKILLS::ESkills)i;
while( SkillsTree->SkillsTree[ skillUpdated ].ParentSkill != SKILLS::unknown )
{
if( _Skills._Skills[ i ].Base > _Skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxLvlReached )
{
_Skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxLvlReached = _Skills._Skills[ i ].Base;
_Skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].Base = min( _Skills._Skills[ skillUpdated ].Base, (sint32)SkillsTree->SkillsTree[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxSkillValue );
skillUpdated = SkillsTree->SkillsTree[ skillUpdated ].ParentSkill;
}
else
{
break;
}
}
} }
} }
//----------------------------------------------- //-----------------------------------------------
// CCharacter::sendDynamicSystemMessage // CCharacter::sendDynamicSystemMessage
@ -7475,7 +7501,6 @@ void CCharacter::sendUserChar( uint32 userId, uint8 scenarioSeason, const R2::TU
} }
} }
//----------------------------------------------- //-----------------------------------------------
// Return the home mainland session id for a character // Return the home mainland session id for a character
TSessionId CCharacter::getHomeMainlandSessionId() const TSessionId CCharacter::getHomeMainlandSessionId() const
@ -7949,6 +7974,7 @@ void CCharacter::setStartStatistics( const CCreateCharMsg& createCharMsg )
_Race = (EGSPD::CPeople::TPeople) createCharMsg.People; _Race = (EGSPD::CPeople::TPeople) createCharMsg.People;
_Gender = createCharMsg.Sex; _Gender = createCharMsg.Sex;
_Title = CHARACTER_TITLE::Refugee; _Title = CHARACTER_TITLE::Refugee;
_NewTitle = "Refugee";
// fame information // fame information
// Players start out as Neutral in their declared clans // Players start out as Neutral in their declared clans
@ -9787,7 +9813,7 @@ bool CCharacter::queryItemPrice( const CGameItemPtr item, uint32& price )
quality = theItem->quality(); quality = theItem->quality();
if ( theItem->maxDurability() ) if ( theItem->maxDurability() )
wornFactor = float(theItem->durability()) / float(theItem->maxDurability()); wornFactor = float(theItem->durability()) / float(theItem->maxDurability());
price = (uint32) ( CShopTypeManager::computeBasePrice( theItem, quality ) * wornFactor ); price = (uint32) ( CShopTypeManager::computeBasePrice( theItem, quality ) * wornFactor * 0.02 );
return true; return true;
} }
@ -10214,6 +10240,35 @@ void CCharacter::initPvpPointDb()
CBankAccessor_PLR::getUSER().getRRPS_LEVELS(0).setVALUE(_PropertyDatabase, _PvpPoint ); CBankAccessor_PLR::getUSER().getRRPS_LEVELS(0).setVALUE(_PropertyDatabase, _PvpPoint );
} }
//-----------------------------------------------------------------------------
void CCharacter::setLangChannel(const string &lang) {
_LangChannel = lang;
}
//-----------------------------------------------------------------------------
void CCharacter::setNewTitle(const string &title) {
_NewTitle = title;
}
//-----------------------------------------------------------------------------
void CCharacter::setTagPvPA(const string &tag) {
_TagPvPA = tag;
}
//-----------------------------------------------------------------------------
void CCharacter::setTagPvPB(const string &tag) {
_TagPvPB = tag;
}
//-----------------------------------------------------------------------------
void CCharacter::setTagA(const string &tag) {
_TagA = tag;
}
//-----------------------------------------------------------------------------
void CCharacter::setTagB(const string &tag) {
_TagB = tag;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CCharacter::setOrganization(uint32 org) void CCharacter::setOrganization(uint32 org)
@ -12895,7 +12950,7 @@ void CCharacter::registerName(const ucstring &newName)
CMessage msgName("CHARACTER_NAME_LANG"); CMessage msgName("CHARACTER_NAME_LANG");
msgName.serial(_EntityRowId); msgName.serial(_EntityRowId);
string sTitle = CHARACTER_TITLE::toString(_Title); string sTitle = getFullTitle();
ucstring RegisteredName; ucstring RegisteredName;
if (newName.empty()) if (newName.empty())
RegisteredName = getName() + string("$") + sTitle + string("$"); RegisteredName = getName() + string("$") + sTitle + string("$");
@ -16162,13 +16217,28 @@ void CCharacter::applyGooDamage( float gooDistance )
if( hpLost > _PhysScores._PhysicalScores[ SCORES::hit_points ].Current ) if( hpLost > _PhysScores._PhysicalScores[ SCORES::hit_points ].Current )
{ {
_PhysScores._PhysicalScores[ SCORES::hit_points ].Current = 0; _PhysScores._PhysicalScores[ SCORES::hit_points ].Current = 0;
// send message to player for inform is dead by goo
// send message to player for inform is dead by goo or other
if (_CurrentContinent == CONTINENT::FYROS)
sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_FIRE");
else if (_CurrentContinent == CONTINENT::TRYKER)
sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_STEAM");
else if (_CurrentContinent == CONTINENT::MATIS)
sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_POISON");
else
sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_GOO"); sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_GOO");
} }
else else
{ {
_PhysScores._PhysicalScores[ SCORES::hit_points ].Current = _PhysScores._PhysicalScores[ SCORES::hit_points ].Current - hpLost; _PhysScores._PhysicalScores[ SCORES::hit_points ].Current = _PhysScores._PhysicalScores[ SCORES::hit_points ].Current - hpLost;
// send message to player for inform is suffer goo damage // send message to player for inform is suffer goo damage
if (_CurrentContinent == CONTINENT::FYROS)
sendDynamicSystemMessage(_EntityRowId, "SUFFER_FIRE_DAMAGE");
else if (_CurrentContinent == CONTINENT::TRYKER)
sendDynamicSystemMessage(_EntityRowId, "SUFFER_STEAM_DAMAGE");
else if (_CurrentContinent == CONTINENT::MATIS)
sendDynamicSystemMessage(_EntityRowId, "SUFFER_POISON_DAMAGE");
else
sendDynamicSystemMessage(_EntityRowId, "SUFFER_GOO_DAMAGE"); sendDynamicSystemMessage(_EntityRowId, "SUFFER_GOO_DAMAGE");
} }
} }
@ -19057,7 +19127,7 @@ void CCharacter::setStartupInstance(uint32 instanceId)
void CCharacter::setTitle( CHARACTER_TITLE::ECharacterTitle title ) void CCharacter::setTitle( CHARACTER_TITLE::ECharacterTitle title )
{ {
_Title = title; setNewTitle(CHARACTER_TITLE::toString(title));
} }

@ -890,6 +890,9 @@ public:
// Set skill tree of character to max value of each skill // Set skill tree of character to max value of each skill
void setSkillsToMaxValue(); void setSkillsToMaxValue();
// Set skill tree of character to specified value
void setSkillsToValue(const sint32& value);
// for respawn management, need to modify _TimeDeath in cbTpAcknownledge callback // for respawn management, need to modify _TimeDeath in cbTpAcknownledge callback
NLMISC::TGameTime& getTimeOfDeath(); NLMISC::TGameTime& getTimeOfDeath();
void setTimeOfDeath( NLMISC::TGameTime t); void setTimeOfDeath( NLMISC::TGameTime t);
@ -2392,6 +2395,27 @@ public:
uint32 getLastConnectedTime() const; uint32 getLastConnectedTime() const;
uint32 getLastConnectedDate() const; uint32 getLastConnectedDate() const;
uint32 getPlayedTime() const; uint32 getPlayedTime() const;
const std::string& getLangChannel() const;
void setLangChannel(const std::string &lang);
const std::string& getNewTitle() const;
void setNewTitle(const std::string &title);
std::string getFullTitle() const;
std::string getTagA() const;
void setTagA(const std::string &tag);
std::string getTagB() const;
void setTagB(const std::string &tag);
std::string getTagPvPA() const;
void setTagPvPA(const std::string &tag);
std::string getTagPvPB() const;
void setTagPvPB(const std::string &tag);
uint32 getOrganization() const; uint32 getOrganization() const;
uint32 getOrganizationStatus() const; uint32 getOrganizationStatus() const;
const std::list<TCharacterLogTime>& getLastLogStats() const; const std::list<TCharacterLogTime>& getLastLogStats() const;
@ -3032,6 +3056,14 @@ private:
uint32 _OrganizationStatus; uint32 _OrganizationStatus;
uint32 _OrganizationPoints; uint32 _OrganizationPoints;
std::string _LangChannel;
std::string _NewTitle;
std::string _TagPvPA;
std::string _TagPvPB;
std::string _TagA;
std::string _TagB;
/// SDB path where player wins HoF points in PvP (if not empty) /// SDB path where player wins HoF points in PvP (if not empty)
std::string _SDBPvPPath; std::string _SDBPvPPath;

@ -894,6 +894,67 @@ inline uint32 CCharacter::getPlayedTime() const
return _PlayedTime; return _PlayedTime;
} }
//------------------------------------------------------------------------------
inline const std::string& CCharacter::getLangChannel() const
{
return _LangChannel;
}
//------------------------------------------------------------------------------
inline const std::string& CCharacter::getNewTitle() const
{
return _NewTitle;
}
//------------------------------------------------------------------------------
inline std::string CCharacter::getTagA() const
{
if (_TagA.empty())
return "_";
return _TagA;
}
//------------------------------------------------------------------------------
inline std::string CCharacter::getTagB() const
{
if (_TagB.empty())
return "_";
return _TagB;
}
//------------------------------------------------------------------------------
inline std::string CCharacter::getTagPvPA() const
{
if (_TagPvPA.empty())
return "_";
return _TagPvPA;
}
//------------------------------------------------------------------------------
inline std::string CCharacter::getTagPvPB() const
{
if (_TagPvPB.empty())
return "_";
return _TagPvPB;
}
//------------------------------------------------------------------------------
inline std::string CCharacter::getFullTitle() const
{
if (!_TagA.empty() || !_TagB.empty() || !_TagPvPA.empty() || !_TagPvPB.empty())
return _NewTitle+"#"+getTagPvPA()+"#"+getTagPvPB()+"#"+getTagA()+"#"+getTagB();
else
return _NewTitle;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
inline uint32 CCharacter::getOrganization() const inline uint32 CCharacter::getOrganization() const

@ -321,7 +321,7 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons
H_AUTO(CCharacterStore);\ H_AUTO(CCharacterStore);\
CFameManager::getInstance().savePlayerFame(_Id, const_cast<EGSPD::CFameContainerPD &>(*_Fames));\ CFameManager::getInstance().savePlayerFame(_Id, const_cast<EGSPD::CFameContainerPD &>(*_Fames));\
/* Update the current playing session duration */ \ /* Update the current playing session duration */ \
if (_LastLogStats.size() > 0) _LastLogStats.begin()->Duration = CTime::getSecondsSince1970() - _LastLogStats.begin()->LoginTime; \ if (!_LastLogStats.empty()) _LastLogStats.begin()->Duration = CTime::getSecondsSince1970() - _LastLogStats.begin()->LoginTime;\
else nlwarning("Cannot update play session duration, _LastLogStats is empty, new character?");\ else nlwarning("Cannot update play session duration, _LastLogStats is empty, new character?");\
\ \
/* Unless the top of the position stack is locked, */ \ /* Unless the top of the position stack is locked, */ \
@ -415,6 +415,7 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons
PVP_CLAN::TPVPClan k=PVP_CLAN::fromString(key); if ((k>=PVP_CLAN::BeginClans) && (k<=PVP_CLAN::EndClans)) _FactionPoint[k-PVP_CLAN::BeginClans]=val)\ PVP_CLAN::TPVPClan k=PVP_CLAN::fromString(key); if ((k>=PVP_CLAN::BeginClans) && (k<=PVP_CLAN::EndClans)) _FactionPoint[k-PVP_CLAN::BeginClans]=val)\
\ \
PROP(uint32,_PvpPoint)\ PROP(uint32,_PvpPoint)\
PROP2(_LangChannel,string,_LangChannel,_LangChannel=val)\
PROP(uint32,_Organization)\ PROP(uint32,_Organization)\
PROP(uint32,_OrganizationStatus)\ PROP(uint32,_OrganizationStatus)\
PROP(uint32,_OrganizationPoints)\ PROP(uint32,_OrganizationPoints)\
@ -438,6 +439,11 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons
PROP_GAME_CYCLE_COMP(_ForbidAuraUseStartDate)\ PROP_GAME_CYCLE_COMP(_ForbidAuraUseStartDate)\
PROP_GAME_CYCLE_COMP(_ForbidAuraUseEndDate)\ PROP_GAME_CYCLE_COMP(_ForbidAuraUseEndDate)\
PROP2(_Title, string, CHARACTER_TITLE::toString(getTitle()), setTitle(CHARACTER_TITLE::toCharacterTitle(val)))\ PROP2(_Title, string, CHARACTER_TITLE::toString(getTitle()), setTitle(CHARACTER_TITLE::toCharacterTitle(val)))\
PROP2(_NewTitle, string, _NewTitle, _NewTitle=val)\
PROP2(_TagPvPA, string, _TagPvPA, _TagPvPA=val)\
PROP2(_TagPvPB, string, _TagPvPB, _TagPvPB=val)\
PROP2(_TagA, string, _TagA, _TagA=val)\
PROP2(_TagB, string, _TagB, _TagB=val)\
\ \
/* Visual Properties */\ /* Visual Properties */\
PROP2(HairType, uint8, _VisualPropertyA().PropertySubData.HatModel, SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatModel,val))\ PROP2(HairType, uint8, _VisualPropertyA().PropertySubData.HatModel, SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatModel,val))\

@ -230,6 +230,22 @@ std::vector<TChanID> CPVPManager2::getCharacterChannels(CCharacter * user)
} }
} }
// Add lang channel
if (!user->getLangChannel().empty()) {
TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(user->getLangChannel());
if (it != _ExtraFactionChannel.end())
{
result.push_back((*it).second);
}
} else {
TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("en");
if (it != _ExtraFactionChannel.end())
{
result.push_back((*it).second);
}
}
/*
bool matis = CFameInterface::getInstance().getFameIndexed(user->getId(), 0) >= PVPFameRequired*6000; bool matis = CFameInterface::getInstance().getFameIndexed(user->getId(), 0) >= PVPFameRequired*6000;
bool fyros = CFameInterface::getInstance().getFameIndexed(user->getId(), 1) >= PVPFameRequired*6000; bool fyros = CFameInterface::getInstance().getFameIndexed(user->getId(), 1) >= PVPFameRequired*6000;
bool tryker = CFameInterface::getInstance().getFameIndexed(user->getId(), 2) >= PVPFameRequired*6000; bool tryker = CFameInterface::getInstance().getFameIndexed(user->getId(), 2) >= PVPFameRequired*6000;
@ -279,7 +295,7 @@ std::vector<TChanID> CPVPManager2::getCharacterChannels(CCharacter * user)
result.push_back((*it).second); result.push_back((*it).second);
} }
} }
// } */
return result; return result;
} }
@ -1088,10 +1104,19 @@ bool CPVPManager2::addFactionWar( PVP_CLAN::TPVPClan clan1, PVP_CLAN::TPVPClan c
void CPVPManager2::onIOSMirrorUp() void CPVPManager2::onIOSMirrorUp()
{ {
// create extra factions channels // create extra factions channels
/*
createExtraFactionChannel("hominists"); createExtraFactionChannel("hominists");
createExtraFactionChannel("urasies"); createExtraFactionChannel("urasies");
createExtraFactionChannel("marauders"); createExtraFactionChannel("marauders");
createExtraFactionChannel("agnos"); createExtraFactionChannel("agnos");
*/
// Community Channels
createExtraFactionChannel("en");
createExtraFactionChannel("fr");
createExtraFactionChannel("de");
createExtraFactionChannel("ru");
createExtraFactionChannel("es");
for (uint i = PVP_CLAN::BeginClans; i <= PVP_CLAN::EndClans; i++) for (uint i = PVP_CLAN::BeginClans; i <= PVP_CLAN::EndClans; i++)
{ {

@ -242,7 +242,7 @@ void CShopTypeManager::initShopBase()
CConfigFile::CVar& cvShopType = ShopConfigFile.getVar("ShopCategory"); CConfigFile::CVar& cvShopType = ShopConfigFile.getVar("ShopCategory");
for (uint i = 0; i < cvShopType.size(); ++i ) for (uint i = 0; i < cvShopType.size(); ++i )
{ {
if ( cvShopType.asString(i) != "" ) if ( !cvShopType.asString(i).empty() )
{ {
_CategoryName.push_back( cvShopType.asString( i ) ); _CategoryName.push_back( cvShopType.asString( i ) );
} }
@ -252,7 +252,7 @@ void CShopTypeManager::initShopBase()
CConfigFile::CVar& cvShopAlias = ShopConfigFile.getVar("ShopNameAliases"); CConfigFile::CVar& cvShopAlias = ShopConfigFile.getVar("ShopNameAliases");
for ( uint i = 0; i < cvShopAlias.size(); ++i ) for ( uint i = 0; i < cvShopAlias.size(); ++i )
{ {
if ( cvShopAlias.asString(i) != "" ) if ( !cvShopAlias.asString(i).empty() )
{ {
CVectorSString args; CVectorSString args;
explode(cvShopAlias.asString(i), string(":"), reinterpret_cast<vector<string> &>(args)); explode(cvShopAlias.asString(i), string(":"), reinterpret_cast<vector<string> &>(args));

@ -1508,7 +1508,7 @@ bool CZoneManager::getPlace( sint32 x, sint32 y, float& gooDistance, const CPlac
} }
for (uint k = 0; k < _Continents[i].getRegions()[j]->getPlaces().size(); k++ ) for (uint k = 0; k < _Continents[i].getRegions()[j]->getPlaces().size(); k++ )
{ {
if( _Continents[i].getRegions()[j]->getPlaces()[k]->isGooPath() == false ) if(!_Continents[i].getRegions()[j]->getPlaces()[k]->isGooActive())
{ {
if ( _Continents[i].getRegions()[j]->getPlaces()[k]->contains( vect ) ) if ( _Continents[i].getRegions()[j]->getPlaces()[k]->contains( vect ) )
{ {

@ -132,7 +132,7 @@ void CChatManager::onServiceDown(const std::string &serviceShortName)
*/ */
void CChatManager::resetChatLog() void CChatManager::resetChatLog()
{ {
std::string logPath = (LogChatDirectory.get() == "" ? Bsi.getLocalPath() : LogChatDirectory.get()); std::string logPath = (LogChatDirectory.get().empty() ? Bsi.getLocalPath() : LogChatDirectory.get());
_Displayer.setParam(CPath::standardizePath(logPath) + "chat.log"); _Displayer.setParam(CPath::standardizePath(logPath) + "chat.log");
} }

@ -47,7 +47,7 @@ public:
// TODO: check if good // TODO: check if good
static bool exists( const TDataSetRow& entityIndex ); static bool exists( const TDataSetRow& entityIndex );
static const NLMISC::CEntityId& getEntityId( const TDataSetRow& entityIndex ); static const NLMISC::CEntityId& getEntityId( const TDataSetRow& entityIndex );
static const uint16 getTeamId(const TDataSetRow& entityIndex); static uint16 getTeamId(const TDataSetRow& entityIndex);
static CAICoord x( const TDataSetRow& entityIndex ); static CAICoord x( const TDataSetRow& entityIndex );
static CAICoord y( const TDataSetRow& entityIndex ); static CAICoord y( const TDataSetRow& entityIndex );

@ -113,13 +113,13 @@ void LoadCraftParts()
data.readFromFile( "rm_item_parts.csv" ); data.readFromFile( "rm_item_parts.csv" );
while ( data != "" ) while ( !data.empty() )
{ {
ligne = data.splitTo( "\n", true ); ligne = data.splitTo( "\n", true );
// on recherche la ligne correspondant à notre craft part // on recherche la ligne correspondant à notre craft part
info = ligne.splitTo( ";", true ); info = ligne.splitTo( ";", true );
if ( info != "" ) if ( !info.empty() )
{ {
index = info.c_str()[0] - 'A'; index = info.c_str()[0] - 'A';
@ -179,13 +179,13 @@ void InitCreatureMP()
data.readFromFile( "creature_models.csv" ); data.readFromFile( "creature_models.csv" );
while ( data != "" ) while ( !data.empty() )
{ {
ligneN = data.splitTo( "\n", true ); ligneN = data.splitTo( "\n", true );
ligneM = data.splitTo( "\n", true ); ligneM = data.splitTo( "\n", true );
// on vérifie que la ligne est valide // on vérifie que la ligne est valide
if ( ligneN.splitTo( ";", true ) != "" ) if ( !ligneN.splitTo( ";", true ).empty() )
{ {
ligneM.splitTo( ";", true ); ligneM.splitTo( ";", true );
@ -195,7 +195,7 @@ void InitCreatureMP()
ligneN.splitTo( ";", true ); ligneN.splitTo( ";", true );
ligneM.splitTo( ";", true ); ligneM.splitTo( ";", true );
while ( ligneN != "" ) while ( !ligneN.empty() )
{ {
ListeCreatureMP listeCreatureMP; ListeCreatureMP listeCreatureMP;
@ -426,7 +426,7 @@ int GetNumeroMP( const CSString& nomMP )
result = FamilyTypContent.splitFrom( buffer ); result = FamilyTypContent.splitFrom( buffer );
// si oui, on retourne son numéro de MP // si oui, on retourne son numéro de MP
if ( result != "" ) if ( !result.empty() )
res = result.splitTo( "\"" ).atoi(); res = result.splitTo( "\"" ).atoi();
else else
{ {
@ -478,7 +478,7 @@ int GetNumeroGroupe( const CSString& groupe )
result = GroupTypContent.splitFrom( buffer ); result = GroupTypContent.splitFrom( buffer );
// si oui, on retourne son numéro de groupe // si oui, on retourne son numéro de groupe
if ( result != "" ) if ( !result.empty() )
res = result.splitTo( "\"" ).atoi(); res = result.splitTo( "\"" ).atoi();
else else
{ {
@ -557,14 +557,14 @@ void CreateParentSItem( int numMP,
// 3d // 3d
output += " <STRUCT Name=\"3d\">\n"; output += " <STRUCT Name=\"3d\">\n";
if ( icon != "" ) if ( !icon.empty() )
{ {
output += " <ATOM Name=\"icon\" Value=\""; output += " <ATOM Name=\"icon\" Value=\"";
output += icon; output += icon;
output += "\"/>\n"; output += "\"/>\n";
} }
if ( overlay != "" ) if ( !overlay.empty() )
{ {
output += " <ATOM Name=\"text overlay\" Value=\""; output += " <ATOM Name=\"text overlay\" Value=\"";
output += overlay; output += overlay;
@ -787,13 +787,13 @@ void CreateSheet( int numMP, const CSString& nomMP,
break; break;
} }
if ( ( eco == 'c' ) && creature && ( craftStats.Craft == "" ) ) if ( ( eco == 'c' ) && creature && ( craftStats.Craft.empty() ) )
return; return;
outputFileName = toString( "m%04d%s%c%c%02d.sitem", numMP, code.c_str(), eco, outputFileName = toString( "m%04d%s%c%c%02d.sitem", numMP, code.c_str(), eco,
'a' + level, variation ); 'a' + level, variation );
if ( craftStats.Craft == "" ) if ( craftStats.Craft.empty() )
{ {
CSString levelZone = toString( "%c", 'a' + level ); CSString levelZone = toString( "%c", 'a' + level );
currentDocItem.push( DtLevelZone, levelZone.toUpper() ); currentDocItem.push( DtLevelZone, levelZone.toUpper() );
@ -825,7 +825,7 @@ void CreateSheet( int numMP, const CSString& nomMP,
output += " <ATOM Name=\"MpColor\" Value=\""; output += " <ATOM Name=\"MpColor\" Value=\"";
// materiaux de missions toujours Beige // materiaux de missions toujours Beige
if ( craftStats.Craft == "" ) if ( craftStats.Craft.empty() )
{ {
output += "Beige\"/>\n"; output += "Beige\"/>\n";
if(craftStats.UsedAsCraftRequirement) if(craftStats.UsedAsCraftRequirement)
@ -894,7 +894,7 @@ void CreateSheet( int numMP, const CSString& nomMP,
CSString statEnergy; CSString statEnergy;
if ( ( variation == 2 ) && ( numMP == 695 ) ) // cas particulier pour le kitin trophy (beurk) if ( ( variation == 2 ) && ( numMP == 695 ) ) // cas particulier pour le kitin trophy (beurk)
statEnergy = "0"; statEnergy = "0";
else if ( !creature || ( craftStats.Craft == "" ) ) else if ( !creature || ( craftStats.Craft.empty() ) )
statEnergy = toString( "%d", GetStatEnergy( level ) ); statEnergy = toString( "%d", GetStatEnergy( level ) );
else if ( variation < 2 ) else if ( variation < 2 )
statEnergy = toString( "%d", GetStatEnergy( level + 1 ) ); statEnergy = toString( "%d", GetStatEnergy( level + 1 ) );
@ -912,7 +912,7 @@ void CreateSheet( int numMP, const CSString& nomMP,
outputFileName = toString( "m%04d%s%c%c%02d", numMP, code.c_str(), eco, 'a' + level, variation ); outputFileName = toString( "m%04d%s%c%c%02d", numMP, code.c_str(), eco, 'a' + level, variation );
output = outputFileName; output = outputFileName;
GenerateItemNames( nomMP, eco, level, ( craftStats.Craft == "" ), creature, itemName ); GenerateItemNames( nomMP, eco, level, ( craftStats.Craft.empty() ), creature, itemName );
output += "\t" + itemName; output += "\t" + itemName;
itemNames.insert( output ); itemNames.insert( output );
} }
@ -947,7 +947,7 @@ void GenerateDepositItems( int numMP, const CSString& nomMP, const MPCraftStats&
code = "cxx"; code = "cxx";
// pas de craft = items de mission // pas de craft = items de mission
if ( craftStats.Craft == "" ) if ( craftStats.Craft.empty() )
{ {
if ( loc != "G" ) if ( loc != "G" )
CreateSheet( numMP, nomMP, code, 'c', 0, craftStats ); CreateSheet( numMP, nomMP, code, 'c', 0, craftStats );
@ -1000,7 +1000,7 @@ void GenerateCreatureItems( int numMP, CSString& nomMP, const MPCraftStats& craf
CSString creatureFileName = "c"; CSString creatureFileName = "c";
creatureFileName += (*itMP)->codeCreature.toLower(); creatureFileName += (*itMP)->codeCreature.toLower();
if ( craftStats.Craft != "" ) if ( !craftStats.Craft.empty() )
{ {
quality = statQuality[creatureLevel-1]; quality = statQuality[creatureLevel-1];
if ( quality != 6 ) if ( quality != 6 )
@ -1107,7 +1107,7 @@ void NewMP( CSString& ligne )
// nouveau nom de famille // nouveau nom de famille
nomMP = ligne.splitTo( ";", true ); nomMP = ligne.splitTo( ";", true );
if ( nomMP == "" ) if ( nomMP.empty() )
{ {
// cette ligne ne contient pas d'info // cette ligne ne contient pas d'info
return; return;
@ -1126,37 +1126,37 @@ void NewMP( CSString& ligne )
ligne.splitTo( ";", true ); ligne.splitTo( ";", true );
stat = ligne.splitTo( ";", true ); stat = ligne.splitTo( ";", true );
if ( stat.firstWord() != "" ) if ( !stat.firstWord().empty() )
craftStats.bestStatA = stat.atoi(); craftStats.bestStatA = stat.atoi();
else else
craftStats.bestStatA = -1; craftStats.bestStatA = -1;
stat = ligne.splitTo( ";", true ); stat = ligne.splitTo( ";", true );
if ( stat.firstWord() != "" ) if ( !stat.firstWord().empty() )
craftStats.worstStatA1 = stat.atoi(); craftStats.worstStatA1 = stat.atoi();
else else
craftStats.worstStatA1 = -1; craftStats.worstStatA1 = -1;
stat = ligne.splitTo( ";", true ); stat = ligne.splitTo( ";", true );
if ( stat.firstWord() != "" ) if ( !stat.firstWord().empty() )
craftStats.worstStatA2 = stat.atoi(); craftStats.worstStatA2 = stat.atoi();
else else
craftStats.worstStatA2 = -1; craftStats.worstStatA2 = -1;
stat = ligne.splitTo( ";", true ); stat = ligne.splitTo( ";", true );
if ( stat.firstWord() != "" ) if ( !stat.firstWord().empty() )
craftStats.bestStatB = stat.atoi(); craftStats.bestStatB = stat.atoi();
else else
craftStats.bestStatB = -1; craftStats.bestStatB = -1;
stat = ligne.splitTo( ";", true ); stat = ligne.splitTo( ";", true );
if ( stat.firstWord() != "" ) if ( !stat.firstWord().empty() )
craftStats.worstStatB1 = stat.atoi(); craftStats.worstStatB1 = stat.atoi();
else else
craftStats.worstStatB1 = -1; craftStats.worstStatB1 = -1;
stat = ligne.splitTo( ";", true ); stat = ligne.splitTo( ";", true );
if ( stat.firstWord() != "" ) if ( !stat.firstWord().empty() )
craftStats.worstStatB2 = stat.atoi(); craftStats.worstStatB2 = stat.atoi();
else else
craftStats.worstStatB2 = -1; craftStats.worstStatB2 = -1;
@ -1168,19 +1168,19 @@ void NewMP( CSString& ligne )
specialOnly = stat.firstWord().contains( "x" ); specialOnly = stat.firstWord().contains( "x" );
// cas particuliers // cas particuliers
while ( ligne != "" ) while ( !ligne.empty() )
{ {
if ( !ligne.contains( ";" ) ) if ( !ligne.contains( ";" ) )
{ {
special = ligne; special = ligne;
if ( special.firstWord() != "" ) if ( !special.firstWord().empty() )
specialNames.insert( special ); specialNames.insert( special );
ligne = ""; ligne = "";
} }
else else
{ {
special = ligne.splitTo( ";", true ); special = ligne.splitTo( ";", true );
if ( special != "" ) if ( !special.empty() )
specialNames.insert( special ); specialNames.insert( special );
} }
} }
@ -1357,7 +1357,7 @@ void LoadCustomizedProperties()
fileName = CPath::lookup( name, false, false, true ); fileName = CPath::lookup( name, false, false, true );
// on vérifie que le fichier concerné existe // on vérifie que le fichier concerné existe
if ( fileName != "" ) if ( !fileName.empty() )
{ {
CSString zone = prop.splitTo( ".", true ); CSString zone = prop.splitTo( ".", true );
str.readFromFile( fileName ); str.readFromFile( fileName );
@ -1530,7 +1530,7 @@ void LoadFamillesMP()
ligne = fileData.splitTo( "\n", true ); ligne = fileData.splitTo( "\n", true );
while ( ligne != "" ) while ( !ligne.empty() )
{ {
NewMP( ligne ); NewMP( ligne );
ligne = fileData.splitTo( "\n", true ); ligne = fileData.splitTo( "\n", true );

@ -67,7 +67,7 @@ int verifItemsFile (const char *filename)
string s(buffer); string s(buffer);
// null or comment // null or comment
if (s == "" || s.find("//") == 0) if (s.empty() || s.find("//") == 0)
continue; continue;
if (s.find("_LocSlot") == string::npos) if (s.find("_LocSlot") == string::npos)
@ -113,7 +113,7 @@ int verifCsvFile (const char *filename)
void processItemLine(const string &s) void processItemLine(const string &s)
{ {
// null or comment // null or comment
if (s == "" || s.find("//") == 0) if (s.empty() || s.find("//") == 0)
return; return;
// other stuff // other stuff
@ -176,7 +176,7 @@ int getFieldsFromFile(const char *filename)
s = s.strtok("\n"); s = s.strtok("\n");
// skip null or comment // skip null or comment
if (s == "" || s.find("//") == 0) if (s.empty() || s.find("//") == 0)
continue; continue;
// add the field // add the field
@ -294,7 +294,7 @@ void getItemBounds(const CVectorSString &lines, uint num, uint &a, uint &b)
while (++i < lines.size() && !ok) while (++i < lines.size() && !ok)
{ {
if (lines[i] == "" || lines[i].find("//") != string::npos) if (lines[i].empty() || lines[i].find("//") != string::npos)
continue; continue;
// get item number // get item number
@ -404,7 +404,7 @@ void updateItemField(CVectorSString &lines, uint itemIndex, uint fieldIndex, uin
} }
// param not found // param not found
if (!found && val != "" && val != "nul") if (!found && !val.empty() && val != "nul")
{ {
// add it // add it
if (field.find("_CraftParameters") == string::npos) if (field.find("_CraftParameters") == string::npos)
@ -552,7 +552,7 @@ int main(int argc, char *argv[])
// load csv values // load csv values
importCsv(csvFile.c_str()); importCsv(csvFile.c_str());
if (itemsFile != "" && CFile::isExists(itemsFile.c_str())) if (!itemsFile.empty() && CFile::isExists(itemsFile.c_str()))
updateItems(itemsFile.c_str()); updateItems(itemsFile.c_str());
else else
nlerror("Can't find file : %s", itemsFile.c_str()); nlerror("Can't find file : %s", itemsFile.c_str());

@ -216,7 +216,7 @@ void CDialogProperties::removeWidgets ()
else if (widget.Parameter.Type == CPrimitiveClass::CParameter::StringArray) else if (widget.Parameter.Type == CPrimitiveClass::CParameter::StringArray)
{ {
widget.MultiLineEditBox.DestroyWindow (); widget.MultiLineEditBox.DestroyWindow ();
if (widget.Parameter.Folder != "" || !widget.Parameter.FileExtension.empty()) if (!widget.Parameter.Folder.empty() || !widget.Parameter.FileExtension.empty())
{ {
widget.CheckBox.DestroyWindow (); widget.CheckBox.DestroyWindow ();
} }

Loading…
Cancel
Save