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_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
# on Mac OS X libxml2 requieres iconv
# on Mac OS X libxml2 requires iconv and liblzma
IF(APPLE)
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})
ENDIF(APPLE)
ENDIF(WITH_STATIC)

@ -34,18 +34,18 @@ ENDIF(MSVC)
MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
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)
GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE)
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(NOT MSVC)
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES )
FOREACH(item ${DIRINC})
LIST(APPEND ${_out_compile_flags} " ${_PCH_include_prefix}\"${item}\"")
LIST(APPEND _FLAGS " ${_PCH_include_prefix}\"${item}\"")
ENDFOREACH(item)
# 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_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
LIST(APPEND ${_out_compile_flags} ${GLOBAL_DEFINITIONS})
LIST(APPEND ${_out_compile_flags} ${_directory_flags})
LIST(APPEND ${_out_compile_flags} ${_directory_definitions})
LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS})
LIST(APPEND _FLAGS ${GLOBAL_DEFINITIONS})
LIST(APPEND _FLAGS ${_directory_flags})
LIST(APPEND _FLAGS ${_directory_definitions})
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
# 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)
MACRO(_PCH_GET_PDB_FILENAME out_filename _target)

@ -13,11 +13,7 @@ ENDIF(NOT CMAKE_BUILD_TYPE)
MACRO(NL_GEN_PC name)
IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}")
IF(CMAKE_LIBRARY_ARCHITECTURE)
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)
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION ${NL_LIB_PREFIX}/pkgconfig)
ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
ENDMACRO(NL_GEN_PC)
@ -250,16 +246,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
###
# 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)
ENDIF(DEB_HOST_GNU_CPU)
OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" OFF)
IF(WIN32)
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 )
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)
#-----------------------------------------------------------------------------
@ -372,9 +364,6 @@ MACRO(NL_SETUP_BUILD)
ENDIF(HOST_CPU MATCHES "amd64")
# 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 TARGET_CPU)
@ -387,9 +376,6 @@ MACRO(NL_SETUP_BUILD)
SET(TARGET_CPU "x86")
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")
SET(CLANG ON)
MESSAGE(STATUS "Using Clang compiler")
@ -427,79 +413,120 @@ MACRO(NL_SETUP_BUILD)
ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
# 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}")
# Remove -g and -O flag because we are managing them ourself
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_CXXFLAGS ${PLATFORM_CXXFLAGS})
# Strip spaces
STRING(STRIP ${PLATFORM_CFLAGS} PLATFORM_CFLAGS)
STRING(STRIP ${PLATFORM_CXXFLAGS} PLATFORM_CXXFLAGS)
STRING(STRIP ${PLATFORM_LINKFLAGS} PLATFORM_LINKFLAGS)
IF(TARGET_CPU STREQUAL "x86_64")
SET(TARGET_X64 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86_64")
ELSEIF(TARGET_CPU STREQUAL "x86")
SET(TARGET_X86 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86")
ELSEIF(TARGET_CPU STREQUAL "arm")
SET(TARGET_ARM 1)
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_ARM")
ENDIF(TARGET_CPU STREQUAL "x86_64")
IF(NOT CMAKE_OSX_ARCHITECTURES)
IF(TARGET_CPU STREQUAL "x86_64")
SET(TARGET_X64 1)
ELSEIF(TARGET_CPU STREQUAL "x86")
SET(TARGET_X86 1)
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")
SET(TARGET_ARM 1)
ENDIF(TARGET_CPU STREQUAL "x86_64")
ENDIF(NOT CMAKE_OSX_ARCHITECTURES)
# Fix library paths suffixes for Debian MultiArch
SET(DEBIAN_MULTIARCH $ENV{DEB_HOST_MULTIARCH})
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(LIBRARY_ARCHITECTURE)
SET(CMAKE_LIBRARY_PATH /lib/${LIBRARY_ARCHITECTURE} /usr/lib/${LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH})
IF(TARGET_X64)
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64)
ENDIF(TARGET_X64)
IF(TARGET_X86)
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32)
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(MSVC10)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /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
SET(MIN_OPTIMIZATIONS "/Od /Ob1")
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC90)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# 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
SET(MIN_OPTIMIZATIONS "/Ob1")
SET(DEBUG_CFLAGS "/Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC80)
ADD_PLATFORM_FLAGS("/Gy- /Wp64")
# 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
SET(MIN_OPTIMIZATIONS "/Od /Ob1")
SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}")
ELSE(MSVC10)
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
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)
# 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
SET(MIN_OPTIMIZATIONS "${MIN_OPTIMIZATIONS} /bigobj")
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} /bigobj")
ELSE(TARGET_X64)
# Allows 32 bits applications to use 3 GB of RAM
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE")
ENDIF(TARGET_X64)
# Exceptions are only set for C++
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa")
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /EHa")
IF(WITH_SYMBOLS)
SET(NL_RELEASE_CFLAGS "/Zi ${NL_RELEASE_CFLAGS}")
@ -508,88 +535,204 @@ MACRO(NL_SETUP_BUILD)
SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}")
ENDIF(WITH_SYMBOLS)
SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS} ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${SPEED_OPTIMIZATIONS} ${NL_RELEASE_CFLAGS}")
SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_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_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)
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)
IF(APPLE)
IF(TARGET_CPU STREQUAL "x86")
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch i386")
ENDIF(TARGET_CPU STREQUAL "x86")
IF(TARGET_ARM)
ADD_PLATFORM_FLAGS("-mthumb")
ENDIF(TARGET_ARM)
IF(TARGET_CPU STREQUAL "x86_64")
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch x86_64")
ENDIF(TARGET_CPU STREQUAL "x86_64")
IF(APPLE)
IF(IOS)
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE PATH "" FORCE)
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(XCODE)
IF(IOS)
SET(CMAKE_OSX_SYSROOT "iphoneos" CACHE PATH "" FORCE)
ELSE(IOS)
# SET(CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE)
ENDIF(IOS)
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(TARGETS_COUNT EQUAL 1)
IF(TARGET_ARM)
IF(TARGET_ARMV7S)
ADD_PLATFORM_FLAGS("-arch armv7s")
ENDIF(TARGET_ARMV7S)
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-arch armv7")
ENDIF(TARGET_ARMV7)
IF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-arch armv6")
ENDIF(TARGET_ARMV6)
IF(TARGET_ARMV5)
ADD_PLATFORM_FLAGS("-arch armv5")
ENDIF(TARGET_ARMV5)
ENDIF(TARGET_ARM)
IF(TARGET_X86)
ADD_PLATFORM_FLAGS("-arch i386")
ENDIF(TARGET_X86)
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-arch x86_64")
ENDIF(TARGET_X64)
ELSE(TARGETS_COUNT EQUAL 1)
IF(TARGET_ARMV6)
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})
IF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
SET(CMAKE_OSX_SYSROOT ${_SDK} CACHE PATH "" FORCE)
ENDIF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
ENDFOREACH(_SDK)
IF(CMAKE_OSX_SYSROOT)
ADD_PLATFORM_FLAGS("-isysroot ${CMAKE_OSX_SYSROOT}")
ELSE(CMAKE_OSX_SYSROOT)
MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated")
ENDIF(CMAKE_OSX_SYSROOT)
# Always force -mmacosx-version-min to override environement variable
ADD_PLATFORM_FLAGS("-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(IOS)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names")
IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-search_paths_first")
ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST)
ENDIF(XCODE)
ELSE(APPLE)
IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m32 -march=i686")
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")
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m64")
ADD_PLATFORM_FLAGS("-m64")
ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
ENDIF(APPLE)
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(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -ansi")
ENDIF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
ADD_PLATFORM_FLAGS("-D_REENTRANT -pipe -fno-strict-aliasing")
IF(WITH_COVERAGE)
SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}")
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)
SET(PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}")
ADD_PLATFORM_FLAGS("-gdwarf-2")
ENDIF(APPLE)
IF(APPLE AND XCODE)
# SET(CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE)
ELSEIF(APPLE AND NOT XCODE)
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6")
ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
FOREACH(_SDK ${_CMAKE_OSX_SDKS})
IF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
SET(CMAKE_OSX_SYSROOT ${_SDK} CACHE PATH "" FORCE)
ENDIF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk")
ENDFOREACH(_SDK)
IF(CMAKE_OSX_SYSROOT)
SET(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CFLAGS}")
ELSE(CMAKE_OSX_SYSROOT)
MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated")
ENDIF(CMAKE_OSX_SYSROOT)
IF(CMAKE_OSX_ARCHITECTURES)
FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES})
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch ${_ARCH}")
ENDFOREACH(_ARCH)
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")
IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
SET(PLATFORM_LINKFLAGS "-Wl,-search_paths_first ${PLATFORM_LINKFLAGS}")
ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST)
ENDIF(APPLE AND XCODE)
# Fix "relocation R_X86_64_32 against.." error on x64 platforms
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)
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} -ftemplate-depth-48")
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")
IF(NOT APPLE)
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.
IF(NOT NL_LIB_PREFIX)
IF(CMAKE_LIBRARY_ARCHITECTURE)
SET(NL_LIB_PREFIX "lib/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
ELSE(CMAKE_LIBRARY_ARCHITECTURE)
IF(LIBRARY_ARCHITECTURE)
SET(NL_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
ELSE(LIBRARY_ARCHITECTURE)
SET(NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
ENDIF(CMAKE_LIBRARY_ARCHITECTURE)
ENDIF(LIBRARY_ARCHITECTURE)
ENDIF(NOT NL_LIB_PREFIX)
NL_MAKE_ABSOLUTE_PREFIX(NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX)
@ -698,11 +841,11 @@ MACRO(NL_SETUP_PREFIX_PATHS)
IF(WIN32)
SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.")
ELSE(WIN32)
IF(CMAKE_LIBRARY_ARCHITECTURE)
SET(NL_DRIVER_PREFIX "lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.")
ELSE(CMAKE_LIBRARY_ARCHITECTURE)
IF(LIBRARY_ARCHITECTURE)
SET(NL_DRIVER_PREFIX "lib/${LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.")
ELSE(LIBRARY_ARCHITECTURE)
SET(NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers.")
ENDIF(CMAKE_LIBRARY_ARCHITECTURE)
ENDIF(LIBRARY_ARCHITECTURE)
ENDIF(WIN32)
ENDIF(NOT NL_DRIVER_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.
IF(NOT RYZOM_LIB_PREFIX)
IF(CMAKE_LIBRARY_ARCHITECTURE)
SET(RYZOM_LIB_PREFIX "lib/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
ELSE(CMAKE_LIBRARY_ARCHITECTURE)
IF(LIBRARY_ARCHITECTURE)
SET(RYZOM_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.")
ELSE(LIBRARY_ARCHITECTURE)
SET(RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
ENDIF(CMAKE_LIBRARY_ARCHITECTURE)
ENDIF(LIBRARY_ARCHITECTURE)
ENDIF(NOT RYZOM_LIB_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")
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE)
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)
MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!")
ENDIF(NOT VC_ROOT_DIR)

@ -297,8 +297,8 @@ public:
void swap(CBitmap &other);
/**
* Read a bitmap(TGA or DDS) from an IStream.
* Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and
* Read a bitmap(TGA, JPEG, PNG or DDS) from an IStream.
* Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5), PNG, JPEG and
* uncompressed TGA (24 and 32 bits).
* \param IStream The stream must be in reading mode.
* \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.
* 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).
* NB: at the end, f is seeked to begin.
* \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];
uint32 i, j;
if (filename == "")
if (filename.empty())
{
// No filename so init with default
for (i = 0; i < NbW; ++i)

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

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

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

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

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

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

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

@ -364,7 +364,7 @@ CString CSource_sounds_builderDlg::SoundName( HTREEITEM hitem )
{
CString s = m_Tree.GetItemText( hitem );
sint last;
if ( s != "" )
if ( !s.empty() )
{
if ( s[s.GetLength()-1] == '*' )
{
@ -425,13 +425,13 @@ void CSource_sounds_builderDlg::OnSave()
}
nameset.insert( (*ips)->getName() );
}
if ( duplicates != "" )
if ( !duplicates.empty() )
{
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() );
AfxMessageBox( s, MB_ICONWARNING );
}
if ( blanksounds != "" )
if ( !blanksounds.empty() )
{
CString s;
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 )
{
string sname = string(name);
if ( sname != "" ) // prevent from taking blank names
if ( !sname.empty() ) // prevent from taking blank names
{
AddSound( sname.c_str() );
}

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

@ -21,7 +21,7 @@
#include <CoreFoundation/CoreFoundation.h>
#endif
std::string getAppBundlePath()
std::string getAppBundlePath()
{
static std::string cachedPathToBundle;

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

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

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

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

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

@ -139,7 +139,7 @@ UInstanceGroup *getCluster(const UGlobalPosition &gp)
return 0;
const string &strPos = GR->getIdentifier(gp);
if(strPos == "")
if(strPos.empty())
return 0;
// try to find the ig in the loaded ig map
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 *table;
if (instanceId == "")
if (instanceId.empty())
{
table = getEditor().getDMC().newComponent("Position");
table->set("x", vector.x);

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

@ -470,7 +470,7 @@ protected:
/// display nodes
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());

@ -483,7 +483,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si
nlassert(index != -1);
instanceId = parent->getAttr("InstanceId")->toString();
attrName = parent->getKey(index);
if (attrName == "")
if (attrName.empty())
{
position = index;
}
@ -501,7 +501,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si
nlassert(index2 != -1);
sint32 index = parent->findIndex(this);
nlassert(index != -1);
if (parent2->getKey(index2) == "")
if (parent2->getKey(index2).empty())
{
nlassert(0); // TMP : want to see if may possibly happen
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)
{
//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());
if (canSet)
{
@ -1092,7 +1092,7 @@ void CObjectTable::doSerialize(std::string& out, CSerializeContext& context) co
if ( _Value[i].second->isString("Name")
&& _Value[i].second->isString("LocationId")
&& _Value[i].second->toString("Name") == "Permanent"
&& _Value[i].second->toString("LocationId") == "")
&& _Value[i].second->toString("LocationId").empty())
{
isDefault = true;
}
@ -1248,7 +1248,7 @@ bool CObjectTable::setObject(const std::string& key, CObject* value)
//H_AUTO(R2_CObjectTable_setObject)
CHECK_TABLE_INTEGRITY
value->setGhost(this->getGhost());
if (key == "")
if (key.empty())
{
clear();

@ -406,7 +406,7 @@ void CScenarioEntryPoints::loadFromXMLFile()
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);
else
completeIsland.Package = CSString(package);

@ -8,7 +8,7 @@
AESAliasName = "bms_master";
Paths = {
Paths += {
".",
"../common/data_leveldesign",
};
@ -25,7 +25,7 @@ WriteFilesDirectory = "data_shard";
WebPort = 49970;
// ---- service custom variables (used by CVariable class)
// ---- service custom variables (used by CVariable class)
// BS - Root directory where data are backuped to
IncrementalBackupDirectory = "../incremental_backup";

@ -1,22 +1,23 @@
#include "common.cfg"
// ---- service NeL variables (used by ConfigFile class)
// ---- service NeL variables (used by ConfigFile class)
DontUseNS = 1;
// ---- service NeL variables (used by CVariable class)
// ---- service NeL variables (used by CVariable class)
ListeningPort = 49990;
// ---- service custom variables (used by ConfigFile class)
// ---- service custom variables (used by ConfigFile class)
// Listening port for the Web server to connect in
WebPort = 49898;
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
L3ListeningPort = 49950;
@ -25,7 +26,7 @@ L3ListeningPort = 49950;
SaveTemplatePath = "$shard/characters/account_$userid_$charid$ext";
// character saves possible extension list
SaveExtList = "_pdr.bin _pdr.xml .bin";
SaveExtList = "_pdr.bin _pdr.xml .bin";
//BSFilePrefix = "R:/code/ryzom/r2_shard/";
//BSFileSubst = "r2_shard/";

@ -4,7 +4,7 @@
ShardId = 302;
// Used by CVariable in WS
PlayerLimit = 5000;
PlayerLimit = 5000;
// Used to connect to AES (this file) and to set up AES service (admin_executor_service.cfg)
AESPort="46702";
@ -96,4 +96,5 @@ WriteFilesDirectory = "data_shard";
// ---- 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
teamInvite // Send a team invite to a player character
connectUserChannel // Connect to User Channel Chat
connectLangChannel // Connect to Lang Channel Chat
webExecCommand // Execute web command (need HMAC signature)
webDelCommandsIds // Delete web transactions for web_app
webAddCommandsIds // Add web command transactions for web_app

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

@ -22,22 +22,22 @@ StartCommands +=
"lgs_gw.transportAdd L3Client masterL3c",
// open the transport
"lgs_gw.transportCmd masterL3c(connect addr="+MasterLGSHost+":"+L3MasterLGSPort+")",
};
};
#ifndef DONT_USE_LGS_SLAVE
StartCommands +=
{
// add a layer 3 server transport for slave logger service
"lgs_gw.transportAdd L3Client slaveL3c",
// open the transport
"lgs_gw.transportCmd slaveL3c(connect addr="+SlaveLGSHost+":"+L3SlaveLGSPort+")",
};
};
#endif
StartCommands +=
{
{
// Create a shard unifier client module
"moduleManager.createModule ShardUnifierClient suc",
// Create a client commands forwader module

@ -1,5 +1,5 @@
#include "common.cfg"
CheckPlayerSpeed = 0;
SecuritySpeedFactor = 1.5;

@ -1,6 +1,6 @@
#include "common.cfg"
// ---- service NeL variables (used by ConfigFile class)
// ---- service NeL variables (used by ConfigFile class)
StartCommands +=
{
@ -23,22 +23,22 @@ StartCommands +=
"lgs_gw.transportAdd L3Client masterL3c",
// open the transport
"lgs_gw.transportCmd masterL3c(connect addr="+MasterLGSHost+":"+L3MasterLGSPort+")",
};
};
#ifndef DONT_USE_LGS_SLAVE
StartCommands +=
{
{
// add a layer 3 server transport for slave logger service
"lgs_gw.transportAdd L3Client slaveL3c",
// open the transport
"lgs_gw.transportCmd slaveL3c(connect addr="+SlaveLGSHost+":"+L3SlaveLGSPort+")",
};
};
#endif
StartCommands +=
{
{
// Create a chat unifier client
"moduleManager.createModule ChatUnifierClient cuc",
@ -52,33 +52,34 @@ StartCommands +=
};
#endif
// ---- service NeL variables (used by CVariable class)
// ---- service custom variables (used by ConfigFile class)
// ---- service NeL variables (used by CVariable class)
// ---- service custom variables (used by ConfigFile class)
// a list of system command that can be run with "sysCmd" service command.
SystemCmd = {};
// IOS don't use work directory by default
ReadTranslationWork = 0;
TranslationWorkPath = "translation/work";
// Global shard bot name translation file. You sould overide this
// in input_output_service.cfg to specialize the file
// depending on the shard main language.
BotNameTranslationFile = "bot_names.txt";
// Global shard event faction translation file. You sould override this
// in input_output_service.cfg to specialize the file
// depending on the shard main language.
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
DebugReplacementParameter = 1;
// Default verbose debug flags:
//-----------------------------

@ -1,14 +1,15 @@
#include "common.cfg"
// ---- service NeL variables (used by ConfigFile class)
// ---- service NeL variables (used by ConfigFile class)
DontUseNS = 1;
// ---- service NeL variables (used by CVariable class)
// ---- service custom variables (used by ConfigFile class)
// ---- service custom variables (used by CVariable class)
// ---- service NeL variables (used by CVariable class)
// ---- service custom variables (used by ConfigFile class)
// ---- service custom variables (used by CVariable class)
WebRootDirectory = "save_shard/www";

@ -1,6 +1,6 @@
#include "common.cfg"
// ---- service custom variables (used by ConfigFile class)
// ---- service custom variables (used by ConfigFile class)
// Linux only
DestroyGhostSegments = 1;

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

@ -1,7 +1,7 @@
#include "common.cfg"
DontUseNS = 1;
StartCommands +=
{
// Create a gateway for global interconnection

@ -126,7 +126,7 @@ SystemCmd = {};
ReadTranslationWork = 0;
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
// 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;
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
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)
{
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));
}
}

@ -181,6 +181,7 @@ AdminCommandsInit[] =
"validateRespawnPoint", true,
"summonPet", true,
"connectUserChannel", true,
"connectLangChannel", true,
"updateTarget", true,
"resetName", true,
"showOnline", true,
@ -1126,6 +1127,8 @@ ENTITY_VARIABLE(Position, "Position of a player (in meter) <eid> <posx>,<posy>[,
vector<string> res;
sint32 x = 0, y = 0, z = 0;
sint32 cell = 0;
if (get)
{
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);
y = entityBase->getState().Y + sint32 (sin (entityBase->getState ().Heading) * 2000);
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
uint8 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
{
c->teleportCharacter(x,y,z,true);
c->teleportCharacter(x,y,z,true, false, 0.f, 0xFF, cell);
}
if ( cont )
@ -2960,7 +2967,7 @@ void audit(const CAdminCommand *cmd, const string &rawCommand, const CEntityId &
string host = varHost->asString();
string page = varPage->asString();
if (host == "" || page == "")
if (host.empty() || page.empty())
return;
char params[1024];
@ -3780,7 +3787,7 @@ NLMISC_COMMAND( monitorMissions, "monitor a player missions", "<CSR id><player n
CHECK_RIGHT( c,target );
// 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" );
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", "")
{
if ( args.size() != 1 )
return false;
GET_CHARACTER;
uint32 guildId = c->getGuildId();
CGuildManager::getInstance()->setGMGuild( guildId );
@ -4450,8 +4455,8 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
CPVPManager2 *inst = CPVPManager2::getInstance();
string pass;
string name = args[1];
TChanID channel = CPVPManager2::getInstance()->getUserDynChannel(name);
string name = toLower(args[1]);
TChanID channel = inst->getUserDynChannel(name);
if (args.size() < 3)
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>")
{
GET_CHARACTER
@ -4601,9 +4638,15 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
GET_CHARACTER
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 separator "|"
if (args.size() >= 6 && (args[5] == "2" || args[5] == "3"))
new_separator = true;
bool next_step = false;
if (args.size() >= 7 && args[6] == "1")
next_step = true;
@ -4680,7 +4723,10 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
}
std::vector<std::string> command_args;
NLMISC::splitString(command, "!", command_args);
if (new_separator)
NLMISC::splitString(command, "|", command_args);
else
NLMISC::splitString(command, "!", command_args);
if (command_args.empty())
return false;
@ -5317,8 +5363,10 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
uint32 value;
fromString(command_args[2], value);
target->setHairColor(value);
if (target)
target->setHairColor(value);
else
return false;
}
//*************************************************
@ -5468,12 +5516,35 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
//*************************************************
//***************** set_title
//*************************************************
// /a webExecCommand debug 1 set_title!toto hmac 0
else if (command_args[0] == "set_title")
{
if (command_args.size () != 2) return false;
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");
msgout.serial(row);
msgout.serial(name);
@ -5500,6 +5571,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
vector<string> res;
sint32 x = 0, y = 0, z = 0;
float h = 0;
sint32 cell;
if ( value.find(',') != string::npos ) // Position x,y,z,a
{
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);
z = entityBase->getState().Z;
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->teleportCharacter(x,y,z,allowPetTp,true,h);
c->teleportCharacter(x,y,z,allowPetTp,true,h,0xFF,cell);
if ( cont )
{
@ -5903,6 +5979,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{
if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_faction_points", getSalt());
return true;
}
}
else if (action=="set")
@ -5941,6 +6018,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", "<user id> <web_app_url
{
if (send_url)
c->sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_pvp_points", getSalt());
return true;
}
}
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
//*************************************************
@ -6921,7 +7044,7 @@ NLMISC_COMMAND(setChanHistoricSize, "Set size of the historic for a localized ch
// 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)]")
{
if (args.size() != 2) return false;
if (args.size() < 2 || args.size() > 3) return false;
GET_CHARACTER
TChanID chanID = DynChatEGS.getChanIDFromName(args[1]);
if (chanID == DYN_CHAT_INVALID_CHAN)

@ -89,7 +89,15 @@ bool IBuildingPhysical::addUser(CCharacter * user, uint16 roomIdx, uint16 ownerI
return false;
}
if (user->currentHp() <= 0 )
{
nlwarning("<BUILDING>user %s is dead",user->getId().toString().c_str());
return false;
}
CCharacter *owner;
if (ownerIdx < _Players.size())
{
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 )
{
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
c->setTitle( (CHARACTER_TITLE::ECharacterTitle) title );
c->setNewTitle(CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)title));
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
//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();
ucstring name;

@ -4321,41 +4321,7 @@ NLMISC_COMMAND(setAllSkillsToValue,"set all skills to value","<entity id(id:type
if( e )
{
log.displayNL("Player %s skills are all set to value %u", id.toString().c_str(), value);
// get pointer on static skills tree definition
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) );
}
e->setSkillsToValue(value);
}
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());
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();
if( memberGrade >= EGSPD::CGuildGrade::Member)
{
@ -255,9 +265,10 @@ void CGuild::setMOTD( const std::string& motd, const NLMISC::CEntityId& eId)
if(!_MessageOfTheDay.empty())
{
// Show new MOTD to all members
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal= _MessageOfTheDay;
CCharacter::sendDynamicMessageToChatGroup(user->getEntityRowId(), "GMOTD", CChatGroup::guild, params);
sendMessageToGuildChat("GMOTD", params);
}
}
else
@ -1408,6 +1419,25 @@ void CGuild::sendMessageToGuildMembers( const std::string & msg, const TVectorP
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 )
{

@ -165,6 +165,8 @@ public:
void addMemberToGuildChat(CGuildMember *member);
/// send a message to all members
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
void setMemberClientDB( CGuildMember* member );
/// return the best online user

@ -215,9 +215,7 @@ class CMissionStepKillFauna : public IMissionStepTemplate
ret.clear();
ret.resize( _SubSteps.size() );
for ( uint i = 0; i < _SubSteps.size(); i++ )
{
ret[i] = _SubSteps[i].Quantity;
}
}
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)
{
NLMISC::fromString(args[1], endTime);
if (args[1][0]=='+')
if (args[1].find('+')==0)
endTime += CTime::getSecondsSince1970();
}
if (endTime==0) endTime = 1;
@ -144,7 +144,7 @@ NLMISC_COMMAND(outpostSimulateTimer1End, "", "<outpost_id> [<absolute end time>
if (args.size()>1)
{
NLMISC::fromString(args[1], endTime);
if (args[1][0]=='+')
if (args[1].find('+')==0)
endTime += CTime::getSecondsSince1970();
}
if (endTime==0) endTime = 1;
@ -167,7 +167,7 @@ NLMISC_COMMAND(outpostSimulateTimer2End, "", "<outpost_id> [<absolute end time>
if (args.size()>1)
{
NLMISC::fromString(args[1], endTime);
if (args[1][0]=='+')
if (args[1].find('+')==0)
endTime += CTime::getSecondsSince1970();
}
if (endTime==0) endTime = 1;

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

@ -54,7 +54,7 @@ CFaberPhrase::CFaberPhrase()
_CraftedItemStaticForm = 0;
_RootFaberBricks = false;
_RootFaberPlan = 0;
// recommended skill level for using crafted item
_Recommended = 0;
@ -67,13 +67,13 @@ CFaberPhrase::CFaberPhrase()
_MBORange = 0.0f;
_MBOProtection = 0.0f;
_MBOSapLoad = 0.0f;
// energy buff on item
_MBOHitPoint = 0;
_MBOSap = 0;
_MBOStamina = 0;
_MBOFocus = 0;
_IsStatic = true;
_PhraseType = BRICK_TYPE::FABER;
}
@ -85,7 +85,7 @@ CFaberPhrase::CFaberPhrase()
bool CFaberPhrase::build( const TDataSetRow & actorRowId, const std::vector< const CStaticBrick* >& bricks, bool buildToExecute )
{
H_AUTO(CFaberPhrase_build);
// we are sure there is at least one brick and that there are non NULL;
nlassert( !bricks.empty() );
@ -112,7 +112,7 @@ bool CFaberPhrase::build( const TDataSetRow & actorRowId, const std::vector< con
return false;
}
}
else*/ if( ( brick.Family >= BRICK_FAMILIES::BeginFaberOption && brick.Family <= BRICK_FAMILIES::EndFaberOption )
else*/ if( ( brick.Family >= BRICK_FAMILIES::BeginFaberOption && brick.Family <= BRICK_FAMILIES::EndFaberOption )
|| ( brick.Family >= BRICK_FAMILIES::BeginFaberCredit && brick.Family <= BRICK_FAMILIES::EndFaberCredit ) )
{
for ( uint j = 0 ; j < brick.Params.size() ; ++j)
@ -120,7 +120,7 @@ bool CFaberPhrase::build( const TDataSetRow & actorRowId, const std::vector< con
const TBrickParam::IId* param = brick.Params[j];
switch(param->id())
{
{
case TBrickParam::FOCUS:
INFOLOG("FOCUS: %i",((CSBrickParamCraftFocus *)param)->Focus);
_FocusCost += ((CSBrickParamCraftFocus *)param)->Focus;
@ -217,10 +217,10 @@ bool CFaberPhrase::evaluate()
bool CFaberPhrase::validate()
{
H_AUTO(CFaberPhrase_validate);
if ( !CraftSystemEnabled )
return false;
CCharacter * c = (CCharacter *) CEntityBaseManager::getEntityBasePtr( _ActorRowId );
if( c == 0 )
{
@ -234,7 +234,7 @@ bool CFaberPhrase::validate()
return false;
}
// check right hand item is a crafting tool
// check right hand item is a crafting tool
CGameItemPtr rightHandItem = c->getRightHandItem();
if (rightHandItem == NULL || rightHandItem->getStaticForm() == NULL || rightHandItem->getStaticForm()->Family != ITEMFAMILY::CRAFTING_TOOL)
{
@ -249,8 +249,16 @@ bool CFaberPhrase::validate()
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
/* 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 );
if (TheDataset.isAccessible(entityRowId))
{
@ -258,7 +266,7 @@ bool CFaberPhrase::validate()
return false;
}
*/
const sint32 focus = c->getScores()._PhysicalScores[ SCORES::focus ].Current;
if ( focus < _FocusCost )
{
@ -318,7 +326,7 @@ bool CFaberPhrase::update()
void CFaberPhrase::execute()
{
H_AUTO(CFaberPhrase_execute);
CCharacter* player = PlayerManager.getChar(_ActorRowId);
if (!player)
return;
@ -336,13 +344,13 @@ void CFaberPhrase::execute()
_FaberTime = (NLMISC::TGameCycle)(plan->CraftingDuration * 10);
}
nldebug("CFaberPhrase::execute> _FaberTime = %d",_FaberTime);
const NLMISC::TGameCycle time = CTickEventHandler::getGameCycle();
_ExecutionEndDate = time + _FaberTime ;
player->setCurrentAction(CLIENT_ACTION_TYPE::Faber,_ExecutionEndDate);
player->staticActionInProgress(true);
player->staticActionInProgress(true);
// set behaviour
PHRASE_UTILITIES::sendUpdateBehaviour( _ActorRowId, MBEHAV::FABER );
@ -366,7 +374,7 @@ bool CFaberPhrase::launch()
void CFaberPhrase::apply()
{
H_AUTO(CFaberPhrase_apply);
CCharacter * c = dynamic_cast< CCharacter * > ( CEntityBaseManager::getEntityBasePtr( _ActorRowId ) );
if( c == 0 )
{
@ -410,7 +418,7 @@ void CFaberPhrase::apply()
}
nbMp = (sint32)_MpsFormula.size();
uint32 nbMpForumulaNeedeInPlan = 0;
neededMp = (uint32)_RootFaberPlan->Faber->NeededMpsFormula.size();
for( uint mp = 0; mp < neededMp; ++mp )
@ -418,7 +426,7 @@ void CFaberPhrase::apply()
//for each type of Mp needed
nbMpForumulaNeedeInPlan += _RootFaberPlan->Faber->NeededMpsFormula[ mp ].Quantity;
}
if( nbMpForumulaNeedeInPlan != _MpsFormula.size() )
{
nlwarning("<CFaberPhrase::apply> Craft plan %s need %d Raw Material Formula and client send %d Raw Material Formula", c->getCraftPlan().toString().c_str(), _RootFaberPlan->Faber->NeededMpsFormula.size(), _MpsFormula.size() );
@ -453,7 +461,7 @@ void CFaberPhrase::apply()
stop();
return;
}
neededMp = (uint32)_RootFaberPlan->Faber->NeededMps.size();
EGSPD::CPeople::TPeople civRestriction = _RootFaberPlan->CivRestriction;
uint32 usedMp=0;
@ -469,7 +477,7 @@ void CFaberPhrase::apply()
{
// for each Mp of one type (we have Quantity by type)
uint32 NumMpParameters = (uint32)usedMps[u_mp]->Mp->MpFaberParameters.size();
// for each Faber parameters in Mp
for( uint j = 0; j < NumMpParameters; ++j )
{
@ -571,7 +579,7 @@ void CFaberPhrase::apply()
CGameItemPtr CFaberPhrase::systemCraftItem( const NLMISC::CSheetId& sheet, const std::vector< NLMISC::CSheetId >& Mp, const std::vector< NLMISC::CSheetId >& MpFormula )
{
H_AUTO(CFaberPhrase_systemCraftItem);
std::vector< const CStaticBrick* > bricks;
_RootFaberPlan = CSheets::getSBrickForm( sheet );
const CStaticBrick * rootFaberBricks = CSheets::getSBrickForm( CSheetId("bcpa01.sbrick") );
@ -586,7 +594,7 @@ CGameItemPtr CFaberPhrase::systemCraftItem( const NLMISC::CSheetId& sheet, const
}
CGameItemPtr craftedItem = 0;
if( _RootFaberPlan && _RootFaberPlan->Faber )
{
_CraftedItemStaticForm = CSheets::getForm( _RootFaberPlan->Faber->CraftedItem );
@ -597,7 +605,7 @@ CGameItemPtr CFaberPhrase::systemCraftItem( const NLMISC::CSheetId& sheet, const
bricks.push_back( rootFaberBricks );
bricks.push_back( _RootFaberPlan );
for( vector< NLMISC::CSheetId >::const_iterator it = Mp.begin(); it != Mp.end(); ++it )
{
const CStaticItem * mp = CSheets::getForm( (*it) );
@ -626,7 +634,7 @@ CGameItemPtr CFaberPhrase::systemCraftItem( const NLMISC::CSheetId& sheet, const
}
_MpsFormula.push_back( mp );
}
// Check quantity of gived Mps formula
if( _RootFaberPlan->Faber->NeededMpsFormula.size() > _MpsFormula.size() )
{
@ -658,7 +666,7 @@ CGameItemPtr CFaberPhrase::systemCraftItem( const NLMISC::CSheetId& sheet, const
void CFaberPhrase::end()
{
H_AUTO(CFaberPhrase_end);
CCharacter* player = PlayerManager.getChar(_ActorRowId);
if (!player)
return;
@ -679,7 +687,7 @@ void CFaberPhrase::end()
void CFaberPhrase::stop()
{
H_AUTO(CFaberPhrase_stop);
CCharacter* player = PlayerManager.getChar(_ActorRowId);
if (!player)
return;
@ -697,11 +705,11 @@ void CFaberPhrase::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)
return false;
uint32 nbSimu, skillLevel, itemQuality;
NLMISC::fromString(args[0], nbSimu);
NLMISC::fromString(args[1], skillLevel);
@ -733,7 +741,7 @@ NLMISC_COMMAND(simuCraft, "Simulation de craft pour verifier les probabilit
if(sf == 1.0f)
{
++nbFullSuccess;
XpGain += CStaticSuccessTable::getXPGain(SUCCESS_TABLE_TYPE::Craft, deltaLvlXp);
XpGain += CStaticSuccessTable::getXPGain(SUCCESS_TABLE_TYPE::Craft, deltaLvlXp);
}
else if( sf > 0.0f)
{
@ -747,7 +755,7 @@ NLMISC_COMMAND(simuCraft, "Simulation de craft pour verifier les probabilit
nlinfo("FaberSimu: Results after %d roll: Sucess: %d (%.2f%%), partial sucess: %d (%.2f%%), Miss: %d (%.2f%%), Xp Gain %d",
nbSimu,
nbFullSuccess, 100.0f*nbFullSuccess/nbSimu,
nbPartialSuccess, 100.0f*nbPartialSuccess/nbSimu,
nbPartialSuccess, 100.0f*nbPartialSuccess/nbSimu,
nbMiss, 100.0f*nbMiss/nbSimu,
uint32(1000.f*XpGain / (nbSimu-nbMiss/2) ) );

@ -107,7 +107,7 @@ CFgExtractionPhrase::CFgExtractionPhrase()
bool CFgExtractionPhrase::build( const TDataSetRow & actorRowId, const std::vector< const CStaticBrick* >& bricks, bool buildToExecute )
{
H_AUTO(CFgExtractionPhrase_build);
_ActorRowId = actorRowId;
// Check grammar
@ -120,7 +120,7 @@ bool CFgExtractionPhrase::build( const TDataSetRow & actorRowId, const std::vect
for (std::vector<const CStaticBrick*>::const_iterator ib=bricks.begin(); ib!=bricks.end(); ++ib )
{
const CStaticBrick& brick = *(*ib);
// Compute Sabrina credit and cost)
if ( brick.SabrinaValue > 0 )
sabrinaCost += brick.SabrinaValue;
@ -156,7 +156,7 @@ bool CFgExtractionPhrase::build( const TDataSetRow & actorRowId, const std::vect
break;
case TBrickParam::FG_SRC_PRD:
INFOLOG("FG_SRC_PRD: %g",((CSBrickParamForagePeriod *)param)->Period);
if ( ((CSBrickParamForagePeriod *)param)->Period != 0 )
if ( ((CSBrickParamForagePeriod *)param)->Period != 0 )
_RequestedProps[CHarvestSource::S] = 1.0f / (((CSBrickParamForagePeriod *)param)->Period * 10.0f); // period converted from second to tick
else
_RequestedProps[CHarvestSource::S] = 1.0f;
@ -231,7 +231,7 @@ bool CFgExtractionPhrase::build( const TDataSetRow & actorRowId, const std::vect
//nlerror( "TODO: Families" );
//if ( brick.Family >= BRICK_FAMILIES::BeginForage
//insertProgressingSkill( brick.Skill, brick.SheetId );
}
@ -432,7 +432,7 @@ bool CFgExtractionPhrase::evaluate()
bool CFgExtractionPhrase::validate()
{
H_AUTO(CFgExtractionPhrase_validate);
if ( ! HarvestSystemEnabled )
return false;
@ -544,6 +544,15 @@ bool CFgExtractionPhrase::validate()
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)
const CEntityState& state = player->getState();
CVector2f playerPos( (float)state.X / 1000.0f, (float)state.Y / 1000.0f );
@ -589,7 +598,7 @@ bool CFgExtractionPhrase::validate()
bool CFgExtractionPhrase::update()
{
H_AUTO(CFgExtractionPhrase_update);
CCharacter* player = PlayerManager.getChar( _ActorRowId );
if ( ! player )
return false;
@ -600,7 +609,7 @@ bool CFgExtractionPhrase::update()
if( idle() )
{
idle(false);
// check if actor can use action
CBypassCheckFlags bypassCheckFlags = CBypassCheckFlags::NoFlags;
if (player->canEntityUseAction(bypassCheckFlags,false) == false)
@ -633,7 +642,7 @@ bool CFgExtractionPhrase::update()
void CFgExtractionPhrase::execute()
{
H_AUTO(CFgExtractionPhrase_execute);
// Get character
CCharacter* player = PlayerManager.getChar( _ActorRowId );
if (!player)
@ -676,7 +685,7 @@ void CFgExtractionPhrase::execute()
void CFgExtractionPhrase::end()
{
H_AUTO(CFgExtractionPhrase_end);
CCharacter* player = PlayerManager.getChar(_ActorRowId);
if (!player)
return;
@ -694,7 +703,7 @@ void CFgExtractionPhrase::end()
void CFgExtractionPhrase::stop()
{
H_AUTO(CFgExtractionPhrase_stop);
CCharacter* player = PlayerManager.getChar(_ActorRowId);
if (!player)
return;
@ -742,7 +751,7 @@ bool CFgExtractionPhrase::launch()
void CFgExtractionPhrase::apply()
{
H_AUTO(CFgExtractionPhrase_apply);
CCharacter* player = PlayerManager.getChar( _ActorRowId );
if (!player)
return;
@ -778,7 +787,7 @@ void CFgExtractionPhrase::apply()
void CFgExtractionPhrase::applyExtraction( CCharacter *player, float successFactor )
{
H_AUTO(CFgExtractionPhrase_applyExtraction);
nlassert( _Source );
if ( ! player->forageProgress() )
return;
@ -801,7 +810,7 @@ void CFgExtractionPhrase::applyExtraction( CCharacter *player, float successFact
player->forageProgress()->fillFromExtraction( _Props.Extraction.ObtainedProps[CHarvestSource::A], _Props.Extraction.ObtainedProps[CHarvestSource::Q], player );
else
return;
// Report result of action
if ( propDrop != CHarvestSource::NoDrop )
{
@ -864,7 +873,7 @@ struct CNonNullGameItemPtrPred : std::unary_function<CGameItemPtr,bool>
void CFgExtractionPhrase::doKamiOffering( CCharacter *player )
{
H_AUTO(CFgExtractionPhrase_doKamiOffering);
// Count the number of non empty slots
// const vector<CGameItemPtr> &theBag = player->getInventory()[INVENTORIES::bag]()->getChildren();
CInventoryPtr theBag = player->getInventory(INVENTORIES::bag);
@ -912,7 +921,7 @@ void CFgExtractionPhrase::doKamiOffering( CCharacter *player )
(*ib)->getSheetId().toString().c_str());
*/
// EGSPD::forageKamiItemOffering(player->getId(), _Source->depositForK()->name(), _Source->depositForK()->kamiAnger(), _Props.Care.KamiAngerDec[CHarvestSource::KamiAngerDec], item->getSheetId().toString());
// TODO: quantity, filter, etc.
// player->destroyItem( INVENTORIES::bag, ib-theBag.begin(), 1/*(*ib).quantity()*/, false );
theBag->deleteItem(i);

@ -675,6 +675,9 @@ CCharacter::CCharacter(): CEntityBase(false),
_FriendVisibility = VisibleToAll;
_LangChannel = "en";
_NewTitle = "Refugee";
initDatabase();
} // CCharacter //
@ -699,6 +702,7 @@ void CCharacter::clear()
_ForbidAuraUseStartDate=0;
_ForbidAuraUseEndDate=0;
_Title= CHARACTER_TITLE::Refugee;
_NewTitle = "Refugee";
SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatModel,0);
SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatColor,0);
@ -3851,9 +3855,9 @@ void CCharacter::sendBetaTesterStatus()
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();
}
}
@ -3869,9 +3873,9 @@ void CCharacter::sendWindermeerStatus()
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();
}
}
@ -6963,11 +6967,11 @@ double CCharacter::addXpToSkillInternal( double XpGain, const std::string& ContS
CBankAccessor_PLR::getCHARACTER_INFO().getRING_XP_CATALYSER().setCount(_PropertyDatabase, checkedCast<uint16>(ringCatalyserCount) );
}
}
}
if (!p->isTrialPlayer())
{
xpBonus = XpGain;
if (!p->isTrialPlayer())
{
xpBonus = XpGain;
}
}
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);
paramsP[0].Enum = skillEnum;
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);
if( xpBonus > 0 )
@ -7329,11 +7333,18 @@ double CCharacter::addXpToSkillInternal( double XpGain, const std::string& ContS
return XpGainRemainder;
}
//-----------------------------------------------
// CCharacter::setSkillTreeToMaxValue Set skill tree of character to max value of each skill
//-----------------------------------------------
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
CSheetId sheet("skills.skill_tree");
@ -7342,16 +7353,31 @@ void CCharacter::setSkillsToMaxValue()
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;
// _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SKILLS.Skill[i], _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 );
_Skills._Skills[ i ].MaxLvlReached = _Skills._Skills[ i ].Current;
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
//-----------------------------------------------
@ -7475,7 +7501,6 @@ void CCharacter::sendUserChar( uint32 userId, uint8 scenarioSeason, const R2::TU
}
}
//-----------------------------------------------
// Return the home mainland session id for a character
TSessionId CCharacter::getHomeMainlandSessionId() const
@ -7949,6 +7974,7 @@ void CCharacter::setStartStatistics( const CCreateCharMsg& createCharMsg )
_Race = (EGSPD::CPeople::TPeople) createCharMsg.People;
_Gender = createCharMsg.Sex;
_Title = CHARACTER_TITLE::Refugee;
_NewTitle = "Refugee";
// fame information
// Players start out as Neutral in their declared clans
@ -9787,7 +9813,7 @@ bool CCharacter::queryItemPrice( const CGameItemPtr item, uint32& price )
quality = theItem->quality();
if ( 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;
}
@ -10214,6 +10240,35 @@ void CCharacter::initPvpPointDb()
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)
@ -12895,7 +12950,7 @@ void CCharacter::registerName(const ucstring &newName)
CMessage msgName("CHARACTER_NAME_LANG");
msgName.serial(_EntityRowId);
string sTitle = CHARACTER_TITLE::toString(_Title);
string sTitle = getFullTitle();
ucstring RegisteredName;
if (newName.empty())
RegisteredName = getName() + string("$") + sTitle + string("$");
@ -16161,15 +16216,30 @@ void CCharacter::applyGooDamage( float gooDistance )
if (hpLost < 1) hpLost = 1;
if( hpLost > _PhysScores._PhysicalScores[ SCORES::hit_points ].Current )
{
_PhysScores._PhysicalScores[ SCORES::hit_points ].Current = 0;
// send message to player for inform is dead by goo
sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_GOO");
_PhysScores._PhysicalScores[ SCORES::hit_points ].Current = 0;
// 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");
}
else
{
_PhysScores._PhysicalScores[ SCORES::hit_points ].Current = _PhysScores._PhysicalScores[ SCORES::hit_points ].Current - hpLost;
// send message to player for inform is suffer goo damage
sendDynamicSystemMessage(_EntityRowId, "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");
}
}
}
@ -19057,7 +19127,7 @@ void CCharacter::setStartupInstance(uint32 instanceId)
void CCharacter::setTitle( CHARACTER_TITLE::ECharacterTitle title )
{
_Title = title;
setNewTitle(CHARACTER_TITLE::toString(title));
}
@ -20736,4 +20806,4 @@ bool CCharacter::initPetInventory(uint8 index)
return true;
}
return false;
}
}

@ -890,6 +890,9 @@ public:
// Set skill tree of character to max value of each skill
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
NLMISC::TGameTime& getTimeOfDeath();
void setTimeOfDeath( NLMISC::TGameTime t);
@ -2392,6 +2395,27 @@ public:
uint32 getLastConnectedTime() const;
uint32 getLastConnectedDate() 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 getOrganizationStatus() const;
const std::list<TCharacterLogTime>& getLastLogStats() const;
@ -3032,6 +3056,14 @@ private:
uint32 _OrganizationStatus;
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)
std::string _SDBPvPPath;

@ -894,6 +894,67 @@ inline uint32 CCharacter::getPlayedTime() const
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

@ -321,8 +321,8 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons
H_AUTO(CCharacterStore);\
CFameManager::getInstance().savePlayerFame(_Id, const_cast<EGSPD::CFameContainerPD &>(*_Fames));\
/* Update the current playing session duration */ \
if (_LastLogStats.size() > 0) _LastLogStats.begin()->Duration = CTime::getSecondsSince1970() - _LastLogStats.begin()->LoginTime; \
else nlwarning("Cannot update play session duration, _LastLogStats is empty, new character?"); \
if (!_LastLogStats.empty()) _LastLogStats.begin()->Duration = CTime::getSecondsSince1970() - _LastLogStats.begin()->LoginTime;\
else nlwarning("Cannot update play session duration, _LastLogStats is empty, new character?");\
\
/* Unless the top of the position stack is locked, */ \
/* update the stored position stack with the current position */ \
@ -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)\
\
PROP(uint32,_PvpPoint)\
PROP2(_LangChannel,string,_LangChannel,_LangChannel=val)\
PROP(uint32,_Organization)\
PROP(uint32,_OrganizationStatus)\
PROP(uint32,_OrganizationPoints)\
@ -438,6 +439,11 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons
PROP_GAME_CYCLE_COMP(_ForbidAuraUseStartDate)\
PROP_GAME_CYCLE_COMP(_ForbidAuraUseEndDate)\
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 */\
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 fyros = CFameInterface::getInstance().getFameIndexed(user->getId(), 1) >= 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);
}
}
// }
*/
return result;
}
@ -1088,10 +1104,19 @@ bool CPVPManager2::addFactionWar( PVP_CLAN::TPVPClan clan1, PVP_CLAN::TPVPClan c
void CPVPManager2::onIOSMirrorUp()
{
// create extra factions channels
/*
createExtraFactionChannel("hominists");
createExtraFactionChannel("urasies");
createExtraFactionChannel("marauders");
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++)
{

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

@ -132,7 +132,7 @@ void CChatManager::onServiceDown(const std::string &serviceShortName)
*/
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");
}

@ -47,7 +47,7 @@ public:
// TODO: check if good
static bool exists( 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 y( const TDataSetRow& entityIndex );

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

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

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

Loading…
Cancel
Save