diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 630ff4414..4d429e693 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -143,11 +143,11 @@ IF(WITH_RYZOM) ENDIF(WITH_RYZOM) IF(WITH_NELNS) -# ADD_SUBDIRECTORY(nelns) + ADD_SUBDIRECTORY(nelns) ENDIF(WITH_NELNS) IF(WITH_SNOWBALLS) -# ADD_SUBDIRECTORY(snowballs2) + ADD_SUBDIRECTORY(snowballs2) ENDIF(WITH_SNOWBALLS) IF(WITH_TOOLS) diff --git a/code/CMakeModules/Find3dsMaxSDK.cmake b/code/CMakeModules/Find3dsMaxSDK.cmake index 52c4cc011..ddec22f90 100644 --- a/code/CMakeModules/Find3dsMaxSDK.cmake +++ b/code/CMakeModules/Find3dsMaxSDK.cmake @@ -12,32 +12,35 @@ endif(MAXSDK_INCLUDE_DIR) find_path(MAXSDK_INCLUDE_DIR max.h PATHS + "$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/include" + "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include" - "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include" ) find_path(MAXSDK_CS_INCLUDE_DIR bipexp.h PATHS + "$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/include/CS" + "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include/CS" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include/CS" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include/CS" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include/CS" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include/CS" - "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include/CS" ) MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) FIND_LIBRARY(${MYLIBRARY} NAMES ${MYLIBRARYNAME} PATHS + "$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/lib" + "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/lib" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/lib" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/lib" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/lib" "$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/lib" - "$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/lib" - ) + ) ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME) FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core) diff --git a/code/CMakeModules/FindExternal.cmake b/code/CMakeModules/FindExternal.cmake index fae4af92d..5d6086bc6 100644 --- a/code/CMakeModules/FindExternal.cmake +++ b/code/CMakeModules/FindExternal.cmake @@ -8,7 +8,7 @@ # EXTERNAL_FOUND - True if the external libraries are available SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH}) -SET(EXTERNAL_TEMP_FILE "include/zlib.h") +SET(EXTERNAL_TEMP_FILE "include/wwwconf.h") SET(EXTERNAL_NAME "external") # If using STLport preprend external_stlport @@ -36,18 +36,18 @@ IF(EXTERNAL_PATH) SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include") # Using 32 or 64 bits binaries - IF(TARGET_X64) + IF(TARGET_X64 AND WIN32) SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64") - ELSE(TARGET_X64) + ELSE(TARGET_X64 AND WIN32) SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin") - ENDIF(TARGET_X64) - + ENDIF(TARGET_X64 AND WIN32) + # Using 32 or 64 bits libraries - IF(TARGET_X64) + IF(TARGET_X64 AND WIN32) SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64") - ELSE(TARGET_X64) + ELSE(TARGET_X64 AND WIN32) SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib") - ENDIF(TARGET_X64) + ENDIF(TARGET_X64 AND WIN32) SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}") # Stupid hack for FindOpenAL.cmake diff --git a/code/CMakeModules/FindFreeType.cmake b/code/CMakeModules/FindFreeType.cmake index 0ba439fb9..b9d00d96a 100644 --- a/code/CMakeModules/FindFreeType.cmake +++ b/code/CMakeModules/FindFreeType.cmake @@ -41,7 +41,7 @@ IF(FREETYPE_ADDITIONAL_INCLUDE_DIR) ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR) FIND_LIBRARY(FREETYPE_LIBRARY - NAMES freetype libfreetype freetype219 + NAMES freetype libfreetype freetype219 freetype246 PATHS $ENV{FREETYPE_DIR}/lib /usr/local/lib diff --git a/code/CMakeModules/FindLibwww.cmake b/code/CMakeModules/FindLibwww.cmake index 8f1c1c02a..77140492e 100644 --- a/code/CMakeModules/FindLibwww.cmake +++ b/code/CMakeModules/FindLibwww.cmake @@ -6,6 +6,8 @@ # LIBWWW_LIBRARY, where to find the LibWWW library. # LIBWWW_FOUND, If false, do not try to use LibWWW. +OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF) + SET(LIBWWW_FIND_QUIETLY ${Libwww_FIND_QUIETLY}) # also defined, but not for general use are @@ -46,6 +48,11 @@ ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR) # helper to find all the libwww sub libraries MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) + IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) + SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) + FIND_LIBRARY(${MYLIBRARY} NAMES ${ARGN} PATHS @@ -60,21 +67,27 @@ MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) /usr/freeware/lib64 ) + IF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) + ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) + IF(${MYLIBRARY}) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC) + IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC) + ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) ELSE(${MYLIBRARY}) - IF(NOT LIBWWW_FIND_QUIETLY) + IF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32) MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}") - ENDIF(NOT LIBWWW_FIND_QUIETLY) + ENDIF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32) ENDIF(${MYLIBRARY}) MARK_AS_ADVANCED(${MYLIBRARY}) ENDMACRO(FIND_WWW_LIBRARY) MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL) - LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL}) + IF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL) + LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL}) + ENDIF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL) ENDMACRO(LINK_WWW_LIBRARY) # Find and link required libs for static or dynamic diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 30e507f85..25903be14 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -33,6 +33,12 @@ FIND_PATH(WINSDK_INCLUDE_DIR Windows.h ${WINSDKCURRENT_DIR}/Include ) +FIND_PROGRAM(WINSDK_SIGNTOOL signtool + PATHS + ${WINSDK71_DIR}/Bin + ${WINSDKCURRENT_DIR}/Bin +) + IF(WINSDK_INCLUDE_DIR) SET(WINSDK_FOUND TRUE) ELSE(WINSDK_INCLUDE_DIR) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 14a78d721..5c5efc4a9 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -3,10 +3,10 @@ # Argument: name - the name of the .pc package, e.g. "nel-pacs.pc" ### MACRO(NL_GEN_PC name) - IF(NOT WIN32) + IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}") INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/pkgconfig) - ENDIF(NOT WIN32) + ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) ENDMACRO(NL_GEN_PC) ### @@ -37,9 +37,7 @@ ENDMACRO(NL_TARGET_DRIVER) # Argument: ### MACRO(NL_DEFAULT_PROPS name label) - IF(NOT MSVC10) - SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label}) - ENDIF(NOT MSVC10) + SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label}) GET_TARGET_PROPERTY(type ${name} TYPE) IF(${type} STREQUAL SHARED_LIBRARY) # Set versions only if target is a shared library @@ -49,6 +47,15 @@ MACRO(NL_DEFAULT_PROPS name label) SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX}) ENDIF(NL_LIB_PREFIX) ENDIF(${type} STREQUAL SHARED_LIBRARY) + + IF(${type} STREQUAL EXECUTABLE AND WIN32) + SET_TARGET_PROPERTIES(${name} PROPERTIES + VERSION ${NL_VERSION} + SOVERSION ${NL_VERSION_MAJOR} + COMPILE_FLAGS "/GA" + LINK_FLAGS "/VERSION:${NL_VERSION}") + ENDIF(${type} STREQUAL EXECUTABLE AND WIN32) + IF(WITH_STLPORT AND WIN32) SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") ENDIF(WITH_STLPORT AND WIN32) @@ -171,7 +178,13 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) OPTION(WITH_STATIC "With static libraries." OFF) ENDIF(WIN32) OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF) + IF(WIN32) + OPTION(WITH_EXTERNAL "With provided external." ON ) + ELSE(WIN32) + OPTION(WITH_EXTERNAL "With provided external." OFF) + ENDIF(WIN32) OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF) + OPTION(WITH_INSTALL_LIBRARIES "Install development files." ON ) ### # GUI toolkits @@ -196,10 +209,10 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF) - OPTION(WITH_NEL "Build NeL (nearly always required)." ON ) - OPTION(WITH_NELNS "Build NeL Network Services." OFF) - OPTION(WITH_RYZOM "Build Ryzom Core." ON ) - OPTION(WITH_SNOWBALLS "Build Snowballs." OFF) + OPTION(WITH_NEL "Build NeL (nearly always required)." ON ) + OPTION(WITH_NELNS "Build NeL Network Services." OFF) + OPTION(WITH_RYZOM "Build Ryzom Core." ON ) + OPTION(WITH_SNOWBALLS "Build Snowballs." OFF) ENDMACRO(NL_SETUP_DEFAULT_OPTIONS) MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) @@ -308,25 +321,32 @@ MACRO(NL_SETUP_BUILD) ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) # ADD_DEFINITIONS(-DHAVE_IA64) # ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") - + IF(WIN32) IF(MSVC10) # /Ox is working with VC++ 2010, but custom optimizations don't exist SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") # without inlining it's unusable, use custom optimizations again SET(MIN_OPTIMIZATIONS "/Od /Ob1") - ELSE(MSVC10) + ELSEIF(MSVC90) # don't use a /O[012x] flag if you want custom optimizations SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") # without inlining it's unusable, use custom optimizations again SET(MIN_OPTIMIZATIONS "/Ob1") + ELSEIF(MSVC80) + # don't use a /O[012x] flag if you want custom optimizations + SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") + # without inlining it's unusable, use custom optimizations again + SET(MIN_OPTIMIZATIONS "/Od /Ob1") + ELSE(MSVC10) + MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") ENDIF(MSVC10) - SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-") # Common link flags SET(PLATFORM_LINKFLAGS "-DEBUG") - + IF(TARGET_X64) # Fix a bug with Intellisense SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64") @@ -354,6 +374,11 @@ MACRO(NL_SETUP_BUILD) SET(PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}") ENDIF(APPLE) + # 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}") + ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS) + SET(PLATFORM_CXXFLAGS ${PLATFORM_CFLAGS}) IF(NOT APPLE) @@ -456,54 +481,60 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS) IF(WIN32) SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations") ELSE(WIN32) - SET(RYZOM_ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc/ryzom" CACHE PATH "Installation path for configurations") + SET(RYZOM_ETC_PREFIX "${RYZOM_PREFIX}/etc/ryzom" CACHE PATH "Installation path for configurations") ENDIF(WIN32) ENDIF(NOT RYZOM_ETC_PREFIX) ## Allow override of install_prefix/share path. IF(NOT RYZOM_SHARE_PREFIX) IF(WIN32) - SET(RYZOM_SHARE_PREFIX "." CACHE PATH "Installation path for data.") - ELSE(WIN32) - SET(RYZOM_SHARE_PREFIX "${CMAKE_INSTALL_PREFIX}/share/ryzom" CACHE PATH "Installation path for data.") - ENDIF(WIN32) + SET(RYZOM_SHARE_PREFIX "." CACHE PATH "Installation path for data.") + ELSE(WIN32) + SET(RYZOM_SHARE_PREFIX "${RYZOM_PREFIX}/share/ryzom" CACHE PATH "Installation path for data.") + ENDIF(WIN32) ENDIF(NOT RYZOM_SHARE_PREFIX) ## Allow override of install_prefix/sbin path. IF(NOT RYZOM_SBIN_PREFIX) - IF(WIN32) - SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") - ELSE(WIN32) - SET(RYZOM_SBIN_PREFIX "${CMAKE_INSTALL_PREFIX}/sbin" CACHE PATH "Installation path for admin tools and services.") - ENDIF(WIN32) + IF(WIN32) + SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") + ELSE(WIN32) + SET(RYZOM_SBIN_PREFIX "${RYZOM_PREFIX}/sbin" CACHE PATH "Installation path for admin tools and services.") + ENDIF(WIN32) ENDIF(NOT RYZOM_SBIN_PREFIX) ## Allow override of install_prefix/bin path. IF(NOT RYZOM_BIN_PREFIX) IF(WIN32) - SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") + SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") ELSE(WIN32) - SET(RYZOM_BIN_PREFIX "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation path for tools.") + SET(RYZOM_BIN_PREFIX "${RYZOM_PREFIX}/bin" CACHE PATH "Installation path for tools.") ENDIF(WIN32) ENDIF(NOT RYZOM_BIN_PREFIX) ## Allow override of install_prefix/games path. IF(NOT RYZOM_GAMES_PREFIX) IF(WIN32) - SET(RYZOM_GAMES_PREFIX "." CACHE PATH "Installation path for tools and applications.") + SET(RYZOM_GAMES_PREFIX "." CACHE PATH "Installation path for tools and applications.") ELSE(WIN32) - SET(RYZOM_GAMES_PREFIX "${CMAKE_INSTALL_PREFIX}/games" CACHE PATH "Installation path for client.") + SET(RYZOM_GAMES_PREFIX "${RYZOM_PREFIX}/games" CACHE PATH "Installation path for client.") ENDIF(WIN32) ENDIF(NOT RYZOM_GAMES_PREFIX) ENDMACRO(RYZOM_SETUP_PREFIX_PATHS) MACRO(SETUP_EXTERNAL) - IF(WIN32) + IF(WITH_EXTERNAL) FIND_PACKAGE(External REQUIRED) + ENDIF(WITH_EXTERNAL) + IF(WIN32) INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) IF(MSVC10) + IF(NOT MSVC10_REDIST_DIR) + # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF(NOT MSVC10_REDIST_DIR) GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE) # VC_ROOT_DIR is set to "registry" when a key is not found IF(VC_ROOT_DIR MATCHES "registry") @@ -544,5 +575,4 @@ MACRO(SETUP_EXTERNAL) INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR}) ENDIF(WIN32) ENDIF(WITH_STLPORT) - ENDMACRO(SETUP_EXTERNAL) diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index ead484a2d..57f7edd44 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -54,24 +54,27 @@ IF(WITH_GTK) FIND_PACKAGE(GTK2) ENDIF(WITH_GTK) -IF(UNIX) - SET(prefix ${CMAKE_INSTALL_PREFIX}) - SET(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) - SET(libdir ${CMAKE_INSTALL_PREFIX}/lib) - SET(includedir ${CMAKE_INSTALL_PREFIX}/include) - SET(enable_ligo ${WITH_LIGO}) - SET(enable_logic ${WITH_LOGIC}) - SET(enable_georges ${WITH_GEORGES}) - SET(enable_net ${WITH_NET}) - SET(enable_3d ${WITH_3D}) - SET(enable_pacs ${WITH_PACS}) - SET(enable_sound ${WITH_SOUND}) - CONFIGURE_FILE(nel-config.in ${CMAKE_CURRENT_BINARY_DIR}/nel-config) +IF(WITH_INSTALL_LIBRARIES) + IF(UNIX) + SET(prefix ${CMAKE_INSTALL_PREFIX}) + SET(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) + SET(libdir ${CMAKE_INSTALL_PREFIX}/lib) + SET(includedir ${CMAKE_INSTALL_PREFIX}/include) + SET(enable_ligo ${WITH_LIGO}) + SET(enable_logic ${WITH_LOGIC}) + SET(enable_georges ${WITH_GEORGES}) + SET(enable_net ${WITH_NET}) + SET(enable_3d ${WITH_3D}) + SET(enable_pacs ${WITH_PACS}) + SET(enable_sound ${WITH_SOUND}) + CONFIGURE_FILE(nel-config.in ${CMAKE_CURRENT_BINARY_DIR}/nel-config) - INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/nel-config DESTINATION bin) -ENDIF(UNIX) + INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/nel-config DESTINATION bin) + ENDIF(UNIX) + + ADD_SUBDIRECTORY(include) +ENDIF(WITH_INSTALL_LIBRARIES) -ADD_SUBDIRECTORY(include) ADD_SUBDIRECTORY(src) IF(WITH_NEL_SAMPLES) diff --git a/code/nel/src/3d/CMakeLists.txt b/code/nel/src/3d/CMakeLists.txt index 3888be211..45b38fcbd 100644 --- a/code/nel/src/3d/CMakeLists.txt +++ b/code/nel/src/3d/CMakeLists.txt @@ -706,6 +706,9 @@ IF(WITH_PCH) ENDIF(WITH_PCH) NL_GEN_PC(nel-3d.pc) -INSTALL(TARGETS nel3d LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nel3d LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) ADD_SUBDIRECTORY(driver) diff --git a/code/nel/src/3d/driver/direct3d/CMakeLists.txt b/code/nel/src/3d/driver/direct3d/CMakeLists.txt index 5011c3c45..cc61fa9bd 100644 --- a/code/nel/src/3d/driver/direct3d/CMakeLists.txt +++ b/code/nel/src/3d/driver/direct3d/CMakeLists.txt @@ -16,7 +16,9 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_direct3d_win ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS nel_drv_direct3d_win LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) -IF(WITH_MAXPLUGIN) - INSTALL(TARGETS nel_drv_direct3d_win RUNTIME DESTINATION maxplugin COMPONENT drivers3d) -ENDIF(WITH_MAXPLUGIN) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) + INSTALL(TARGETS nel_drv_direct3d_win LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) + IF(WITH_MAXPLUGIN) + INSTALL(TARGETS nel_drv_direct3d_win RUNTIME DESTINATION maxplugin COMPONENT drivers3d) + ENDIF(WITH_MAXPLUGIN) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) diff --git a/code/nel/src/3d/driver/opengl/CMakeLists.txt b/code/nel/src/3d/driver/opengl/CMakeLists.txt index 6fdecab71..d90c7e0b3 100644 --- a/code/nel/src/3d/driver/opengl/CMakeLists.txt +++ b/code/nel/src/3d/driver/opengl/CMakeLists.txt @@ -61,7 +61,9 @@ IF(NOT APPLE AND WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp) ENDIF(NOT APPLE AND WITH_PCH) -INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) -IF(WITH_MAXPLUGIN) - INSTALL(TARGETS ${NLDRV_OGL_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d) -ENDIF(WITH_MAXPLUGIN) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) + INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) + IF(WITH_MAXPLUGIN) + INSTALL(TARGETS ${NLDRV_OGL_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d) + ENDIF(WITH_MAXPLUGIN) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) diff --git a/code/nel/src/cegui/CMakeLists.txt b/code/nel/src/cegui/CMakeLists.txt index 99fcfedf3..342e08780 100644 --- a/code/nel/src/cegui/CMakeLists.txt +++ b/code/nel/src/cegui/CMakeLists.txt @@ -11,4 +11,6 @@ NL_ADD_LIB_SUFFIX(nelceguirenderer) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DNEL_CEGUIRENDERER_EXPORTS) -INSTALL(TARGETS nelceguirenderer RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nelceguirenderer RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/src/georges/CMakeLists.txt b/code/nel/src/georges/CMakeLists.txt index d3c0199d7..6954bb87b 100644 --- a/code/nel/src/georges/CMakeLists.txt +++ b/code/nel/src/georges/CMakeLists.txt @@ -21,4 +21,7 @@ IF(WITH_PCH) ENDIF(WITH_PCH) NL_GEN_PC(nel-georges.pc) -INSTALL(TARGETS nelgeorges LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nelgeorges LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/src/ligo/CMakeLists.txt b/code/nel/src/ligo/CMakeLists.txt index f600637b7..4d8d49f3d 100644 --- a/code/nel/src/ligo/CMakeLists.txt +++ b/code/nel/src/ligo/CMakeLists.txt @@ -19,4 +19,7 @@ IF(WITH_PCH) ENDIF(WITH_PCH) NL_GEN_PC(nel-ligo.pc) -INSTALL(TARGETS nelligo LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nelligo LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/src/logic/CMakeLists.txt b/code/nel/src/logic/CMakeLists.txt index 107c57850..c84e8d18e 100644 --- a/code/nel/src/logic/CMakeLists.txt +++ b/code/nel/src/logic/CMakeLists.txt @@ -14,4 +14,6 @@ NL_ADD_LIB_SUFFIX(nellogic) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) -INSTALL(TARGETS nellogic LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nellogic LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/src/misc/CMakeLists.txt b/code/nel/src/misc/CMakeLists.txt index 1710e5b6b..38d291552 100644 --- a/code/nel/src/misc/CMakeLists.txt +++ b/code/nel/src/misc/CMakeLists.txt @@ -53,4 +53,7 @@ IF(WITH_PCH) ENDIF(WITH_PCH) NL_GEN_PC(nel-misc.pc) -INSTALL(TARGETS nelmisc LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nelmisc LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/src/net/CMakeLists.txt b/code/nel/src/net/CMakeLists.txt index ea68efe32..c24a94215 100644 --- a/code/nel/src/net/CMakeLists.txt +++ b/code/nel/src/net/CMakeLists.txt @@ -24,4 +24,7 @@ IF(WITH_PCH) ENDIF(WITH_PCH) NL_GEN_PC(nel-net.pc) -INSTALL(TARGETS nelnet LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nelnet LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/src/pacs/CMakeLists.txt b/code/nel/src/pacs/CMakeLists.txt index 0fa059d68..62a809407 100644 --- a/code/nel/src/pacs/CMakeLists.txt +++ b/code/nel/src/pacs/CMakeLists.txt @@ -19,4 +19,7 @@ IF(WITH_PCH) ENDIF(WITH_PCH) NL_GEN_PC(nel-pacs.pc) -INSTALL(TARGETS nelpacs LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nelpacs LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/src/sound/CMakeLists.txt b/code/nel/src/sound/CMakeLists.txt index 9497357ee..21c1de1f8 100644 --- a/code/nel/src/sound/CMakeLists.txt +++ b/code/nel/src/sound/CMakeLists.txt @@ -19,6 +19,9 @@ IF(WITH_PCH) ENDIF(WITH_PCH) NL_GEN_PC(nel-sound.pc) -INSTALL(TARGETS nelsound LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nelsound LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) ADD_SUBDIRECTORY(driver) diff --git a/code/nel/src/sound/driver/CMakeLists.txt b/code/nel/src/sound/driver/CMakeLists.txt index c2ae80606..1a8391c41 100644 --- a/code/nel/src/sound/driver/CMakeLists.txt +++ b/code/nel/src/sound/driver/CMakeLists.txt @@ -23,7 +23,9 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nelsnd_lowlevel ${CMAKE_CURRENT_SOURCE_DIR}/stdsound_lowlevel.h ${CMAKE_CURRENT_SOURCE_DIR}/stdsound_lowlevel.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS nelsnd_lowlevel LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nelsnd_lowlevel LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) IF(WITH_DRIVER_OPENAL) ADD_SUBDIRECTORY(openal) diff --git a/code/nel/src/sound/driver/dsound/CMakeLists.txt b/code/nel/src/sound/driver/dsound/CMakeLists.txt index f2d13d785..c2fc934dc 100644 --- a/code/nel/src/sound/driver/dsound/CMakeLists.txt +++ b/code/nel/src/sound/driver/dsound/CMakeLists.txt @@ -13,7 +13,9 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_dsound_win ${CMAKE_CURRENT_SOURCE_DIR}/stddsound.h ${CMAKE_CURRENT_SOURCE_DIR}/stddsound.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) -IF(WITH_MAXPLUGIN) - INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) -ENDIF(WITH_MAXPLUGIN) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) + INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) + IF(WITH_MAXPLUGIN) + INSTALL(TARGETS nel_drv_dsound_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) + ENDIF(WITH_MAXPLUGIN) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) diff --git a/code/nel/src/sound/driver/fmod/CMakeLists.txt b/code/nel/src/sound/driver/fmod/CMakeLists.txt index 049d8b627..e641a9277 100644 --- a/code/nel/src/sound/driver/fmod/CMakeLists.txt +++ b/code/nel/src/sound/driver/fmod/CMakeLists.txt @@ -13,7 +13,9 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_fmod_win ${CMAKE_CURRENT_SOURCE_DIR}/stdfmod.h ${CMAKE_CURRENT_SOURCE_DIR}/stdfmod.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) -IF(WITH_MAXPLUGIN) - INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) -ENDIF(WITH_MAXPLUGIN) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) + INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) + IF(WITH_MAXPLUGIN) + INSTALL(TARGETS nel_drv_fmod_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) + ENDIF(WITH_MAXPLUGIN) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) diff --git a/code/nel/src/sound/driver/openal/CMakeLists.txt b/code/nel/src/sound/driver/openal/CMakeLists.txt index 53b0c8c2a..47ce5b24f 100644 --- a/code/nel/src/sound/driver/openal/CMakeLists.txt +++ b/code/nel/src/sound/driver/openal/CMakeLists.txt @@ -44,7 +44,9 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_AL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopenal.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopenal.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) -IF(WITH_MAXPLUGIN) - INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION maxplugin COMPONENT driverssound) -ENDIF(WITH_MAXPLUGIN) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) + INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION ${NL_DRIVER_PREFIX} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) + IF(WITH_MAXPLUGIN) + INSTALL(TARGETS ${NLDRV_AL_LIB} RUNTIME DESTINATION maxplugin COMPONENT driverssound) + ENDIF(WITH_MAXPLUGIN) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) diff --git a/code/nel/src/sound/driver/xaudio2/CMakeLists.txt b/code/nel/src/sound/driver/xaudio2/CMakeLists.txt index 5e45a9809..eb342a4df 100644 --- a/code/nel/src/sound/driver/xaudio2/CMakeLists.txt +++ b/code/nel/src/sound/driver/xaudio2/CMakeLists.txt @@ -40,7 +40,9 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_xaudio2_win ${CMAKE_CURRENT_SOURCE_DIR}/stdxaudio2.h ${CMAKE_CURRENT_SOURCE_DIR}/stdxaudio2.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) -IF(WITH_MAXPLUGIN) - INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) -ENDIF(WITH_MAXPLUGIN) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) + INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION bin LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib COMPONENT driverssound) + IF(WITH_MAXPLUGIN) + INSTALL(TARGETS nel_drv_xaudio2_win RUNTIME DESTINATION maxplugin COMPONENT driverssound) + ENDIF(WITH_MAXPLUGIN) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) diff --git a/code/nel/tools/3d/ligo/plugin_max/DllEntry.cpp b/code/nel/tools/3d/ligo/plugin_max/DllEntry.cpp index 3cf88f4a7..ee9964566 100644 --- a/code/nel/tools/3d/ligo/plugin_max/DllEntry.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/DllEntry.cpp @@ -18,6 +18,7 @@ #include "nel/misc/app_context.h" #include #include "../../plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.h" +#include extern ClassDesc2* GetLigoscapeDesc(); @@ -44,7 +45,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) if (!controlsInit) { controlsInit = TRUE; +#if MAX_VERSION_MAJOR < 14 InitCustomControls(hInstance); // Initialize MAX's custom controls +#endif InitCommonControls(); // Initialize Win95 controls } diff --git a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp index 7500b027b..eb4951991 100644 --- a/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/max_to_ligo.cpp @@ -17,7 +17,12 @@ #include // From MAXSDK -#include +#include +#if MAX_VERSION_MAJOR >= 14 +# include +#else +# include +#endif #include "max_to_ligo.h" diff --git a/code/nel/tools/3d/ligo/plugin_max/script.cpp b/code/nel/tools/3d/ligo/plugin_max/script.cpp index 5d6381303..90050304f 100644 --- a/code/nel/tools/3d/ligo/plugin_max/script.cpp +++ b/code/nel/tools/3d/ligo/plugin_max/script.cpp @@ -19,17 +19,30 @@ #include // Various MAX and MXS includes -#include -#include -#include -#include -#include -#include -#include -#include +#include +#if MAX_VERSION_MAJOR >= 14 +# include +# include +# include +# include +# include +# include +# include +# include +# include +#else +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif #include #include -#include // Visual #include diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/CMakeLists.txt index 8fb0881af..f4ed13e0a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/CMakeLists.txt @@ -36,6 +36,15 @@ LIST(REMOVE_ITEM QT_PROPERTY_EDITOR_MOC_SRC ${CMAKE_CURRENT_BINARY_DIR}/moc_qtbu ${CMAKE_CURRENT_BINARY_DIR}/moc_qttreepropertybrowser.cxx ${CMAKE_CURRENT_BINARY_DIR}/moc_qtvariantproperty.cxx) +# We need to add new depencencies on removed files because we need them to be still generated +SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtbuttonpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtbuttonpropertybrowser.cxx) +SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qteditorfactory.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qteditorfactory.cxx) +SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtgroupboxpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtgroupboxpropertybrowser.cxx) +SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtpropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cxx) +SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtpropertymanager.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertymanager.cxx) +SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qttreepropertybrowser.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qttreepropertybrowser.cxx) +SET_PROPERTY(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/qtvariantproperty.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/moc_qtvariantproperty.cxx) + #set( # qtpropertyeditor_HEADERS_ONLY_MOC # ${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cpp @@ -79,7 +88,7 @@ TARGET_LINK_LIBRARIES(qt_property_browser ${QT_LIBRARIES}) ADD_DEFINITIONS(${QT_DEFINITIONS}) ADD_DEFINITIONS(-DQT_DLL) -#ADD_DEFINITIONS(-DQT_QTPROPERTYBROWSER_EXPORT) +ADD_DEFINITIONS(-DQT_QTPROPERTYBROWSER_EXPORT) ADD_DEFINITIONS(-DQT_PLUGIN) #ADD_DEFINITIONS(-DQT_NO_DEBUG) ADD_DEFINITIONS(-DQT_SHARED) diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h index fc2e0736b..864028501 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h @@ -105,6 +105,6 @@ public: }; //namespace ExtensionSystem -Q_DECLARE_INTERFACE(ExtensionSystem::IPlugin, "dev.ryzom.com.ObjectViewerQt.IPlugin/0.9.1") +Q_DECLARE_INTERFACE(ExtensionSystem::IPlugin, "dev.ryzom.com.ObjectViewerQt.IPlugin/0.9.2") #endif // IPLUGIN_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h index 05d4b832c..e38748e77 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h @@ -98,7 +98,7 @@ public: { QList all = allObjects(); QObject *result = 0; - Q_FOREACH (QObject *qobj, all) + Q_FOREACH(QObject *qobj, all) { if (qobj->objectName() == name) { diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_spec.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_spec.h index f0c62fec7..45895c36f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_spec.h +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_spec.h @@ -71,9 +71,13 @@ public: virtual IPlugin *plugin() const = 0; // state - virtual int getState() const = 0; + virtual int state() const = 0; virtual bool hasError() const = 0; virtual QString errorString() const = 0; + + /// Enables/disables load this plugin after restart the program + virtual void setEnabled(bool enabled) = 0; + virtual bool isEnabled() const = 0; }; } // namespace ExtensionSystem diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp index be5f18c74..3b2431a07 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp @@ -34,6 +34,7 @@ CPluginManager::CPluginManager(QObject *parent) CPluginManager::~CPluginManager() { + writeSettings(); stopAll(); deleteAll(); qDeleteAll(m_pluginSpecs); @@ -114,6 +115,7 @@ void CPluginManager::setPluginPaths(const QStringList &paths) { m_pluginPaths = paths; readPluginPaths(); + readSettings(); } QList CPluginManager::plugins() const @@ -133,10 +135,41 @@ QSettings *CPluginManager::settings() const void CPluginManager::readSettings() { + if (m_settings) + { + QStringList blackList; + m_settings->beginGroup("PluginManager"); + blackList = m_settings->value("BlackList").toStringList(); + m_settings->endGroup(); + Q_FOREACH (CPluginSpec *spec, m_pluginSpecs) + { + QString pluginName = spec->fileName(); + + if (blackList.contains(pluginName)) + { + spec->setEnabled(false); + spec->setEnabledStartup(false); + } + } + } } void CPluginManager::writeSettings() { + if (m_settings) + { + QStringList blackList; + Q_FOREACH(CPluginSpec *spec, m_pluginSpecs) + { + nlinfo(spec->fileName().toStdString().c_str()); + if (!spec->isEnabled()) + blackList.push_back(spec->fileName()); + } + m_settings->beginGroup("PluginManager"); + m_settings->setValue("BlackList", blackList); + m_settings->endGroup(); + m_settings->sync(); + } } void CPluginManager::readPluginPaths() @@ -176,7 +209,11 @@ void CPluginManager::readPluginPaths() void CPluginManager::setPluginState(CPluginSpec *spec, int destState) { - if (spec->hasError() || spec->getState() != destState-1) + if (spec->hasError() || spec->state() != destState-1) + return; + + // plugin in black list + if (!spec->isEnabledStartup()) return; switch (destState) @@ -198,7 +235,7 @@ void CPluginManager::setPluginState(CPluginSpec *spec, int destState) } Q_FOREACH (const CPluginSpec *depSpec, spec->dependencySpecs()) { - if (depSpec->getState() != destState) + if (depSpec->state() != destState) { spec->m_hasError = true; spec->m_errorString = tr("Cannot initializing plugin because dependency failed to load: %1\nReason: %2") @@ -251,7 +288,7 @@ bool CPluginManager::loadQueue(CPluginSpec *spec, QList &queue, } circularityCheckQueue.append(spec); // check if we have the dependencies - if (spec->getState() == State::Invalid || spec->getState() == State::Read) + if (spec->state() == State::Invalid || spec->state() == State::Read) { queue.append(spec); return false; diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp index d77d90962..6e15e1181 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp @@ -40,6 +40,8 @@ CPluginSpec::CPluginSpec() m_vendor(""), m_description(""), m_state(State::Invalid), + m_enabled(true), + m_enabledStartup(true), m_hasError(false), m_errorString(""), m_plugin(0), @@ -82,12 +84,12 @@ QString CPluginSpec::fileName() const return m_fileName; } -IPlugin* CPluginSpec::plugin() const +IPlugin *CPluginSpec::plugin() const { return m_plugin; } -int CPluginSpec::getState() const +int CPluginSpec::state() const { return m_state; } @@ -124,6 +126,16 @@ bool CPluginSpec::setFileName(const QString &fileName) return true; } +void CPluginSpec::setEnabled(bool enabled) +{ + m_enabled = enabled; +} + +bool CPluginSpec::isEnabled() const +{ + return m_enabled; +} + bool CPluginSpec::loadLibrary() { if (m_hasError) @@ -259,6 +271,16 @@ void CPluginSpec::kill() m_state = State::Deleted; } +void CPluginSpec::setEnabledStartup(bool enabled) +{ + m_enabledStartup = enabled; +} + +bool CPluginSpec::isEnabledStartup() const +{ + return m_enabledStartup; +} + bool CPluginSpec::reportError(const QString &err) { m_errorString = err; diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h index 0cc895ada..5d9605de7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h +++ b/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h @@ -41,11 +41,15 @@ public: virtual IPlugin *plugin() const; // state - virtual int getState() const; + virtual int state() const; virtual bool hasError() const; virtual QString errorString() const; QList dependencySpecs() const; + /// Enables/disables load this plugin after restart the program + virtual void setEnabled(bool enabled); + virtual bool isEnabled() const; + private: CPluginSpec(); @@ -57,6 +61,11 @@ private: void stop(); void kill(); + /// Enables/disables load this plugin on startup the program + /// Method is used for disabling startup plugin by pluginmanager + void setEnabledStartup(bool enabled); + bool isEnabledStartup() const; + bool reportError(const QString &err); QString m_location; @@ -69,6 +78,7 @@ private: QString m_description; int m_state; + bool m_enabled, m_enabledStartup; bool m_hasError; QString m_errorString; diff --git a/code/nel/tools/3d/object_viewer_qt/src/main.cpp b/code/nel/tools/3d/object_viewer_qt/src/main.cpp index 050b7716c..1ddcc5565 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/main.cpp @@ -132,7 +132,7 @@ sint main(int argc, char **argv) QSettings::setDefaultFormat(QSettings::IniFormat); QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, - QLatin1String("RyzomCore"), QLatin1String(appNameC)); + QLatin1String("RyzomCore"), QLatin1String(appNameC)); QTranslator translator; QTranslator qtTranslator; @@ -162,17 +162,8 @@ sint main(int argc, char **argv) splash->hide(); - const QList plugins = pluginManager.plugins(); - ExtensionSystem::IPluginSpec *corePlugin = 0; - Q_FOREACH(ExtensionSystem::IPluginSpec *spec, plugins) - { - if (spec->name() == QLatin1String("Core")) - { - corePlugin = spec; - break; - } - } - + ExtensionSystem::IPluginSpec *corePlugin = pluginManager.pluginByName("Core"); + if (!corePlugin) { QDir absolutePluginPaths(pluginPaths.join(QLatin1String(","))); @@ -183,8 +174,8 @@ sint main(int argc, char **argv) QString newPath = QFileDialog::getExistingDirectory(0, QCoreApplication::translate("Application", "Change the plugins path"), QDir::homePath()); bool ok; QString text = QInputDialog::getText(0, QCoreApplication::translate("Application", "Enter the plugins path"), - QCoreApplication::translate("Application", "Plugin path:"), QLineEdit::Normal, - newPath, &ok); + QCoreApplication::translate("Application", "Plugin path:"), QLineEdit::Normal, + newPath, &ok); if (ok && !text.isEmpty()) settings->setValue("PluginPath", text); settings->sync(); @@ -203,7 +194,7 @@ sint main(int argc, char **argv) if (!errors.isEmpty()) QMessageBox::warning(0, QCoreApplication::translate("Application", "Object Viewer Qt - Plugin loader messages"), - errors.join(QString::fromLatin1("\n\n"))); + errors.join(QString::fromLatin1("\n\n"))); int result = app.exec(); return result; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt index 6db50dac3..426d3aa61 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt @@ -5,9 +5,10 @@ ADD_SUBDIRECTORY(landscape_editor) ADD_SUBDIRECTORY(log) ADD_SUBDIRECTORY(disp_sheet_id) ADD_SUBDIRECTORY(object_viewer) -ADD_SUBDIRECTORY(zone_painter) ADD_SUBDIRECTORY(georges_editor) ADD_SUBDIRECTORY(translation_manager) +# Note: Temporarily disabled until development continues. +#ADD_SUBDIRECTORY(zone_painter) # Ryzom Specific Plugins IF(WITH_RYZOM AND WITH_RYZOM_TOOLS) ADD_SUBDIRECTORY(mission_compiler) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp index 92e776068..8aef51f2a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp @@ -37,6 +37,8 @@ using namespace Core; CorePlugin::CorePlugin() + : m_plugMan(0), + m_mainWindow(0) { } @@ -49,7 +51,8 @@ CorePlugin::~CorePlugin() qDeleteAll(m_autoReleaseObjects); m_autoReleaseObjects.clear(); - delete m_mainWindow; + if (m_mainWindow) + delete m_mainWindow; } bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp index a050f4789..88bd3a298 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp @@ -87,9 +87,11 @@ void GeneralSettingsPage::applyGeneralSettings() settings->beginGroup(Core::Constants::DATA_PATH_SECTION); QString primitivePath = settings->value(Core::Constants::PRIMITIVES_PATH, "l:/primitives").toString(); QString ligoConfigFile = settings->value(Core::Constants::LIGOCONFIG_FILE, "l:/leveldesign/world_editor_files/world_editor_classes.xml").toString(); + QString leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString(); NLMISC::CPath::addSearchPath(primitivePath.toStdString(), true, false); NLMISC::CPath::display(); NLMISC::CPath::addSearchFile(ligoConfigFile.toStdString()); + NLMISC::CPath::addSearchPath(leveldesignPath.toStdString(), true, false); settings->endGroup(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp index caaeb4d5c..2105b8b1b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp @@ -107,8 +107,8 @@ bool MainWindow::initialize(QString *errorString) void MainWindow::extensionsInitialized() { readSettings(); - connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext*)), - this, SLOT(updateContext(Core::IContext*))); + connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext *)), + this, SLOT(updateContext(Core::IContext *))); if (m_contextManager->currentContext() != NULL) updateContext(m_contextManager->currentContext()); show(); @@ -437,7 +437,7 @@ void MainWindow::createStatusBar() void MainWindow::createDialogs() { - m_pluginView = new ExtensionSystem::CPluginView(m_pluginManager, this); + m_pluginView = new PluginView(m_pluginManager, this); // Create undo/redo command list m_dockWidget = new QDockWidget("Command List", this); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h index d594692ee..48ce93a15 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h @@ -93,7 +93,7 @@ private: void writeSettings(); ExtensionSystem::IPluginManager *m_pluginManager; - ExtensionSystem::CPluginView *m_pluginView; + PluginView *m_pluginView; MenuManager *m_menuManager; ContextManager *m_contextManager; CoreImpl *m_coreImpl; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.cpp index b45d46418..175902d39 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.cpp @@ -16,11 +16,12 @@ // along with this program. If not, see . #include "plugin_view_dialog.h" +#include "core_constants.h" + +#include "nel/misc/debug.h" // Qt includes #include -#include -#include #include #include #include @@ -29,45 +30,79 @@ #include "../../extension_system/iplugin_spec.h" #include "../../extension_system/iplugin_manager.h" -namespace ExtensionSystem +namespace Core { -CPluginView::CPluginView(IPluginManager *pluginManager, QWidget *parent) - : QDialog(parent) +PluginView::PluginView(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent) + : QDialog(parent), + m_checkStateColumn(0) { - _ui.setupUi(this); - _pluginManager = pluginManager; + m_ui.setupUi(this); + m_pluginManager = pluginManager; - connect(_pluginManager, SIGNAL(pluginsChanged()), this, SLOT(updateList())); + connect(m_pluginManager, SIGNAL(pluginsChanged()), this, SLOT(updateList())); + connect(this, SIGNAL(accepted()), this, SLOT(updateSettings())); + // WhiteList is list of plugins which can not disable. + m_whiteList << Constants::OVQT_CORE_PLUGIN; updateList(); } -CPluginView::~CPluginView() +PluginView::~PluginView() { } -void CPluginView::updateList() +void PluginView::updateList() { static QIcon okIcon = QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton); static QIcon errorIcon = QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton); + static QIcon notLoadedIcon = QApplication::style()->standardIcon(QStyle::SP_DialogResetButton); + + m_specToItem.clear(); QList items; - Q_FOREACH (IPluginSpec *spec, _pluginManager->plugins()) + Q_FOREACH (ExtensionSystem::IPluginSpec *spec, m_pluginManager->plugins()) { QTreeWidgetItem *item = new QTreeWidgetItem(QStringList() - << "" << spec->name() << QString("%1").arg(spec->version()) << spec->vendor() << QDir::toNativeSeparators(spec->filePath())); - item->setIcon(0, spec->hasError() ? errorIcon : okIcon); + + bool ok = !spec->hasError(); + QIcon icon = ok ? okIcon : errorIcon; + if (ok && (spec->state() != ExtensionSystem::State::Running)) + icon = notLoadedIcon; + + item->setIcon(m_checkStateColumn, icon); + + if (!m_whiteList.contains(spec->name())) + item->setCheckState(m_checkStateColumn, spec->isEnabled() ? Qt::Checked : Qt::Unchecked); + items.append(item); + m_specToItem.insert(spec, item); } - _ui.pluginTreeWidget->clear(); + m_ui.pluginTreeWidget->clear(); if (!items.isEmpty()) - _ui.pluginTreeWidget->addTopLevelItems(items); + m_ui.pluginTreeWidget->addTopLevelItems(items); + + m_ui.pluginTreeWidget->resizeColumnToContents(m_checkStateColumn); } -} /* namespace NLQT */ \ No newline at end of file +void PluginView::updateSettings() +{ + Q_FOREACH (ExtensionSystem::IPluginSpec *spec, m_pluginManager->plugins()) + { + if (m_specToItem.contains(spec) && (!m_whiteList.contains(spec->name()))) + { + QTreeWidgetItem *item = m_specToItem.value(spec); + if (item->checkState(m_checkStateColumn) == Qt::Checked) + spec->setEnabled(true); + else + spec->setEnabled(false); + } + } +} + +} /* namespace Core */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.h index 0f12b64a3..aae16749d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.h @@ -20,28 +20,39 @@ #include "ui_plugin_view_dialog.h" +#include +#include + namespace ExtensionSystem { - class IPluginManager; +class IPluginSpec; +} -class CPluginView: public QDialog +namespace Core +{ + +class PluginView: public QDialog { Q_OBJECT public: - CPluginView(IPluginManager *pluginManager, QWidget *parent = 0); - ~CPluginView(); + PluginView(ExtensionSystem::IPluginManager *pluginManager, QWidget *parent = 0); + ~PluginView(); private Q_SLOTS: void updateList(); + void updateSettings(); private: - IPluginManager *_pluginManager; - Ui::CPluginView _ui; -}; /* class CPluginView */ + const int m_checkStateColumn; + QMap m_specToItem; + QStringList m_whiteList; + ExtensionSystem::IPluginManager *m_pluginManager; + Ui::PluginView m_ui; +}; /* class PluginView */ -} /* namespace NLQT */ +} /* namespace Core */ #endif // PLUGIN_VIEW_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui index 2fb0f568e..60a9b9c46 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui @@ -1,13 +1,13 @@ - CPluginView - + PluginView + 0 0 - 691 - 249 + 756 + 296 @@ -37,14 +37,6 @@ true - - 100 - - - - State - - Name @@ -126,7 +118,7 @@ closePushButton clicked() - CPluginView + PluginView accept() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt index d1dd346ba..b29f32152 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt @@ -10,10 +10,14 @@ SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h georges_editor_form.h - georges_dirtree_dialog.h) + georges_dirtree_dialog.h + georges_filesystem_model.h + georges_treeview_dialog.h + expandable_headerview.h) SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui - georges_dirtree_form.ui) + georges_dirtree_form.ui + georges_treeview_form.ui) SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc) @@ -32,7 +36,7 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) ADD_LIBRARY(ovqt_plugin_georges_editor MODULE ${SRC} ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS} ${OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_georges_editor ovqt_plugin_core nelmisc ${QT_LIBRARIES}) +TARGET_LINK_LIBRARIES(ovqt_plugin_georges_editor ovqt_plugin_core nelmisc nelgeorges ${QT_LIBRARIES}) NL_DEFAULT_PROPS(ovqt_plugin_georges_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Georges Editor") NL_ADD_RUNTIME_FLAGS(ovqt_plugin_georges_editor) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp new file mode 100644 index 000000000..7ae482824 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp @@ -0,0 +1,143 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +// Project includes +#include "expandable_headerview.h" + +// Qt includes +#include +#include +#include + +namespace Plugin +{ + + ExpandableHeaderView::ExpandableHeaderView(Qt::Orientation orientation, QWidget * parent) + : QHeaderView(orientation, parent), + m_expanded(true), + m_inDecoration(false) + { + } + + void ExpandableHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const + { + painter->save(); + QHeaderView::paintSection(painter, rect, logicalIndex); + painter->restore(); + + if (logicalIndex == 0) + { + QRect sectionRect = this->orientation() == Qt::Horizontal ? + QRect(this->sectionPosition(logicalIndex), 0, + this->sectionSize(logicalIndex), this->height()): + QRect(0, this->sectionPosition(logicalIndex), + this->width(), this->sectionSize(logicalIndex)); + + QStyleOptionHeader opt; + initStyleOption(&opt); + opt.iconAlignment = Qt::AlignVCenter; + + QVariant variant = this->model()->headerData(logicalIndex, this->orientation(), + Qt::DecorationRole); + opt.icon = qvariant_cast(variant); + if (opt.icon.isNull()) + { + opt.icon = qvariant_cast(variant); + } + QRect headerLabelRect = this->style()->subElementRect(QStyle::SE_HeaderLabel, &opt, this); + + QPixmap pixmap + = opt.icon.pixmap(this->style()->pixelMetric(QStyle::PM_SmallIconSize), + (opt.state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled); + QRect aligned = this->style()->alignedRect(opt.direction, QFlag(opt.iconAlignment), + pixmap.size(), headerLabelRect); + QRect inter = aligned.intersected(headerLabelRect); + + QStyleOption option; + option.rect = QRect(inter.x()-2,inter.y(),inter.width(),inter.height()); + if (m_expanded) + option.state = QStyle::State_Children | QStyle::State_Open; + else + option.state = QStyle::State_Children; + if (m_inDecoration) + option.state |= QStyle::State_MouseOver; + QApplication::style()->drawPrimitive(QStyle::PE_IndicatorBranch, &option, painter); + } + } + + void ExpandableHeaderView::mousePressEvent(QMouseEvent *e) + { + int section = logicalIndexAt(e->x()); + + if (section == 0 && m_inDecoration) { + if (m_expanded) + m_expanded = false; + else + m_expanded = true; + this->QHeaderView::mousePressEvent(e); + Q_EMIT headerClicked(section); + } + } + + void ExpandableHeaderView::mouseMoveEvent(QMouseEvent *e) + { + int section = this->logicalIndexAt(e->x()); + + if (section != 0) + return; + + bool tmp = m_inDecoration; + if (isPointInDecoration(section, e->pos())) + m_inDecoration = true; + else + m_inDecoration = false; + + if (m_inDecoration != tmp) + updateSection(0); + } + + bool ExpandableHeaderView::isPointInDecoration(int section, QPoint pos)const + { + QRect sectionRect = this->orientation() == Qt::Horizontal ? + QRect(this->sectionPosition(section), 0, + this->sectionSize(section), this->height()): + QRect(0, this->sectionPosition(section), + this->width(), this->sectionSize(section)); + QStyleOptionHeader opt; + this->initStyleOption(&opt); + opt.iconAlignment = Qt::AlignVCenter; + QVariant variant = this->model()->headerData(section, this->orientation(), + Qt::DecorationRole); + opt.icon = qvariant_cast(variant); + if (opt.icon.isNull()) + { + opt.icon = qvariant_cast(variant); + } + QRect headerLabelRect = this->style()->subElementRect(QStyle::SE_HeaderLabel, &opt, this); + // from qcommonstyle.cpp + if (opt.icon.isNull()) + { + return false; + } + QPixmap pixmap + = opt.icon.pixmap(this->style()->pixelMetric(QStyle::PM_SmallIconSize), + (opt.state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled); + QRect aligned = this->style()->alignedRect(opt.direction, QFlag(opt.iconAlignment), + pixmap.size(), headerLabelRect); + QRect inter = aligned.intersected(headerLabelRect); + return inter.contains(pos); + } +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h new file mode 100644 index 000000000..596bf5ba1 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h @@ -0,0 +1,49 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef EXPANDABLE_HEADERVIEW_H +#define EXPANDABLE_HEADERVIEW_H + +// Qt includes +#include + +namespace Plugin +{ + class ExpandableHeaderView : public QHeaderView + { + Q_OBJECT + public: + ExpandableHeaderView(Qt::Orientation orientation, QWidget * parent = 0); + + bool* expanded() { return &m_expanded; } + + protected: + void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const; + bool isPointInDecoration(int section, QPoint pos)const; + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + + private: + bool m_expanded; + bool m_inDecoration; + +Q_SIGNALS: + void headerClicked(int); + }; + +} /* namespace NLQT */ + +#endif // EXPANDABLE_HEADERVIEW_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp new file mode 100644 index 000000000..4d04bc6b5 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp @@ -0,0 +1,278 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "formdelegate.h" + +// NeL includes +#include +#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Project includes +#include "georgesform_model.h" +#include "georgesform_proxy_model.h" +#include "formitem.h" + +namespace Plugin +{ + + FormDelegate::FormDelegate(QObject *parent) + : QStyledItemDelegate(parent) + { + } + + QWidget *FormDelegate::createEditor(QWidget *parent, + const QStyleOptionViewItem & option , + const QModelIndex &index) const + { + const CGeorgesFormProxyModel * mp = dynamic_cast(index.model()); + const CGeorgesFormModel * m = dynamic_cast(mp->sourceModel()); + CFormItem *item = static_cast(mp->mapToSource(index).internalPointer()); + QString value = item->data(1).toString(); + + if (value.isEmpty() || !mp || !m) + return 0; + + CFormItem* curItem = m->getItem(mp->mapToSource(index)); + NLGEORGES::UFormElm *curElm = curItem->getFormElm(); + if (!curElm) { + // TODO: create new Element + return 0; + } + const NLGEORGES::UType *type = curElm->getType(); + if(type) + { + int numDefinitions = type->getNumDefinition(); + + if (numDefinitions) + { + std::string l, v; + QString label,value; + + QComboBox *editor = new QComboBox(parent); + for (int i = 0; i < numDefinitions; i++) + { + type->getDefinition(i,l,v); + label = l.c_str(); + value = v.c_str(); + editor->addItem(label); + } + return editor; + } + else + { + switch (type->getType()) + { + case NLGEORGES::UType::UnsignedInt: + case NLGEORGES::UType::SignedInt: + { + QSpinBox *editor = new QSpinBox(parent); + + //QString min = QString(type->getMin().c_str()); + //QString max = QString(type->getMax().c_str()); + //QString inc = QString(type->getIncrement().c_str()); + //nldebug(QString("min %1 max %2 inc %3").arg(min).arg(max).arg(inc).toStdString().c_str()); + + // TODO: use saved min/max values + editor->setMinimum(-99999); + editor->setMaximum(99999); + editor->setSingleStep(1); + return editor; + } + case NLGEORGES::UType::Double: + { + QDoubleSpinBox *editor = new QDoubleSpinBox(parent); + + //QString min = QString(type->getMin().c_str()); + //QString max = QString(type->getMax().c_str()); + //QString inc = QString(type->getIncrement().c_str()); + //nldebug(QString("min %1 max %2 inc %3").arg(min).arg(max).arg(inc).toStdString().c_str()); + + // TODO: use saved min/max values + editor->setMinimum(-99999); + editor->setMaximum(99999); + editor->setSingleStep(0.1); + editor->setDecimals(1); + return editor; + } + case NLGEORGES::UType::Color: + { + return new QColorDialog(); + } + default: // UType::String + { + QLineEdit *editor = new QLineEdit(parent); + return editor; + } + } + } + } + return 0; + } + + void FormDelegate::setEditorData(QWidget *editor, + const QModelIndex &index) const + { + const CGeorgesFormProxyModel * mp = dynamic_cast(index.model()); + const CGeorgesFormModel * m = dynamic_cast(mp->sourceModel()); + + const NLGEORGES::UType *type = m->getItem(mp->mapToSource(index))->getFormElm()->getType(); + int numDefinitions = type->getNumDefinition(); + QString value = index.model()->data(index, Qt::DisplayRole).toString(); + + if (numDefinitions) + { + QComboBox *cb = static_cast(editor); + cb->setCurrentIndex(cb->findText(value)); + } + else + { + switch (type->getType()) + { + case NLGEORGES::UType::UnsignedInt: + case NLGEORGES::UType::SignedInt: + { + QSpinBox *spinBox = static_cast(editor); + spinBox->setValue((int)value.toDouble()); + break; + } + case NLGEORGES::UType::Double: + { + QDoubleSpinBox *spinBox = static_cast(editor); + spinBox->setValue(value.toDouble()); + break; + } + case NLGEORGES::UType::Color: + { + break; + } + default: + { + QLineEdit *textEdit = static_cast(editor); + textEdit->setText(value); + break; + } + } + } + } + + void FormDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, + const QModelIndex &index) const + { + const CGeorgesFormProxyModel * mp = dynamic_cast(index.model()); + const CGeorgesFormModel * m = dynamic_cast(mp->sourceModel()); + + const NLGEORGES::UType *type = m->getItem(mp->mapToSource(index))->getFormElm()->getType(); + int numDefinitions = type->getNumDefinition(); + + if (numDefinitions) + { + QComboBox *comboBox = static_cast(editor); + QString value = comboBox->currentText(); + QString oldValue = index.model()->data(index, Qt::DisplayRole).toString(); + if (value == oldValue) + { + // nothing's changed + } + else + { + nldebug(QString("setModelData from %1 to %2") + .arg(oldValue).arg(value).toStdString().c_str()); + model->setData(index, value, Qt::EditRole); + } + } + else + { + switch (type->getType()) + { + case NLGEORGES::UType::UnsignedInt: + case NLGEORGES::UType::SignedInt: + { + QSpinBox *spinBox = static_cast(editor); + int value = spinBox->value(); + QString oldValue = index.model()->data(index, Qt::DisplayRole).toString(); + if (QString("%1").arg(value) == oldValue) + { + // nothing's changed + } + else + { + nldebug(QString("setModelData from %1 to %2") + .arg(oldValue).arg(value).toStdString().c_str()); + model->setData(index, value, Qt::EditRole); + } + break; + } + case NLGEORGES::UType::Double: + { + QDoubleSpinBox *spinBox = static_cast(editor); + double value = spinBox->value(); + QString oldValue = index.model()->data(index, Qt::DisplayRole).toString(); + if (QString("%1").arg(value) == oldValue) + { + // nothing's changed + } + else + { + nldebug(QString("setModelData from %1 to %2") + .arg(oldValue).arg(value).toStdString().c_str()); + model->setData(index, value, Qt::EditRole); + } + break; + } + case NLGEORGES::UType::Color: + { + break; // TODO + } + default: // UType::String + { + QLineEdit *textEdit = static_cast(editor); + QString value = textEdit->text(); + QString oldValue = index.model()->data(index, Qt::DisplayRole).toString(); + if (value == oldValue) + { + // nothing's changed + } + else + { + nldebug(QString("setModelData from %1 to %2") + .arg(oldValue).arg(value).toStdString().c_str()); + model->setData(index, value, Qt::EditRole); + } + break; + } + } + } + } + + void FormDelegate::updateEditorGeometry(QWidget *editor, + const QStyleOptionViewItem &option, const QModelIndex &index) const + { + QRect r = option.rect; + editor->setGeometry(r); + } +} /* namespace Plugin */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.h new file mode 100644 index 000000000..a309da1fc --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.h @@ -0,0 +1,41 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef FORMDELEGATE_H +#define FORMDELEGATE_H + +#include + +namespace Plugin +{ + + class FormDelegate : public QStyledItemDelegate + { + + public: + FormDelegate(QObject *parent = 0); + + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index) const; + void setEditorData(QWidget *editor, const QModelIndex &index) const; + void setModelData(QWidget *editor, QAbstractItemModel *model, + const QModelIndex &index) const; + void updateEditorGeometry(QWidget *editor, + const QStyleOptionViewItem &option, const QModelIndex &index) const; + }; + +} +#endif // FORMDELEGATE_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp new file mode 100644 index 000000000..205e18a52 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp @@ -0,0 +1,162 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "formitem.h" + +// Qt includes + +// NeL includes +#include +#include +#include + +namespace Plugin +{ + + CFormItem::CFormItem(NLGEORGES::UFormElm* elm, const QList &data, CFormItem *parent, + NLGEORGES::UFormElm::TWhereIsValue wV, NLGEORGES::UFormElm::TWhereIsNode wN) + { + parentItem = parent; + itemData = data; + formElm = elm; + whereV = wV; + whereN = wN; + } + + CFormItem::~CFormItem() + { + qDeleteAll(childItems); + } + + void CFormItem::appendChild(CFormItem *item) + { + childItems.append(item); + } + + CFormItem *CFormItem::child(int row) + { + return childItems.value(row); + } + + int CFormItem::childCount() const + { + return childItems.count(); + } + + int CFormItem::columnCount() const + { + //nlinfo("columnCount %d",itemData.count()); + return itemData.count(); + } + + QVariant CFormItem::data(int column) const + { + return itemData.value(column); + } + + CFormItem *CFormItem::parent() + { + return parentItem; + } + + int CFormItem::row() const + { + if (parentItem) + return parentItem->childItems.indexOf(const_cast(this)); + + return 0; + } + + bool CFormItem::setData(int column, const QVariant &value) + { + if (column < 0 || column >= itemData.size()) + return false; + + // TODO: default values + if (!formElm) + return false; + + itemData[column] = value; + if (formElm->isAtom()) + { + const NLGEORGES::UType *type = formElm->getType(); + if (type) + { + switch (type->getType()) + { + case NLGEORGES::UType::UnsignedInt: + case NLGEORGES::UType::SignedInt: + case NLGEORGES::UType::Double: + case NLGEORGES::UType::String: + if (parentItem->formElm->isArray()) + { + //((NLGEORGES::CFormElm*)parentItem->formElm);//->arrayInsertNodeByName( + //if(parentItem->formElm->getArrayNode(elmName, num)) + //{ + //} + + bool ok; + // TODO: the node can be renamed from eg "#0" to "foobar" + int arrayIndex = itemData[0].toString().remove("#").toInt(&ok); + if(ok) + { + NLGEORGES::UFormElm *elmt = 0; + if(parentItem->formElm->getArrayNode(&elmt, arrayIndex) && elmt) + { + if (elmt->isAtom()) + { + ((NLGEORGES::CFormElmAtom*)elmt)->setValue(value.toString().toStdString().c_str()); + nldebug(QString("array element string %1 %2") + .arg(itemData[0].toString()).arg(value.toString()) + .toStdString().c_str()); + } + } + } + } + else + { + if(parentItem->formElm->setValueByName( + value.toString().toStdString().c_str(), + itemData[0].toString().toStdString().c_str())) + { + nldebug(QString("string %1 %2") + .arg(itemData[0].toString()).arg(value.toString()) + .toStdString().c_str()); + } + else + { + nldebug(QString("FAILED string %1 %2") + .arg(itemData[0].toString()).arg(value.toString()) + .toStdString().c_str()); + } + } + break; + case NLGEORGES::UType::Color: + nldebug("Color is TODO"); + break; + default: + break; + } + } + } + else + { + nldebug("setting sth other than Atom"); + } + //formElm->setValueByName(); + return true; + } +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.h new file mode 100644 index 000000000..b85b12275 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.h @@ -0,0 +1,69 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef FORMITEM_H +#define FORMITEM_H + +// NeL includes +#include + +// Qt includes +#include +#include + +namespace Plugin +{ + + class CFormItem + + { + public: + CFormItem(NLGEORGES::UFormElm *elm, const QList &data, + CFormItem *parent = 0, + NLGEORGES::UFormElm::TWhereIsValue = NLGEORGES::UFormElm::ValueForm, + NLGEORGES::UFormElm::TWhereIsNode = NLGEORGES::UFormElm::NodeForm); + ~CFormItem(); + + void appendChild(CFormItem *child); + + CFormItem *child(int row); + int childCount() const; + int columnCount() const; + QVariant data(int column) const; + int row() const; + CFormItem *parent(); + bool setData(int column, const QVariant &value); + NLGEORGES::UFormElm* getFormElm() {return formElm;} + NLGEORGES::UFormElm::TWhereIsValue valueFrom() + { + return whereV; + } + NLGEORGES::UFormElm::TWhereIsNode nodeFrom() + { + return whereN; + } + + private: + QList childItems; + QList itemData; + CFormItem *parentItem; + NLGEORGES::UFormElm* formElm; + NLGEORGES::UFormElm::TWhereIsValue whereV; + NLGEORGES::UFormElm::TWhereIsNode whereN; + }; // CFormItem + +} +#endif // FORMITEM_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp new file mode 100644 index 000000000..b93f93ec4 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp @@ -0,0 +1,64 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "georges.h" +#include "nel/misc/o_xml.h" + +// STL includes + +// NeL includes +#include +#include +#include + +// Project includes + +using namespace NLGEORGES; + +namespace Plugin +{ + + CGeorges::CGeorges(): FormLoader(0) + { + FormLoader = UFormLoader::createLoader(); + } + + CGeorges::~CGeorges() + { + } + + UForm *CGeorges::loadForm(std::string formName) + { + UForm *form = FormLoader->loadForm(formName.c_str()); + + return form; + } + + UFormDfn *CGeorges::loadFormDfn(std::string formName) + { + UFormDfn *formdfn = FormLoader->loadFormDfn(formName.c_str()); + + return formdfn; + } + + UType *CGeorges::loadFormType(std::string formName) + { + UType *type = FormLoader->loadFormType(formName.c_str()); + + return type; + } + +} /* namespace Plugin */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.h new file mode 100644 index 000000000..eb9a6b7da --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.h @@ -0,0 +1,69 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef GEORGES_H +#define GEORGES_H + +// Misc + +// STL includes +#include + +// NeL includes + +// Qt includes + +// Project includes + +namespace NLGEORGES +{ + class UType; + class UForm; + class UFormDfn; + class UFormLoader; +} + +using namespace NLGEORGES; + +namespace Plugin +{ + + /** + @class CGeorges + A CGeorges class loading and viewing sheets. + */ + class CGeorges + { + public: + /// Default constructor. + CGeorges(); + virtual ~CGeorges(); + + // Load the given form root + UForm* loadForm(std::string formName); + // Load a dfn + UFormDfn* loadFormDfn(std::string formName); + // Load a type + UType *loadFormType (std::string formName); + + // A form loader + UFormLoader *FormLoader; + + };/* class CGeorges */ + +} /* namespace Plugin */ + +#endif // GEORGES_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp index f7e250cce..de7a105ab 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp @@ -23,20 +23,30 @@ // NeL includes -//using namespace NLMISC; - namespace Plugin { CGeorgesDirTreeDialog::CGeorgesDirTreeDialog(QString ldPath, QWidget *parent) - :QDockWidget(parent), m_ldPath(ldPath) + :QDockWidget(parent), + m_ldPath(ldPath) { m_ui.setupUi(this); + m_ui.filterResetButton->setIcon( + QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton)); + m_dirModel = new CGeorgesFileSystemModel(m_ldPath); + //m_proxyModel = new CGeorgesFileSystemProxyModel(this); + + //m_proxyModel->setSourceModel(m_dirModel); m_ui.dirTree->setModel(m_dirModel); + // TODO: filtering in tree model is ... complicated - so hide it for now + m_ui.filterLineEdit->hide(); + m_ui.filterResetButton->hide(); + m_ui.label->hide(); + if (m_dirModel->isCorrectLDPath()) { m_dirModel->setRootPath(m_ldPath); @@ -61,7 +71,6 @@ CGeorgesDirTreeDialog::~CGeorgesDirTreeDialog() void CGeorgesDirTreeDialog::fileSelected(QModelIndex index) { - QString name; if (index.isValid() && !m_dirModel->isDir(index)) { Q_EMIT selectedForm(m_dirModel->fileName(index)); @@ -81,8 +90,12 @@ void CGeorgesDirTreeDialog::ldPathChanged(QString path) m_ldPath = path; delete m_dirModel; + //delete m_proxyModel; m_dirModel = new CGeorgesFileSystemModel(m_ldPath); + //m_proxyModel = new CGeorgesFileSystemProxyModel(this); + + //m_proxyModel->setSourceModel(m_dirModel); m_ui.dirTree->setModel(m_dirModel); if (m_dirModel->isCorrectLDPath()) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h index 3079f76c2..fa783bca0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h @@ -45,6 +45,7 @@ private: Ui::CGeorgesDirTreeDialog m_ui; CGeorgesFileSystemModel *m_dirModel; + //CGeorgesFileSystemProxyModel *m_proxyModel; QString m_ldPath; Q_SIGNALS: @@ -54,7 +55,6 @@ private Q_SLOTS: void fileSelected(QModelIndex index); void changeFile(QString file); - friend class CMainWindow; }; /* CGEorgesDirTreeDialog */ } /* namespace NLQT */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui index 8731d1ca8..4a429af1f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui @@ -19,7 +19,7 @@ 200 - 111 + 141 @@ -36,7 +36,7 @@ - + @@ -46,9 +46,37 @@ + + + + + + + ... + + + + :/images/ic_nel_georges_editor.png:/images/ic_nel_georges_editor.png + + + true + + + + + + + Filter + + + - + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp index aa614a161..f67be6471 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp @@ -18,6 +18,7 @@ #include "georges_editor_form.h" #include "georges_editor_constants.h" #include "georges_dirtree_dialog.h" +#include "georges_treeview_dialog.h" #include "../core/icore.h" #include "../core/imenu_manager.h" @@ -30,110 +31,257 @@ #include #include #include +#include namespace Plugin { -GeorgesEditorForm::GeorgesEditorForm(QWidget *parent) - : QMainWindow(parent), - m_georgesDirTreeDialog(0) -{ - m_ui.setupUi(this); - - m_undoStack = new QUndoStack(this); - - _openAction = new QAction(tr("&Open..."), this); - _openAction->setIcon(QIcon(Core::Constants::ICON_OPEN)); - _openAction->setShortcut(QKeySequence::Open); - _openAction->setStatusTip(tr("Open an existing file")); - connect(_openAction, SIGNAL(triggered()), this, SLOT(open())); - - _newAction = new QAction(tr("&New..."), this); - _newAction->setIcon(QIcon(Core::Constants::ICON_NEW)); - _newAction->setShortcut(QKeySequence::New); - _newAction->setStatusTip(tr("Create a new file")); - connect(_newAction, SIGNAL(triggered()), this, SLOT(newFile())); - - _saveAction = new QAction(tr("&Save..."), this); - _saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE)); - _saveAction->setShortcut(QKeySequence::Save); - _saveAction->setStatusTip(tr("Save the current file")); - connect(_saveAction, SIGNAL(triggered()), this, SLOT(save())); - - _fileToolBar = addToolBar(tr("&File")); - _fileToolBar->addAction(_openAction); - _fileToolBar->addAction(_newAction); - _fileToolBar->addAction(_saveAction); - - readSettings(); - - // create leveldesign directory tree dockwidget - m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this); - addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog); - //m_georgesDirTreeDialog->setVisible(false); - connect(Core::ICore::instance(), SIGNAL(changeSettings()), - this, SLOT(settingsChanged())); -} - -GeorgesEditorForm::~GeorgesEditorForm() -{ - writeSettings(); -} - -QUndoStack *GeorgesEditorForm::undoStack() const -{ - return m_undoStack; -} - -void GeorgesEditorForm::open() -{ - // TODO: FileDialog & loadFile(); - //QString fileName = QFileDialog::getOpenFileName(); - //loadFile(fileName); -} - -void GeorgesEditorForm::newFile() -{ - -} - -void GeorgesEditorForm::save() -{ - -} - -void GeorgesEditorForm::readSettings() -{ - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(Constants::GEORGES_EDITOR_SECTION); - settings->endGroup(); - - settings->beginGroup(Core::Constants::DATA_PATH_SECTION); - m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString(); - settings->endGroup(); -} - -void GeorgesEditorForm::writeSettings() -{ - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(Constants::GEORGES_EDITOR_SECTION); - settings->endGroup(); - settings->sync(); -} - -void GeorgesEditorForm::settingsChanged() -{ - QSettings *settings = Core::ICore::instance()->settings(); - - settings->beginGroup(Core::Constants::DATA_PATH_SECTION); - QString oldLDPath = m_leveldesignPath; - m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString(); - settings->endGroup(); - - if (oldLDPath != m_leveldesignPath) + GeorgesEditorForm::GeorgesEditorForm(QWidget *parent) + : QMainWindow(parent), + m_georgesDirTreeDialog(0), + m_mainDock(0), + m_lastActiveDock(0) { - m_georgesDirTreeDialog->ldPathChanged(m_leveldesignPath); - } -} + m_ui.setupUi(this); + // background for the mainwindow + QString css = "QWidget#centralwidget {"; + css += "image: url(:/images/ic_nel_georges_editor.png);"; + css += "}"; + + // add new mainwindow for sheet dockwidgets + QWidget *widget = new QWidget(this); + widget->setObjectName("centralwidget"); + widget->setStyleSheet(css); + setCentralWidget(widget); + QGridLayout *layout = new QGridLayout(widget); + layout->setContentsMargins(0,0,0,0); + widget->setLayout(layout); + m_mainDock = new QMainWindow(this); + m_mainDock->setDockNestingEnabled(true); + layout->addWidget(m_mainDock); + + m_undoStack = new QUndoStack(this); + + Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager(); + m_openAction = menuManager->action(Core::Constants::OPEN); + + m_newAction = new QAction(tr("&New..."), this); + m_newAction->setIcon(QIcon(Core::Constants::ICON_NEW)); + m_newAction->setShortcut(QKeySequence::New); + m_newAction->setStatusTip(tr("Create a new file")); + connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile())); + + m_saveAction = new QAction(tr("&Save..."), this); + m_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE)); + m_saveAction->setShortcut(QKeySequence::Save); + m_saveAction->setStatusTip(tr("Save the current file")); + connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save())); + + m_fileToolBar = addToolBar(tr("&File")); + m_fileToolBar->addAction(m_openAction); + m_fileToolBar->addAction(m_newAction); + m_fileToolBar->addAction(m_saveAction); + + m_saveAction->setEnabled(false); + + readSettings(); + + // create leveldesign directory tree dockwidget + m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this); + addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog); + restoreDockWidget(m_georgesDirTreeDialog); + + connect(Core::ICore::instance(), SIGNAL(changeSettings()), + this, SLOT(settingsChanged())); + connect(m_georgesDirTreeDialog, SIGNAL(selectedForm(const QString)), + this, SLOT(loadFile(const QString))); + connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)), + this, SLOT(focusChanged(QWidget*, QWidget*))); + } + + GeorgesEditorForm::~GeorgesEditorForm() + { + writeSettings(); + } + + QUndoStack *GeorgesEditorForm::undoStack() const + { + return m_undoStack; + } + + void GeorgesEditorForm::open() + { + /*qDebug() << "GeorgesEditorForm::open()"; + if (!m_dockedWidgets.size()) + { + m_dockedWidgets.append(new CGeorgesTreeViewDialog(m_mainDock)); + m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last()); + } + else + { + m_dockedWidgets.append(new CGeorgesTreeViewDialog(m_mainDock)); + Q_ASSERT(m_dockedWidgets.size() > 1); + m_mainDock->tabifyDockWidget(m_dockedWidgets.at(m_dockedWidgets.size() - 2), m_dockedWidgets.last()); + }*/ + + // TODO: FileDialog & loadFile(); + //m_mainDock->addDockWidget(Qt::TopDockWidgetArea, new CGeorgesTreeViewDialog(m_mainDock, true)); + //m_mainDock->addDockWidget(Qt::LeftDockWidgetArea, new CGeorgesTreeViewDialog(m_mainDock, true)); + //QString fileName = QFileDialog::getOpenFileName(); + //loadFile(fileName); + } + + void GeorgesEditorForm::newFile() + { + + } + + void GeorgesEditorForm::save() + { + + } + + void GeorgesEditorForm::readSettings() + { + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(Constants::GEORGES_EDITOR_SECTION); + + restoreGeometry(settings->value("geometry").toByteArray()); + restoreState(settings->value("windowState").toByteArray()); + + settings->endGroup(); + + settings->beginGroup(Core::Constants::DATA_PATH_SECTION); + m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString(); + settings->endGroup(); + } + + void GeorgesEditorForm::writeSettings() + { + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(Constants::GEORGES_EDITOR_SECTION); + + settings->setValue("geometry", saveGeometry()); + settings->setValue("windowState", saveState()); + + settings->endGroup(); + settings->sync(); + } + + void GeorgesEditorForm::settingsChanged() + { + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::DATA_PATH_SECTION); + QString oldLDPath = m_leveldesignPath; + m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString(); + settings->endGroup(); + + if (oldLDPath != m_leveldesignPath) + { + m_georgesDirTreeDialog->ldPathChanged(m_leveldesignPath); + } + } + + void GeorgesEditorForm::loadFile(const QString fileName) + { + QFileInfo info(fileName); + + if (!m_dockedWidgets.size()) + { + CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock); + m_lastActiveDock = dock; + m_dockedWidgets.append(dock); + + m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last()); + connect(m_dockedWidgets.last(), SIGNAL(closing()), + this, SLOT(closingTreeView())); + connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)), + m_dockedWidgets.last(), SLOT(checkVisibility(bool))); + } + else + { + + Q_FOREACH(CGeorgesTreeViewDialog *wgt, m_dockedWidgets) + { + if (info.fileName() == wgt->loadedForm) + { + wgt->raise(); + return; + } + } + CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock); + m_dockedWidgets.append(dock); + + connect(m_dockedWidgets.last(), SIGNAL(closing()), + this, SLOT(closingTreeView())); + connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)), + m_dockedWidgets.last(), SLOT(checkVisibility(bool))); + Q_ASSERT(m_dockedWidgets.size() > 1); + m_mainDock->tabifyDockWidget(m_dockedWidgets.at(m_dockedWidgets.size() - 2), m_dockedWidgets.last()); + } + CForm *form = m_dockedWidgets.last()->getFormByName(info.fileName()); + if (form) + { + m_dockedWidgets.last()->setForm(form); + m_dockedWidgets.last()->loadFormIntoDialog(form); + QApplication::processEvents(); + connect(m_dockedWidgets.last(), SIGNAL(modified()), + this, SLOT(setModified())); + m_dockedWidgets.last()->raise(); + connect(m_dockedWidgets.last(), SIGNAL(changeFile(QString)), + m_georgesDirTreeDialog, SLOT(changeFile(QString))); + } + else + { + m_dockedWidgets.last()->close(); + } + } + + void GeorgesEditorForm::closingTreeView() + { + //qDebug() << "closingTreeView"; + m_dockedWidgets.removeAll(qobject_cast(sender())); + if (qobject_cast(sender()) == m_lastActiveDock) + m_lastActiveDock = 0; + } + + void GeorgesEditorForm::setModified () + { + qDebug() << "setModified"; + if (m_lastActiveDock) + m_saveAction->setEnabled(m_lastActiveDock->isModified()); + else + m_saveAction->setEnabled(false); + } + + void GeorgesEditorForm::focusChanged ( QWidget * old, QWidget * now ) + { + if (now) + { + // ugly, UGLY hack for compensating QDockWidgets failure in focus API + if (now->objectName() == "treeView" || + now->objectName() == "checkBoxDefaults" || + now->objectName() == "checkBoxParent" || + now->objectName() == "commentEdit") + { + QWidget *dlg = 0; + QApplication::focusWidget()? + QApplication::focusWidget()->parentWidget()? + QApplication::focusWidget()->parentWidget()->parentWidget()? + QApplication::focusWidget()->parentWidget()->parentWidget()->parentWidget()? + QApplication::focusWidget()->parentWidget()->parentWidget()->parentWidget()->parentWidget()? + QApplication::focusWidget()->parentWidget()->parentWidget()->parentWidget()->parentWidget()->parentWidget()? + dlg=QApplication::focusWidget()->parentWidget()->parentWidget()->parentWidget()->parentWidget()->parentWidget():dlg=0:dlg=0:dlg=0:dlg=0:dlg=0:dlg=0; + CGeorgesTreeViewDialog *active = qobject_cast(dlg); + if(active) + { + //qDebug() << "focusChanged" << active->loadedForm; + m_lastActiveDock = active; + m_saveAction->setEnabled(active->isModified()); + } + } + } + } } /* namespace Plugin */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h index 96fceb4ed..6b270ca3d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h @@ -27,6 +27,7 @@ namespace Plugin { class CGeorgesDirTreeDialog; +class CGeorgesTreeViewDialog; class GeorgesEditorForm: public QMainWindow { Q_OBJECT @@ -39,9 +40,14 @@ public: public Q_SLOTS: void open(); + void loadFile(const QString fileName); void newFile(); void save(); void settingsChanged(); + void closingTreeView(); + void setModified(); + + void focusChanged(QWidget *old, QWidget *now); private: void readSettings(); @@ -51,12 +57,17 @@ private: Ui::GeorgesEditorForm m_ui; CGeorgesDirTreeDialog *m_georgesDirTreeDialog; - QToolBar *_fileToolBar; - QAction *_openAction; - QAction *_newAction; - QAction *_saveAction; + QToolBar *m_fileToolBar; + QAction *m_openAction; + QAction *m_newAction; + QAction *m_saveAction; QString m_leveldesignPath; + + QMainWindow *m_mainDock; + + QList m_dockedWidgets; + CGeorgesTreeViewDialog *m_lastActiveDock; }; /* class GeorgesEditorForm */ } /* namespace Plugin */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.ui index 905814cc7..3f8cde0f7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.ui @@ -13,12 +13,16 @@ Georges Editor + + + QWidget#centralwidget { image: url(:/images/ic_nel_georges_editor.png); } + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp index a97188751..425db7841 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp @@ -74,7 +74,7 @@ QString GeorgesEditorPlugin::name() const QString GeorgesEditorPlugin::version() const { - return "0.2"; + return "0.4"; } QString GeorgesEditorPlugin::vendor() const @@ -90,8 +90,9 @@ QString GeorgesEditorPlugin::description() const QStringList GeorgesEditorPlugin::dependencies() const { QStringList list; - list.append(Core::Constants::OVQT_CORE_PLUGIN); - list.append("ObjectViewer"); // TODO + // TODO + //list.append(Core::Constants::OVQT_CORE_PLUGIN); + //list.append("ObjectViewer"); return list; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp index 20cb30b33..4e021f681 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp @@ -28,6 +28,10 @@ CGeorgesFileSystemModel::CGeorgesFileSystemModel(QString ldPath, QObject *parent m_correct(false) { checkLDPath(); + + // this yielded no relevant performance boost on my observations + //connect(this, SIGNAL(directoryLoaded(QString)), + // this, SLOT(dir(const QString))); } CGeorgesFileSystemModel::~CGeorgesFileSystemModel() @@ -35,6 +39,23 @@ CGeorgesFileSystemModel::~CGeorgesFileSystemModel() } +void CGeorgesFileSystemModel::dir(const QString &dir) +{ + // in theory this should prefetch all directory entries for the + // filesystem model to speed up later work + QModelIndex i = index(dir); + + if (hasChildren(i)) { + int childCount = rowCount(i); + for (int c=0; cnode(parent); +// return (!indexNode->populatedChildren);*/ +//} + +//CGeorgesFileSystemProxyModel::CGeorgesFileSystemProxyModel(QObject *parent) : QSortFilterProxyModel(parent) +//{ +// setFilterCaseSensitivity(Qt::CaseInsensitive); +//} + +//bool CGeorgesFileSystemProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const +//{ + // TODO this is not perfect as it could be + // eg it should filter all dirs which have no entry + //QModelIndex idx = sourceModel()->index(source_row, 0, source_parent); + //if (sourceModel()->hasChildren(idx)) + //{ + // QString d = sourceModel()->data(idx).toString(); + // //QModelIndex i = mapFromSource(source_parent); + // //if (hasChildren(i)) { + // int childCount = sourceModel()->rowCount(idx); + // for (int c=0; cindex(c, 0, idx); + // if (child.isValid()) { + // bool test = filterAcceptsRow(c, child); + // }*/ + // } + // return true; + //} + //return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); +//} + +//QVariant CGeorgesFileSystemProxyModel::data ( const QModelIndex & index, int role ) const +//{ +// if (role == Qt::DisplayRole) +// { +// QString test = QSortFilterProxyModel::data(index, role).toString(); +// return test.append(QString(" (%1/%2)")). +// arg(rowCount(index)). +// arg(sourceModel()->rowCount(mapToSource(index))); +// } +// return QSortFilterProxyModel::data(index, role); +//} } /* namespace NLQT */ /* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h index 775dcb18d..03eb5ecc2 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h @@ -18,32 +18,61 @@ #define GEORGES_FILESYSTEM_MODEL_H #include +#include namespace Plugin { -class CGeorgesFileSystemModel : public QFileSystemModel -{ - QString m_ldPath; - -public: - CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0); - ~CGeorgesFileSystemModel(); - - int columnCount(const QModelIndex &/*parent*/) const; - int rowCount(const QModelIndex &/*parent*/) const; - - QVariant data(const QModelIndex& index, int role) const ; - - bool isCorrectLDPath() + class CGeorgesFileSystemModel : public QFileSystemModel { - return m_correct; - } - void checkLDPath(); + Q_OBJECT -private: - bool m_correct; -};/* class CGeorgesFileSystemModel */ + public: + CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0); + ~CGeorgesFileSystemModel(); + + int columnCount(const QModelIndex &/*parent*/) const; + int rowCount(const QModelIndex &/*parent*/) const; + + QVariant data(const QModelIndex& index, int role) const ; + + bool isCorrectLDPath() + { + return m_correct; + } + bool isInitialized() + { + return m_initialized; + } + void setInitialized( bool init) + { + m_initialized = init; + } + void checkLDPath(); + + private: + bool m_correct; + bool m_initialized; + QString m_ldPath; + +private Q_SLOTS: + void dir(const QString&); + };/* class CGeorgesFileSystemModel */ + + // A modified QSortFilterProxyModel that always accepts the root nodes in the tree + // so filtering is only done on the children. + //class CGeorgesFileSystemProxyModel : public QSortFilterProxyModel + //{ + // Q_OBJECT + + //public: + // CGeorgesFileSystemProxyModel(QObject *parent = 0); + + //QVariant data(const QModelIndex& index, int role) const ; + + //protected: + // bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; + //}; } /* namespace NLQT */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp new file mode 100644 index 000000000..13b0dab03 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp @@ -0,0 +1,388 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "georges_treeview_dialog.h" + +// Qt includes +#include +#include +#include +#include + +// NeL includes +#include +#include +#include +#include + +// Project includes +#include "georges.h" +#include "georgesform_model.h" +#include "georgesform_proxy_model.h" +#include "formitem.h" +#include "formdelegate.h" +#include "expandable_headerview.h" + +using namespace NLMISC; +using namespace NLGEORGES; + +namespace Plugin +{ + + CGeorgesTreeViewDialog::CGeorgesTreeViewDialog(QWidget *parent /*= 0*/) + : QDockWidget(parent), + m_header(0), + m_modified(false) + { + m_georges = new CGeorges; + + loadedForm = ""; + + m_ui.setupUi(this); + m_header = new ExpandableHeaderView(Qt::Horizontal, m_ui.treeView); + m_ui.treeView->setHeader(m_header); + m_ui.treeView->header()->setResizeMode(QHeaderView::ResizeToContents); + m_ui.treeView->header()->setStretchLastSection(true); + m_ui.treeViewTabWidget->setTabEnabled (2,false); + + m_ui.checkBoxParent->setStyleSheet("background-color: rgba(0,255,0,30)"); + m_ui.checkBoxDefaults->setStyleSheet("background-color: rgba(255,0,0,30)"); + m_form = 0; + + FormDelegate *formdelegate = new FormDelegate(this); + m_ui.treeView->setItemDelegateForColumn(1, formdelegate); + + connect(m_ui.treeView, SIGNAL(doubleClicked (QModelIndex)), + this, SLOT(doubleClicked (QModelIndex))); + connect(m_ui.checkBoxParent, SIGNAL(toggled(bool)), + this, SLOT(filterRows())); + connect(m_ui.checkBoxDefaults, SIGNAL(toggled(bool)), + this, SLOT(filterRows())); + connect(m_header, SIGNAL(headerClicked(int)), + this, SLOT(headerClicked(int))); + } + + CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog() + { + delete m_form; + qDebug() << "DTOR"; + } + + void CGeorgesTreeViewDialog::headerClicked(int section) + { + if (section == 0) + if (*(m_header->expanded())) + m_ui.treeView->expandAll(); + else + m_ui.treeView->collapseAll(); + } + + void CGeorgesTreeViewDialog::setForm(const CForm *form) + { + m_form = (UForm*)form; + } + + CForm* CGeorgesTreeViewDialog::getFormByName(const QString formName) + { + if(NLMISC::CPath::exists(formName.toStdString())) + { + return (CForm*)m_georges->loadForm(formName.toStdString()); + } + //else + //{ + // CForm *form = 0; + // // Load the DFN + // std::string extStr = NLMISC::CFile::getExtension( formName.toStdString() ); + // QString dfnName = QString("%1.dfn").arg(extStr.c_str()); + // UFormDfn *formdfn; + // if (NLMISC::CPath::exists(dfnName.toStdString())) + // { + // formdfn = _georges->loadFormDfn (dfnName.toStdString()); + // if (!formdfn) + // { + // nlwarning("Failed to load dfn: %s", dfnName.toStdString().c_str()); + // return 0; + // } + // } + // else + // { + // nlwarning("Cannot find dfn: %s", dfnName.toStdString().c_str()); + // return 0; + // } + + // form = new CForm; + + // // Build the root element + // ((CFormElmStruct*)&form->getRootNode())->build((CFormDfn*)formdfn); + + // uint i; + // for (i=0; iHeldElements[i]))->build ((CFormDfn*)formdfn); + // } + // return form; + //} + return 0; + } + + void CGeorgesTreeViewDialog::loadFormIntoDialog(CForm *form) + { + + if(form) + m_form = form; + else + return; + + UFormElm *root = 0; + root = &m_form->getRootNode(); + + QStringList parents; + for (uint i = 0; i < m_form->getNumParent(); i++) + { + UForm *u = m_form->getParentForm(i); + parents << u->getFilename().c_str(); + } + + QString comments; + comments = m_form->getComment().c_str(); + + if (!comments.isEmpty()) + { + m_ui.treeViewTabWidget->setTabEnabled (1,true); + m_ui.commentEdit->setPlainText(comments); + } + + QStringList strList; + std::set dependencies; + m_form->getDependencies(dependencies); + + QMap< QString, QStringList> deps; + Q_FOREACH(std::string str, dependencies) + { + QString file = str.c_str(); + if (str == m_form->getFilename()) continue; + deps[file.remove(0,file.indexOf(".")+1)] << str.c_str(); + } + nlinfo("typ's %d",deps["typ"].count()); + nlinfo("dfn's %d",deps["dfn"].count()); + + //nlwarning(strList.join(";").toStdString().c_str()); + if (root) + { + loadedForm = m_form->getFilename().c_str(); + + CGeorgesFormModel *model = new CGeorgesFormModel(root,deps,comments,parents,m_header->expanded()); + CGeorgesFormProxyModel *proxyModel = new CGeorgesFormProxyModel(); + proxyModel->setSourceModel(model); + m_ui.treeView->setModel(proxyModel); + m_ui.treeView->expandAll(); + // this is a debug output row + m_ui.treeView->hideColumn(3); + + filterRows(); + + // //_ui.treeView->setRowHidden(0,QModelIndex(),true); + connect(model, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)), + this, SLOT(modifiedFile())); + + setWindowTitle(loadedForm); + // //Modules::mainWin().getTabBar(); + } + } + + void CGeorgesTreeViewDialog::addParentForm(CForm *form) + { + //((CForm*)_form)->insertParent(((CForm*)_form)->getParentCount(), form->getFilename().c_str(), form); + } + + void CGeorgesTreeViewDialog::modifiedFile( ) + { + if (!m_modified) + { + m_modified = true; + setWindowTitle(windowTitle() + "*"); + } + Q_EMIT modified(); + } + + void CGeorgesTreeViewDialog::write( ) + { + + //COFile file; + //std::string s = CPath::lookup(loadedForm.toStdString(), false); + //if (file.open (s)) + //{ + // try + // { + // if (loadedForm.contains(".typ")) + // { + // //nlassert (Type != NULL); + + // //// Write the file + // //// Modified ? + // //if (IsModified ()) + // //{ + // // Type->Header.MinorVersion++; + // // flushValueChange (); + // //} + // //Type->write (xmlStream.getDocument (), theApp.Georges4CVS); + // //modify (NULL, NULL, false); + // //flushValueChange (); + // //UpdateAllViews (NULL); + // //return TRUE; + // } + // else if (loadedForm.contains(".dfn")) + // { + // //nlassert (Dfn != NULL); + + // //// Write the file + // //if (IsModified ()) + // //{ + // // Dfn->Header.MinorVersion++; + // // flushValueChange (); + // //} + // //Dfn->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS); + // //modify (NULL, NULL, false); + // //UpdateAllViews (NULL); + // //return TRUE; + // } + // else + // { + // nlassert (_form != NULL); + + // // Write the file + // /*if (IsModified ()) + // { + // ((CForm*)(UForm*)Form)->Header.MinorVersion++; + // }*/ + // //((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS); + // _form->write(file, false); + // setWindowTitle(windowTitle().remove("*")); + // _modified = false; + // //if (strcmp (xmlStream.getErrorString (), "") != 0) + // //{ + // // char message[512]; + // // smprintf (message, 512, "Error while saving file: %s", xmlStream.getErrorString ()); + // //theApp.outputError (message); + // //} + // //modify (NULL, NULL, false); + // //flushValueChange (); + // //UpdateAllViews (NULL); + + // // Get the left view + // //CView* pView = getLeftView (); + // } + // } + // catch (Exception &e) + // { + // nlerror("Error while loading file: %s", e.what()); + // } + //} + //else + //{ //if (!file.open()) + // nlerror("Can't open the file %s for writing.", s.c_str()); + //} + } + + void CGeorgesTreeViewDialog::doubleClicked ( const QModelIndex & index ) + { + // TODO: this is messy :( perhaps this can be done better + CGeorgesFormProxyModel * proxyModel = + dynamic_cast(m_ui.treeView->model()); + CGeorgesFormModel *model = + dynamic_cast(proxyModel->sourceModel()); + QModelIndex sourceIndex = proxyModel->mapToSource(index); + + CFormItem *item = model->getItem(sourceIndex); + + if (item->parent() && item->parent()->data(0) == "parents") + { + Q_EMIT changeFile(CPath::lookup(item->data(0).toString().toStdString(),false).c_str()); + } + + //// col containing additional stuff like icons + //if (index.column() == 2) + //{ + // QModelIndex in2 = m->index(in.row(),in.column()-1,in.parent()); + // CFormItem *item = m->getItem(in2); + // QString value = item->data(1).toString(); + + // QString path = CPath::lookup(value.toStdString(),false).c_str(); + + // if(value.contains(".tga") || value.contains(".png")) + // { + // QString file = QFileDialog::getOpenFileName( + // this, + // "Select a new image", + // path, + // "Images (*.png *.tga)" + // ); + // if (file.isNull()) + // return; + // QFileInfo info = QFileInfo(file); + + // // TODO? + // // right way would be another delegate but im too lazy :) + // // so for now i just call it directly + // m->setData(in2, info.fileName()); + // return; + // } + // else + // { + // if (path.contains(".shape") || path.contains(".ps")) + // { + // if (Modules::objViewInt()) + // { + // Modules::objViewInt()->resetScene(); + // //Modules::config().configRemapExtensions(); + // Modules::objViewInt()->loadMesh(path.toStdString(),""); + // } + // return; + // } + // } + + // // open eg parent files + // if (!path.isEmpty()) + // Q_EMIT changeFile(path); + + //} + } + + void CGeorgesTreeViewDialog::closeEvent(QCloseEvent *event) + { + Q_EMIT closing(); + deleteLater(); + } + + void CGeorgesTreeViewDialog::checkVisibility(bool visible) { + // this prevents invisible docks from getting tab focus + qDebug() << "checkVisibility" << visible; + setEnabled(visible); + //if (visible) + Q_EMIT modified(); + } + + void CGeorgesTreeViewDialog::filterRows() + { + CGeorgesFormProxyModel * mp = dynamic_cast(m_ui.treeView->model()); + CGeorgesFormModel *m = dynamic_cast(mp->sourceModel()); + if (m) { + m->setShowParents(m_ui.checkBoxParent->isChecked()); + m->setShowDefaults(m_ui.checkBoxDefaults->isChecked()); + } + } + +} /* namespace NLQT */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.h new file mode 100644 index 000000000..4992c9b23 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.h @@ -0,0 +1,96 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef GEORGES_TREEVIEWER_DIALOG_H +#define GEORGES_TREEVIEWER_DIALOG_H + +#include "ui_georges_treeview_form.h" +#include "expandable_headerview.h" + +// Qt includes +#include + +// STL includes + +// NeL includes + +// Project includes + +namespace NLGEORGES +{ + class UForm; + class CForm; +} + +using namespace NLGEORGES; + +namespace Plugin +{ + + class CGeorges; + + class CGeorgesTreeViewDialog: public QDockWidget + { + Q_OBJECT + + public: + CGeorgesTreeViewDialog(QWidget *parent = 0); + ~CGeorgesTreeViewDialog(); + + bool isModified() {return m_modified;} + void setModified(bool m) {m_modified = m;} + + CForm* getFormByName(const QString); + void addParentForm(CForm *form); + + void write ( ); + + QTabWidget* tabWidget() { return m_ui.treeViewTabWidget; } + + QString loadedForm; + + protected: + void closeEvent(QCloseEvent *event); + + Q_SIGNALS: + void changeFile(QString); + void modified(); + void closing(); + + public Q_SLOTS: + void setForm(const CForm*); + void loadFormIntoDialog(CForm *form = 0); + void modifiedFile( ); + void checkVisibility(bool); + + private Q_SLOTS: + void doubleClicked ( const QModelIndex & index ); + void filterRows(); + void headerClicked(int); + + private: + Ui::CGeorgesTreeViewDialog m_ui; + ExpandableHeaderView *m_header; + UForm *m_form; + CGeorges *m_georges; + + bool m_modified; + + }; /* CGeorgesTreeViewDialog */ + +} /* namespace NLQT */ + +#endif // GEORGES_TREEVIEWER_DIALOG_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_form.ui new file mode 100644 index 000000000..183b16118 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_form.ui @@ -0,0 +1,130 @@ + + + CGeorgesTreeViewDialog + + + + 0 + 0 + 400 + 300 + + + + + 0 + 0 + + + + + 199 + 165 + + + + Qt::NoFocus + + + + + + + + + + QTabWidget::West + + + 0 + + + + Qt::NoFocus + + + Form + + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + Parent + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Defaults + + + + + + + + Comment + + + + + + false + + + + + + + + Log + + + + + + + + + + + + + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp new file mode 100644 index 000000000..f6b9c441b --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp @@ -0,0 +1,674 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "georgesform_model.h" + +// NeL includes +#include +#include +#include +#include +#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// project includes +#include "formitem.h" + +using namespace NLGEORGES; + +namespace Plugin +{ + + CGeorgesFormModel::CGeorgesFormModel(UFormElm *rootElm, QMap< QString, QStringList> deps, + QString comment, QStringList parents, bool *expanded, QObject *parent) : QAbstractItemModel(parent) + { + QList rootData; + rootData << "Value" << "Data" << "Extra";// << "Type"; + m_rootElm = rootElm; + m_rootItem = new CFormItem(m_rootElm, rootData); + m_dependencies = deps; + m_comments = comment; + m_parents = parents; + m_parentRows = new QList; + m_expanded = expanded; + + setupModelData(); + } + + CGeorgesFormModel::~CGeorgesFormModel() + { + delete m_rootItem; + } + + /******************************************************************************/ + + QVariant CGeorgesFormModel::data(const QModelIndex &p_index, int p_role) const + { + if (!p_index.isValid()) + return QVariant(); + + switch (p_role) + { + case Qt::DisplayRole: + { + return getItem(p_index)->data(p_index.column()); + } + case Qt::BackgroundRole: + { + QBrush defaultBrush = QBrush(QColor(255,0,0,30)); + QBrush parentBrush = QBrush(QColor(0,255,0,30)); + + // if elm not existing it must be some kind of default or type value + if(!getItem(p_index)->getFormElm()) + { + return defaultBrush; + } + + // else it might be some parent elm + switch (getItem(p_index)->nodeFrom()) + { + case NLGEORGES::UFormElm::NodeParentForm: + { + return parentBrush; + } + case NLGEORGES::UFormElm::NodeForm: + { + switch (getItem(p_index)->valueFrom()) + { + case NLGEORGES::UFormElm::ValueParentForm: + { + return parentBrush; + } + default: + { + // parent status test kindof ugly, testing only 2 steps deep + // only needed for colorization as treeview default hides childs + // when parent is hidden + CFormItem *parent = getItem(p_index)->parent(); + if (parent) + { + if (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm) + { + return parentBrush; + } + + CFormItem *parentParent = parent->parent(); + if (parentParent) + { + if (parentParent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm) + { + return parentBrush; + } + } // endif parentParent + } // endif parent + } // end default + } // end switch valueFrom + } // end case nodeForm + } // end switch nodeFrom + return QVariant(); + } + case Qt::DecorationRole: + { + if (p_index.column() == 2) + { + //p_index. + QModelIndex in = index(p_index.row(),p_index.column()-1,p_index.parent()); + CFormItem *item = getItem(in); + + QString value = item->data(1).toString(); + //QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str(); + + /*if (value.contains(".shape")) + { + if (Modules::objViewInt()) + { + QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString()); + if (icon) + { + if(icon->isNull()) + return QIcon(":/images/pqrticles.png"); + else + return QIcon(*icon); + } + else + { + return QIcon(); + } + } + }*/ + if(value.contains(".tga") || value.contains(".png")) + { + QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str(); + if(path.isEmpty()) + { + path = ":/images/pqrticles.png"; + } + return QIcon(path); + } + } + return QVariant(); + break; + } + case Qt::ToolTipRole: + { + if (p_index.column() == 2) + { + QModelIndex in = index(p_index.row(),p_index.column()-1,p_index.parent()); + CFormItem *item = getItem(in); + QString value = item->data(1).toString(); + + /*if (value.contains(".shape")) + { + if (Modules::objViewInt()) + { + QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString()); + if (icon) + { + if(icon->isNull()) + return QIcon(":/images/pqrticles.png"); + else + return QIcon(*icon); + } + else + { + return QIcon(); + } + } + }*/ + if(value.contains(".tga") || value.contains(".png")) + { + QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str(); + if(path.isEmpty()) + { + path = ":/images/pqrticles.png"; + } + + QString imageTooltip = QString("").arg(path); + + return imageTooltip; + } + } + return QVariant(); + break; + } + default: + return QVariant(); + } + } + + /******************************************************************************/ + + CFormItem *CGeorgesFormModel::getItem(const QModelIndex &index) const + { + if (index.isValid()) + { + CFormItem *item = static_cast(index.internalPointer()); + if (item) + return item; + } + return m_rootItem; + } + + /******************************************************************************/ + + bool CGeorgesFormModel::setData(const QModelIndex &index, const QVariant &value, + int role) + { + + if (role != Qt::EditRole) + return false; + + CFormItem *item = getItem(index); + bool result = item->setData(index.column(), value); + + Q_EMIT dataChanged(index, index); + + //setupModelData(); + return result; + } + + /******************************************************************************/ + + Qt::ItemFlags CGeorgesFormModel::flags(const QModelIndex& index) const { + + if (!index.isValid()) + return 0; + + Qt::ItemFlags returnValue = Qt::ItemIsSelectable | Qt::ItemIsEnabled; + + if(index.column() == 1) + returnValue |= Qt::ItemIsEditable; + + return returnValue; + + } + + /******************************************************************************/ + + QVariant CGeorgesFormModel::headerData(int section, + Qt::Orientation orientation, int role) const + { + if (orientation == Qt::Horizontal) + { + if (role == Qt::DisplayRole) + return m_rootItem->data(section); + if (role == Qt::TextAlignmentRole) + return Qt::AlignLeft; + if (section == 0 && role == Qt::DecorationRole) + { + // transparent pixmap as we paint it ourself with tree brach + // if we extend the HeaderView::paintSection for the CE_HeaderLabel + // we could drop this + QPixmap pixmap = QPixmap( + QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize), + QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize)); + // Create new picture for transparent + QPixmap transparent(pixmap.size()); + + // Do transparency + transparent.fill(Qt::transparent); + QPainter p(&transparent); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.drawPixmap(0, 0, pixmap); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + // Set transparency level to 150 (possible values are 0-255) + // The alpha channel of a color specifies the transparency effect, + // 0 represents a fully transparent color, while 255 represents + // a fully opaque color. + p.fillRect(transparent.rect(), QColor(0, 0, 0, 0)); + p.end(); + + // Set original picture's reference to new transparent one + pixmap = transparent; + return pixmap; + } + } + return QVariant(); + } + + /******************************************************************************/ + + QModelIndex CGeorgesFormModel::index(int row, int column, const QModelIndex &parent) + const + { + if (!hasIndex(row, column, parent)) + return QModelIndex(); + + CFormItem *parentItem; + + if (!parent.isValid()) + parentItem = m_rootItem; + else + parentItem = static_cast(parent.internalPointer()); + + CFormItem *childItem = parentItem->child(row); + if (childItem) + return createIndex(row, column, childItem); + else + return QModelIndex(); + } + + /******************************************************************************/ + + QModelIndex CGeorgesFormModel::parent(const QModelIndex &index) const + { + if (!index.isValid()) + return QModelIndex(); + + CFormItem *childItem = static_cast(index.internalPointer()); + CFormItem *parentItem = childItem->parent(); + + if (parentItem == m_rootItem) + return QModelIndex(); + + return createIndex(parentItem->row(), 0, parentItem); + } + + /******************************************************************************/ + + int CGeorgesFormModel::rowCount(const QModelIndex &parent) const { + + CFormItem *parentItem; + if (parent.column() > 0) + return 0; + + if (!parent.isValid()) + parentItem = m_rootItem; + else + parentItem = static_cast(parent.internalPointer()); + + return parentItem->childCount(); + + } + + /******************************************************************************/ + + int CGeorgesFormModel::columnCount(const QModelIndex &parent) const { + + if (parent.isValid()) + return static_cast(parent.internalPointer())->columnCount(); + else + return m_rootItem->columnCount(); + + } + + /******************************************************************************/ + + void CGeorgesFormModel::loadFormData(UFormElm *root, CFormItem *parent) { + + if (!root) + return; + + uint num = 0; + + + if (root->isStruct()) + { + //((CFormElm*)root)->getForm()->getComment(); + uint structSize = 0; + root->getStructSize(structSize); + while (num < structSize) + { + UFormElm::TWhereIsNode *whereN = new UFormElm::TWhereIsNode; + UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue; + // Append a new item to the current parent's list of children. + std::string elmName; + if(root->getStructNodeName(num, elmName)) + { + QList columnData; + //QVariant value; + std::string value; + //NLMISC::CRGBA value_color; + //uint value_uint; + //sint value_sint; + //double value_double; + QString elmtType = ""; + UFormElm *elmt = 0; + if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true)) + { + if (elmt) + { + if (elmt->isArray()) + elmtType = "Array"; + if (elmt->isStruct()) + elmtType = "Struct"; + if (elmt->isAtom()) + { + elmtType = "Atom"; + uint numDefinitions = 0; + const UType *type = elmt->getType(); + if (type) + { + numDefinitions = type->getNumDefinition(); + root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV); + switch (type->getType()) + { + case UType::UnsignedInt: + value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toStdString(); + elmtType.append("_uint");break; + case UType::SignedInt: + value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toStdString(); + elmtType.append("_sint");break; + case UType::Double: + value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble(),0,'f',1).toStdString(); + elmtType.append("_double");break; + case UType::String: + elmtType.append("_string");break; + case UType::Color: + elmtType.append("_color");break; + default: + elmtType.append("_unknownType"); + } + } + else + { + elmtType.append("_noType"); + } + + if (numDefinitions) + { + std::string l, v; + QString tmpLabel, tmpValue; + for (uint i = 0; i < numDefinitions; i++) + { + type->getDefinition(i,l,v); + tmpLabel = l.c_str(); + tmpValue = v.c_str(); + if (type->getType() == UType::SignedInt) + { + if (QString("%1").arg(value.c_str()).toDouble() == tmpValue.toDouble()) { + value = l; + break; + } + } + if (type->getType() == UType::String) + { + if (QString(value.c_str()) == tmpValue) + { + value = l; + break; + } + } + } + } + } + if (elmt->isVirtualStruct()) + { + root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV); + elmtType = "VirtualStruct"; + } + switch (*whereN) + { + case UFormElm::NodeForm: + elmtType.append("_fromForm"); break; + case UFormElm::NodeParentForm: + elmtType.append("_fromParentForm"); break; + case UFormElm::NodeDfn: + elmtType.append("_isDFN"); break; + case UFormElm::NodeType: + elmtType.append("_isType"); break; + default: + elmtType.append("_noNode"); + } + switch (*whereV) + { + case UFormElm::ValueForm: + elmtType.append("_formValue"); break; + case UFormElm::ValueParentForm: + elmtType.append("_parentValue"); break; + case UFormElm::ValueDefaultDfn: + elmtType.append("_dfnValue"); break; + case UFormElm::ValueDefaultType: + elmtType.append("_typeValue"); break; + default: + elmtType.append("_noValue"); + } + columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType; + parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN)); + //if (parents.last()->childCount() > 0) { + // parents << parents.last()->child(parents.last()->childCount()-1); + //} + loadFormData(elmt, parent->child(parent->childCount()-1)); + } + else + { + // add Defaults + // TODO: spams warnings for non ATOM values but i dont get type of non existing nodes + bool success = root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV); + switch (*whereN) + { + case UFormElm::NodeForm: + elmtType.append("_fromForm"); break; + case UFormElm::NodeParentForm: + elmtType.append("_fromParentForm"); break; + case UFormElm::NodeDfn: + elmtType.append("_isDFN"); break; + case UFormElm::NodeType: + elmtType.append("_isType"); break; + default: + elmtType.append("_noNode"); + } + switch (*whereV) + { + case UFormElm::ValueForm: + elmtType.append("_formValue"); break; + case UFormElm::ValueParentForm: + elmtType.append("_parentValue"); break; + case UFormElm::ValueDefaultDfn: + elmtType.append("_dfnValue"); break; + case UFormElm::ValueDefaultType: + elmtType.append("_typeValue"); break; + default: + elmtType.append("_noValue"); + } + + columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType; + parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN)); + } + } + else + { + nlinfo("getNodeByName returned false"); + } + } + num++; + } + } + if (root->isArray()) + { + uint arraySize = 0; + root->getArraySize(arraySize); + while (num < arraySize) + { + std::string elmName; + if(root->getArrayNodeName(elmName, num)) + { + QList columnData; + std::string value; + QString elmtType = ""; + + UFormElm *elmt = 0; + if(root->getArrayNode(&elmt,0) && elmt) + { + if (elmt->isArray()) + elmtType = "Array"; + if (elmt->isStruct()) { + elmtType = "Struct"; + } + if (elmt->isAtom()) + { + elmt->getValue(value); + elmtType = "Atom"; + } + if (elmt->isVirtualStruct()) + elmtType = "VirtualStruct"; + + elmtType.append("_arrayValue"); + columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType; + parent->appendChild(new CFormItem(elmt, columnData, parent)); + loadFormData(elmt, parent->child(parent->childCount()-1)); + } + } + num++; + } + } + } + + /******************************************************************************/ + + void CGeorgesFormModel::loadFormHeader() + { + + if (m_parents.size()) + { + CFormItem *fi_pars = new CFormItem(m_rootElm, QList() << "parents" << "" << "", m_rootItem); + m_rootItem->appendChild(fi_pars); + + Q_FOREACH(QString str, m_parents) + { + fi_pars->appendChild(new CFormItem(m_rootElm, QList() << str << "" << "", fi_pars)); + } + } + + /*QStringList dfns = _dependencies["dfn"]; + QStringList typs = _dependencies["typ"]; + + _dependencies.remove("dfn"); + _dependencies.remove("typ"); + + CFormItem *fi_dep = new CFormItem(_rootElm, QList() << "dependencies", _rootItem); + _rootItem->appendChild(fi_dep); + + if (!dfns.isEmpty()) { + CFormItem *fi_dfn = new CFormItem(_rootElm, QList() << "dfn", fi_dep); + fi_dep->appendChild(fi_dfn); + foreach(QString str, dfns) { + fi_dfn->appendChild(new CFormItem(_rootElm, QList() << str, fi_dfn)); + } + } + if (!typs.isEmpty()) { + CFormItem *fi_typ = new CFormItem(_rootElm, QList() << "typ", fi_dep); + fi_dep->appendChild(fi_typ); + foreach(QString str, typs) { + fi_typ->appendChild(new CFormItem(_rootElm, QList() << str, fi_typ)); + } + } + if (!_dependencies.isEmpty()) { + CFormItem *fi_other = new CFormItem(_rootElm, QList() << "other", fi_dep); + fi_dep->appendChild(fi_other); + foreach(QStringList list, _dependencies) { + foreach(QString str, list) { + fi_other->appendChild(new CFormItem(_rootElm, QList() << str, fi_other)); + } + } + }*/ + } + + /******************************************************************************/ + + void CGeorgesFormModel::setupModelData() + { + loadFormHeader(); + loadFormData(m_rootElm, m_rootItem); + } + + /******************************************************************************/ + + void CGeorgesFormModel::setShowParents( bool show ) { + m_showParents = show; + Q_EMIT layoutAboutToBeChanged(); + Q_EMIT layoutChanged(); + } + void CGeorgesFormModel::setShowDefaults( bool show ) + { + m_showDefaults = show; + Q_EMIT layoutAboutToBeChanged(); + Q_EMIT layoutChanged(); + } +} /* namespace Plugin */ + +/* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.h new file mode 100644 index 000000000..0d8ce6e69 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.h @@ -0,0 +1,80 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef GEORGESFORM_MODEL_H +#define GEORGESFORM_MODEL_H + +// Qt includes +#include +#include +#include +#include + +// project includes + +namespace NLGEORGES { + class UFormElm; +} + +namespace Plugin +{ + + class CFormItem; + + class CGeorgesFormModel : public QAbstractItemModel + { + + public: + CGeorgesFormModel(NLGEORGES::UFormElm *root, QMap< QString, QStringList> deps, + QString comment, QStringList parents, bool* expanded, QObject *parent = 0); + ~CGeorgesFormModel(); + + QVariant data(const QModelIndex &index, int role) const; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); + Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + CFormItem *getItem(const QModelIndex &index) const; + CGeorgesFormModel *model() { return this; } + bool showParents() { return m_showParents;} + bool showDefaults() { return m_showDefaults;} + void setShowParents( bool show ); + void setShowDefaults( bool show ); + + private: + void setupModelData(); + void loadFormData(NLGEORGES::UFormElm *rootElm, CFormItem *parent); + void loadFormHeader(); + + CFormItem* m_rootItem; + NLGEORGES::UFormElm* m_rootElm; + QMap< QString, QStringList> m_dependencies; + QString m_comments; + QStringList m_parents; + QList* m_parentRows; + + bool m_showParents; + bool m_showDefaults; + bool *m_expanded; + + };/* class CGeorgesFormModel */ + +} /* namespace Plugin */ + +#endif // GEORGESFORM_MODEL_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp new file mode 100644 index 000000000..ae3720a57 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp @@ -0,0 +1,81 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +// NeL includes +#include +#include + +// project includes +#include "formitem.h" +#include "georgesform_proxy_model.h" +#include "georgesform_model.h" + +namespace Plugin +{ + + bool CGeorgesFormProxyModel::filterAcceptsRow(int sourceRow, + const QModelIndex &sourceParent) const + { + // column doesnt matter for item + CGeorgesFormModel *smodel = dynamic_cast(sourceModel()); + QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); + CFormItem *item = smodel->getItem(index); + + // if elm not existing it must be some kind of default or type value + if(!item->getFormElm()) + { + return smodel->showDefaults(); + } + + // else it might be some parent elm + switch (item->nodeFrom()) + { + case NLGEORGES::UFormElm::NodeParentForm: + { + return smodel->showParents(); + } + case NLGEORGES::UFormElm::NodeForm: + { + switch (item->valueFrom()) + { + case NLGEORGES::UFormElm::ValueParentForm: + { + return smodel->showParents(); + } + default: + { + CFormItem *parent = item->parent(); + if (parent && (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)) + { + return smodel->showParents(); + } + } + } + } + } + return true; + } + +/******************************************************************************/ + + bool CGeorgesFormProxyModel::filterAcceptsColumn(int sourceRow, + const QModelIndex &sourceParent) const + { + return QSortFilterProxyModel::filterAcceptsColumn(sourceRow, sourceParent); + } +} /* namespace Plugin */ + +/* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.h new file mode 100644 index 000000000..570913dab --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.h @@ -0,0 +1,45 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef GEORGESFORM_PROXY_MODEL_H +#define GEORGESFORM_PROXY_MODEL_H + +// Qt includes +#include + +namespace Plugin +{ + + class CGeorgesFormProxyModel : public QSortFilterProxyModel + { + + public: + CGeorgesFormProxyModel(QObject *parent = 0): QSortFilterProxyModel(parent) + { + } + ~CGeorgesFormProxyModel() + { + } + + protected: + virtual bool filterAcceptsColumn ( int source_column, const QModelIndex & source_parent ) const ; + virtual bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const ; + + };/* class CGeorgesFormProxyModel */ + +} /* namespace NLQT */ + +#endif // GEORGESFORM_PROXY_MODEL_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/bin_op_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/bin_op_dialog.h index 061edafd4..3180e5d84 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/bin_op_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/bin_op_dialog.h @@ -97,7 +97,7 @@ public: _AttrbDlg[k]->init(); } - static const char * const operators[] = + static const char *const operators[] = { QT_TR_NOOP("Select Arg1"), QT_TR_NOOP("Select Arg2"), diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/entity.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/entity.h index 88338f214..a322363be 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/entity.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/entity.h @@ -141,7 +141,7 @@ public: float getAnimLength(std::string name); /// Get slot infomation - void setSlotInfo(uint num, CSlotInfo& slotInfo) + void setSlotInfo(uint num, CSlotInfo &slotInfo) { _SlotInfo[num] = slotInfo; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp index 93bc1043e..d8e36e785 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp @@ -135,7 +135,7 @@ bool CGraphicsViewport::winEvent(MSG *message, long *result) { winProc proc = (winProc)driver->getWindowProc(); - // TODO: shouldn't it return false like the others? + // TODO: shouldn't it return false like the others? // see macEvent() and x11Event() below return proc(driver, message->hwnd, message->message, message->wParam, message->lParam); } @@ -163,7 +163,7 @@ bool CGraphicsViewport::macEvent(EventHandlerCallRef caller, EventRef event) } } - // return false to let Qt handle the event as well, + // return false to let Qt handle the event as well, // else the widget would never get focus return false; } @@ -184,7 +184,7 @@ bool CGraphicsViewport::x11Event(XEvent *event) } } - // return false to let Qt handle the event as well, + // return false to let Qt handle the event as well, // else the widget would never get focus // TODO: test me please, i have no linux at hand (rti) return false; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h index d810d8c01..0c01fa1ad 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h @@ -59,7 +59,7 @@ public: CGraphicsViewport(QWidget *parent); virtual ~CGraphicsViewport(); - virtual QPaintEngine* paintEngine() const + virtual QPaintEngine *paintEngine() const { return NULL; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/hoverpoints.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/hoverpoints.cpp index fe0751082..a2556c08d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/hoverpoints.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/hoverpoints.cpp @@ -161,7 +161,7 @@ bool HoverPoints::eventFilter(QObject *object, QEvent *event) case QEvent::TouchBegin: case QEvent::TouchUpdate: { - const QTouchEvent *const touchEvent = static_cast(event); + const QTouchEvent *const touchEvent = static_cast(event); const QList points = touchEvent->touchPoints(); const qreal pointSize = qMax(m_pointSize.width(), m_pointSize.height()); Q_FOREACH (const QTouchEvent::TouchPoint &touchPoint, points) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_pill.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_pill.png new file mode 100644 index 000000000..e748b8190 Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_pill.png differ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_dialog.cpp index d125277e4..de88d14c8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/morph_mesh_dialog.cpp @@ -91,7 +91,7 @@ QString CMorphMeshDialog::getShapeDescStr(uint shapeIndex, sint numVerts) const } else { - QString error = qobject_cast(QObject::parent())->getShapeErrorString(numVerts); + QString error = qobject_cast(QObject::parent())->getShapeErrorString(numVerts); QString result = _CM->getShape(shapeIndex).c_str() + QString(" (%1)").arg(error); return result; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp index dc248e563..4b0509018 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp @@ -435,7 +435,7 @@ void CObjectViewer::setCurrentObject(const std::string &name) nlinfo("set current entity %s", _CurrentInstance.c_str()); } -CEntity& CObjectViewer::getEntity(const std::string &name) +CEntity &CObjectViewer::getEntity(const std::string &name) { if ( _Entities.count(name) == 0) nlerror("Entity %s not found", name.c_str()); EIT eit = _Entities.find (name); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.h index dc96f5cdf..5e978d7e0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.h @@ -152,7 +152,7 @@ public: /// Get entity from the scene /// @return ref Entity - CEntity& getEntity(const std::string &name); + CEntity &getEntity(const std::string &name); /// Get full list instances from the scene /// @param listObj - ref of return list instances diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.qrc b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.qrc index ac9647047..b088a5e28 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.qrc +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.qrc @@ -33,6 +33,7 @@ icons/ic_nel_water.png icons/ic_nel_wind.png icons/ic_nel_workspace_item.png + icons/ic_nel_pill.png images/nel.png icons/particles_system_24/ic_nel_collision_zone_item_24.png icons/particles_system_24/ic_nel_emitter_item_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_plugin.h index b5f9c2881..f0f23d398 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_plugin.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_plugin.h @@ -74,7 +74,7 @@ public: virtual QIcon icon() const { - return QIcon(); + return QIcon(":/icons/ic_nel_pill.png"); } virtual QUndoStack *undoStack(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp index 77286ed32..2daebd6e4 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_tree_model.cpp @@ -404,7 +404,7 @@ bool CParticleTreeModel::insertRows(NL3D::CPSLocated *loc, int position, const Q bool CParticleTreeModel::insertRow(NL3D::CPSLocated *loc, uint32 index, int position, const QModelIndex &parent) { beginInsertRows(parent, position, position); - createItemFromLocatedInstance(loc, index, static_cast(parent.internalPointer())); + createItemFromLocatedInstance(loc, index, static_cast(parent.internalPointer())); endInsertRows(); return true; } @@ -424,7 +424,7 @@ bool CParticleTreeModel::removeRows(int position, const QModelIndex &parent) removeRows(0, parent.child(position, 0)); beginRemoveRows(parent, position, position); - static_cast(parent.internalPointer())->deleteChild(position); + static_cast(parent.internalPointer())->deleteChild(position); endRemoveRows(); return false; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp index 858922af1..cb49def05 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp @@ -46,7 +46,7 @@ namespace NLQT { -static const char * const LocatedBindable[] = +static const char *const LocatedBindable[] = { QT_TR_NOOP("Point"), QT_TR_NOOP("LookAt"), @@ -220,7 +220,7 @@ void CParticleWorkspaceDialog::touchPSState(CParticleTreeItem *item) } } -void CParticleWorkspaceDialog::clickedItem(const QModelIndex & index) +void CParticleWorkspaceDialog::clickedItem(const QModelIndex &index) { if (_currentItem != 0) _treeModel->getOwnerNode(_currentItem)->getPSPointer()->setCurrentEditedElement(NULL); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.h index 3a317adc7..c7aa0e52b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.h @@ -59,7 +59,7 @@ Q_SIGNALS: void changeActiveNode(); private Q_SLOTS: - void clickedItem(const QModelIndex & index); + void clickedItem(const QModelIndex &index); void customContextMenu(); void setActiveNode(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.cpp index ba64d834e..07101aa85 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.cpp @@ -107,6 +107,9 @@ void CSoundSystem::init() std::string mess = std::string("Unable to init sound :") + e.what(); nlwarning ("Init sound: %s", mess.c_str()); _AudioMixer = NULL; + QSettings *settings = Core::ICore::instance()->settings(); + if (settings->group() == Constants::OBJECT_VIEWER_SECTION) + settings->endGroup(); return; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.h index 4add4b9db..79ea68a46 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.h @@ -61,13 +61,13 @@ public: } /// Sets the path which contains samples - void setSamplePath(std::string& path) + void setSamplePath(std::string &path) { _SamplePath = NLMISC::CPath::standardizePath(path, true); } /// Sets the path which contains packed sheet - void setPackedSheetPath(std::string& path) + void setPackedSheetPath(std::string &path) { _PackedSheetPath = NLMISC::CPath::standardizePath(path, true); } @@ -88,13 +88,13 @@ public: NLSOUND::USource *create(const std::string &soundName); /// Load the sound animation with the specified name - void loadAnimation(std::string& name) + void loadAnimation(std::string &name) { _AnimManager->loadAnimation(name); } /// Start playing a sound animation. - void playAnimation(std::string& name, float lastTime, float curTime, NLSOUND::CSoundContext &context); + void playAnimation(std::string &name, float lastTime, float curTime, NLSOUND::CSoundContext &context); // Update the sound animations. //static void updateAnimations(float lastTime, float curTime) { _AnimManager->update(lastTime, curTime); }; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_appearance_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_appearance_page.cpp index 9c49871b3..0366bc11f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_appearance_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_appearance_page.cpp @@ -60,7 +60,7 @@ CVegetableApperancePage::CVegetableApperancePage(QWidget *parent) connect(_ui.removePushButton, SIGNAL(clicked()), this, SLOT(removeColor())); connect(_ui.getListPushButton, SIGNAL(clicked()), this, SLOT(getFromListColors())); - connect(_ui.listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(browseColor(QListWidgetItem*))); + connect(_ui.listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(browseColor(QListWidgetItem *))); setEnabled(false); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/workspace_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/workspace_form.ui index 28705f097..b8bec17b7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/workspace_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/workspace_form.ui @@ -6,8 +6,8 @@ 0 0 - 337 - 232 + 235 + 293 @@ -130,7 +130,51 @@ - + + + + false + + + + 0 + 0 + + + + + 55 + 0 + + + + + 16777215 + 16777215 + + + + Unload + + + + :/icons/ic_nel_particle_system_close.png:/icons/ic_nel_particle_system_close.png + + + + 32 + 32 + + + + Qt::ToolButtonTextUnderIcon + + + true + + + + false @@ -177,7 +221,7 @@ - + false @@ -221,50 +265,6 @@ - - - - false - - - - 0 - 0 - - - - - 55 - 0 - - - - - 16777215 - 16777215 - - - - Unload - - - - :/icons/ic_nel_particle_system_close.png:/icons/ic_nel_particle_system_close.png - - - - 32 - 32 - - - - Qt::ToolButtonTextUnderIcon - - - true - - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.h index 7a90271a9..47dcfdb57 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include "ui_ftp_selection.h" diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp index 8f9a213bf..8151ea234 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp @@ -194,8 +194,9 @@ void CMainWindow::updateWindowsList() windowMenu->addAction(action); windowMapper->setMapping(action, subWindows.at(i)); } - - } + } else { + windowMenu->clear(); + } } // Open signal @@ -622,27 +623,27 @@ list CMainWindow::convertQStringList(QStringList listq) bool CMainWindow::isWorksheetEditor(QString filename) { - STRING_MANAGER::TWorksheet wk_file; - if(loadExcelSheet(filename.toStdString(), wk_file, true) == true) - { - if(wk_file.ColCount > 1) - return true; - } + STRING_MANAGER::TWorksheet wk_file; + if(loadExcelSheet(filename.toStdString(), wk_file, true) == true) + { + if(wk_file.ColCount > 1) + return true; + } - return false; + return false; } bool CMainWindow::isPhraseEditor(QString filename) { - vector phrases; - if(readPhraseFile(filename.toStdString(), phrases, false)) - { - return true; - } else { - return false; - } + vector phrases; + if(readPhraseFile(filename.toStdString(), phrases, false)) + { + return true; + } else { + return false; + } } -} /* namespace Plugin */ +} /* namespace TranslationManager */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.h index 6b9822031..19c3c1976 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.h @@ -86,7 +86,6 @@ private Q_SLOTS: void open(); void save(); void saveAs(); - void activeSubWindowChanged(); void setActiveSubWindow(QWidget *window); void updateWindowsList(); void mergeSingleFile(); @@ -99,11 +98,11 @@ private: void createToolbar(); void initializeSettings(bool georges); list convertQStringList(QStringList listq); - CEditor* getEditorByWindowFilePath(const QString &fileName); - // Worksheet specific functions - CEditorWorksheet* getEditorByWorksheetType(const QString &type); + CEditor* getEditorByWindowFilePath(const QString &fileName); + // Worksheet specific functions + CEditorWorksheet* getEditorByWorksheetType(const QString &type); bool isWorksheetEditor(QString filename); - bool isPhraseEditor(QString filename); + bool isPhraseEditor(QString filename); @@ -127,7 +126,7 @@ public: -} // namespace Plugin +} // namespace TranslationManager diff --git a/code/nel/tools/3d/plugin_max/nel_export/DllEntry.cpp b/code/nel/tools/3d/plugin_max/nel_export/DllEntry.cpp index 61337b328..7e6ded529 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/DllEntry.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/DllEntry.cpp @@ -19,7 +19,7 @@ #include "nel/3d/register_3d.h" #include "nel/misc/app_context.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h" - +#include extern ClassDesc2* GetCNelExportDesc(); @@ -42,7 +42,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) if (!controlsInit) { controlsInit = TRUE; +#if MAX_VERSION_MAJOR < 14 InitCustomControls(hInstance); // Initialize MAX's custom controls +#endif InitCommonControls(); // Initialize Win95 controls } diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp index 9218e73ce..d26af56ca 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_script.cpp @@ -16,7 +16,12 @@ #include "std_afx.h" #include "nel_export.h" -#include +#include +#if MAX_VERSION_MAJOR >= 14 +# include +#else +# include +#endif #include "../nel_mesh_lib/export_nel.h" #include "../nel_mesh_lib/export_appdata.h" diff --git a/code/nel/tools/3d/plugin_max/nel_export/std_afx.h b/code/nel/tools/3d/plugin_max/nel_export/std_afx.h index 326c0b9c1..099f2f882 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/std_afx.h +++ b/code/nel/tools/3d/plugin_max/nel_export/std_afx.h @@ -26,16 +26,29 @@ #include #include #undef STRICT -#include -#include -#include -#include -#include -#include -#include -#include +#include +#if MAX_VERSION_MAJOR >= 14 +# include +# include +# include +# include +# include +# include +# include +# include +# include +#else +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif #include -#include #include #ifdef min #undef min diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.h b/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.h index 65b65651e..b3626b896 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.h +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/StdAfx.h @@ -32,7 +32,12 @@ #include #include #include -#include +#include +#if MAX_VERSION_MAJOR >= 14 +# include +#else +# include +#endif //#include // Character Studio SDK include diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp index e65b4ea56..03326cf44 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp @@ -281,13 +281,21 @@ void SLightBuild::convertFromMaxLight (INode *node,TimeValue tvTime) } #if (MAX_RELEASE < 4000) - // Convert exclusion list - NameTab& ntExclu = maxLight->GetExclusionList(); - for( sint i = 0; i < ntExclu.Count(); ++i ) - { - string tmp = *ntExclu.Addr(i); - this->setExclusion.insert( tmp ); - } + // Convert exclusion list + NameTab& ntExclu = maxLight->GetExclusionList(); + for (sint i = 0; i < ntExclu.Count(); ++i) + { + string tmp = *ntExclu.Addr(i); + this->setExclusion.insert(tmp); + } +#else // (MAX_RELEASE < 4000) + ExclList& exclusionList = maxLight->GetExclusionList(); + for (sint i = 0; i < exclusionList.Count(); ++i) + { + INode *exclNode = exclusionList[i]; + string tmp = exclNode->GetName(); + this->setExclusion.insert(tmp); + } #endif // (MAX_RELEASE < 4000) // Get Soft Shadow informations @@ -1999,11 +2007,12 @@ void CExportNel::deleteLM(INode& ZeNode) sprintf( tmp, "%d", i ); sSaveName += tmp; sSaveName += ".tga"; - FILE *file; - if( file = fopen(sSaveName.c_str(),"rb") ) + if (CFile::fileExists(sSaveName)) { - fclose( file ); - DeleteFile( sSaveName.c_str() ); + if (!CFile::deleteFile(sSaveName)) + { + nlwarning("Failed to delete file %s.", sSaveName.c_str()); + } } } } @@ -2576,11 +2585,12 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB for (i = 0; i < 256; ++i) { string sLMName = sBaseName + NLMISC::toString(i) + ".tga"; - CIFile ifi; - if (ifi.open(sLMName)) + if (CFile::fileExists(sLMName)) { - ifi.close (); - DeleteFile (sLMName.c_str()); + if (!CFile::deleteFile(sLMName)) + { + nlwarning("Failed to delete file %s.", sLMName.c_str()); + } } } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp index 0b2426758..a03beb000 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_misc.cpp @@ -260,7 +260,11 @@ Control* CExportNel::getControlerByName (Animatable& node, const char* sName) if (strcmp (paramDef.int_name, sName)==0) { // ok, return this subanim +#if MAX_VERSION_MAJOR >= 14 + return param->GetControllerByID(id); +#else return param->GetController(id); +#endif } } } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp index 4c6b6bc8b..e3504b324 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_particle_system.cpp @@ -36,7 +36,7 @@ IShape* CExportNel::buildParticleSystem(INode& node, TimeValue time) // if not found, get from the APP_DATAS shapeName = CExportNel::getNelObjectName(node); if (shapeName.empty()) return NULL; - shapeName = NLMISC::CPath::lookup("shapeName", false); + shapeName = NLMISC::CPath::lookup(shapeName, false); if (shapeName.empty()) return NULL; } diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp index 4e7edea8a..2d0268a74 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_scene.cpp @@ -24,6 +24,7 @@ #include "../nel_patch_lib/rpo.h" #include "../../ig_lighter_lib/ig_lighter_lib.h" +#include "nel/misc/path.h" #include "nel/3d/scene_group.h" #include "nel/3d/scene.h" #include "nel/3d/shape_bank.h" @@ -418,12 +419,21 @@ CInstanceGroup* CExportNel::buildInstanceGroup(const vector& vectNode, v if (clid.PartA() == NEL_PARTICLE_SYSTEM_CLASS_ID) { // build the shape from the file name - std::string objName = CExportNel::getNelObjectName(*pNode); - if (!objName.empty()) + // std::string objName = CExportNel::getNelObjectName(*pNode); + std::string psFilePath; + // try to get the complete path + if (!CExportNel::getValueByNameUsingParamBlock2(*pNode, "ps_file_name", (ParamType2) TYPE_STRING, &psFilePath, 0)) + { + // if not found, get from the APP_DATAS + psFilePath = CExportNel::getNelObjectName(*pNode); + if (!psFilePath.empty()) + psFilePath = CPath::lookup(psFilePath, false); + } + if (!psFilePath.empty()) { NL3D::CShapeStream ss; NLMISC::CIFile iF; - if (iF.open(objName.c_str())) + if (iF.open(psFilePath.c_str())) { try { diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp index 6f1713683..7fd0ad150 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_script.cpp @@ -15,8 +15,14 @@ // along with this program. If not, see . #include "stdafx.h" -#include -#include +#include +#if MAX_VERSION_MAJOR >= 14 +# include +# include +#else +# include +# include +#endif #include "export_nel.h" #include "export_appdata.h" diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/DllEntry.cpp b/code/nel/tools/3d/plugin_max/nel_patch_converter/DllEntry.cpp index 22ae76790..50f249c31 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/DllEntry.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/DllEntry.cpp @@ -20,6 +20,7 @@ #include "nel/misc/debug.h" #include "nel/misc/app_context.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h" +#include extern ClassDesc2* GetPO2RPODesc(); extern ClassDesc* GetRPODesc(); @@ -58,7 +59,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { // This method has been deprecated. controlsInit = TRUE; +#if MAX_VERSION_MAJOR < 14 InitCustomControls(hInstance); // Initialize MAX's custom controls +#endif InitCommonControls(); // Initialize Win95 controls } return (TRUE); diff --git a/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp b/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp index b324c2cc6..1dfdc97f4 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_converter/script.cpp @@ -22,24 +22,38 @@ #define _CRT_SECURE_NO_DEPRECATE #include -#include -#include -// Various MAX and MXS includes -#include -#include -#include -#include -#include -#include +#include +#if MAX_VERSION_MAJOR >= 14 +# include +# include +# include +# include +# include +# include +# include +# include +# include +#else +# include +# include +// Various MAX and MXS includes +# include +# include +# include +# include +# include +# include +// define the new primitives using macros from SDK +# include +#endif + #include #include #include #include -// define the new primitives using macros from SDK -#include #undef _CRT_SECURE_NO_DEPRECATE @@ -109,9 +123,9 @@ def_visible_primitive( set_tile_bank, "NelSetTileBank"); def_visible_primitive( export_zone, "ExportRykolZone"); def_visible_primitive( import_zone, "NeLImportZone"); -/* permettre l'acces à auto/manual intrior edges +/* permettre l'acces Eauto/manual intrior edges faire une methode pour interfacer la fonction compute interior edge -donner un acces à tiledmode/patchmode (on/off) +donner un acces Etiledmode/patchmode (on/off) faire un getselectedvertex faire un getselectedpatch faire un getselectedtile */ diff --git a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_mods.cpp b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_mods.cpp index c2696674a..8d7467a62 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_edit/np_mods.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_edit/np_mods.cpp @@ -17,6 +17,8 @@ #include #include "../nel_3dsmax_shared/nel_3dsmax_shared.h" +#include + HINSTANCE hInstance; int controlsInit = FALSE; @@ -42,7 +44,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) controlsInit = TRUE; // jaguar controls +#if MAX_VERSION_MAJOR < 14 InitCustomControls(hInstance); +#endif #ifdef OLD3DCONTROLS // initialize 3D controls diff --git a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp index edf2f77e6..d99dc0f98 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_lib/rpo2nel.cpp @@ -18,7 +18,12 @@ // For MAX_RELEASE #include -#include +#include +#if MAX_VERSION_MAJOR >= 14 +# include +#else +# include +#endif #include "rpo.h" #include "nel/3d/zone.h" diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/DllEntry.cpp b/code/nel/tools/3d/plugin_max/nel_patch_paint/DllEntry.cpp index a3578a0bc..b4b79da80 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/DllEntry.cpp +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/DllEntry.cpp @@ -3,6 +3,7 @@ #include "nel/misc/debug.h" #include "nel/misc/app_context.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h" +#include HINSTANCE hInstance; int controlsInit = FALSE; @@ -26,7 +27,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) controlsInit = TRUE; // jaguar controls +#if MAX_VERSION_MAJOR < 14 InitCustomControls(hInstance); +#endif #ifdef OLD3DCONTROLS // initialize 3D controls diff --git a/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h b/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h index 944807aca..3563b4712 100644 --- a/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h +++ b/code/nel/tools/3d/plugin_max/nel_patch_paint/nel_patch_paint.h @@ -3,7 +3,12 @@ #include "resource.h" #include -#include +#include +#if MAX_VERSION_MAJOR >= 14 +# include +#else +# include +#endif #include "namesel.h" #include "nsclip.h" #include "sbmtlapi.h" diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/dllmain.cpp b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/dllmain.cpp index 4dc068eea..1f04fe088 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/dllmain.cpp +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/dllmain.cpp @@ -1,6 +1,6 @@ #include "vertex_tree_paint.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h" - +#include HINSTANCE hInstance; @@ -18,7 +18,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) switch (fdwReason) { case DLL_PROCESS_ATTACH: +#if MAX_VERSION_MAJOR < 14 InitCustomControls(hInstance); // Initialize MAX's custom controls +#endif InitCommonControls(); // Initialize Win95 controls break; } diff --git a/code/nel/tools/3d/plugin_max/tile_utility/DllEntry.cpp b/code/nel/tools/3d/plugin_max/tile_utility/DllEntry.cpp index d1c6c7d6b..26e2d14f8 100644 --- a/code/nel/tools/3d/plugin_max/tile_utility/DllEntry.cpp +++ b/code/nel/tools/3d/plugin_max/tile_utility/DllEntry.cpp @@ -20,6 +20,7 @@ #include "nel/misc/app_context.h" #include "../nel_3dsmax_shared/nel_3dsmax_shared.h" #include +#include extern ClassDesc2* GetTile_utilityDesc(); extern ClassDesc* GetRGBAddDesc(); @@ -46,7 +47,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) if (!controlsInit) { controlsInit = TRUE; +#if MAX_VERSION_MAJOR < 14 InitCustomControls(hInstance); // Initialize MAX's custom controls +#endif InitCommonControls(); // Initialize Win95 controls } diff --git a/code/nel/tools/build_gamedata/0_setup.py b/code/nel/tools/build_gamedata/0_setup.py index d921d03f4..1fe084407 100644 --- a/code/nel/tools/build_gamedata/0_setup.py +++ b/code/nel/tools/build_gamedata/0_setup.py @@ -24,9 +24,27 @@ # along with this program. If not, see . # -import time, sys, os, shutil, subprocess, distutils.dir_util +import time, sys, os, shutil, subprocess, distutils.dir_util, argparse sys.path.append("configuration") +parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Setup') +parser.add_argument('--noconf', '-nc', action='store_true') +parser.add_argument('--noverify', '-nv', action='store_true') +# parser.add_argument('--haltonerror', '-eh', action='store_true') +parser.add_argument('--includeproject', '-ipj', nargs='+') +parser.add_argument('--excludeproject', '-epj', nargs='+') +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + +if not args.includeproject == None and not args.excludeproject == None: + print "ERROR --includeproject cannot be combined with --excludeproject, exit." + exit() + +if not args.includeprocess == None and not args.excludeprocess == None: + print "ERROR --includeprocess cannot be combined with --excludeprocess, exit." + exit() + if os.path.isfile("log.log"): os.remove("log.log") log = open("log.log", "w") @@ -35,221 +53,225 @@ try: from buildsite import * except ImportError: printLog(log, "*** FIRST RUN ***") + if args.noconf: + printLog(log, "ERROR --noconf is invalid on first run, exit.") + exit() from tools import * -try: - BuildQuality -except NameError: - BuildQuality = 1 -try: - ToolDirectories -except NameError: - ToolDirectories = [ 'R:/code/nel', 'R:/code/ryzom/tools' ] -try: - ToolSuffix -except NameError: - ToolSuffix = "_r.exe" -try: - ScriptDirectory -except NameError: - ScriptDirectory = "R:/code/nel/tools/build_gamedata" -try: - WorkspaceDirectory -except NameError: - WorkspaceDirectory = "R:/code/ryzom/tools/build_gamedata/workspace" -try: - DatabaseDirectory -except NameError: - DatabaseDirectory = "W:/database" -try: - ExportBuildDirectory -except NameError: - ExportBuildDirectory = "W:/export" -try: - InstallDirectory -except NameError: - InstallDirectory = "W:/install" -try: - DataShardDirectory -except NameError: - DataShardDirectory = "R:/code/ryzom/server/data_shard" -try: - ClientDevDirectory -except NameError: - ClientDevDirectory = "W:/client_dev" -try: - ClientPatchDirectory -except NameError: - ClientPatchDirectory = "W:/client_patch" -try: - ClientInstallDirectory -except NameError: - ClientInstallDirectory = "W:/client_install" -try: - LeveldesignDirectory -except NameError: - LeveldesignDirectory = "L:/leveldesign" -try: - LeveldesignDfnDirectory -except NameError: - LeveldesignDfnDirectory = "L:/leveldesign/dfn" -try: - LeveldesignWorldDirectory -except NameError: - LeveldesignWorldDirectory = "L:/leveldesign/world" -try: - PrimitivesDirectory -except NameError: - PrimitivesDirectory = "L:/primitives" -try: - GamedevDirectory -except NameError: - GamedevDirectory = "R:/code/ryzom/client/data/gamedev" -try: - DataCommonDirectory -except NameError: - DataCommonDirectory = "R:/code/ryzom/common/data_common" -try: - WindowsExeDllCfgDirectories -except NameError: - WindowsExeDllCfgDirectories = [ 'C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/redist/x86', 'D:/source/external_local/bin/x86', 'D:/source/external_shared/bin/x86', 'R:/code/nel/lib', 'R:/code/ryzom/bin', 'R:/code/ryzom/client', 'R:/code/ryzom/tools/client/client_config/bin' ] -try: - MaxAvailable -except NameError: - MaxAvailable = 1 -try: - MaxDirectory -except NameError: - MaxDirectory = "C:/Program Files (x86)/Autodesk/3ds Max 2010" -try: - MaxUserDirectory -except NameError: - MaxUserDirectory = "C:/Users/Kaetemi/AppData/Local/Autodesk/3dsMax/2010 - 32bit/enu" -try: - MaxExecutable -except NameError: - MaxExecutable = "3dsmax.exe" +if not args.noconf: + try: + BuildQuality + except NameError: + BuildQuality = 1 + try: + ToolDirectories + except NameError: + ToolDirectories = [ 'R:/build/dev/bin/Release', 'D:/libraries/external/bin' ] + try: + ToolSuffix + except NameError: + ToolSuffix = ".exe" + try: + ScriptDirectory + except NameError: + ScriptDirectory = "R:/code/nel/tools/build_gamedata" + try: + WorkspaceDirectory + except NameError: + WorkspaceDirectory = "R:/code/ryzom/tools/build_gamedata/workspace" + try: + DatabaseDirectory + except NameError: + DatabaseDirectory = "W:/database" + try: + ExportBuildDirectory + except NameError: + ExportBuildDirectory = "W:/export" + try: + InstallDirectory + except NameError: + InstallDirectory = "W:/install" + try: + DataShardDirectory + except NameError: + DataShardDirectory = "R:/code/ryzom/server/data_shard" + try: + ClientDevDirectory + except NameError: + ClientDevDirectory = "W:/client_dev" + try: + ClientPatchDirectory + except NameError: + ClientPatchDirectory = "W:/client_patch" + try: + ClientInstallDirectory + except NameError: + ClientInstallDirectory = "W:/client_install" + try: + LeveldesignDirectory + except NameError: + LeveldesignDirectory = "L:/leveldesign" + try: + LeveldesignDfnDirectory + except NameError: + LeveldesignDfnDirectory = "L:/leveldesign/dfn" + try: + LeveldesignWorldDirectory + except NameError: + LeveldesignWorldDirectory = "L:/leveldesign/world" + try: + PrimitivesDirectory + except NameError: + PrimitivesDirectory = "L:/primitives" + try: + GamedevDirectory + except NameError: + GamedevDirectory = "R:/code/ryzom/client/data/gamedev" + try: + DataCommonDirectory + except NameError: + DataCommonDirectory = "R:/code/ryzom/common/data_common" + try: + WindowsExeDllCfgDirectories + except NameError: + WindowsExeDllCfgDirectories = [ 'C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/redist/x86', 'D:/libraries/external/bin', 'R:/build/dev/bin/Release', 'R:/code/ryzom/client', 'R:/code/nel/lib', 'R:/code/ryzom/bin', 'R:/code/ryzom/tools/client/client_config/bin' ] + try: + MaxAvailable + except NameError: + MaxAvailable = 1 + try: + MaxDirectory + except NameError: + MaxDirectory = "C:/Program Files (x86)/Autodesk/3ds Max 2010" + try: + MaxUserDirectory + except NameError: + MaxUserDirectory = "C:/Users/Kaetemi/AppData/Local/Autodesk/3dsMax/2010 - 32bit/enu" + try: + MaxExecutable + except NameError: + MaxExecutable = "3dsmax.exe" -printLog(log, "") -printLog(log, "-------") -printLog(log, "--- Setup build site") -printLog(log, "-------") -printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) -printLog(log, "") -printLog(log, "This script will set up the buildsite configuration, and create needed directories.") -printLog(log, "To use the defaults, simply hit ENTER, else type in the new value.") -printLog(log, "Use -- if you need to insert an empty value.") -printLog(log, "") -BuildQuality = int(askVar(log, "Build Quality", str(BuildQuality))) -ToolDirectories[0] = askVar(log, "Primary Tool Directory", ToolDirectories[0]).replace("\\", "/") -ToolDirectories[1] = askVar(log, "Secondary Tool Directory", ToolDirectories[1]).replace("\\", "/") -ToolSuffix = askVar(log, "Tool Suffix", ToolSuffix) -ScriptDirectory = askVar(log, "Script Directory", os.getcwd().replace("\\", "/")).replace("\\", "/") -WorkspaceDirectory = askVar(log, "Workspace Directory", WorkspaceDirectory).replace("\\", "/") -DatabaseDirectory = askVar(log, "Database Directory", DatabaseDirectory).replace("\\", "/") -ExportBuildDirectory = askVar(log, "Export Build Directory", ExportBuildDirectory).replace("\\", "/") -InstallDirectory = askVar(log, "Install Directory", InstallDirectory).replace("\\", "/") -DataShardDirectory = askVar(log, "Data Shard Directory", DataShardDirectory).replace("\\", "/") -ClientDevDirectory = askVar(log, "Client Dev Directory", ClientDevDirectory).replace("\\", "/") -ClientPatchDirectory = askVar(log, "Client Patch Directory", ClientPatchDirectory).replace("\\", "/") -ClientInstallDirectory = askVar(log, "Client Install Directory", ClientInstallDirectory).replace("\\", "/") -LeveldesignDirectory = askVar(log, "Leveldesign Directory", LeveldesignDirectory).replace("\\", "/") -LeveldesignDfnDirectory = askVar(log, "Leveldesign DFN Directory", LeveldesignDfnDirectory).replace("\\", "/") -LeveldesignWorldDirectory = askVar(log, "Leveldesign World Directory", LeveldesignWorldDirectory).replace("\\", "/") -PrimitivesDirectory = askVar(log, "Primitives Directory", PrimitivesDirectory).replace("\\", "/") -GamedevDirectory = askVar(log, "Gamedev Directory", GamedevDirectory).replace("\\", "/") -DataCommonDirectory = askVar(log, "Data Common Directory", DataCommonDirectory).replace("\\", "/") -WindowsExeDllCfgDirectories[0] = askVar(log, "Primary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[0]).replace("\\", "/") -WindowsExeDllCfgDirectories[1] = askVar(log, "Secondary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[1]).replace("\\", "/") -WindowsExeDllCfgDirectories[2] = askVar(log, "Tertiary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[2]).replace("\\", "/") -WindowsExeDllCfgDirectories[3] = askVar(log, "Quaternary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[3]).replace("\\", "/") -WindowsExeDllCfgDirectories[4] = askVar(log, "Quinary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[4]).replace("\\", "/") -WindowsExeDllCfgDirectories[5] = askVar(log, "Senary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[5]).replace("\\", "/") -WindowsExeDllCfgDirectories[6] = askVar(log, "Septenary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[6]).replace("\\", "/") -MaxAvailable = int(askVar(log, "3dsMax Available", str(MaxAvailable))) -if MaxAvailable: - MaxDirectory = askVar(log, "3dsMax Directory", MaxDirectory).replace("\\", "/") - MaxUserDirectory = askVar(log, "3dsMax User Directory", MaxUserDirectory).replace("\\", "/") - MaxExecutable = askVar(log, "3dsMax Executable", MaxExecutable) -if os.path.isfile("configuration/buildsite.py"): - os.remove("configuration/buildsite.py") -sf = open("configuration/buildsite.py", "w") -sf.write("#!/usr/bin/python\n") -sf.write("# \n") -sf.write("# \\file site.py\n") -sf.write("# \\brief Site configuration\n") -sf.write("# \\date " + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "\n") -sf.write("# \\author Jan Boon (Kaetemi)\n") -sf.write("# Python port of game data build pipeline.\n") -sf.write("# Site configuration.\n") -sf.write("# \n") -sf.write("# NeL - MMORPG Framework \n") -sf.write("# Copyright (C) 2010 Winch Gate Property Limited\n") -sf.write("# \n") -sf.write("# This program is free software: you can redistribute it and/or modify\n") -sf.write("# it under the terms of the GNU Affero General Public License as\n") -sf.write("# published by the Free Software Foundation, either version 3 of the\n") -sf.write("# License, or (at your option) any later version.\n") -sf.write("# \n") -sf.write("# This program is distributed in the hope that it will be useful,\n") -sf.write("# but WITHOUT ANY WARRANTY; without even the implied warranty of\n") -sf.write("# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n") -sf.write("# GNU Affero General Public License for more details.\n") -sf.write("# \n") -sf.write("# You should have received a copy of the GNU Affero General Public License\n") -sf.write("# along with this program. If not, see .\n") -sf.write("# \n") -sf.write("\n") -sf.write("\n") -sf.write("# *** SITE INSTALLATION ***\n") -sf.write("\n") -sf.write("# Use '/' in path name, not '\'\n") -sf.write("# Don't put '/' at the end of a directory name\n") -sf.write("\n") -sf.write("\n") -sf.write("# Quality option for this site (1 for BEST, 0 for DRAFT)\n") -sf.write("BuildQuality = " + str(BuildQuality) + "\n") -sf.write("\n") -sf.write("ToolDirectories = " + str(ToolDirectories) + "\n") -sf.write("ToolSuffix = \"" + str(ToolSuffix) + "\"\n") -sf.write("\n") -sf.write("# Build script directory\n") -sf.write("ScriptDirectory = \"" + str(ScriptDirectory) + "\"\n") -sf.write("WorkspaceDirectory = \"" + str(WorkspaceDirectory) + "\"\n") -sf.write("\n") -sf.write("# Data build directories\n") -sf.write("DatabaseDirectory = \"" + str(DatabaseDirectory) + "\"\n") -sf.write("ExportBuildDirectory = \"" + str(ExportBuildDirectory) + "\"\n") -sf.write("\n") -sf.write("# Install directories\n") -sf.write("InstallDirectory = \"" + str(InstallDirectory) + "\"\n") -sf.write("DataShardDirectory = \"" + str(DataShardDirectory) + "\"\n") -sf.write("ClientDevDirectory = \"" + str(ClientDevDirectory) + "\"\n") -sf.write("ClientPatchDirectory = \"" + str(ClientPatchDirectory) + "\"\n") -sf.write("ClientInstallDirectory = \"" + str(ClientInstallDirectory) + "\"\n") -sf.write("\n") -sf.write("# TODO: NETWORK RECONNECT NOT IMPLEMENTED :)\n") -sf.write("\n") -sf.write("# Leveldesign directories\n") -sf.write("LeveldesignDirectory = \"" + str(LeveldesignDirectory) + "\"\n") -sf.write("LeveldesignDfnDirectory = \"" + str(LeveldesignDfnDirectory) + "\"\n") -sf.write("LeveldesignWorldDirectory = \"" + str(LeveldesignWorldDirectory) + "\"\n") -sf.write("PrimitivesDirectory = \"" + str(PrimitivesDirectory) + "\"\n") -sf.write("\n") -sf.write("# Misc data directories\n") -sf.write("GamedevDirectory = \"" + str(GamedevDirectory) + "\"\n") -sf.write("DataCommonDirectory = \"" + str(DataCommonDirectory) + "\"\n") -sf.write("WindowsExeDllCfgDirectories = " + str(WindowsExeDllCfgDirectories) + "\n") -sf.write("\n") -sf.write("# 3dsMax directives\n") -sf.write("MaxAvailable = " + str(MaxAvailable) + "\n") -sf.write("MaxDirectory = \"" + str(MaxDirectory) + "\"\n") -sf.write("MaxUserDirectory = \"" + str(MaxUserDirectory) + "\"\n") -sf.write("MaxExecutable = \"" + str(MaxExecutable) + "\"\n") -sf.write("\n") -sf.write("\n") -sf.write("# end of file\n") -sf.close() + printLog(log, "") + printLog(log, "-------") + printLog(log, "--- Setup build site") + printLog(log, "-------") + printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) + printLog(log, "") + printLog(log, "This script will set up the buildsite configuration, and create needed directories.") + printLog(log, "To use the defaults, simply hit ENTER, else type in the new value.") + printLog(log, "Use -- if you need to insert an empty value.") + printLog(log, "") + BuildQuality = int(askVar(log, "Build Quality", str(BuildQuality))) + ToolDirectories[0] = askVar(log, "Primary Tool Directory", ToolDirectories[0]).replace("\\", "/") + ToolDirectories[1] = askVar(log, "Secondary Tool Directory", ToolDirectories[1]).replace("\\", "/") + ToolSuffix = askVar(log, "Tool Suffix", ToolSuffix) + ScriptDirectory = askVar(log, "Script Directory", os.getcwd().replace("\\", "/")).replace("\\", "/") + WorkspaceDirectory = askVar(log, "Workspace Directory", WorkspaceDirectory).replace("\\", "/") + DatabaseDirectory = askVar(log, "Database Directory", DatabaseDirectory).replace("\\", "/") + ExportBuildDirectory = askVar(log, "Export Build Directory", ExportBuildDirectory).replace("\\", "/") + InstallDirectory = askVar(log, "Install Directory", InstallDirectory).replace("\\", "/") + DataShardDirectory = askVar(log, "Data Shard Directory", DataShardDirectory).replace("\\", "/") + ClientDevDirectory = askVar(log, "Client Dev Directory", ClientDevDirectory).replace("\\", "/") + ClientPatchDirectory = askVar(log, "Client Patch Directory", ClientPatchDirectory).replace("\\", "/") + ClientInstallDirectory = askVar(log, "Client Install Directory", ClientInstallDirectory).replace("\\", "/") + LeveldesignDirectory = askVar(log, "Leveldesign Directory", LeveldesignDirectory).replace("\\", "/") + LeveldesignDfnDirectory = askVar(log, "Leveldesign DFN Directory", LeveldesignDfnDirectory).replace("\\", "/") + LeveldesignWorldDirectory = askVar(log, "Leveldesign World Directory", LeveldesignWorldDirectory).replace("\\", "/") + PrimitivesDirectory = askVar(log, "Primitives Directory", PrimitivesDirectory).replace("\\", "/") + GamedevDirectory = askVar(log, "Gamedev Directory", GamedevDirectory).replace("\\", "/") + DataCommonDirectory = askVar(log, "Data Common Directory", DataCommonDirectory).replace("\\", "/") + WindowsExeDllCfgDirectories[0] = askVar(log, "Primary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[0]).replace("\\", "/") + WindowsExeDllCfgDirectories[1] = askVar(log, "Secondary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[1]).replace("\\", "/") + WindowsExeDllCfgDirectories[2] = askVar(log, "Tertiary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[2]).replace("\\", "/") + WindowsExeDllCfgDirectories[3] = askVar(log, "Quaternary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[3]).replace("\\", "/") + WindowsExeDllCfgDirectories[4] = askVar(log, "Quinary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[4]).replace("\\", "/") + WindowsExeDllCfgDirectories[5] = askVar(log, "Senary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[5]).replace("\\", "/") + WindowsExeDllCfgDirectories[6] = askVar(log, "Septenary Windows exe/dll/cfg Directory", WindowsExeDllCfgDirectories[6]).replace("\\", "/") + MaxAvailable = int(askVar(log, "3dsMax Available", str(MaxAvailable))) + if MaxAvailable: + MaxDirectory = askVar(log, "3dsMax Directory", MaxDirectory).replace("\\", "/") + MaxUserDirectory = askVar(log, "3dsMax User Directory", MaxUserDirectory).replace("\\", "/") + MaxExecutable = askVar(log, "3dsMax Executable", MaxExecutable) + if os.path.isfile("configuration/buildsite.py"): + os.remove("configuration/buildsite.py") + sf = open("configuration/buildsite.py", "w") + sf.write("#!/usr/bin/python\n") + sf.write("# \n") + sf.write("# \\file site.py\n") + sf.write("# \\brief Site configuration\n") + sf.write("# \\date " + time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "\n") + sf.write("# \\author Jan Boon (Kaetemi)\n") + sf.write("# Python port of game data build pipeline.\n") + sf.write("# Site configuration.\n") + sf.write("# \n") + sf.write("# NeL - MMORPG Framework \n") + sf.write("# Copyright (C) 2010 Winch Gate Property Limited\n") + sf.write("# \n") + sf.write("# This program is free software: you can redistribute it and/or modify\n") + sf.write("# it under the terms of the GNU Affero General Public License as\n") + sf.write("# published by the Free Software Foundation, either version 3 of the\n") + sf.write("# License, or (at your option) any later version.\n") + sf.write("# \n") + sf.write("# This program is distributed in the hope that it will be useful,\n") + sf.write("# but WITHOUT ANY WARRANTY; without even the implied warranty of\n") + sf.write("# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n") + sf.write("# GNU Affero General Public License for more details.\n") + sf.write("# \n") + sf.write("# You should have received a copy of the GNU Affero General Public License\n") + sf.write("# along with this program. If not, see .\n") + sf.write("# \n") + sf.write("\n") + sf.write("\n") + sf.write("# *** SITE INSTALLATION ***\n") + sf.write("\n") + sf.write("# Use '/' in path name, not '\'\n") + sf.write("# Don't put '/' at the end of a directory name\n") + sf.write("\n") + sf.write("\n") + sf.write("# Quality option for this site (1 for BEST, 0 for DRAFT)\n") + sf.write("BuildQuality = " + str(BuildQuality) + "\n") + sf.write("\n") + sf.write("ToolDirectories = " + str(ToolDirectories) + "\n") + sf.write("ToolSuffix = \"" + str(ToolSuffix) + "\"\n") + sf.write("\n") + sf.write("# Build script directory\n") + sf.write("ScriptDirectory = \"" + str(ScriptDirectory) + "\"\n") + sf.write("WorkspaceDirectory = \"" + str(WorkspaceDirectory) + "\"\n") + sf.write("\n") + sf.write("# Data build directories\n") + sf.write("DatabaseDirectory = \"" + str(DatabaseDirectory) + "\"\n") + sf.write("ExportBuildDirectory = \"" + str(ExportBuildDirectory) + "\"\n") + sf.write("\n") + sf.write("# Install directories\n") + sf.write("InstallDirectory = \"" + str(InstallDirectory) + "\"\n") + sf.write("DataShardDirectory = \"" + str(DataShardDirectory) + "\"\n") + sf.write("ClientDevDirectory = \"" + str(ClientDevDirectory) + "\"\n") + sf.write("ClientPatchDirectory = \"" + str(ClientPatchDirectory) + "\"\n") + sf.write("ClientInstallDirectory = \"" + str(ClientInstallDirectory) + "\"\n") + sf.write("\n") + sf.write("# TODO: NETWORK RECONNECT NOT IMPLEMENTED :)\n") + sf.write("\n") + sf.write("# Leveldesign directories\n") + sf.write("LeveldesignDirectory = \"" + str(LeveldesignDirectory) + "\"\n") + sf.write("LeveldesignDfnDirectory = \"" + str(LeveldesignDfnDirectory) + "\"\n") + sf.write("LeveldesignWorldDirectory = \"" + str(LeveldesignWorldDirectory) + "\"\n") + sf.write("PrimitivesDirectory = \"" + str(PrimitivesDirectory) + "\"\n") + sf.write("\n") + sf.write("# Misc data directories\n") + sf.write("GamedevDirectory = \"" + str(GamedevDirectory) + "\"\n") + sf.write("DataCommonDirectory = \"" + str(DataCommonDirectory) + "\"\n") + sf.write("WindowsExeDllCfgDirectories = " + str(WindowsExeDllCfgDirectories) + "\n") + sf.write("\n") + sf.write("# 3dsMax directives\n") + sf.write("MaxAvailable = " + str(MaxAvailable) + "\n") + sf.write("MaxDirectory = \"" + str(MaxDirectory) + "\"\n") + sf.write("MaxUserDirectory = \"" + str(MaxUserDirectory) + "\"\n") + sf.write("MaxExecutable = \"" + str(MaxExecutable) + "\"\n") + sf.write("\n") + sf.write("\n") + sf.write("# end of file\n") + sf.close() sys.path.append(WorkspaceDirectory) from projects import * @@ -262,22 +284,83 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") # For each project for projectName in ProjectsToProcess: - os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName)) - os.chdir("processes") - try: - subprocess.call([ "python", "0_setup.py" ]) - except Exception, e: - printLog(log, "<" + projectName + "> " + str(e)) - os.chdir("..") - try: - projectLog = open("processes/log.log", "r") - projectLogData = projectLog.read() - projectLog.close() - log.write(projectLogData) - except Exception, e: - printLog(log, "<" + projectName + "> " + str(e)) + if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)): + printLog(log, "PROJECT " + projectName) + os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName)) + os.chdir("processes") + try: + if not args.includeprocess == None: + subprocess.call([ "python", "0_setup.py", "--includeprocess" ] + args.includeprocess) + elif not args.excludeprocess == None: + subprocess.call([ "python", "0_setup.py", "--excludeprocess" ] + args.excludeprocess) + else: + subprocess.call([ "python", "0_setup.py" ]) + except Exception, e: + printLog(log, "<" + projectName + "> " + str(e)) + os.chdir("..") + try: + projectLog = open("processes/log.log", "r") + projectLogData = projectLog.read() + projectLog.close() + log.write(projectLogData) + except Exception, e: + printLog(log, "<" + projectName + "> " + str(e)) + else: + printLog(log, "IGNORE PROJECT " + projectName) printLog(log, "") +# Additional directories +printLog(log, ">>> Setup additional directories <<<") +mkPath(log, ClientDevDirectory) +mkPath(log, ClientPatchDirectory) +mkPath(log, ClientInstallDirectory) + +if not args.noverify: + printLog(log, "") + printLog(log, "-------") + printLog(log, "--- Verify tool paths") + printLog(log, "-------") + printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) + printLog(log, "") + if MaxAvailable: + findMax(log, MaxDirectory, MaxExecutable) + findTool(log, ToolDirectories, TgaToDdsTool, ToolSuffix) + findTool(log, ToolDirectories, BuildInterfaceTool, ToolSuffix) + findTool(log, ToolDirectories, ExecTimeoutTool, ToolSuffix) + findTool(log, ToolDirectories, BuildSmallbankTool, ToolSuffix) + findTool(log, ToolDirectories, BuildFarbankTool, ToolSuffix) + findTool(log, ToolDirectories, ZoneDependenciesTool, ToolSuffix) + findTool(log, ToolDirectories, ZoneWelderTool, ToolSuffix) + findTool(log, ToolDirectories, BuildRbankTool, ToolSuffix) + findTool(log, ToolDirectories, BuildIndoorRbankTool, ToolSuffix) + findTool(log, ToolDirectories, BuildIgBoxesTool, ToolSuffix) + findTool(log, ToolDirectories, GetNeighborsTool, ToolSuffix) + findTool(log, ToolDirectories, ZoneLighterTool, ToolSuffix) + findTool(log, ToolDirectories, ZoneIgLighterTool, ToolSuffix) + findTool(log, ToolDirectories, IgLighterTool, ToolSuffix) + findTool(log, ToolDirectories, AnimBuilderTool, ToolSuffix) + findTool(log, ToolDirectories, TileEditTool, ToolSuffix) + # findTool(log, ToolDirectories, BuildImagesetTool, ToolSuffix) # kaetemi stuff, ignore this + findTool(log, ToolDirectories, MakeSheetIdTool, ToolSuffix) + # findTool(log, ToolDirectories, BuildSheetsTool, ToolSuffix) # kaetemi stuff, ignore this + # findTool(log, ToolDirectories, BuildSoundTool, ToolSuffix) # kaetemi stuff, ignore this + findTool(log, ToolDirectories, BuildCoarseMeshTool, ToolSuffix) + findTool(log, ToolDirectories, LightmapOptimizerTool, ToolSuffix) + findTool(log, ToolDirectories, BuildClodtexTool, ToolSuffix) + findTool(log, ToolDirectories, BuildShadowSkinTool, ToolSuffix) + findTool(log, ToolDirectories, PanoplyMakerTool, ToolSuffix) + findTool(log, ToolDirectories, HlsBankMakerTool, ToolSuffix) + findTool(log, ToolDirectories, LandExportTool, ToolSuffix) + findTool(log, ToolDirectories, PrimExportTool, ToolSuffix) + findTool(log, ToolDirectories, IgElevationTool, ToolSuffix) + findTool(log, ToolDirectories, IgAddTool, ToolSuffix) + findTool(log, ToolDirectories, BuildClodBankTool, ToolSuffix) + findTool(log, ToolDirectories, SheetsPackerTool, ToolSuffix) + findTool(log, ToolDirectories, BnpMakeTool, ToolSuffix) + findTool(log, ToolDirectories, AiBuildWmapTool, ToolSuffix) + findTool(log, ToolDirectories, TgaCutTool, ToolSuffix) + findTool(log, ToolDirectories, PatchGenTool, ToolSuffix) + log.close() if os.path.isfile("0_setup.log"): os.remove("0_setup.log") diff --git a/code/nel/tools/build_gamedata/1_export.py b/code/nel/tools/build_gamedata/1_export.py index 0fb684592..6abe0a3a5 100644 --- a/code/nel/tools/build_gamedata/1_export.py +++ b/code/nel/tools/build_gamedata/1_export.py @@ -24,9 +24,25 @@ # along with this program. If not, see . # -import time, sys, os, shutil, subprocess, distutils.dir_util +import time, sys, os, shutil, subprocess, distutils.dir_util, argparse sys.path.append("configuration") +parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Export') +# parser.add_argument('--haltonerror', '-eh', action='store_true') +parser.add_argument('--includeproject', '-ipj', nargs='+') +parser.add_argument('--excludeproject', '-epj', nargs='+') +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + +if not args.includeproject == None and not args.excludeproject == None: + print "ERROR --includeproject cannot be combined with --excludeproject, exit." + exit() + +if not args.includeprocess == None and not args.excludeprocess == None: + print "ERROR --includeprocess cannot be combined with --excludeprocess, exit." + exit() + if os.path.isfile("log.log"): os.remove("log.log") log = open("log.log", "w") @@ -46,20 +62,29 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") # For each project for projectName in ProjectsToProcess: - os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName)) - os.chdir("processes") - try: - subprocess.call([ "python", "1_export.py" ]) - except Exception, e: - printLog(log, "<" + projectName + "> " + str(e)) - os.chdir("..") - try: - projectLog = open("processes/log.log", "r") - projectLogData = projectLog.read() - projectLog.close() - log.write(projectLogData) - except Exception, e: - printLog(log, "<" + projectName + "> " + str(e)) + if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)): + printLog(log, "PROJECT " + projectName) + os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName)) + os.chdir("processes") + try: + if not args.includeprocess == None: + subprocess.call([ "python", "1_export.py", "--includeprocess" ] + args.includeprocess) + elif not args.excludeprocess == None: + subprocess.call([ "python", "1_export.py", "--excludeprocess" ] + args.excludeprocess) + else: + subprocess.call([ "python", "1_export.py" ]) + except Exception, e: + printLog(log, "<" + projectName + "> " + str(e)) + os.chdir("..") + try: + projectLog = open("processes/log.log", "r") + projectLogData = projectLog.read() + projectLog.close() + log.write(projectLogData) + except Exception, e: + printLog(log, "<" + projectName + "> " + str(e)) + else: + printLog(log, "IGNORE PROJECT " + projectName) printLog(log, "") log.close() diff --git a/code/nel/tools/build_gamedata/2_build.py b/code/nel/tools/build_gamedata/2_build.py index a6229c29c..36a171161 100644 --- a/code/nel/tools/build_gamedata/2_build.py +++ b/code/nel/tools/build_gamedata/2_build.py @@ -24,9 +24,25 @@ # along with this program. If not, see . # -import time, sys, os, shutil, subprocess, distutils.dir_util +import time, sys, os, shutil, subprocess, distutils.dir_util, argparse sys.path.append("configuration") +parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Build') +# parser.add_argument('--haltonerror', '-eh', action='store_true') +parser.add_argument('--includeproject', '-ipj', nargs='+') +parser.add_argument('--excludeproject', '-epj', nargs='+') +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + +if not args.includeproject == None and not args.excludeproject == None: + print "ERROR --includeproject cannot be combined with --excludeproject, exit." + exit() + +if not args.includeprocess == None and not args.excludeprocess == None: + print "ERROR --includeprocess cannot be combined with --excludeprocess, exit." + exit() + if os.path.isfile("log.log"): os.remove("log.log") log = open("log.log", "w") @@ -46,20 +62,29 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") # For each project for projectName in ProjectsToProcess: - os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName)) - os.chdir("processes") - try: - subprocess.call([ "python", "2_build.py" ]) - except Exception, e: - printLog(log, "<" + projectName + "> " + str(e)) - os.chdir("..") - try: - projectLog = open("processes/log.log", "r") - projectLogData = projectLog.read() - projectLog.close() - log.write(projectLogData) - except Exception, e: - printLog(log, "<" + projectName + "> " + str(e)) + if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)): + printLog(log, "PROJECT " + projectName) + os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName)) + os.chdir("processes") + try: + if not args.includeprocess == None: + subprocess.call([ "python", "2_build.py", "--includeprocess" ] + args.includeprocess) + elif not args.excludeprocess == None: + subprocess.call([ "python", "2_build.py", "--excludeprocess" ] + args.excludeprocess) + else: + subprocess.call([ "python", "2_build.py" ]) + except Exception, e: + printLog(log, "<" + projectName + "> " + str(e)) + os.chdir("..") + try: + projectLog = open("processes/log.log", "r") + projectLogData = projectLog.read() + projectLog.close() + log.write(projectLogData) + except Exception, e: + printLog(log, "<" + projectName + "> " + str(e)) + else: + printLog(log, "IGNORE PROJECT " + projectName) printLog(log, "") log.close() diff --git a/code/nel/tools/build_gamedata/3_install.py b/code/nel/tools/build_gamedata/3_install.py index 70ece522b..39a19dea3 100644 --- a/code/nel/tools/build_gamedata/3_install.py +++ b/code/nel/tools/build_gamedata/3_install.py @@ -24,9 +24,25 @@ # along with this program. If not, see . # -import time, sys, os, shutil, subprocess, distutils.dir_util +import time, sys, os, shutil, subprocess, distutils.dir_util, argparse sys.path.append("configuration") +parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Install') +# parser.add_argument('--haltonerror', '-eh', action='store_true') +parser.add_argument('--includeproject', '-ipj', nargs='+') +parser.add_argument('--excludeproject', '-epj', nargs='+') +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + +if not args.includeproject == None and not args.excludeproject == None: + print "ERROR --includeproject cannot be combined with --excludeproject, exit." + exit() + +if not args.includeprocess == None and not args.excludeprocess == None: + print "ERROR --includeprocess cannot be combined with --excludeprocess, exit." + exit() + if os.path.isfile("log.log"): os.remove("log.log") log = open("log.log", "w") @@ -46,20 +62,29 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") # For each project for projectName in ProjectsToProcess: - os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName)) - os.chdir("processes") - try: - subprocess.call([ "python", "3_install.py" ]) - except Exception, e: - printLog(log, "<" + projectName + "> " + str(e)) - os.chdir("..") - try: - projectLog = open("processes/log.log", "r") - projectLogData = projectLog.read() - projectLog.close() - log.write(projectLogData) - except Exception, e: - printLog(log, "<" + projectName + "> " + str(e)) + if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)): + printLog(log, "PROJECT " + projectName) + os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName)) + os.chdir("processes") + try: + if not args.includeprocess == None: + subprocess.call([ "python", "3_install.py", "--includeprocess" ] + args.includeprocess) + elif not args.excludeprocess == None: + subprocess.call([ "python", "3_install.py", "--excludeprocess" ] + args.excludeprocess) + else: + subprocess.call([ "python", "3_install.py" ]) + except Exception, e: + printLog(log, "<" + projectName + "> " + str(e)) + os.chdir("..") + try: + projectLog = open("processes/log.log", "r") + projectLogData = projectLog.read() + projectLog.close() + log.write(projectLogData) + except Exception, e: + printLog(log, "<" + projectName + "> " + str(e)) + else: + printLog(log, "IGNORE PROJECT " + projectName) printLog(log, "") log.close() diff --git a/code/nel/tools/build_gamedata/7_client_install.py b/code/nel/tools/build_gamedata/7_client_install.py index b5a5bab1f..c4c1ab03c 100644 --- a/code/nel/tools/build_gamedata/7_client_install.py +++ b/code/nel/tools/build_gamedata/7_client_install.py @@ -45,45 +45,30 @@ printLog(log, "-------") printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") -# Find tools -BnpMake = findTool(log, ToolDirectories, BnpMakeTool, ToolSuffix) -printLog(log, "") - -if BnpMake == "": - toolLogFail(log, BnpMakeTool, ToolSuffix) -else: - for category in InstallClientData: - printLog(log, "CATEGORY " + category["Name"]) - if (category["UnpackTo"] != None): - targetPath = ClientInstallDirectory - if (category["UnpackTo"] != ""): - targetPath += "/" + category["UnpackTo"] - mkPath(log, targetPath) - for package in category["Packages"]: - printLog(log, "PACKAGE " + package[0]) - mkPath(log, InstallDirectory + "/" + package[0]) - copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + package[0], targetPath) - else: - targetPath = ClientInstallDirectory + "/data" - mkPath(log, targetPath) - for package in category["Packages"]: - printLog(log, "PACKAGE " + package[0]) - sourcePath = InstallDirectory + "/" + package[0] - mkPath(log, sourcePath) - targetBnp = targetPath + "/" + package[0] + ".bnp" - if (len(package[1]) > 0): - targetBnp = targetPath + "/" + package[1][0] - printLog(log, "TARGET " + package[1][0]) - needUpdateBnp = 1 - if (len(package) > 2): - needUpdateBnp = needUpdate(log, sourcePath + "/" + package[2], targetBnp) - else: - needUpdateBnp = needUpdateDirNoSubdirFile(log, sourcePath, targetBnp) - if (needUpdateBnp): - printLog(log, "BNP " + targetBnp) - subprocess.call([ BnpMake, "/p", sourcePath, targetPath ] + package[1]) - else: - printLog(log, "SKIP " + targetBnp) +for category in InstallClientData: + printLog(log, "CATEGORY " + category["Name"]) + if (category["UnpackTo"] != None): + targetPath = ClientInstallDirectory + if (category["UnpackTo"] != ""): + targetPath += "/" + category["UnpackTo"] + mkPath(log, targetPath) + for package in category["Packages"]: + printLog(log, "PACKAGE " + package[0]) + mkPath(log, InstallDirectory + "/" + package[0]) + copyFilesNoTreeIfNeeded(log, InstallDirectory + "/" + package[0], targetPath) + else: + sourcePath = ClientPatchDirectory + "/bnp" + targetPath = ClientInstallDirectory + "/data" + mkPath(log, targetPath) + for package in category["Packages"]: + printLog(log, "PACKAGE " + package[0]) + sourceBnp = sourcePath + "/" + package[0] + ".bnp" + targetBnp = targetPath + "/" + package[0] + ".bnp" + if (len(package[1]) > 0): + sourceBnp = sourcePath + "/" + package[1][0] + targetBnp = targetPath + "/" + package[1][0] + printLog(log, "TARGET " + package[1][0]) + copyFileIfNeeded(log, sourceBnp, targetBnp) printLog(log, "") log.close() diff --git a/code/nel/tools/build_gamedata/configuration/tools.py b/code/nel/tools/build_gamedata/configuration/tools.py index e533270c1..5eff45977 100644 --- a/code/nel/tools/build_gamedata/configuration/tools.py +++ b/code/nel/tools/build_gamedata/configuration/tools.py @@ -69,10 +69,10 @@ ZoneIgLighterTool = "zone_ig_lighter" IgLighterTool = "ig_lighter" AnimBuilderTool = "anim_builder" TileEditTool = "tile_edit" -BuildImagesetTool = "th_build_imageset" +# BuildImagesetTool = "th_build_imageset" # kaetemi stuff, ignore this MakeSheetIdTool = "make_sheet_id" -BuildSheetsTool = "th_build_sheets" -BuildSoundTool = "th_build_sound" +# BuildSheetsTool = "th_build_sheets" # kaetemi stuff, ignore this +# BuildSoundTool = "th_build_sound" # kaetemi stuff, ignore this BuildCoarseMeshTool = "build_coarse_mesh" LightmapOptimizerTool = "lightmap_optimizer" BuildClodtexTool = "build_clodtex" diff --git a/code/nel/tools/build_gamedata/processes/0_setup.py b/code/nel/tools/build_gamedata/processes/0_setup.py index cb6de2abb..213158c92 100644 --- a/code/nel/tools/build_gamedata/processes/0_setup.py +++ b/code/nel/tools/build_gamedata/processes/0_setup.py @@ -24,8 +24,14 @@ # along with this program. If not, see . # -import time, sys, os, shutil, subprocess, distutils.dir_util +import time, sys, os, shutil, subprocess, distutils.dir_util, argparse sys.path.append("../configuration") + +parser = argparse.ArgumentParser() +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + if os.path.isfile("log.log"): os.remove("log.log") log = open("log.log", "w") @@ -60,20 +66,24 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") # For each process for processName in ProcessToComplete: - os.chdir(processName) - try: - subprocess.call([ "python", "0_setup.py" ]) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - os.chdir("..") - try: - processLog = open(processName + "/log.log", "r") - processLogData = processLog.read() - processLog.close() - log.write(processLogData) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - # subprocess.call("idle.bat") + if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): + printLog(log, "PROCESS " + processName) + os.chdir(processName) + try: + subprocess.call([ "python", "0_setup.py" ]) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + os.chdir("..") + try: + processLog = open(processName + "/log.log", "r") + processLogData = processLog.read() + processLog.close() + log.write(processLogData) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + # subprocess.call("idle.bat") + else: + printLog(log, "IGNORE PROCESS " + processName) printLog(log, "") log.close() diff --git a/code/nel/tools/build_gamedata/processes/1_export.py b/code/nel/tools/build_gamedata/processes/1_export.py index fdd497720..766639f17 100644 --- a/code/nel/tools/build_gamedata/processes/1_export.py +++ b/code/nel/tools/build_gamedata/processes/1_export.py @@ -24,9 +24,14 @@ # along with this program. If not, see . # -import time, sys, os, shutil, subprocess, distutils.dir_util +import time, sys, os, shutil, subprocess, distutils.dir_util, argparse sys.path.append("../configuration") +parser = argparse.ArgumentParser() +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + if os.path.isfile("log.log"): os.remove("log.log") log = open("log.log", "w") @@ -45,20 +50,24 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") # For each process for processName in ProcessToComplete: - os.chdir(processName) - try: - subprocess.call([ "python", "1_export.py" ]) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - os.chdir("..") - try: - processLog = open(processName + "/log.log", "r") - processLogData = processLog.read() - processLog.close() - log.write(processLogData) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - # subprocess.call("idle.bat") + if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): + printLog(log, "PROCESS " + processName) + os.chdir(processName) + try: + subprocess.call([ "python", "1_export.py" ]) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + os.chdir("..") + try: + processLog = open(processName + "/log.log", "r") + processLogData = processLog.read() + processLog.close() + log.write(processLogData) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + # subprocess.call("idle.bat") + else: + printLog(log, "IGNORE PROCESS " + processName) printLog(log, "") log.close() diff --git a/code/nel/tools/build_gamedata/processes/2_build.py b/code/nel/tools/build_gamedata/processes/2_build.py index 28ee3147c..4ad70b2f4 100644 --- a/code/nel/tools/build_gamedata/processes/2_build.py +++ b/code/nel/tools/build_gamedata/processes/2_build.py @@ -24,9 +24,14 @@ # along with this program. If not, see . # -import time, sys, os, shutil, subprocess, distutils.dir_util +import time, sys, os, shutil, subprocess, distutils.dir_util, argparse sys.path.append("../configuration") +parser = argparse.ArgumentParser() +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + if os.path.isfile("log.log"): os.remove("log.log") log = open("log.log", "w") @@ -45,20 +50,24 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") # For each process for processName in ProcessToComplete: - os.chdir(processName) - try: - subprocess.call([ "python", "2_build.py" ]) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - os.chdir("..") - try: - processLog = open(processName + "/log.log", "r") - processLogData = processLog.read() - processLog.close() - log.write(processLogData) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - # subprocess.call("idle.bat") + if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): + printLog(log, "PROCESS " + processName) + os.chdir(processName) + try: + subprocess.call([ "python", "2_build.py" ]) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + os.chdir("..") + try: + processLog = open(processName + "/log.log", "r") + processLogData = processLog.read() + processLog.close() + log.write(processLogData) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + # subprocess.call("idle.bat") + else: + printLog(log, "IGNORE PROCESS " + processName) printLog(log, "") log.close() diff --git a/code/nel/tools/build_gamedata/processes/3_install.py b/code/nel/tools/build_gamedata/processes/3_install.py index fe51c0772..89bf53660 100644 --- a/code/nel/tools/build_gamedata/processes/3_install.py +++ b/code/nel/tools/build_gamedata/processes/3_install.py @@ -24,9 +24,14 @@ # along with this program. If not, see . # -import time, sys, os, shutil, subprocess, distutils.dir_util +import time, sys, os, shutil, subprocess, distutils.dir_util, argparse sys.path.append("../configuration") +parser = argparse.ArgumentParser() +parser.add_argument('--includeprocess', '-ipc', nargs='+') +parser.add_argument('--excludeprocess', '-epc', nargs='+') +args = parser.parse_args() + if os.path.isfile("log.log"): os.remove("log.log") log = open("log.log", "w") @@ -44,20 +49,24 @@ printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time()))) printLog(log, "") # For each process for processName in ProcessToComplete: - os.chdir(processName) - try: - subprocess.call([ "python", "3_install.py" ]) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - os.chdir("..") - try: - processLog = open(processName + "/log.log", "r") - processLogData = processLog.read() - processLog.close() - log.write(processLogData) - except Exception, e: - printLog(log, "<" + processName + "> " + str(e)) - # subprocess.call("idle.bat") + if ((args.includeprocess == None or processName in args.includeprocess) and (args.excludeprocess == None or not processName in args.excludeprocess)): + printLog(log, "PROCESS " + processName) + os.chdir(processName) + try: + subprocess.call([ "python", "3_install.py" ]) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + os.chdir("..") + try: + processLog = open(processName + "/log.log", "r") + processLogData = processLog.read() + processLog.close() + log.write(processLogData) + except Exception, e: + printLog(log, "<" + processName + "> " + str(e)) + # subprocess.call("idle.bat") + else: + printLog(log, "IGNORE PROCESS " + processName) printLog(log, "") log.close() diff --git a/code/nelns/CMakeLists.txt b/code/nelns/CMakeLists.txt index 9a8402fac..63916ba08 100644 --- a/code/nelns/CMakeLists.txt +++ b/code/nelns/CMakeLists.txt @@ -1,14 +1,14 @@ -FIND_PACKAGE(MySQL) -FIND_PACKAGE(CURL) - -IF(BUILD_SERVICES) - ADD_SUBDIRECTORY(admin_executor_service) - ADD_SUBDIRECTORY(admin_service) - ADD_SUBDIRECTORY(naming_service) - ADD_SUBDIRECTORY(login_service) - ADD_SUBDIRECTORY(welcome_service) -ENDIF(BUILD_SERVICES) - -IF(BUILD_LOGIN_SYSTEM) - ADD_SUBDIRECTORY(login_system) -ENDIF(BUILD_LOGIN_SYSTEM) +FIND_PACKAGE(MySQL) +FIND_PACKAGE(CURL) + +IF(WITH_NELNS_SERVER) + ADD_SUBDIRECTORY(admin_executor_service) + ADD_SUBDIRECTORY(admin_service) + ADD_SUBDIRECTORY(naming_service) + ADD_SUBDIRECTORY(login_service) + ADD_SUBDIRECTORY(welcome_service) +ENDIF(WITH_NELNS_SERVER) + +IF(WITH_NELNS_LOGIN_SYSTEM) + ADD_SUBDIRECTORY(login_system) +ENDIF(WITH_NELNS_LOGIN_SYSTEM) diff --git a/code/nelns/admin_executor_service/log_report.cpp b/code/nelns/admin_executor_service/log_report.cpp index eac5f83c3..7106fb9d1 100644 --- a/code/nelns/admin_executor_service/log_report.cpp +++ b/code/nelns/admin_executor_service/log_report.cpp @@ -1,580 +1,581 @@ -// NeLNS - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "log_report.h" -#include -#include "nel/misc/common.h" -#include "nel/misc/displayer.h" -#include "nel/misc/file.h" -#include "nel/misc/path.h" -#include "nel/misc/variable.h" - -using namespace NLMISC; -using namespace std; - - -CVariable LogPath( "LogReport","LogPath", "Path of the log files", ".", 0, true ); - -const uint MAX_LOG_LINE_SIZE = 1024; -//nlctassert(MAX_LOG_LINE_SIZE>0); - -enum TLogLineHeader { LHDate, LHTime, LHType, LHThread, LHService, LHCodeFile, LHCodeLine, LHSeparator, LH_NB_FIELDS }; - - -/// -bool isLogFile( const std::string& filename ) -{ - uint len = (uint)filename.size(); - return (len >= 4 ) && (filename.substr( len-4 ) == ".log"); -} - -/// -inline bool isNumberChar( char c ) -{ - return (c >= '0') && (c <= '9'); -} - -/// -void sortLogFiles( vector& filenames ) -{ - uint i; - for ( i=0; i!=filenames.size(); ++i ) - { - // Ensure that a log file without number comes *after* the ones with a number - string name = string(filenames[i]); - string::size_type dotpos = name.find_last_of('.'); - if ( (dotpos!=string::npos) && (dotpos > 2) ) - { - if ( ! (isNumberChar(name[dotpos-1]) && isNumberChar(name[dotpos-2]) && isNumberChar(name[dotpos-3])) ) - { - name = name.substr( 0, dotpos ) + "ZZZ" + name.substr( dotpos ); - filenames[i] = name.c_str(); - } - } - } - sort( filenames.begin(), filenames.end() ); - for ( i=0; i!=filenames.size(); ++i ) - { - // Set the original names back - string name = filenames[i]; - string::size_type tokenpos = name.find( "ZZZ." ); - if ( tokenpos != string::npos ) - { - name = name.substr( 0, tokenpos ) + name.substr( tokenpos + 3 ); - filenames[i] = name.c_str(); - } - } -} - -void CMakeLogTask::setLogPath(const std::string & logPath) -{ - _LogPaths.resize( 1 ); - _LogPaths[0] = logPath; -} - -void CMakeLogTask::setLogPaths(const std::vector& logPaths) -{ - _LogPaths = logPaths; -} - -void CMakeLogTask::setLogPathToDefault() -{ - setLogPath( LogPath.get() ); -} - -/* - * - */ -CMakeLogTask::~CMakeLogTask() -{ - if ( _Thread ) // implies && _OutputLogReport - { - if ( ! _Complete ) - { - pleaseStop(); - _Thread->wait(); - } - clear(); - } -} - - -/* - * - */ -void CMakeLogTask::start() -{ - if ( _Thread ) - { - if ( _Complete ) - clear(); - else - return; - } - _Stopping = false; - _Complete = false; - _Thread = NLMISC::IThread::create( this ); - _OutputLogReport = new CLogReport(); - _Thread->start(); -} - - -/* - * - */ -void CMakeLogTask::clear() -{ - if (_Thread) - { - delete _Thread; - _Thread = NULL; - } - if (_OutputLogReport) - { - delete _OutputLogReport; - _OutputLogReport = NULL; - } -} - -/* - * - */ -void CMakeLogTask::terminateTask() -{ - if (!_Thread) // _Thread _implies _OutputLogReport - return; - - pleaseStop(); - _Thread->wait(); - - clear(); -} - -// -bool isOfLogDotLogFamily( const std::string& filename ) -{ - return ((filename == "log.log") || - ((filename.size() == 10) && - (filename.substr( 0, 3 ) == "log") && - isNumberChar(filename[3]) && isNumberChar(filename[4]) && isNumberChar(filename[5]) && - (filename.substr( 6, 4 ) == ".log")) ); -} - - -enum TVersionTargetMode { TTMAll, TTMMatchAllV, TTMMatchExactV, TTMMatchGreaterV, TTMMatchLowerV } targetMode; -const uint CurrentVersion = std::numeric_limits::max(); - -// Return true and logVersion, or false if not a log with version -bool getLogVersion( const std::string& filename, uint& logVersion ) -{ - uint len = (uint)filename.size(); - if ( (len > 4) && (filename.substr( len-4 ) == ".log") ) - { - if ( filename.substr(0, 3) == "log" ) - { - if ( (len == 7) || - ((len == 10) && (isNumberChar(filename[3]) && isNumberChar(filename[4]) && isNumberChar(filename[5]))) ) - { - logVersion = CurrentVersion; - return true; - } - } - else if ( filename[0] == 'v' ) - { - string::size_type p = filename.find( "_", 1 ); - if ( p != string::npos ) - { - if ( (len == p + 8) || - ((len == p + 11) && (isNumberChar(filename[p+4]) && isNumberChar(filename[p+5]) && isNumberChar(filename[p+6]))) ) - { - NLMISC::fromString( filename.substr( 1, p-1 ), logVersion ); - return true; - } - } - } - } - return false; -} - -// Assumes filename is .log file -bool matchLogTarget( const std::string& filename, TVersionTargetMode targetMode, uint targetVersion ) -{ - if ( targetMode == TTMAll ) - return true; - - uint version; - - // Get version or exclude non-standard log files - if ( ! getLogVersion( filename, version ) ) - return false; - - // Exclude non-matching version - switch ( targetMode ) - { - case TTMMatchExactV: - return (version == targetVersion); // break; - case TTMMatchGreaterV: - return (version >= targetVersion); // break; - case TTMMatchLowerV: - return (version <= targetVersion); // break; - default: // TTMMatchAllV - return true; - } -} - -/* - * - */ -void CMakeLogTask::run() -{ - // Parse log target - uint targetVersion = CurrentVersion; - uint lts = (uint)_LogTarget.size(); - if ( _LogTarget.empty() || (_LogTarget == "v") ) - { - targetMode = TTMMatchExactV; - } - else if ( _LogTarget == "v*" ) - { - targetMode = TTMMatchAllV; - } - else if ( _LogTarget == "*" ) - { - targetMode = TTMAll; - } - else if ( (lts > 1) && (_LogTarget[0] == 'v') ) - { - uint additionalChars = 1; - if ( _LogTarget[lts-1] == '+' ) - targetMode = TTMMatchGreaterV; - else if ( _LogTarget[lts-1] == '-' ) - targetMode = TTMMatchLowerV; - else - { - targetMode = TTMMatchExactV; - additionalChars = 0; - } - - NLMISC::fromString( _LogTarget.substr( 1, lts-additionalChars-1 ), targetVersion ); - } - else - { - nlwarning( "Invalid log target argument: %s", _LogTarget.c_str() ); - _Complete = true; - return; - } - - // Get log files and sort them - vector filenames; - vector filenamesOfPath; - for ( vector::const_iterator ilf=_LogPaths.begin(); ilf!=_LogPaths.end(); ++ilf ) - { - string path = (*ilf); - if ( (! path.empty()) && (path[path.size()-1]!='/') ) - path += "/"; - filenamesOfPath.clear(); - CPath::getPathContent( path, false, false, true, filenamesOfPath, NULL, true ); - vector::iterator ilf2 = partition( filenamesOfPath.begin(), filenamesOfPath.end(), isLogFile ); - filenamesOfPath.erase( ilf2, filenamesOfPath.end() ); - sortLogFiles( filenamesOfPath ); - filenames.insert( filenames.end(), filenamesOfPath.begin(), filenamesOfPath.end() ); - } - - // Analyse log files - _OutputLogReport->reset(); - uint nbLines = 0; - char line [MAX_LOG_LINE_SIZE]; - - uint nbSkippedFiles = 0; - for ( vector::const_iterator ilf=filenames.begin(); ilf!=filenames.end(); ++ilf ) - { - string shortname = CFile::getFilename( *ilf ); - - // Filter log files based on filename before opening them - if ( ! matchLogTarget( shortname, targetMode, targetVersion ) ) - { - ++nbSkippedFiles; - continue; - } - - nlinfo( "Processing %s (%u/%u)", (*ilf).c_str(), ilf-filenames.begin(), filenames.size() ); - CIFile logfile; - if ( logfile.open( *ilf, true ) ) - { - _OutputLogReport->setProgress( (uint)(ilf-filenames.begin()), (uint)filenames.size() ); - while ( ! logfile.eof() ) - { - logfile.getline( line, MAX_LOG_LINE_SIZE ); - line[MAX_LOG_LINE_SIZE-1] = '\0'; // force valid end of line - _OutputLogReport->pushLine( line ); - ++nbLines; - - if ( isStopping() ) - return; - } - } - } - nlinfo( "%u lines processed", nbLines ); - if ( nbSkippedFiles != 0 ) - nlinfo( "%u log files skipped, not matching target %s", nbSkippedFiles, _LogTarget.c_str() ); - _Complete = true; -} - - -/* - * Add a log line to the report tree - */ -void CLogReport::pushLine( const std::string& line, NLMISC::CLog::TLogType onlyType, bool countOtherTypes ) -{ - // Ignore session title - if ( (line.size() > 14) && (line.substr( 0, 14 ) == "Log Starting [") ) - return; - - // Decode standard log line - vector lineTokens; - explode( line, string(" "), lineTokens ); - - if ( lineTokens.size() < LH_NB_FIELDS ) - return; - - // Filter log type - if ( onlyType != CLog::LOG_UNKNOWN ) - { - if ( lineTokens[LHType] != IDisplayer::logTypeToString( onlyType ) ) - { - if ( countOtherTypes ) - storeLine( lineTokens, true ); - return; - } - } - - // Store - storeLine( lineTokens, false ); -} - - -/* - * - */ -void CLogReportNode::storeLine( const std::vector& lineTokens, bool mainCountOnly ) -{ - // Get service name from "[machine/]serviceName-serviceId" - string service = lineTokens[LHService]; - string::size_type p = service.find( '/' ); - if ( p != string::npos ) - service = service.substr( p+1 ); - p = service.find( '-' ); - if ( p != string::npos ) - service = service.substr( 0, p ); - - // Store to appropriate child - CLogReportLeaf *child = getChild( service ); - if ( ! child ) - child = addChild( service ); - child->storeLine( lineTokens, mainCountOnly ); -} - - -/* - * - */ -void CLogReportLeaf::storeLine( const std::vector& lineTokens, bool mainCountOnly ) -{ - if ( ! mainCountOnly ) - { - // Build key from "codeFile codeLine" - string key = lineTokens[LHCodeFile] + ":" + lineTokens[LHCodeLine]; - _LogLineInfo[key].addAnOccurence( lineTokens ); - } - ++_Counts[lineTokens[LHType]]; - ++_TotalLines; -} - - -/* - * - */ -void CLogLineInfo::addAnOccurence( const std::vector& lineTokens ) -{ - if ( NbOccurences == 0 ) - { - for ( uint i=LH_NB_FIELDS; ireport( targetLog, true ); - } - else - { - targetLog->displayNL( "Nothing found for service %s", service.c_str() ); - } -} - - -/* - * Get results for a service (all distinct lines, sorted by occurence) - */ -void CLogReportLeaf::report( NLMISC::CLog *targetLog, bool ) -{ - // Sort it - typedef multimap< uint, pair< string, const CLogLineInfo * >, std::greater > CSortedByOccurenceLogLineInfoMap; - CSortedByOccurenceLogLineInfoMap sortedByOccurence; - for ( CLogLineInfoMap::const_iterator it=_LogLineInfo.begin(); it!=_LogLineInfo.end(); ++it ) - { - const string &key = (*it).first; - const CLogLineInfo& info = (*it).second; - sortedByOccurence.insert( make_pair( info.NbOccurences, make_pair( key, &info ) ) ); - } - - // Display it - for ( CSortedByOccurenceLogLineInfoMap::const_iterator iso=sortedByOccurence.begin(); iso!=sortedByOccurence.end(); ++iso ) - { - const string &key = (*iso).second.first; - const CLogLineInfo& info = *((*iso).second.second); - targetLog->displayRawNL( "%s %6u %s : %s", _Service.c_str(), info.NbOccurences, key.c_str(), info.SampleLogText.c_str() ); - } -} - - -/* - * Return the number of lines displayed - */ -uint CLogReportLeaf::reportPart( uint beginIndex, uint maxNbLines, NLMISC::CLog *targetLog ) -{ - uint i = 0; - CLogLineInfoMap::const_iterator it; - for ( it=_LogLineInfo.begin(); it!=_LogLineInfo.end(); ++it ) - { - if ( i >= beginIndex ) - { - if ( i >= maxNbLines ) - return i - beginIndex; - - const string &key = (*it).first; - const CLogLineInfo& info = (*it).second; - targetLog->displayRawNL( "%s %6u %s : %s", _Service.c_str(), info.NbOccurences, key.c_str(), info.SampleLogText.c_str() ); - } - ++i; - } - return i - beginIndex; -} - - -/* - * Get summary of results - */ -void CLogReportNode::report( NLMISC::CLog *targetLog, bool displayDetailsPerService ) -{ - uint nb1Sum=0, nb2Sum=0; - for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) - { - CLogReportLeaf *pt = (*it); - - // Get distinct warnings - uint nb1 = pt->getNbDistinctLines(); - nb1Sum += nb1; - - // Get total warnings, info... but filter out lines with no header - uint sumTotalLinesNotUnknown = 0; - uint nbTotalLines [CLog::LOG_UNKNOWN]; - for ( uint i=CLog::LOG_ERROR; i!=CLog::LOG_UNKNOWN; ++i ) - { - nbTotalLines[i] = pt->getNbTotalLines( (CLog::TLogType)i ); - sumTotalLinesNotUnknown += nbTotalLines[i]; - } - if ( sumTotalLinesNotUnknown != 0 ) - { - targetLog->displayRawNL( "%s: \t%u distinct WRN, %u total WRN, %u INF, %u DBG, %u STT, %u AST, %u ERR, %u TOTAL", - pt->service().c_str(), nb1, nbTotalLines[CLog::LOG_WARNING], - nbTotalLines[CLog::LOG_INFO], nbTotalLines[CLog::LOG_DEBUG], - nbTotalLines[CLog::LOG_STAT], nbTotalLines[CLog::LOG_ASSERT], - nbTotalLines[CLog::LOG_ERROR], pt->getNbTotalLines( CLog::LOG_UNKNOWN ) ); - nb2Sum += nbTotalLines[CLog::LOG_WARNING]; - } - } - targetLog->displayRawNL( "=> %u distinct, %u total WRN (%u pages)", nb1Sum, nb2Sum, nb1Sum / NB_LINES_PER_PAGE + 1 ); - - if ( displayDetailsPerService ) - { - for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) - { - (*it)->report( targetLog, true ); - } - } -} - - -/* - * Get partial results (pageNum>=1) - */ -void CLogReportNode::reportPage( uint pageNum, NLMISC::CLog *targetLog ) -{ - if ( _Children.empty() ) - { - targetLog->displayRawNL( "[END OF LOG]" ); - return; - } - - uint beginIndex = pageNum * NB_LINES_PER_PAGE; - uint lineCounter = 0, prevLineCounter; - for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) - { - CLogReportLeaf *pt = (*it); - prevLineCounter = lineCounter; - lineCounter += pt->getNbDistinctLines(); - if ( lineCounter >= beginIndex ) - { - uint remainingLines = pageNum - (lineCounter - beginIndex ); - pt->reportPart( beginIndex - prevLineCounter, remainingLines, targetLog ); // - while ( remainingLines != 0 ) - { - ++it; - if ( it == _Children.end() ) - { - targetLog->displayRawNL( "[END OF LOG]" ); - return; - } - pt = (*it); - remainingLines -= pt->reportPart( 0, remainingLines, targetLog ); - } - return; - } - } -} +// NeLNS - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "log_report.h" +#include +#include +#include "nel/misc/common.h" +#include "nel/misc/displayer.h" +#include "nel/misc/file.h" +#include "nel/misc/path.h" +#include "nel/misc/variable.h" + +using namespace NLMISC; +using namespace std; + + +CVariable LogPath( "LogReport","LogPath", "Path of the log files", ".", 0, true ); + +const uint MAX_LOG_LINE_SIZE = 1024; +//nlctassert(MAX_LOG_LINE_SIZE>0); + +enum TLogLineHeader { LHDate, LHTime, LHType, LHThread, LHService, LHCodeFile, LHCodeLine, LHSeparator, LH_NB_FIELDS }; + + +/// +bool isLogFile( const std::string& filename ) +{ + uint len = (uint)filename.size(); + return (len >= 4 ) && (filename.substr( len-4 ) == ".log"); +} + +/// +inline bool isNumberChar( char c ) +{ + return (c >= '0') && (c <= '9'); +} + +/// +void sortLogFiles( vector& filenames ) +{ + uint i; + for ( i=0; i!=filenames.size(); ++i ) + { + // Ensure that a log file without number comes *after* the ones with a number + string name = string(filenames[i]); + string::size_type dotpos = name.find_last_of('.'); + if ( (dotpos!=string::npos) && (dotpos > 2) ) + { + if ( ! (isNumberChar(name[dotpos-1]) && isNumberChar(name[dotpos-2]) && isNumberChar(name[dotpos-3])) ) + { + name = name.substr( 0, dotpos ) + "ZZZ" + name.substr( dotpos ); + filenames[i] = name.c_str(); + } + } + } + sort( filenames.begin(), filenames.end() ); + for ( i=0; i!=filenames.size(); ++i ) + { + // Set the original names back + string name = filenames[i]; + string::size_type tokenpos = name.find( "ZZZ." ); + if ( tokenpos != string::npos ) + { + name = name.substr( 0, tokenpos ) + name.substr( tokenpos + 3 ); + filenames[i] = name.c_str(); + } + } +} + +void CMakeLogTask::setLogPath(const std::string & logPath) +{ + _LogPaths.resize( 1 ); + _LogPaths[0] = logPath; +} + +void CMakeLogTask::setLogPaths(const std::vector& logPaths) +{ + _LogPaths = logPaths; +} + +void CMakeLogTask::setLogPathToDefault() +{ + setLogPath( LogPath.get() ); +} + +/* + * + */ +CMakeLogTask::~CMakeLogTask() +{ + if ( _Thread ) // implies && _OutputLogReport + { + if ( ! _Complete ) + { + pleaseStop(); + _Thread->wait(); + } + clear(); + } +} + + +/* + * + */ +void CMakeLogTask::start() +{ + if ( _Thread ) + { + if ( _Complete ) + clear(); + else + return; + } + _Stopping = false; + _Complete = false; + _Thread = NLMISC::IThread::create( this ); + _OutputLogReport = new CLogReport(); + _Thread->start(); +} + + +/* + * + */ +void CMakeLogTask::clear() +{ + if (_Thread) + { + delete _Thread; + _Thread = NULL; + } + if (_OutputLogReport) + { + delete _OutputLogReport; + _OutputLogReport = NULL; + } +} + +/* + * + */ +void CMakeLogTask::terminateTask() +{ + if (!_Thread) // _Thread _implies _OutputLogReport + return; + + pleaseStop(); + _Thread->wait(); + + clear(); +} + +// +bool isOfLogDotLogFamily( const std::string& filename ) +{ + return ((filename == "log.log") || + ((filename.size() == 10) && + (filename.substr( 0, 3 ) == "log") && + isNumberChar(filename[3]) && isNumberChar(filename[4]) && isNumberChar(filename[5]) && + (filename.substr( 6, 4 ) == ".log")) ); +} + + +enum TVersionTargetMode { TTMAll, TTMMatchAllV, TTMMatchExactV, TTMMatchGreaterV, TTMMatchLowerV } targetMode; +const uint CurrentVersion = std::numeric_limits::max(); + +// Return true and logVersion, or false if not a log with version +bool getLogVersion( const std::string& filename, uint& logVersion ) +{ + uint len = (uint)filename.size(); + if ( (len > 4) && (filename.substr( len-4 ) == ".log") ) + { + if ( filename.substr(0, 3) == "log" ) + { + if ( (len == 7) || + ((len == 10) && (isNumberChar(filename[3]) && isNumberChar(filename[4]) && isNumberChar(filename[5]))) ) + { + logVersion = CurrentVersion; + return true; + } + } + else if ( filename[0] == 'v' ) + { + string::size_type p = filename.find( "_", 1 ); + if ( p != string::npos ) + { + if ( (len == p + 8) || + ((len == p + 11) && (isNumberChar(filename[p+4]) && isNumberChar(filename[p+5]) && isNumberChar(filename[p+6]))) ) + { + NLMISC::fromString( filename.substr( 1, p-1 ), logVersion ); + return true; + } + } + } + } + return false; +} + +// Assumes filename is .log file +bool matchLogTarget( const std::string& filename, TVersionTargetMode targetMode, uint targetVersion ) +{ + if ( targetMode == TTMAll ) + return true; + + uint version; + + // Get version or exclude non-standard log files + if ( ! getLogVersion( filename, version ) ) + return false; + + // Exclude non-matching version + switch ( targetMode ) + { + case TTMMatchExactV: + return (version == targetVersion); // break; + case TTMMatchGreaterV: + return (version >= targetVersion); // break; + case TTMMatchLowerV: + return (version <= targetVersion); // break; + default: // TTMMatchAllV + return true; + } +} + +/* + * + */ +void CMakeLogTask::run() +{ + // Parse log target + uint targetVersion = CurrentVersion; + uint lts = (uint)_LogTarget.size(); + if ( _LogTarget.empty() || (_LogTarget == "v") ) + { + targetMode = TTMMatchExactV; + } + else if ( _LogTarget == "v*" ) + { + targetMode = TTMMatchAllV; + } + else if ( _LogTarget == "*" ) + { + targetMode = TTMAll; + } + else if ( (lts > 1) && (_LogTarget[0] == 'v') ) + { + uint additionalChars = 1; + if ( _LogTarget[lts-1] == '+' ) + targetMode = TTMMatchGreaterV; + else if ( _LogTarget[lts-1] == '-' ) + targetMode = TTMMatchLowerV; + else + { + targetMode = TTMMatchExactV; + additionalChars = 0; + } + + NLMISC::fromString( _LogTarget.substr( 1, lts-additionalChars-1 ), targetVersion ); + } + else + { + nlwarning( "Invalid log target argument: %s", _LogTarget.c_str() ); + _Complete = true; + return; + } + + // Get log files and sort them + vector filenames; + vector filenamesOfPath; + for ( vector::const_iterator ilf=_LogPaths.begin(); ilf!=_LogPaths.end(); ++ilf ) + { + string path = (*ilf); + if ( (! path.empty()) && (path[path.size()-1]!='/') ) + path += "/"; + filenamesOfPath.clear(); + CPath::getPathContent( path, false, false, true, filenamesOfPath, NULL, true ); + vector::iterator ilf2 = partition( filenamesOfPath.begin(), filenamesOfPath.end(), isLogFile ); + filenamesOfPath.erase( ilf2, filenamesOfPath.end() ); + sortLogFiles( filenamesOfPath ); + filenames.insert( filenames.end(), filenamesOfPath.begin(), filenamesOfPath.end() ); + } + + // Analyse log files + _OutputLogReport->reset(); + uint nbLines = 0; + char line [MAX_LOG_LINE_SIZE]; + + uint nbSkippedFiles = 0; + for ( vector::const_iterator ilf=filenames.begin(); ilf!=filenames.end(); ++ilf ) + { + string shortname = CFile::getFilename( *ilf ); + + // Filter log files based on filename before opening them + if ( ! matchLogTarget( shortname, targetMode, targetVersion ) ) + { + ++nbSkippedFiles; + continue; + } + + nlinfo( "Processing %s (%u/%u)", (*ilf).c_str(), ilf-filenames.begin(), filenames.size() ); + CIFile logfile; + if ( logfile.open( *ilf, true ) ) + { + _OutputLogReport->setProgress( (uint)(ilf-filenames.begin()), (uint)filenames.size() ); + while ( ! logfile.eof() ) + { + logfile.getline( line, MAX_LOG_LINE_SIZE ); + line[MAX_LOG_LINE_SIZE-1] = '\0'; // force valid end of line + _OutputLogReport->pushLine( line ); + ++nbLines; + + if ( isStopping() ) + return; + } + } + } + nlinfo( "%u lines processed", nbLines ); + if ( nbSkippedFiles != 0 ) + nlinfo( "%u log files skipped, not matching target %s", nbSkippedFiles, _LogTarget.c_str() ); + _Complete = true; +} + + +/* + * Add a log line to the report tree + */ +void CLogReport::pushLine( const std::string& line, NLMISC::CLog::TLogType onlyType, bool countOtherTypes ) +{ + // Ignore session title + if ( (line.size() > 14) && (line.substr( 0, 14 ) == "Log Starting [") ) + return; + + // Decode standard log line + vector lineTokens; + explode( line, string(" "), lineTokens ); + + if ( lineTokens.size() < LH_NB_FIELDS ) + return; + + // Filter log type + if ( onlyType != CLog::LOG_UNKNOWN ) + { + if ( lineTokens[LHType] != IDisplayer::logTypeToString( onlyType ) ) + { + if ( countOtherTypes ) + storeLine( lineTokens, true ); + return; + } + } + + // Store + storeLine( lineTokens, false ); +} + + +/* + * + */ +void CLogReportNode::storeLine( const std::vector& lineTokens, bool mainCountOnly ) +{ + // Get service name from "[machine/]serviceName-serviceId" + string service = lineTokens[LHService]; + string::size_type p = service.find( '/' ); + if ( p != string::npos ) + service = service.substr( p+1 ); + p = service.find( '-' ); + if ( p != string::npos ) + service = service.substr( 0, p ); + + // Store to appropriate child + CLogReportLeaf *child = getChild( service ); + if ( ! child ) + child = addChild( service ); + child->storeLine( lineTokens, mainCountOnly ); +} + + +/* + * + */ +void CLogReportLeaf::storeLine( const std::vector& lineTokens, bool mainCountOnly ) +{ + if ( ! mainCountOnly ) + { + // Build key from "codeFile codeLine" + string key = lineTokens[LHCodeFile] + ":" + lineTokens[LHCodeLine]; + _LogLineInfo[key].addAnOccurence( lineTokens ); + } + ++_Counts[lineTokens[LHType]]; + ++_TotalLines; +} + + +/* + * + */ +void CLogLineInfo::addAnOccurence( const std::vector& lineTokens ) +{ + if ( NbOccurences == 0 ) + { + for ( uint i=LH_NB_FIELDS; ireport( targetLog, true ); + } + else + { + targetLog->displayNL( "Nothing found for service %s", service.c_str() ); + } +} + + +/* + * Get results for a service (all distinct lines, sorted by occurence) + */ +void CLogReportLeaf::report( NLMISC::CLog *targetLog, bool ) +{ + // Sort it + typedef multimap< uint, pair< string, const CLogLineInfo * >, std::greater > CSortedByOccurenceLogLineInfoMap; + CSortedByOccurenceLogLineInfoMap sortedByOccurence; + for ( CLogLineInfoMap::const_iterator it=_LogLineInfo.begin(); it!=_LogLineInfo.end(); ++it ) + { + const string &key = (*it).first; + const CLogLineInfo& info = (*it).second; + sortedByOccurence.insert( make_pair( info.NbOccurences, make_pair( key, &info ) ) ); + } + + // Display it + for ( CSortedByOccurenceLogLineInfoMap::const_iterator iso=sortedByOccurence.begin(); iso!=sortedByOccurence.end(); ++iso ) + { + const string &key = (*iso).second.first; + const CLogLineInfo& info = *((*iso).second.second); + targetLog->displayRawNL( "%s %6u %s : %s", _Service.c_str(), info.NbOccurences, key.c_str(), info.SampleLogText.c_str() ); + } +} + + +/* + * Return the number of lines displayed + */ +uint CLogReportLeaf::reportPart( uint beginIndex, uint maxNbLines, NLMISC::CLog *targetLog ) +{ + uint i = 0; + CLogLineInfoMap::const_iterator it; + for ( it=_LogLineInfo.begin(); it!=_LogLineInfo.end(); ++it ) + { + if ( i >= beginIndex ) + { + if ( i >= maxNbLines ) + return i - beginIndex; + + const string &key = (*it).first; + const CLogLineInfo& info = (*it).second; + targetLog->displayRawNL( "%s %6u %s : %s", _Service.c_str(), info.NbOccurences, key.c_str(), info.SampleLogText.c_str() ); + } + ++i; + } + return i - beginIndex; +} + + +/* + * Get summary of results + */ +void CLogReportNode::report( NLMISC::CLog *targetLog, bool displayDetailsPerService ) +{ + uint nb1Sum=0, nb2Sum=0; + for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) + { + CLogReportLeaf *pt = (*it); + + // Get distinct warnings + uint nb1 = pt->getNbDistinctLines(); + nb1Sum += nb1; + + // Get total warnings, info... but filter out lines with no header + uint sumTotalLinesNotUnknown = 0; + uint nbTotalLines [CLog::LOG_UNKNOWN]; + for ( uint i=CLog::LOG_ERROR; i!=CLog::LOG_UNKNOWN; ++i ) + { + nbTotalLines[i] = pt->getNbTotalLines( (CLog::TLogType)i ); + sumTotalLinesNotUnknown += nbTotalLines[i]; + } + if ( sumTotalLinesNotUnknown != 0 ) + { + targetLog->displayRawNL( "%s: \t%u distinct WRN, %u total WRN, %u INF, %u DBG, %u STT, %u AST, %u ERR, %u TOTAL", + pt->service().c_str(), nb1, nbTotalLines[CLog::LOG_WARNING], + nbTotalLines[CLog::LOG_INFO], nbTotalLines[CLog::LOG_DEBUG], + nbTotalLines[CLog::LOG_STAT], nbTotalLines[CLog::LOG_ASSERT], + nbTotalLines[CLog::LOG_ERROR], pt->getNbTotalLines( CLog::LOG_UNKNOWN ) ); + nb2Sum += nbTotalLines[CLog::LOG_WARNING]; + } + } + targetLog->displayRawNL( "=> %u distinct, %u total WRN (%u pages)", nb1Sum, nb2Sum, nb1Sum / NB_LINES_PER_PAGE + 1 ); + + if ( displayDetailsPerService ) + { + for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) + { + (*it)->report( targetLog, true ); + } + } +} + + +/* + * Get partial results (pageNum>=1) + */ +void CLogReportNode::reportPage( uint pageNum, NLMISC::CLog *targetLog ) +{ + if ( _Children.empty() ) + { + targetLog->displayRawNL( "[END OF LOG]" ); + return; + } + + uint beginIndex = pageNum * NB_LINES_PER_PAGE; + uint lineCounter = 0, prevLineCounter; + for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) + { + CLogReportLeaf *pt = (*it); + prevLineCounter = lineCounter; + lineCounter += pt->getNbDistinctLines(); + if ( lineCounter >= beginIndex ) + { + uint remainingLines = pageNum - (lineCounter - beginIndex ); + pt->reportPart( beginIndex - prevLineCounter, remainingLines, targetLog ); // + while ( remainingLines != 0 ) + { + ++it; + if ( it == _Children.end() ) + { + targetLog->displayRawNL( "[END OF LOG]" ); + return; + } + pt = (*it); + remainingLines -= pt->reportPart( 0, remainingLines, targetLog ); + } + return; + } + } +} diff --git a/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt b/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt index bf2096b9a..3bd503eef 100644 --- a/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt +++ b/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt @@ -1,37 +1,41 @@ -INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR}/login_system/nel_launcher_qt/ ) -INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/login_system/nel_launcher_qt/ ) -INCLUDE( ${QT_USE_FILE} ) - -FILE(GLOB NEL_LAUNCHER_SRC *.cpp) -SET(NEL_LAUNCHER_HDR nel_launcher_dlg.h) -SET(NEL_LAUNCHER_UIS nel_launcher_dlg.ui) -SET(NEL_LAUNCHER_RCS ) - -SET( QT_USE_QT3SUPPORT TRUE) -SET( QT_USE_QTXML TRUE) - -QT4_ADD_RESOURCES( NEL_LAUNCHER_RC_SRCS ${NEL_LAUNCHER_RCS} ) -QT4_WRAP_UI( NEL_LAUNCHER_UI_HDRS ${NEL_LAUNCHER_UIS} ) -QT4_WRAP_CPP( NEL_LAUNCHER_MOC_SRCS ${NEL_LAUNCHER_HDR}) - -ADD_EXECUTABLE(nel_launcher_qt WIN32 ${NEL_LAUNCHER_SRC} ${NEL_LAUNCHER_MOC_SRCS} ${NEL_LAUNCHER_RC_SRCS} ${NEL_LAUNCHER_UI_HDRS}) - -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${QT_INCLUDES}) - -TARGET_LINK_LIBRARIES(nel_launcher_qt - ${LIBXML2_LIBRARIES} - ${QT_LIBRARIES} - nelmisc - nelnet) - -NL_DEFAULT_PROPS(nel_launcher_qt "NelNS, Launcher: NeL Launcher Qt") -NL_ADD_RUNTIME_FLAGS(nel_launcher_qt) - -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS}) - -INSTALL(TARGETS nel_launcher_qt RUNTIME DESTINATION bin COMPONENT launcher) -IF(WIN32) - INSTALL(FILES nel_launcher.cfg DESTINATION bin COMPONENT launcher) -ELSE(WIN32) - INSTALL(FILES nel_launcher.cfg DESTINATION etc/nel/nelns COMPONENT launcher) -ENDIF(WIN32) \ No newline at end of file +INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBXML2_INCLUDE_DIR} + ${QT_INCLUDES}) + +INCLUDE( ${QT_USE_FILE} ) + +FILE(GLOB NEL_LAUNCHER_SRC *.cpp) +SET(NEL_LAUNCHER_HDR nel_launcher_dlg.h) +SET(NEL_LAUNCHER_UIS nel_launcher_dlg.ui) +SET(NEL_LAUNCHER_RCS ) + +SET( QT_USE_QT3SUPPORT TRUE) +SET( QT_USE_QTXML TRUE) + +QT4_ADD_RESOURCES( NEL_LAUNCHER_RC_SRCS ${NEL_LAUNCHER_RCS} ) +QT4_WRAP_UI( NEL_LAUNCHER_UI_HDRS ${NEL_LAUNCHER_UIS} ) +QT4_WRAP_CPP( NEL_LAUNCHER_MOC_SRCS ${NEL_LAUNCHER_HDR}) + +ADD_EXECUTABLE(nel_launcher_qt WIN32 ${NEL_LAUNCHER_SRC} ${NEL_LAUNCHER_MOC_SRCS} ${NEL_LAUNCHER_RC_SRCS} ${NEL_LAUNCHER_UI_HDRS}) + +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${QT_INCLUDES}) + +TARGET_LINK_LIBRARIES(nel_launcher_qt + ${LIBXML2_LIBRARIES} + ${QT_LIBRARIES} + ${QT_QTMAIN_LIBRARY} + nelmisc + nelnet) + +NL_DEFAULT_PROPS(nel_launcher_qt "NelNS, Launcher: NeL Launcher Qt") +NL_ADD_RUNTIME_FLAGS(nel_launcher_qt) + +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS}) + +INSTALL(TARGETS nel_launcher_qt RUNTIME DESTINATION bin COMPONENT launcher) +IF(WIN32) + INSTALL(FILES nel_launcher.cfg DESTINATION bin COMPONENT launcher) +ELSE(WIN32) + INSTALL(FILES nel_launcher.cfg DESTINATION etc/nel/nelns COMPONENT launcher) +ENDIF(WIN32) diff --git a/code/ryzom/client/CMakeLists.txt b/code/ryzom/client/CMakeLists.txt index db2ffce2a..36090be7b 100644 --- a/code/ryzom/client/CMakeLists.txt +++ b/code/ryzom/client/CMakeLists.txt @@ -1,6 +1,6 @@ ADD_SUBDIRECTORY(src) -ADD_SUBDIRECTORY(data) -ADD_SUBDIRECTORY(patcher) +#ADD_SUBDIRECTORY(data) +#ADD_SUBDIRECTORY(patcher) IF(UNIX AND NOT APPLE) ADD_SUBDIRECTORY(unix) diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 84ea6a369..3971fb98f 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -94,12 +94,12 @@ TARGET_LINK_LIBRARIES(ryzom_client ) IF(NOT APPLE AND NOT WIN32) - TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES}) + TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES}) ENDIF(NOT APPLE AND NOT WIN32) IF(APPLE) - FIND_LIBRARY(FOUNDATION_LIBRARY Foundation) - TARGET_LINK_LIBRARIES(ryzom_client ${FOUNDATION_LIBRARY}) + FIND_LIBRARY(FOUNDATION_LIBRARY Foundation) + TARGET_LINK_LIBRARIES(ryzom_client ${FOUNDATION_LIBRARY}) ENDIF(APPLE) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${CURL_DEFINITIONS} ${LUABIND_DEFINITIONS}) @@ -113,4 +113,4 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(ryzom_client ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS ryzom_client RUNTIME DESTINATION games COMPONENT client BUNDLE DESTINATION /Applications) +INSTALL(TARGETS ryzom_client RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client BUNDLE DESTINATION /Applications) diff --git a/code/ryzom/client/src/client_sheets/CMakeLists.txt b/code/ryzom/client/src/client_sheets/CMakeLists.txt index cc02e3c64..4f21ecf9d 100644 --- a/code/ryzom/client/src/client_sheets/CMakeLists.txt +++ b/code/ryzom/client/src/client_sheets/CMakeLists.txt @@ -13,4 +13,6 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(ryzom_clientsheets ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS ryzom_clientsheets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS ryzom_clientsheets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/ryzom/client/src/seven_zip/CMakeLists.txt b/code/ryzom/client/src/seven_zip/CMakeLists.txt index 80bd946a6..85212084e 100644 --- a/code/ryzom/client/src/seven_zip/CMakeLists.txt +++ b/code/ryzom/client/src/seven_zip/CMakeLists.txt @@ -19,5 +19,7 @@ NL_ADD_LIB_SUFFIX(ryzom_sevenzip) ADD_DEFINITIONS(-D_SZ_ONE_DIRECTORY) -INSTALL(TARGETS ryzom_sevenzip LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) -INSTALL(TARGETS 7zDec RUNTIME DESTINATION bin COMPONENT client) +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS ryzom_sevenzip LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + INSTALL(TARGETS 7zDec RUNTIME DESTINATION bin COMPONENT client) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/ryzom/client/unix/CMakeLists.txt b/code/ryzom/client/unix/CMakeLists.txt index df17996fe..fef098783 100644 --- a/code/ryzom/client/unix/CMakeLists.txt +++ b/code/ryzom/client/unix/CMakeLists.txt @@ -1,4 +1,11 @@ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ryzom.desktop.in" "${CMAKE_CURRENT_BINARY_DIR}/ryzom.desktop") -INSTALL(FILES ryzom.png DESTINATION share/pixmaps) INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/ryzom.desktop" DESTINATION share/applications) +INSTALL(FILES ryzom.png DESTINATION share/pixmaps) +INSTALL(FILES ryzom.xpm DESTINATION share/pixmaps) +INSTALL(FILES ryzom_16x16.png DESTINATION share/icons/hicolor/16x16/apps RENAME ryzom.png) +INSTALL(FILES ryzom_22x22.png DESTINATION share/icons/hicolor/22x22/apps RENAME ryzom.png) +INSTALL(FILES ryzom_24x24.png DESTINATION share/icons/hicolor/24x24/apps RENAME ryzom.png) +INSTALL(FILES ryzom_32x32.png DESTINATION share/icons/hicolor/32x32/apps RENAME ryzom.png) +INSTALL(FILES ryzom_48x48.png DESTINATION share/icons/hicolor/48x48/apps RENAME ryzom.png) +INSTALL(FILES ryzom_128x128.png DESTINATION share/icons/hicolor/128x128/apps RENAME ryzom.png) diff --git a/code/ryzom/client/unix/ryzom.xpm b/code/ryzom/client/unix/ryzom.xpm new file mode 100644 index 000000000..5e6ef89df --- /dev/null +++ b/code/ryzom/client/unix/ryzom.xpm @@ -0,0 +1,1313 @@ +/* XPM */ +static char * ryzom_48x48_xpm[] = { +"48 48 1262 2", +" c None", +". c #AAB2A8", +"+ c #A6ABAF", +"@ c #79868A", +"# c #6A7B81", +"$ c #A6ABAA", +"% c #ADB0AF", +"& c #AAAFA9", +"* c #C8D2CE", +"= c #838679", +"- c #5F6159", +"; c #656766", +"> c #636365", +", c #504E50", +"' c #646464", +") c #7E8180", +"! c #9B988B", +"~ c #6D695B", +"{ c #636564", +"] c #535843", +"^ c #686A54", +"/ c #7E7D70", +"( c #717262", +"_ c #556056", +": c #47493B", +"< c #423E30", +"[ c #413629", +"} c #323229", +"| c #424039", +"1 c #5E5D56", +"2 c #656560", +"3 c #A8AAA7", +"4 c #989795", +"5 c #76726D", +"6 c #888074", +"7 c #807256", +"8 c #675B47", +"9 c #4B442E", +"0 c #808076", +"a c #8C8A7D", +"b c #817962", +"c c #4F4F36", +"d c #4A5535", +"e c #515E3E", +"f c #434736", +"g c #4C483F", +"h c #6E634E", +"i c #434233", +"j c #4A4943", +"k c #585347", +"l c #797367", +"m c #938B85", +"n c #908781", +"o c #746860", +"p c #605349", +"q c #897C6E", +"r c #958C81", +"s c #746953", +"t c #6C5E46", +"u c #665B43", +"v c #756852", +"w c #84847B", +"x c #AEB2AD", +"y c #737661", +"z c #49492E", +"A c #3A361F", +"B c #33371D", +"C c #34381F", +"D c #3D4028", +"E c #475131", +"F c #524F45", +"G c #7C7F76", +"H c #7D725E", +"I c #7E6847", +"J c #51534E", +"K c #4F5B5F", +"L c #3A3833", +"M c #332B18", +"N c #37331D", +"O c #51432D", +"P c #393326", +"Q c #423728", +"R c #55482E", +"S c #53482F", +"T c #565436", +"U c #727660", +"V c #888B7F", +"W c #88897C", +"X c #6E714C", +"Y c #6B724A", +"Z c #555B3A", +"` c #4B3D1D", +" . c #363119", +".. c #4B572D", +"+. c #536838", +"@. c #4C5740", +"#. c #4A3B24", +"$. c #795F3F", +"%. c #604D32", +"&. c #2E2D18", +"*. c #413C2D", +"=. c #808276", +"-. c #535C54", +";. c #474D43", +">. c #3C3E37", +",. c #353A30", +"'. c #807246", +"). c #4B5329", +"!. c #606F31", +"~. c #525730", +"{. c #73735E", +"]. c #8E9080", +"^. c #87887D", +"/. c #B7B6B6", +"(. c #858281", +"_. c #515941", +":. c #707C5F", +"<. c #656754", +"[. c #626A4B", +"}. c #645E3E", +"|. c #3C4023", +"1. c #44512E", +"2. c #38462C", +"3. c #21230E", +"4. c #29270D", +"5. c #382E14", +"6. c #39341B", +"7. c #524C33", +"8. c #53524A", +"9. c #645F55", +"0. c #48452C", +"a. c #464521", +"b. c #5D522D", +"c. c #716F3B", +"d. c #5C642A", +"e. c #51602B", +"f. c #37481B", +"g. c #33381E", +"h. c #5C5B3B", +"i. c #514D2F", +"j. c #4D462D", +"k. c #3F3A30", +"l. c #35352B", +"m. c #4C4C43", +"n. c #5B5B4A", +"o. c #91978B", +"p. c #9CA19B", +"q. c #B0B7AB", +"r. c #898D77", +"s. c #51593C", +"t. c #2F3B22", +"u. c #919162", +"v. c #464529", +"w. c #5F6031", +"x. c #545925", +"y. c #464E1F", +"z. c #373E23", +"A. c #585235", +"B. c #664F2F", +"C. c #3E3A23", +"D. c #595D35", +"E. c #666D38", +"F. c #75743D", +"G. c #636931", +"H. c #6E6B39", +"I. c #3D371C", +"J. c #222711", +"K. c #161A0E", +"L. c #353A24", +"M. c #6B7054", +"N. c #7D7F67", +"O. c #978C75", +"P. c #696450", +"Q. c #78786D", +"R. c #89887D", +"S. c #929591", +"T. c #52534E", +"U. c #5D5F5D", +"V. c #4B4E48", +"W. c #45493C", +"X. c #3F4533", +"Y. c #181C0D", +"Z. c #53512E", +"`. c #7D9042", +" + c #74903B", +".+ c #475525", +"++ c #4A5428", +"@+ c #534528", +"#+ c #513B1E", +"$+ c #554825", +"%+ c #494E26", +"&+ c #6E833A", +"*+ c #576B2A", +"=+ c #353E1D", +"-+ c #383D20", +";+ c #6F5B35", +">+ c #303017", +",+ c #2E2C17", +"'+ c #454426", +")+ c #737A49", +"!+ c #6D6F4B", +"~+ c #5A6140", +"{+ c #727260", +"]+ c #AFA799", +"^+ c #DDDFDA", +"/+ c #ECEDEC", +"(+ c #8F8F8D", +"_+ c #3C3E34", +":+ c #323623", +"<+ c #212415", +"[+ c #212712", +"}+ c #1C220F", +"|+ c #252310", +"1+ c #231E0C", +"2+ c #2F3317", +"3+ c #5C632E", +"4+ c #5E6C33", +"5+ c #465A22", +"6+ c #3D4022", +"7+ c #453921", +"8+ c #433E1D", +"9+ c #615C31", +"0+ c #3F471F", +"a+ c #545831", +"b+ c #586136", +"c+ c #29281A", +"d+ c #322F1B", +"e+ c #6B5836", +"f+ c #706134", +"g+ c #7F6B41", +"h+ c #83693F", +"i+ c #8F7846", +"j+ c #5C5B2B", +"k+ c #76804B", +"l+ c #6F7D47", +"m+ c #8C9178", +"n+ c #999188", +"o+ c #B0AAA8", +"p+ c #C7C6C6", +"q+ c #A29FA0", +"r+ c #9C9D95", +"s+ c #686E53", +"t+ c #414924", +"u+ c #373E1E", +"v+ c #303721", +"w+ c #343928", +"x+ c #212314", +"y+ c #363220", +"z+ c #2D3215", +"A+ c #333515", +"B+ c #5C4F2D", +"C+ c #5F5232", +"D+ c #2D2715", +"E+ c #31381A", +"F+ c #55592F", +"G+ c #4C552A", +"H+ c #677B43", +"I+ c #799250", +"J+ c #74864A", +"K+ c #656F46", +"L+ c #635637", +"M+ c #79683A", +"N+ c #968251", +"O+ c #665B33", +"P+ c #7D7840", +"Q+ c #616A32", +"R+ c #4C4F29", +"S+ c #4C562E", +"T+ c #556539", +"U+ c #595F44", +"V+ c #4D4D44", +"W+ c #6A6561", +"X+ c #95908F", +"Y+ c #74706F", +"Z+ c #797573", +"`+ c #595B4C", +" @ c #4E5532", +".@ c #5D603D", +"+@ c #797059", +"@@ c #655136", +"#@ c #5B5342", +"$@ c #504E3F", +"%@ c #3D461C", +"&@ c #21270E", +"*@ c #24280D", +"=@ c #141005", +"-@ c #191909", +";@ c #3D3A1C", +">@ c #454425", +",@ c #425024", +"'@ c #323C1B", +")@ c #506232", +"!@ c #7F9A5B", +"~@ c #75804F", +"{@ c #727F46", +"]@ c #635E36", +"^@ c #837443", +"/@ c #70562B", +"(@ c #505129", +"_@ c #454923", +":@ c #2E3019", +"<@ c #353920", +"[@ c #353B26", +"}@ c #404236", +"|@ c #98978C", +"1@ c #D6D4D2", +"2@ c #AFADA7", +"3@ c #8F8784", +"4@ c #7C7875", +"5@ c #A2A39D", +"6@ c #7E7D77", +"7@ c #868B7F", +"8@ c #A1A296", +"9@ c #5C5142", +"0@ c #553720", +"a@ c #543F33", +"b@ c #5F4A3A", +"c@ c #372A15", +"d@ c #657D32", +"e@ c #373D1B", +"f@ c #2C2B12", +"g@ c #343311", +"h@ c #3E3214", +"i@ c #392811", +"j@ c #3D3518", +"k@ c #393F1B", +"l@ c #2D3416", +"m@ c #5C713C", +"n@ c #678048", +"o@ c #47512F", +"p@ c #677346", +"q@ c #515132", +"r@ c #6B613A", +"s@ c #5D582D", +"t@ c #444224", +"u@ c #474B28", +"v@ c #5E5E37", +"w@ c #666B44", +"x@ c #999C81", +"y@ c #CDCBC5", +"z@ c #E5E1DE", +"A@ c #BEB9BA", +"B@ c #A9A3A0", +"C@ c #756D65", +"D@ c #877F79", +"E@ c #B2AFAA", +"F@ c #BEBEBA", +"G@ c #9FA19C", +"H@ c #443C2E", +"I@ c #302413", +"J@ c #301F0E", +"K@ c #27201A", +"L@ c #331D11", +"M@ c #432D13", +"N@ c #2D280F", +"O@ c #424F20", +"P@ c #1A1C0B", +"Q@ c #2F2E16", +"R@ c #54471F", +"S@ c #4F2E13", +"T@ c #1E0804", +"U@ c #542F14", +"V@ c #6F6534", +"W@ c #596332", +"X@ c #6F7444", +"Y@ c #645C32", +"Z@ c #526031", +"`@ c #434C2B", +" # c #4E5730", +".# c #48462A", +"+# c #5A5231", +"@# c #5C532E", +"## c #685A37", +"$# c #72673F", +"%# c #7F7C54", +"&# c #CAC8BA", +"*# c #DEDBD6", +"=# c #DBD7D3", +"-# c #D9D5D4", +";# c #C7C1C0", +"># c #857E7D", +",# c #59544B", +"'# c #544C44", +")# c #655F61", +"!# c #736D69", +"~# c #837E7E", +"{# c #595B4D", +"]# c #4D462F", +"^# c #7D7862", +"/# c #8D9594", +"(# c #4F3F2C", +"_# c #635237", +":# c #251E06", +"<# c #435120", +"[# c #262913", +"}# c #212012", +"|# c #3F3F27", +"1# c #6A5631", +"2# c #3D140C", +"3# c #1A0907", +"4# c #31180C", +"5# c #988561", +"6# c #7A804B", +"7# c #887C5D", +"8# c #596137", +"9# c #525633", +"0# c #242513", +"a# c #201A0F", +"b# c #453821", +"c# c #78613B", +"d# c #78603D", +"e# c #AB8E5D", +"f# c #A0865F", +"g# c #AB9575", +"h# c #C7BCB1", +"i# c #A49994", +"j# c #9E9492", +"k# c #A59E9D", +"l# c #A7A3A4", +"m# c #8A8280", +"n# c #7E7C72", +"o# c #403727", +"p# c #1C2119", +"q# c #55534F", +"r# c #555147", +"s# c #8C8F88", +"t# c #8E948D", +"u# c #788278", +"v# c #8C989C", +"w# c #444137", +"x# c #423E2D", +"y# c #3F3D1B", +"z# c #473C25", +"A# c #737367", +"B# c #818772", +"C# c #838365", +"D# c #431F14", +"E# c #3E251F", +"F# c #6B523E", +"G# c #8A7F5E", +"H# c #736544", +"I# c #6B5E3C", +"J# c #5D5134", +"K# c #494326", +"L# c #2C2715", +"M# c #3F371F", +"N# c #6D5835", +"O# c #79693D", +"P# c #A39B77", +"Q# c #D2CDB6", +"R# c #E4DCCD", +"S# c #E5DACF", +"T# c #C0B5AF", +"U# c #988E8B", +"V# c #9C9490", +"W# c #B6B3AF", +"X# c #AEAFAE", +"Y# c #A7A9A8", +"Z# c #55524A", +"`# c #514B37", +" $ c #434527", +".$ c #4A4D31", +"+$ c #595E45", +"@$ c #7E7A75", +"#$ c #4C4A47", +"$$ c #393023", +"%$ c #2B251E", +"&$ c #2F2C1E", +"*$ c #4B4C3C", +"=$ c #3D3E32", +"-$ c #4B4320", +";$ c #979789", +">$ c #C6CFCB", +",$ c #AFB1AB", +"'$ c #67695A", +")$ c #605136", +"!$ c #8F7E67", +"~$ c #867D62", +"{$ c #6D6D4E", +"]$ c #625434", +"^$ c #554B26", +"/$ c #464020", +"($ c #494825", +"_$ c #494926", +":$ c #75683D", +"<$ c #998149", +"[$ c #A3854F", +"}$ c #A89C86", +"|$ c #D8D5D1", +"1$ c #D9D7D5", +"2$ c #E7E6E4", +"3$ c #CDCAC9", +"4$ c #918986", +"5$ c #B5B5B0", +"6$ c #B2B6B2", +"7$ c #A8B0AB", +"8$ c #B8C2C2", +"9$ c #8B908E", +"0$ c #585B48", +"a$ c #64663A", +"b$ c #65643A", +"c$ c #565336", +"d$ c #4B3D2B", +"e$ c #443B31", +"f$ c #616057", +"g$ c #5F6251", +"h$ c #495134", +"i$ c #798175", +"j$ c #555648", +"k$ c #665D3F", +"l$ c #80857A", +"m$ c #646263", +"n$ c #48443F", +"o$ c #393528", +"p$ c #4C4836", +"q$ c #5D5739", +"r$ c #595733", +"s$ c #534A2C", +"t$ c #3C4420", +"u$ c #2C3318", +"v$ c #3E4623", +"w$ c #5C6E37", +"x$ c #7E8A52", +"y$ c #8B8964", +"z$ c #94976D", +"A$ c #797B56", +"B$ c #7C7855", +"C$ c #58573F", +"D$ c #353329", +"E$ c #413937", +"F$ c #544A47", +"G$ c #A1A09C", +"H$ c #817F79", +"I$ c #A6AEAB", +"J$ c #8C9091", +"K$ c #524F4D", +"L$ c #2D261F", +"M$ c #535645", +"N$ c #81886E", +"O$ c #938E77", +"P$ c #B0ADAA", +"Q$ c #807368", +"R$ c #A3A9A0", +"S$ c #818D86", +"T$ c #68726D", +"U$ c #727B6D", +"V$ c #444031", +"W$ c #363123", +"X$ c #545138", +"Y$ c #3C3F28", +"Z$ c #3A3B32", +"`$ c #2E3424", +" % c #383B31", +".% c #353E26", +"+% c #5E5A3A", +"@% c #403B21", +"#% c #3A4620", +"$% c #374320", +"%% c #414B2B", +"&% c #657349", +"*% c #8E9874", +"=% c #B8BBA1", +"-% c #B6BAAA", +";% c #A19D91", +">% c #9D9888", +",% c #A1AD86", +"'% c #565E41", +")% c #4A4A37", +"!% c #625C4E", +"~% c #585043", +"{% c #3D362B", +"]% c #2F2317", +"^% c #2D2619", +"/% c #3A3624", +"(% c #514C3C", +"_% c #85877D", +":% c #C2C4BF", +"<% c #AEAEAA", +"[% c #8F8D88", +"}% c #787870", +"|% c #767F77", +"1% c #757C7A", +"2% c #6C7274", +"3% c #43413B", +"4% c #2B2514", +"5% c #2D2814", +"6% c #26220F", +"7% c #3A331E", +"8% c #212413", +"9% c #273019", +"0% c #505644", +"a% c #6A6E66", +"b% c #5B644A", +"c% c #464B2A", +"d% c #404E28", +"e% c #313920", +"f% c #4C5A33", +"g% c #899377", +"h% c #737C60", +"i% c #CCCDC4", +"j% c #E9EAE5", +"k% c #DEDDDA", +"l% c #6B6159", +"m% c #665E4B", +"n% c #4B4736", +"o% c #2D3221", +"p% c #474029", +"q% c #59574B", +"r% c #726F62", +"s% c #7C7962", +"t% c #716A4E", +"u% c #958C6E", +"v% c #A39E8D", +"w% c #B8B8A9", +"x% c #CBCDC8", +"y% c #D1D8D7", +"z% c #D0DAD8", +"A% c #A1AAA6", +"B% c #7E8380", +"C% c #35382D", +"D% c #3F3D35", +"E% c #3A362B", +"F% c #2A261E", +"G% c #1F1A13", +"H% c #3B4223", +"I% c #2C2D13", +"J% c #2F2B15", +"K% c #2E2410", +"L% c #323424", +"M% c #313219", +"N% c #4F574C", +"O% c #616E64", +"P% c #4D4F40", +"Q% c #353624", +"R% c #2C341D", +"S% c #4E5D33", +"T% c #56663A", +"U% c #434A2B", +"V% c #4F5936", +"W% c #767668", +"X% c #9F9B9C", +"Y% c #878182", +"Z% c #504941", +"`% c #5E5940", +" & c #515137", +".& c #4E4B36", +"+& c #666148", +"@& c #564E34", +"#& c #4A452C", +"$& c #504829", +"%& c #66593B", +"&& c #68634F", +"*& c #9D9C92", +"=& c #DBDFDD", +"-& c #D7E0DF", +";& c #C4D4D5", +">& c #B6C8CC", +",& c #929FA3", +"'& c #555348", +")& c #423925", +"!& c #585143", +"~& c #444036", +"{& c #404524", +"]& c #35401D", +"^& c #2C3012", +"/& c #303214", +"(& c #423C1C", +"_& c #303210", +":& c #46471F", +"<& c #505E50", +"[& c #495747", +"}& c #484A3B", +"|& c #4C4832", +"1& c #363A24", +"2& c #4E522E", +"3& c #51552F", +"4& c #4E532E", +"5& c #586639", +"6& c #535D36", +"7& c #5B6249", +"8& c #38362A", +"9& c #33321F", +"0& c #52572C", +"a& c #51542A", +"b& c #4E4C2A", +"c& c #3A411E", +"d& c #2E3219", +"e& c #312B15", +"f& c #4C4220", +"g& c #51421F", +"h& c #554C27", +"i& c #747463", +"j& c #CCD6D6", +"k& c #B8CACD", +"l& c #9DB1B7", +"m& c #83959B", +"n& c #5A6368", +"o& c #403E38", +"p& c #422E18", +"q& c #503F1C", +"r& c #3C3B1B", +"s& c #343917", +"t& c #37421E", +"u& c #374820", +"v& c #2F3518", +"w& c #24230B", +"x& c #465122", +"y& c #32330A", +"z& c #414310", +"A& c #434A1B", +"B& c #3E4816", +"C& c #504D29", +"D& c #5B5A40", +"E& c #898778", +"F& c #615D3C", +"G& c #504E2A", +"H& c #586434", +"I& c #647E40", +"J& c #4E5E32", +"K& c #586D36", +"L& c #2F351C", +"M& c #373D20", +"N& c #474B23", +"O& c #6A6339", +"P& c #524B26", +"Q& c #3E3C1F", +"R& c #4E4C2B", +"S& c #4A4426", +"T& c #403B1D", +"U& c #443A1C", +"V& c #3B371B", +"W& c #5D553B", +"X& c #61635F", +"Y& c #78868B", +"Z& c #545C62", +"`& c #40444A", +" * c #252524", +".* c #27261F", +"+* c #4A4320", +"@* c #485022", +"#* c #2D3515", +"$* c #2C3415", +"%* c #3F4E26", +"&* c #273416", +"** c #262C11", +"=* c #1C1C0C", +"-* c #3D461E", +";* c #3D3815", +">* c #3B2406", +",* c #332508", +"'* c #3D390E", +")* c #504E1D", +"!* c #6C6138", +"~* c #A7A392", +"{* c #908674", +"]* c #715D3A", +"^* c #645633", +"/* c #2F2A15", +"(* c #4F5A31", +"_* c #47512E", +":* c #505933", +"<* c #40432B", +"[* c #59553D", +"}* c #554933", +"|* c #686136", +"1* c #717A3D", +"2* c #554C2F", +"3* c #604A29", +"4* c #625530", +"5* c #61572D", +"6* c #513F1D", +"7* c #443919", +"8* c #3C2E19", +"9* c #1F1812", +"0* c #1F1B17", +"a* c #23241D", +"b* c #1F2119", +"c* c #17180F", +"d* c #2F3319", +"e* c #3F421E", +"f* c #292813", +"g* c #343B19", +"h* c #35431D", +"i* c #1E290F", +"j* c #111309", +"k* c #465226", +"l* c #4A5024", +"m* c #231B09", +"n* c #492C0B", +"o* c #544113", +"p* c #605F28", +"q* c #6B7F38", +"r* c #6E7B45", +"s* c #696959", +"t* c #867E72", +"u* c #655432", +"v* c #574929", +"w* c #59663A", +"x* c #444B2D", +"y* c #444E29", +"z* c #25241F", +"A* c #41565B", +"B* c #41676B", +"C* c #5E7236", +"D* c #4D5134", +"E* c #544934", +"F* c #5B4627", +"G* c #5C4321", +"H* c #644A25", +"I* c #604A24", +"J* c #614C27", +"K* c #4F3E22", +"L* c #4A3118", +"M* c #50391F", +"N* c #292115", +"O* c #161007", +"P* c #2E2212", +"Q* c #46361C", +"R* c #533616", +"S* c #31220C", +"T* c #30250C", +"U* c #232811", +"V* c #141708", +"W* c #141407", +"X* c #536B32", +"Y* c #566434", +"Z* c #403B19", +"`* c #50471A", +" = c #3D4214", +".= c #3F4B1A", +"+= c #374519", +"@= c #3C451E", +"#= c #5B6742", +"$= c #909487", +"%= c #6B6954", +"&= c #363C22", +"*= c #3E4527", +"== c #2A2C18", +"-= c #262314", +";= c #2A2A26", +">= c #3C4E51", +",= c #3D585D", +"'= c #444D40", +")= c #39372B", +"!= c #413C24", +"~= c #534A2A", +"{= c #68532E", +"]= c #644E29", +"^= c #583A1B", +"/= c #5C492B", +"(= c #3F2F1C", +"_= c #4A321A", +":= c #4C3A1C", +"<= c #402F18", +"[= c #21140A", +"}= c #4E3D23", +"|= c #2D160B", +"1= c #422C15", +"2= c #4F411F", +"3= c #50451E", +"4= c #262A15", +"5= c #272C12", +"6= c #171606", +"7= c #425423", +"8= c #323927", +"9= c #282A17", +"0= c #483A1B", +"a= c #3A4115", +"b= c #25350C", +"c= c #212E0D", +"d= c #424F29", +"e= c #5E7137", +"f= c #8B947C", +"g= c #717868", +"h= c #3B432B", +"i= c #3B4030", +"j= c #2E2F20", +"k= c #38352A", +"l= c #485150", +"m= c #7A694F", +"n= c #7D5E39", +"o= c #624929", +"p= c #352919", +"q= c #4B3921", +"r= c #604E30", +"s= c #2F291B", +"t= c #423924", +"u= c #605736", +"v= c #605A31", +"w= c #656330", +"x= c #474C25", +"y= c #54562C", +"z= c #43361C", +"A= c #4B3A21", +"B= c #4D3417", +"C= c #5B4727", +"D= c #475228", +"E= c #222A12", +"F= c #343118", +"G= c #292811", +"H= c #282813", +"I= c #262513", +"J= c #1F2114", +"K= c #1A1F0B", +"L= c #352F12", +"M= c #3B3A12", +"N= c #303710", +"O= c #38381B", +"P= c #3B471E", +"Q= c #394420", +"R= c #3B3F2D", +"S= c #595C50", +"T= c #73756E", +"U= c #7E8079", +"V= c #7D7467", +"W= c #746244", +"X= c #736636", +"Y= c #6C6F3B", +"Z= c #646738", +"`= c #57542E", +" - c #5B5930", +".- c #625A31", +"+- c #5E5D31", +"@- c #44492A", +"#- c #4E5230", +"$- c #4C5431", +"%- c #404328", +"&- c #4A4725", +"*- c #525026", +"=- c #484C2A", +"-- c #47562B", +";- c #494E24", +">- c #3B4A28", +",- c #28341B", +"'- c #13150C", +")- c #1F2414", +"!- c #2C2C17", +"~- c #32311D", +"{- c #36362A", +"]- c #342E16", +"^- c #484C29", +"/- c #4D4827", +"(- c #4B3D22", +"_- c #393012", +":- c #3A3517", +"<- c #3A4721", +"[- c #283013", +"}- c #292F13", +"|- c #1A1E1D", +"1- c #242E32", +"2- c #505C62", +"3- c #5E534B", +"4- c #6A5A37", +"5- c #707D44", +"6- c #576931", +"7- c #49502E", +"8- c #596338", +"9- c #525F38", +"0- c #4F5833", +"a- c #4F482C", +"b- c #4C5632", +"c- c #525C33", +"d- c #454D2C", +"e- c #50562F", +"f- c #556536", +"g- c #637A3B", +"h- c #415229", +"i- c #3F5428", +"j- c #2A381B", +"k- c #242E1A", +"l- c #191E16", +"m- c #181D13", +"n- c #1F2116", +"o- c #343D22", +"p- c #313B28", +"q- c #392D15", +"r- c #38391C", +"s- c #645B45", +"t- c #8D8E7D", +"u- c #868C71", +"v- c #5D6640", +"w- c #282C17", +"x- c #282B16", +"y- c #262616", +"z- c #363426", +"A- c #30332E", +"B- c #43433A", +"C- c #55503A", +"D- c #545734", +"E- c #516038", +"F- c #42532A", +"G- c #43512E", +"H- c #3F482B", +"I- c #393C22", +"J- c #474428", +"K- c #4B452B", +"L- c #4E4A2C", +"M- c #505F35", +"N- c #48512E", +"O- c #525F35", +"P- c #46572C", +"Q- c #303D1D", +"R- c #2B371E", +"S- c #39482C", +"T- c #242D1E", +"U- c #1D2417", +"V- c #191E15", +"W- c #1B1B14", +"X- c #242718", +"Y- c #293219", +"Z- c #3B463C", +"`- c #454427", +" ; c #3F4A2B", +".; c #4F4F3E", +"+; c #8E9897", +"@; c #97A19A", +"#; c #808C77", +"$; c #5A6934", +"%; c #3A401E", +"&; c #383926", +"*; c #585747", +"=; c #485144", +"-; c #484932", +";; c #555A3E", +">; c #4B4F36", +",; c #303528", +"'; c #25271F", +"); c #26261D", +"!; c #3B3322", +"~; c #52472D", +"{; c #615E3B", +"]; c #515E34", +"^; c #475730", +"/; c #40492B", +"(; c #4C5C33", +"_; c #374425", +":; c #2E3820", +"<; c #212918", +"[; c #4A5149", +"}; c #4A5349", +"|; c #252D1F", +"1; c #1C211B", +"2; c #242219", +"3; c #2A2E1C", +"4; c #2D3622", +"5; c #464B40", +"6; c #4B5149", +"7; c #95A1A1", +"8; c #9FABA8", +"9; c #6C7966", +"0; c #556342", +"a; c #575F4A", +"b; c #6C7368", +"c; c #6F7D7D", +"d; c #586159", +"e; c #777B72", +"f; c #747267", +"g; c #524E41", +"h; c #443E31", +"i; c #463D2D", +"j; c #625644", +"k; c #685740", +"l; c #6E5F3A", +"m; c #454629", +"n; c #2C3120", +"o; c #373828", +"p; c #3A3F2A", +"q; c #3F4B30", +"r; c #24271B", +"s; c #1F1F16", +"t; c #414441", +"u; c #8E9E9F", +"v; c #3A4241", +"w; c #414849", +"x; c #2B2A21", +"y; c #48483D", +"z; c #3D4738", +"A; c #6D7872", +"B; c #A3B2B5", +"C; c #A8B6B7", +"D; c #808C85", +"E; c #555B53", +"F; c #393B2C", +"G; c #4D493E", +"H; c #878984", +"I; c #7F7B71", +"J; c #6D6252", +"K; c #574B32", +"L; c #635A3A", +"M; c #7A7452", +"N; c #6D6446", +"O; c #474431", +"P; c #404331", +"Q; c #484D39", +"R; c #4A4A39", +"S; c #33342D", +"T; c #787D77", +"U; c #5D5F59", +"V; c #2F2D23", +"W; c #36382F", +"X; c #8A9BA0", +"Y; c #637279", +"Z; c #262B2A", +"`; c #2B2C25", +" > c #404439", +".> c #403320", +"+> c #3A3C30", +"@> c #4E5648", +"#> c #646B69", +"$> c #6F7779", +"%> c #666B6D", +"&> c #434642", +"*> c #4B4C43", +"=> c #686A5F", +"-> c #666C5A", +";> c #64695C", +">> c #505240", +",> c #50553B", +"'> c #494F37", +")> c #464B30", +"!> c #52513A", +"~> c #797B67", +"{> c #848E75", +"]> c #7D8A6E", +"^> c #60675A", +"/> c #4B5147", +"(> c #767B78", +"_> c #7C807F", +":> c #37362A", +"<> c #2E3024", +"[> c #383C34", +"}> c #6D7C7F", +"|> c #63757D", +"1> c #4B5659", +"2> c #33362E", +"3> c #47534C", +"4> c #383E31", +"5> c #353A29", +"6> c #626C6A", +"7> c #4D5452", +"8> c #2A2E23", +"9> c #353B2A", +"0> c #49523F", +"a> c #4E5745", +"b> c #565A4E", +"c> c #5B6052", +"d> c #424934", +"e> c #434931", +"f> c #4C5339", +"g> c #616555", +"h> c #747E69", +"i> c #7D8679", +"j> c #95A299", +"k> c #929C99", +"l> c #79817F", +"m> c #6E776F", +"n> c #7B827D", +"o> c #858F93", +"p> c #3A3E3E", +"q> c #3E3B2E", +"r> c #596059", +"s> c #6C7B7A", +"t> c #5B6D75", +"u> c #404A4D", +"v> c #313730", +"w> c #5D6669", +"x> c #4B534F", +"y> c #32362E", +"z> c #3B4231", +"A> c #3C4437", +"B> c #545F51", +"C> c #43473D", +"D> c #3D3C2C", +"E> c #4E4F3B", +"F> c #5E5E4B", +"G> c #84887B", +"H> c #8E928C", +"I> c #99A19E", +"J> c #9AA5A5", +"K> c #A2AFB1", +"L> c #9BA7AA", +"M> c #ACBCBF", +"N> c #97A3A7", +"O> c #676F72", +"P> c #3F4538", +"Q> c #576057", +"R> c #364132", +"S> c #607172", +"T> c #54676F", +"U> c #505854", +"V> c #4A524E", +"W> c #576062", +"X> c #6E797C", +"Y> c #707D7C", +"Z> c #748080", +"`> c #737E7D", +" , c #747C79", +"., c #6E7065", +"+, c #78776B", +"@, c #767467", +"#, c #767970", +"$, c #919B96", +"%, c #859090", +"&, c #747A7C", +"*, c #909CA0", +"=, c #96A5A9", +"-, c #9BABB0", +";, c #7E8B91", +">, c #4B5153", +",, c #373B37", +"', c #21251D", +"), c #282C23", +"!, c #5D6B6F", +"~, c #546465", +"{, c #566566", +"], c #71858B", +"^, c #82979E", +"/, c #86999F", +"(, c #8D9FA5", +"_, c #8D9B9C", +":, c #828E8E", +"<, c #737B76", +"[, c #727D74", +"}, c #808D8D", +"|, c #7E898B", +"1, c #838D8E", +"2, c #7E8B8F", +"3, c #84949B", +"4, c #7B8B91", +"5, c #6C7A81", +"6, c #515B5F", +"7, c #363C3A", +"8, c #2A302F", +"9, c #36474F", +"0, c #5C6C72", +"a, c #5B6971", +"b, c #596871", +"c, c #6F838C", +"d, c #7B9099", +"e, c #778A91", +"f, c #7B8D93", +"g, c #738487", +"h, c #6E7C7D", +"i, c #78878C", +"j, c #829399", +"k, c #7D9097", +"l, c #73868C", +"m, c #6C7D83", +"n, c #63747B", +"o, c #55646B", +"p, c #4F5B62", +"q, c #515E67", +"r, c #5F737D", +"s, c #637882", +"t, c #677C85", +"u, c #647780", +"v, c #64767D", +"w, c #62747C", +"x, c #62757E", +"y, c #60737D", +"z, c #5A6B74", +"A, c #55666F", +" ", +" ", +" ", +" ", +" . + @ # $ % & * = ", +" - ; > , ' ) ! ~ { ] ^ / ( _ : < [ ", +" } | 1 2 3 4 5 6 7 8 9 0 a b c d e f g ", +" h i j k l m n o p q r s t u v w x y z A B C D E ", +" F G H I J K L M N O P Q R S T U V W X Y Z ` ...+.@. ", +" #.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2. ", +" 3.4.5.6.7.8.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t. ", +" v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y. ", +" Z.`. +.+++@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+^+/+(+_+:+<+[+}+|+1+ ", +" 2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+ ", +" z+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@ ", +" %@&@*@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@}@|@1@2@3@4@5@6@7@8@9@0@a@b@c@ ", +" d@e@f@g@h@i@j@k@,@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@C@D@E@F@G@H@I@J@K@L@M@N@ ", +" O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#^#/#(#_#:# ", +" <#[#}#|#1#2#3#4#5#6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#p#q#r#s#t#u#v#w#x#y# ", +" z#A#B#C#D#E#F#G#H#I#J#K#L#M#N#O#P#Q#R#S#T#U#V#W#X#Y#Z#`# $.$+$@$#$$$%$&$*$=$ ", +" -$;$>$,$'$)$!$~${$]$^$/$($_$:$<$[$}$|$1$2$3$4$5$6$7$8$9$0$a$b$c$d$e$f$g$h$i$j$ ", +" k$l$m$n$o$p$q$r$s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$H$I$J$K$L$M$N$O$P$Q$R$S$T$U$V$W$ ", +" X$Y$Z$`$ %.%+%@%#%$%%%&%*%=%-%;%>%,%'%)%D$!%~%{%]%^%/%(%_%:%<%[%}%|%1%2%3%4%5%6% ", +" 7%8%9%0%a%b%c%d%e%f%g%h%i%j%k%l%m%n%o%p%q%r%s%t%u%v%w%x%y%z%A%B%C%D%E%F%G%H%I%J% ", +" K%L%M%N%O%P%Q%R%S%T%U%V%W%X%Y%Z%`% &.&+&@&#&$&%&&&*&=&-&;&>&,&V.'&)&!&~&{&]&^&/& ", +" (&_&:&<&[&}&|&1&2&3&4&5&6&7&8&9&0&a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w& ", +" x&y&z&A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T&U&V&W&X&Y&Z&`& *.*+*@*#*$*%*&***=* ", +" -*;*>*,*'*)*!*~*{*]*^*/*(*_*:*<*[*}*|*1*2*3*4*5*6*7*8*9*0*a*b*c*d*e*f*g*h*i*j* ", +" k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*A*B*C*D*E*F*G*H*I*J*K*L*M*N*O*P*Q*R*S*T*U*V*W* ", +" X*Y*Z*`* =.=+=@=#=$=%=&=*===-=;=>=,='=)=!=~={=]=^=/=(=_=:=<=[=}=|=1=2=3=4=5=6= ", +" 7=8=9=0=a=b=c=d=e=f=g=h=i=j=k=l=m=n=o=p=q=r=s=t=u=v=w=x=y=z=A=B=C=D=E=F=G=H=I= ", +" J=K=L=M=N=O=P=Q=R=S=T=U=V=W=X=Y=Z=`= -.-+-@-#-$-%-&-*-=---;->-,-'-)-!-~-{- ", +" ]-^-/-(-_-:-<-[-}-|-1-2-3-4-5-6-7-8-9-0-a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p- ", +" q-r-s-t-u-v-w-x-y-z-A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z- ", +" `- ;.;+;@;#;$;%;&;*;=;-;;;>;,;';);!;~;{;];^;/;(;_;:;<;[;};|;1;2;3;4; ", +" 5;6;7;8;9;0;a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;v;w;x;3; ", +" y;z;A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;2;W;X;Y;Z;`; > ", +" .>+>@>#>$>%>&>*>=>->;>>>,>'>)>!>~>{>]>^>/>(>_>:><>[>}>|>1>2> ", +" 4>5>6>7>8>9>0>a>b>c>d>e>f>g>h>i>j>k>l>m>n>o>p>q>r>s>t>u> ", +" v>w>x>y>z>A>B>C>D>E>F>G>H>I>J>K>L>M>N>O>P>Q>R>S>T> ", +" U>V>W>X>Y>Z>`> ,.,+,@,#,$,%,&,*,=,-,;,>,,,',), ", +" !,~,{,],^,/,(,_,:,<,[,},|,1,2,3,4,5,6,7,8, ", +" 0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p, ", +" q,r,s,t,u,v,w,x,y,z,A, ", +" ", +" ", +" ", +" "}; diff --git a/code/ryzom/client/unix/ryzom_128x128.png b/code/ryzom/client/unix/ryzom_128x128.png new file mode 100644 index 000000000..3b1146210 Binary files /dev/null and b/code/ryzom/client/unix/ryzom_128x128.png differ diff --git a/code/ryzom/client/unix/ryzom_16x16.png b/code/ryzom/client/unix/ryzom_16x16.png new file mode 100644 index 000000000..c3eef52bd Binary files /dev/null and b/code/ryzom/client/unix/ryzom_16x16.png differ diff --git a/code/ryzom/client/unix/ryzom_22x22.png b/code/ryzom/client/unix/ryzom_22x22.png new file mode 100644 index 000000000..4030743e2 Binary files /dev/null and b/code/ryzom/client/unix/ryzom_22x22.png differ diff --git a/code/ryzom/client/unix/ryzom_24x24.png b/code/ryzom/client/unix/ryzom_24x24.png new file mode 100644 index 000000000..2272b27ea Binary files /dev/null and b/code/ryzom/client/unix/ryzom_24x24.png differ diff --git a/code/ryzom/client/unix/ryzom_32x32.png b/code/ryzom/client/unix/ryzom_32x32.png new file mode 100644 index 000000000..cb26ed4f4 Binary files /dev/null and b/code/ryzom/client/unix/ryzom_32x32.png differ diff --git a/code/ryzom/client/unix/ryzom_48x48.png b/code/ryzom/client/unix/ryzom_48x48.png new file mode 100644 index 000000000..b0ce66708 Binary files /dev/null and b/code/ryzom/client/unix/ryzom_48x48.png differ diff --git a/code/ryzom/common/data_leveldesign/leveldesign/game_element/anim/mode2animset.string_array b/code/ryzom/common/data_leveldesign/leveldesign/game_element/anim/mode2animset.string_array new file mode 100644 index 000000000..b4600ce12 --- /dev/null +++ b/code/ryzom/common/data_leveldesign/leveldesign/game_element/anim/mode2animset.string_array @@ -0,0 +1,26 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/destroy_item.html b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/destroy_item.html index 366a02977..9eaf62bfd 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/destroy_item.html +++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/destroy_item.html @@ -253,6 +253,14 @@ NPC tag name. Used to write in the sys info who destroyed the items

item description. See item_guidelines for the formatting requirements.

+

 

+ +

guild (Boolean): This parameter is only for guild missions. If it is set to true the action is done for the guild (not for the players that completed the mission).

+ +

 

diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/do_mission.html b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/do_mission.html index 0c516a984..4a480e1b8 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/do_mission.html +++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/do_mission.html @@ -160,7 +160,8 @@ mso-ansi-language:EN-US'> 

mission_names: Mission names with the specific mission -objective texts.

+objective texts. The name can be followed by a space and a number representing the number of +times this mission needs to be done (useful for guild missions to specify the number of members needed to complete the mission)

 

diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_fame.html b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_fame.html index 391814c2b..1921ec67b 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_fame.html +++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_fame.html @@ -166,6 +166,13 @@ reduce fame, use a negative figure.

 

+

guild (Boolean): This parameter is only for guild missions. If it is set to true the action is done for the guild (not for the players that completed the mission).

+ +

 

+

Default variables:

diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_item.html b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_item.html index 96b454cd2..aa4ba81f3 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_item.html +++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_item.html @@ -178,11 +178,20 @@ lang=EN-US style='mso-ansi-language:EN-US'>: Array containing given item description. See item_guidelines for the formatting requirements.

+

 

+ +

guild (Boolean): This parameter is only for guild missions. If it is set to true the action is done for the guild (not for the players that completed the mission).

+ +

 

+

Default variables:

diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_money.html b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_money.html index 88030c8d1..7de97c411 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_money.html +++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/recv_money.html @@ -169,6 +169,14 @@ lang=EN-US style='mso-ansi-language:EN-US'>amount: Amount of money to add to the player’s funds. To withdraw money, use a negative figure.

+

 

+ +

guild (Boolean): This parameter is only for guild missions. If it is set to true the action is done for the guild (not for the players that completed the mission).

+ +

 

Default diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/spawn_mission.html b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/spawn_mission.html new file mode 100644 index 000000000..53b4f4cc9 --- /dev/null +++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/class_doc/spawn_mission.html @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + +
+ +

spawn_mission

+ +

 

+ +

Properties:

+ +

 

+ +

name: Action name, only used by the +mission designer.

+ +

 

+ +

giver_name: The NPC that gives the mission.

+ +

 

+ +

guild (Boolean): This parameter is only for guild missions. .

+ + +

 

+ +

mission_name: The name of the mission to spawn.

+ +

 

+ + +
+ + + + diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml index 1e4f9d723..5426361fa 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml +++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml @@ -688,8 +688,6 @@ - - @@ -709,6 +707,7 @@ + @@ -838,14 +837,6 @@ - - - - - - - - @@ -1108,8 +1099,6 @@ - - @@ -1122,10 +1111,6 @@ - - - - @@ -1135,45 +1120,28 @@ - - - - - - - - - + - - - - - - - - - @@ -1182,27 +1150,18 @@ - - - - - - - - - @@ -1212,9 +1171,6 @@ - - - @@ -1223,9 +1179,6 @@ - - - @@ -1233,9 +1186,6 @@ - - - @@ -1243,35 +1193,23 @@ - - - - - - - - - - - - @@ -1304,18 +1242,12 @@ - - - - - - diff --git a/code/ryzom/common/data_leveldesign/primitives/newbieland/guild_missions.primitive b/code/ryzom/common/data_leveldesign/primitives/newbieland/guild_missions.primitive new file mode 100644 index 000000000..568d89398 --- /dev/null +++ b/code/ryzom/common/data_leveldesign/primitives/newbieland/guild_missions.primitive @@ -0,0 +1,448 @@ + + + + + + + class + missions_editor + + + name + guild_missions + + + + audience + guild + + + auto_remove_from_journal + false + + + automatic + false + + + class + mission_tree + + + fail_if_inventory_is_full + false + + + giver_primitive + urban_newbieland.primitive + + + mission_category + Killing + + + mission_description + GUILD_MISSION_DESC + + + mission_giver + $givervar@fullname$ + + + mission_title + GUILD_MISSION_TITLE + + + mono_instance + false + + + name + GUILD_MISSION + + + need_validation + false + + + non_abandonnable + false + + + not_in_journal + false + + + not_proposed + false + + + replayable + true + + + run_only_once + false + + + + class + variables + + + name + variables + + + + class + var_npc + + + npc_function + fct_ranger_leader + + + npc_name + chiang_the_strong + + + var_name + givervar + + + + + + class + pre_requisite + + + name + pre_requisite + + + require_guild_grade + Leader + + + require_guild_membership + true + + + + + + class + alias + + + name + alias + + + + + class + step + + + name + step + + + + class + actions + + + name + pre_actions + + + + class + spawn_mission + + + giver_name + chiang_the_strong + + + guild + true + + + mission_name + SOLO_GUILD_MISSION + + + + + + class + mission_objectives + + + name + objectives + + + + class + do_mission + + + mission_names + SOLO_GUILD_MISSION 2 + + + overload_objective + MIS_DO_MISSION + + + + + class + kill + + + fauna/quantity + chdfa1 2 + + + name + kill chdfa1 2 + + + + + + class + actions + + + name + post_actions + + + + amount + 100 + + + class + recv_money + + + guild + true + + + name + recv_money 100 guild + + + + + amount + 50 + + + class + recv_money + + + + + + + + audience + solo + + + auto_remove_from_journal + false + + + automatic + false + + + class + mission_tree + + + fail_if_inventory_is_full + false + + + giver_primitive + urban_newbieland.primitive + + + mission_category + Killing + + + mission_description + SOLO_GUILD_MISSION_DESC + + + mission_giver + $givervar@fullname$ + + + mission_title + SOLO_GUILD_MISSION_TITLE + + + mono_instance + false + + + name + SOLO_GUILD_MISSION + + + need_validation + false + + + non_abandonnable + false + + + not_in_journal + false + + + not_proposed + true + + + replayable + true + + + run_only_once + false + + + + class + variables + + + name + variables + + + + class + var_npc + + + npc_function + fct_ranger_leader + + + npc_name + chiang_the_strong + + + var_name + givervar + + + + + + class + pre_requisite + + + name + pre_requisite + + + + + + class + alias + + + name + alias + + + + + class + step + + + name + step + + + + class + actions + + + name + pre_actions + + + + + class + mission_objectives + + + name + objectives + + + + class + kill + + + fauna/quantity + chdfa1 1 + + + name + kill chdfa1 1 + + + + + + class + actions + + + name + post_actions + + + + amount + 20 + + + class + recv_money + + + + + + + + diff --git a/code/ryzom/common/src/game_share/CMakeLists.txt b/code/ryzom/common/src/game_share/CMakeLists.txt index 7883ce03d..6342f468d 100644 --- a/code/ryzom/common/src/game_share/CMakeLists.txt +++ b/code/ryzom/common/src/game_share/CMakeLists.txt @@ -22,5 +22,6 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(ryzom_gameshare ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS ryzom_gameshare LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) - +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS ryzom_gameshare LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp b/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp index 56a2606dd..a93bdaeb1 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild.cpp @@ -34,6 +34,8 @@ #include "outpost_manager/outpost_manager.h" #include "primitives_parser.h" #include "modules/shard_unifier_client.h" +#include "mission_manager/mission_manager.h" +#include "phrase_manager/phrase_utilities_functions.h" /// todo guild remove entity id translator #include "nel/misc/eid_translator.h" @@ -686,23 +688,193 @@ void CGuild::unregisterGuild() // //} - //---------------------------------------------------------------------------- -void CGuild::removeMission(CMissionGuild * mission, TMissionResult result) +void CGuild::removeMission( uint idx, TMissionResult result) { - /// todo guild mission + if ( idx >= _Missions.size() ) + return; + + /// if the mission was finished, the result is success + if ( _Missions[idx]->getFinished() ) + { + if ( _Missions[idx]->getMissionSuccess() ) + result = mr_success; + else + result = mr_fail; + } + + CMissionTemplate *tpl = CMissionManager::getInstance()->getTemplate(_Missions[idx]->getTemplateId()); + + updateMissionHistories( _Missions[idx]->getTemplateId(), result); + + if ( tpl && !tpl->Tags.NoList ) + { + _Missions[idx]->clearUsersJournalEntry(); + } + + CMissionManager::getInstance()->deInstanciateMission(_Missions[idx]); + delete _Missions[idx]; + _Missions.erase(_Missions.begin() + idx) ; } //---------------------------------------------------------------------------- void CGuild::addSuccessfulMission(CMissionTemplate * templ) { - /// todo guild mission + TMissionHistory &mh = _MissionHistories[templ->Alias]; + mh.Successfull = true; } //---------------------------------------------------------------------------- -bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias ) +void CGuild::clearSuccessfulMissions() { - /// todo guild mission + _MissionHistories.clear(); +} + +//---------------------------------------------------------------------------- +void CGuild::updateMissionHistories(TAIAlias missionAlias, uint32 result) +{ + TMissionHistory &mh = _MissionHistories[missionAlias]; + + switch(result) + { + case mr_success: + case mr_forced: + mh.Successfull = true; + // validate last try date + _MissionHistories[missionAlias].LastSuccessDate = CTickEventHandler::getGameCycle(); + break; + } +} + +//---------------------------------------------------------------------------- +void CGuild::sendDynamicMessageToMembers(const string &msgName, const TVectorParamCheck ¶ms, const set &excluded) const +{ + for ( std::map::const_iterator it = getMembersBegin(); + it != getMembersEnd();++it ) + { + CCharacter * user = PlayerManager.getChar( it->first ); + + if ( excluded.find(it->first) == excluded.end()) + { + const uint32 stringId = STRING_MANAGER::sendStringToClient(TheDataset.getDataSetRow(it->first), msgName, params ); + PHRASE_UTILITIES::sendDynamicSystemMessage(TheDataset.getDataSetRow(it->first), stringId); + } + } +} + +//---------------------------------------------------------------------------- +bool CGuild::processMissionEvent( CMissionEvent & event, TAIAlias alias) +{ + std::list listEvents; + listEvents.push_back(&event); + return processGuildMissionEvent(listEvents, alias); +} + +//---------------------------------------------------------------------------- +bool CGuild::processGuildMissionEvent(std::list< CMissionEvent *> & eventList, TAIAlias missionAlias) +{ + for (uint i = 0; i < _Missions.size(); i++ ) + { + nlassert( _Missions[i] ); + if ( missionAlias == CAIAliasTranslator::Invalid || _Missions[i]->getTemplateId() == missionAlias ) + { + if ( processGuildMissionStepEvent( eventList, _Missions[i]->getTemplateId() ,0xFFFFFFFF) ) + return true; + } + } + return false; +} + +//---------------------------------------------------------------------------- +bool CGuild::processGuildMissionStepEvent(std::list< CMissionEvent*> & eventList, TAIAlias missionAlias, uint32 stepIndex) +{ + CMissionGuild * mission = getMissionByAlias( missionAlias ); + if (!mission ) + { + nlwarning("invalid missionAlias"); + return false; + } + // I don't know if i should pass _EId to this function + CMissionEvent::TResult result = mission->processEvent(TheDataset.getDataSetRow(getHighestGradeOnlineUser()) /*TheDataset.getDataSetRow( _EId)*/ ,eventList,stepIndex ); + if ( result == CMissionEvent::Nothing ) + return false; + else if ( result == CMissionEvent::MissionFailed ) + return true; + + CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( mission->getTemplateId() ); + nlassert( templ ); + if ( result == CMissionEvent::MissionEnds ) + { + CMissionEventMissionDone * event = new CMissionEventMissionDone(templ->Alias); + eventList.push_back(event); + + addSuccessfulMission(templ); + + for ( std::map::iterator it = getMembersBegin(); + it != getMembersEnd();++it ) + { + CCharacter * user = PlayerManager.getChar( it->first ); + if ( user ) + { + if ( templ->Tags.NoList == false ) + CCharacter::sendDynamicSystemMessage( user->getEntityRowId(),"EGS_MISSION_SUCCESS"); + } + } + + CMissionManager::getInstance()->missionDoneOnce(templ); + mission->stopChildren(); + + // only remove no list missions, other must be manually removed by user + if ( templ->Tags.NoList || mission->isChained() || templ->Tags.AutoRemove ) + { + mission->updateEncyclopedia(); + removeMission(mission, mr_success); + } + else + { + mission->setSuccessFlag(); + mission->updateUsersJournalEntry(); + } + return true; + } + else if ( result == CMissionEvent::StepEnds ) + { + if ( templ->Tags.NoList == false ) + { + for ( std::map::iterator it = getMembersBegin(); + it != getMembersEnd();++it ) + { + CCharacter * user = PlayerManager.getChar( it->first ); + if ( user ) + { + if ( templ->Tags.NoList == false ) + CCharacter::sendDynamicSystemMessage( user->getEntityRowId(),"EGS_MISSION_STEP_SUCCESS"); + } + } + } + } + mission->updateUsersJournalEntry(); + return true; +} + +//---------------------------------------------------------------------------- +CMissionGuild* CGuild::getMissionByAlias( TAIAlias missionAlias ) +{ + const uint size = (uint)_Missions.size(); + for ( uint i = 0; i < size; i++ ) + { + if ( _Missions[i] && _Missions[i]->getTemplateId() == missionAlias ) + return _Missions[i]; + } + return NULL; +} + +//---------------------------------------------------------------------------- +bool CGuild::isMissionSuccessfull(TAIAlias alias) +{ + std::map::iterator it(_MissionHistories.find(alias)); + if (it != _MissionHistories.end()) + return it->second.Successfull; return false; } @@ -732,10 +904,12 @@ bool CGuild::canAccessToGuildInventory( CCharacter * user ) } //---------------------------------------------------------------------------- -void CGuild::putItem( CGameItemPtr item ) +bool CGuild::putItem( CGameItemPtr item ) { - if (_Inventory->insertItem(item, INVENTORIES::INSERT_IN_FIRST_FREE_SLOT, true) != CInventoryBase::ior_ok) + CInventoryBase::TInventoryOpResult res = _Inventory->insertItem(item, INVENTORIES::INSERT_IN_FIRST_FREE_SLOT, true); + if (res != CInventoryBase::ior_ok) item.deleteItem(); + return res == CInventoryBase::ior_ok; } //---------------------------------------------------------------------------- @@ -856,6 +1030,88 @@ void CGuild::takeItem( CCharacter * user, uint32 slot, uint32 quantity, uint16 s } } +//---------------------------------------------------------------------------- +uint CGuild::selectItems(NLMISC::CSheetId itemSheetId, uint32 quality, std::vector *itemList) +{ + // For all items + uint quantitySelected= 0; + for (uint32 i = 0; i < _Inventory->getSlotCount(); i++) + { + CGameItemPtr item = _Inventory->getItem(i); + if (item == NULL) + continue; + + // if match, append to the list + if (item->getSheetId()==itemSheetId && item->quality()>=quality) + { + quantitySelected+= item->getStackSize(); + if(itemList) + { + CItemSlotId entry; + entry.Slot= i; + entry.Quality= item->quality(); + itemList->push_back(entry); + } + } + } + + return quantitySelected; +} + +//---------------------------------------------------------------------------- +uint CGuild::destroyItems(const std::vector &itemSlotIns, uint32 maxQuantity) +{ + // none to destroy actually? + if(maxQuantity==0 || itemSlotIns.empty()) + return 0; + + // If has to destroy only some of them, must sort to take first the ones of lowest quality + const std::vector *itemSlots= NULL; + std::vector itemSlotSorted; + if(maxQuantity!=uint32(-1)) + { + itemSlotSorted= itemSlotIns; + std::sort(itemSlotSorted.begin(), itemSlotSorted.end()); + itemSlots= &itemSlotSorted; + } + else + { + // just point to the original one + itemSlots= &itemSlotIns; + } + + // destroy items up to the maxquantity wanted + uint index= 0; + uint totalDestroyed= 0; + while(maxQuantity>0 && indexgetStackSize()); + + CGameItemPtr item = _Inventory->removeItem(itemSlot.Slot, quantityToDestroy); + item.deleteItem(); + + // decrease if not infinity + if(maxQuantity!=-1) + maxQuantity-= quantityToDestroy; + + // increase count + totalDestroyed+= quantityToDestroy; + } + + // next slot to destroy + index++; + } + + return totalDestroyed; +} + //---------------------------------------------------------------------------- void CGuild::takeMoney( CCharacter * user, uint64 money, uint16 session ) { diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild.h b/code/ryzom/server/src/entities_game_service/guild_manager/guild.h index e740540ca..671f7c17b 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild.h +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild.h @@ -27,10 +27,15 @@ #include "outpost_manager/outpost_guild_db_updater.h" #include "guild_interface.h" #include "database_guild.h" +#include "mission_manager/mission_guild.h" class CMissionGuild; class CGuildMember; +/* Storage class for mission history data. +*/ +struct TMissionHistory; + /** * A guild in ryzom @@ -176,9 +181,36 @@ public: ///\name Mission management //@{ - void removeMission(CMissionGuild * mission, TMissionResult result); + void removeMission(CMissionGuild * mission, TMissionResult result) + { + for (uint i = 0; i < _Missions.size(); i++) + { + if ( _Missions[i] == mission ) + { + removeMission(i, result); + } + } + } + void removeMission( uint idx, TMissionResult result); void addSuccessfulMission(CMissionTemplate * templ); + void clearSuccessfulMissions(); + void updateMissionHistories(TAIAlias missionAlias, uint32 result); bool processMissionEvent( CMissionEvent & event, TAIAlias alias = CAIAliasTranslator::Invalid); + bool processGuildMissionEvent(std::list< CMissionEvent * > & eventList, TAIAlias missionAlias ); + bool processGuildMissionStepEvent(std::list< CMissionEvent* > & eventList, TAIAlias missionAlias, uint32 stepIndex); + CMissionGuild* getMissionByAlias( TAIAlias missionAlias ); + bool isMissionSuccessfull(TAIAlias alias); + void sendDynamicMessageToMembers(const std::string &msgName, const TVectorParamCheck ¶ms, const std::set &excluded) const; + ///\return the mission + inline std::vector & getMissions() + { + return _Missions; + } + void addMission(CMissionGuild* guildMission) + { + _Missions.push_back(guildMission); + guildMission->updateUsersJournalEntry(); + } //@} /// inventory management @@ -203,7 +235,23 @@ public: return _Inventory->getItem(slot); } /// add an item in the guild inventory (item can be deleted if not inserted : do not use it anymore in any case!) - void putItem( CGameItemPtr item ); + bool putItem( CGameItemPtr item ); + + class CItemSlotId + { + public: + uint32 Slot; + uint32 Quality; + bool operator<(const CItemSlotId &o) const + { + return Quality *itemList= NULL); + /// destroy a list of items (up to maxQuantity to destroy) + uint destroyItems(const std::vector &itemSlots, uint32 maxQuantity=-1); /// return the inventory (const) const NLMISC::CSmartPtr& getInventory() const { return _Inventory; } @@ -351,6 +399,11 @@ private: /// list of outposts challenged by guild std::vector _ChallengedOutposts; + ///the missions took by the guild + std::vector _Missions; + /// Successful missions + std::map _MissionHistories; + NLMISC_COMMAND_FRIEND( guildDB ); }; #endif // RY_GUILD_H diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.h b/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.h index 4447e356f..46dee0f96 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.h +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.h @@ -99,6 +99,12 @@ public: /// user wanna pick a mission CMissionGuild * pickMission( TAIAlias alias ); + // Function to check if the member can pick a mission. By default only Officer and above can pick a guild mission + virtual bool canPickMission(TAIAlias alias) + { + return false; + } + /// set the version of last sent info of items in guild inventory void setLastSentInfoVersion(uint32 slot, uint8 infoVersion) { diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_officer_module.h b/code/ryzom/server/src/entities_game_service/guild_manager/guild_officer_module.h index 7d6f49096..e31885300 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_officer_module.h +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_officer_module.h @@ -34,6 +34,14 @@ public: :CGuildMemberModule(proxy,guildMember){} virtual bool canAffectGrade(EGSPD::CGuildGrade::TGuildGrade grade)const; virtual bool canInvite()const; + + // Function to check if the member can pick a mission. + // By default only Officers and above can pick a guild mission. + // So we don't need to implement this function for the other grades + virtual bool canPickMission(TAIAlias alias) + { + return true; + } }; ; diff --git a/code/ryzom/server/src/entities_game_service/mission_client_callbacks.cpp b/code/ryzom/server/src/entities_game_service/mission_client_callbacks.cpp index f0205ed95..52fd214f9 100644 --- a/code/ryzom/server/src/entities_game_service/mission_client_callbacks.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_client_callbacks.cpp @@ -26,6 +26,9 @@ #include "team_manager/team_manager.h" #include "mission_manager/mission_team.h" #include "mission_manager/mission_log.h" +#include "guild_manager/guild_manager.h" +#include "guild_manager/guild.h" +#include "guild_manager/guild_member.h" using namespace std; @@ -222,50 +225,108 @@ void cbClientGroupAbandonMission( NLNET::CMessage& msgin, const std::string &ser CCharacter * user = PlayerManager.getChar( userId ); user->setAfkState(false); - CTeam * team = TeamManager.getRealTeam( user->getTeamId() ); - if ( !team ) - { - MISLOG("user:%s cbClientGroupAbandonMission : Invalid team", userId.toString().c_str()); - return; - } - if ( team->getLeader() != userId ) - { - CCharacter::sendDynamicSystemMessage( user->getEntityRowId(), "REQ_LEADER_TO_ABANDON_MISSION" ); - return; - } - if ( index >= team->getMissions().size() ) + // We check if it's a guild or team mission + if (index < MaxGroupMissionCount) { - MISLOG("user:%s cbClientGroupAbandonMission : Invalid group mission %u ( count %u )", - userId.toString().c_str(), index, team->getMissions().size()); - return; - } - + // Team - CMissionTeam* mission = team->getMissions()[index]; - nlassert(mission); - - if ( mission->getFinished() == false ) - { - CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( mission->getTemplateId() ); - if ( !templ ) + CTeam * team = TeamManager.getRealTeam( user->getTeamId() ); + if ( !team ) { - MISLOG("user:%s cbClientGroupAbandonMission : invalid group mission alias %u", - userId.toString().c_str(), mission->getTemplateId()); + MISLOG("user:%s cbClientGroupAbandonMission : Invalid team", userId.toString().c_str()); return; } - if ( templ->Tags.NonAbandonnable ) + if ( team->getLeader() != userId ) { - MISLOG("user:%s cbClientGroupAbandonMission : group mission alias %u is not abandonnable but user tries to abandon it", - userId.toString().c_str(), mission->getTemplateId()); + CCharacter::sendDynamicSystemMessage( user->getEntityRowId(), "REQ_LEADER_TO_ABANDON_MISSION" ); + return; + } + + if ( index >= team->getMissions().size() ) + { + MISLOG("user:%s cbClientGroupAbandonMission : Invalid group mission %u ( count %u )", + userId.toString().c_str(), index, team->getMissions().size()); return; } - set excluded; - excluded.insert( userId ); - team->sendDynamicMessageToMembers( "ABANDON_GROUP_MISSION",TVectorParamCheck(), excluded ); + + CMissionTeam* mission = team->getMissions()[index]; + nlassert(mission); + + if ( mission->getFinished() == false ) + { + CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( mission->getTemplateId() ); + if ( !templ ) + { + MISLOG("user:%s cbClientGroupAbandonMission : invalid group mission alias %u", + userId.toString().c_str(), mission->getTemplateId()); + return; + } + if ( templ->Tags.NonAbandonnable ) + { + MISLOG("user:%s cbClientGroupAbandonMission : group mission alias %u is not abandonnable but user tries to abandon it", + userId.toString().c_str(), mission->getTemplateId()); + return; + } + set excluded; + excluded.insert( userId ); + + team->sendDynamicMessageToMembers( "ABANDON_GROUP_MISSION",TVectorParamCheck(), excluded ); + } + team->removeMission( index, mr_abandon ); + } + else + { + // Guild + // We set the correct index + index = MaxGroupMissionCount - index; + + CGuild * guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() ); + if ( !guild ) + { + MISLOG("user:%s cbClientGroupAbandonMission : Invalid team", userId.toString().c_str()); + return; + } + if ( guild->getLeader()->getIngameEId() != userId ) + { + CCharacter::sendDynamicSystemMessage( user->getEntityRowId(), "REQ_LEADER_TO_ABANDON_MISSION" ); + return; + } + + if ( index >= guild->getMissions().size() ) + { + MISLOG("user:%s cbClientGroupAbandonMission : Invalid group mission %u ( count %u )", + userId.toString().c_str(), index, guild->getMissions().size()); + return; + } + + + CMissionGuild* mission = guild->getMissions()[index]; + nlassert(mission); + + if ( mission->getFinished() == false ) + { + CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( mission->getTemplateId() ); + if ( !templ ) + { + MISLOG("user:%s cbClientGroupAbandonMission : invalid group mission alias %u", + userId.toString().c_str(), mission->getTemplateId()); + return; + } + if ( templ->Tags.NonAbandonnable ) + { + MISLOG("user:%s cbClientGroupAbandonMission : group mission alias %u is not abandonnable but user tries to abandon it", + userId.toString().c_str(), mission->getTemplateId()); + return; + } + set excluded; + excluded.insert( userId ); + + guild->sendDynamicMessageToMembers( "ABANDON_GROUP_MISSION",TVectorParamCheck(), excluded ); + } + guild->removeMission( index, mr_abandon ); } - team->removeMission( index, mr_abandon ); } //---------------------------------------------------------------------------- diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp index eb627551d..31cf1ff0f 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_action.cpp @@ -511,9 +511,9 @@ class CMissionActionRecvItem : public IMissionAction { _SourceLine = line; bool ret = true; - if ( script.size() != 2 && script.size() != 3 ) + if ( script.size() != 2 && script.size() != 3 && script.size() != 4) { - MISLOGSYNTAXERROR(" [] [][:npc_name][:group]"); + MISLOGSYNTAXERROR(" [] [][:npc_name][:group][:guild]"); return false; } vector args; @@ -569,6 +569,17 @@ class CMissionActionRecvItem : public IMissionAction _Group = true; } + // We check for the guild option + _Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + _Guild = true; + break; + } + } + if ( _Quantity == 0 ) { @@ -606,7 +617,7 @@ class CMissionActionRecvItem : public IMissionAction } } } - else if ( !_Group ) + else if ( !_Group && !_Guild) { CCharacter * user = PlayerManager.getChar( entities[0] ); CTeam * team = TeamManager.getRealTeam(user->getTeamId()); @@ -617,141 +628,245 @@ class CMissionActionRecvItem : public IMissionAction } } - - // check free room space in inventory - // NB : in case of group, fail happens only if none in the group have enough free space - sint16 neededSlotCount = 0; - uint32 neededBulk = 0; - CSheetId sheet = ( _SheetId != CSheetId::Unknown )?_SheetId:_Item.getSheetId(); - CGameItemPtr itemTmp = GameItemManager.createItem(sheet, _Quality, true, true); - if (itemTmp != NULL) + // If the case we want to give the item to the guild + if (_Guild) { - neededSlotCount = (sint16) ceil( (float)_Quantity / itemTmp->getMaxStackSize() ); - neededBulk = _Quantity * itemTmp->getStackBulk(); - itemTmp.deleteItem(); + if (entities.size() == 0) + return; + + CCharacter * user = PlayerManager.getChar( entities[0] ); + if (!user) + { + LOGMISSIONACTION("recv_fame : Invalid user"); + return; + } + + CGuild * guild = CGuildManager::getInstance()->getGuildFromId(user->getGuildId()); + if (!guild) + { + LOGMISSIONACTION("recv_fame : Invalid guild id '" + NLMISC::toString(user->getGuildId()) + "'"); + return; + } + + SM_STATIC_PARAMS_3(params, STRING_MANAGER::item, STRING_MANAGER::integer, STRING_MANAGER::integer); + if ( _SheetId != CSheetId::Unknown ) + { + const CStaticItem * form = CSheets::getForm( _SheetId ); + if ( !form ) + { + LOGMISSIONACTION("sheetId '" + _SheetId.toString() + "' is unknown"); + return; + } + if (form->Family != ITEMFAMILY::MISSION_ITEM) + return; + + uint quantity = _Quantity; + while (quantity > 0) + { + CGameItemPtr item = user->createItem(_Quality, quantity, _SheetId); + if (item == NULL) + break; + const uint32 stackSize = item->getStackSize(); + + if (!guild->putItem(item)) + { + CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() ); + if ( templ ) + { + if ( templ->Tags.FailIfInventoryIsFull ) + { + instance->setProcessingState(CMission::ActionFailed); + return; + } + } + } + // from here item maybe NULL (because of autostack) + + quantity -= stackSize; + } + params[2].Int = _Quality; + } + else + { + const CStaticItem * form = CSheets::getForm( _Item.getSheetId() ); + if ( !form ) + { + LOGMISSIONACTION("sheetId '" + _Item.getSheetId().toString() + "' is unknown"); + return; + } + uint quantity = _Quantity; + while (quantity > 0) + { + CGameItemPtr item = _Item.createItem(quantity); + if (item == NULL) + break; + + const uint32 stackSize = item->getStackSize(); + if (!guild->putItem(item)) + { + CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() ); + if ( templ ) + { + if ( templ->Tags.FailIfInventoryIsFull ) + { + instance->setProcessingState(CMission::ActionFailed); + return; + } + } + } + // from here item maybe NULL (because of autostack) + + quantity -= stackSize; + } + params[2].Int = _Item.getQuality(); + } + + params[0].SheetId = _SheetId; + params[1].Int = _Quantity; + + for ( uint i = 0; i < entities.size(); i++ ) + { + CCharacter * user = PlayerManager.getChar( entities[i] ); + if ( user ) + PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_GUILD_RECV_ITEM", params); + } } else { - LOGMISSIONACTION("can't get static item from sheet " + sheet.toString()); - return; - } - - - bool fail = true; - for ( uint i = 0; i < entities.size(); i++ ) - { - CCharacter * user = PlayerManager.getChar( entities[i] ); - if ( user ) + // check free room space in inventory + // NB : in case of group, fail happens only if none in the group have enough free space + sint16 neededSlotCount = 0; + uint32 neededBulk = 0; + CSheetId sheet = ( _SheetId != CSheetId::Unknown )?_SheetId:_Item.getSheetId(); + CGameItemPtr itemTmp = GameItemManager.createItem(sheet, _Quality, true, true); + if (itemTmp != NULL) { - CInventoryPtr invBag = user->getInventory( INVENTORIES::bag ); - sint16 freeSlotcount = invBag->getFreeSlotCount(); - uint32 maxBulk = invBag->getMaxBulk(); - - CInventoryPtr invTemp = user->getInventory( INVENTORIES::temporary ); - if( invTemp ) - { - freeSlotcount -= invTemp->getUsedSlotCount(); - maxBulk -= invTemp->getInventoryBulk(); - } - - if( (neededSlotCount <= freeSlotcount) && ( neededBulk + invBag->getInventoryBulk() <= maxBulk) ) - { - fail = false; - break; - } + neededSlotCount = (sint16) ceil( (float)_Quantity / itemTmp->getMaxStackSize() ); + neededBulk = _Quantity * itemTmp->getStackBulk(); + itemTmp.deleteItem(); } - } - if( fail ) - { - CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() ); - if ( templ ) + else { - if ( templ->Tags.FailIfInventoryIsFull ) - { - instance->setProcessingState(CMission::ActionFailed); - return; - } + LOGMISSIONACTION("can't get static item from sheet " + sheet.toString()); + return; } - } - for ( uint i = 0; i < entities.size(); i++ ) - { - CCharacter * user = PlayerManager.getChar( entities[i] ); - if ( user ) + bool fail = true; + for ( uint i = 0; i < entities.size(); i++ ) { - SM_STATIC_PARAMS_3(params, STRING_MANAGER::item, STRING_MANAGER::integer, STRING_MANAGER::integer); - if ( _SheetId != CSheetId::Unknown ) + CCharacter * user = PlayerManager.getChar( entities[i] ); + if ( user ) { - const CStaticItem * form = CSheets::getForm( _SheetId ); - if ( !form ) + CInventoryPtr invBag = user->getInventory( INVENTORIES::bag ); + sint16 freeSlotcount = invBag->getFreeSlotCount(); + uint32 maxBulk = invBag->getMaxBulk(); + + CInventoryPtr invTemp = user->getInventory( INVENTORIES::temporary ); + if( invTemp ) { - LOGMISSIONACTION("sheetId '" + _SheetId.toString() + "' is unknown"); + freeSlotcount -= invTemp->getUsedSlotCount(); + maxBulk -= invTemp->getInventoryBulk(); + } + + if( (neededSlotCount <= freeSlotcount) && ( neededBulk + invBag->getInventoryBulk() <= maxBulk) ) + { + fail = false; + break; + } + } + } + if( fail ) + { + CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() ); + if ( templ ) + { + if ( templ->Tags.FailIfInventoryIsFull ) + { + instance->setProcessingState(CMission::ActionFailed); return; } - if (form->Family != ITEMFAMILY::MISSION_ITEM && !user->enterTempInventoryMode(TEMP_INV_MODE::MissionReward)) - continue; + } + } - uint quantity = _Quantity; - while (quantity > 0) + for ( uint i = 0; i < entities.size(); i++ ) + { + CCharacter * user = PlayerManager.getChar( entities[i] ); + if ( user ) + { + SM_STATIC_PARAMS_3(params, STRING_MANAGER::item, STRING_MANAGER::integer, STRING_MANAGER::integer); + if ( _SheetId != CSheetId::Unknown ) { - CGameItemPtr item = user->createItem(_Quality, quantity, _SheetId); - if (item == NULL) - break; - const uint32 stackSize = item->getStackSize(); - - if( form->Family != ITEMFAMILY::MISSION_ITEM ) + const CStaticItem * form = CSheets::getForm( _SheetId ); + if ( !form ) { + LOGMISSIONACTION("sheetId '" + _SheetId.toString() + "' is unknown"); + return; + } + if (form->Family != ITEMFAMILY::MISSION_ITEM && !user->enterTempInventoryMode(TEMP_INV_MODE::MissionReward)) + continue; + + uint quantity = _Quantity; + while (quantity > 0) + { + CGameItemPtr item = user->createItem(_Quality, quantity, _SheetId); + if (item == NULL) + break; + const uint32 stackSize = item->getStackSize(); + + if( form->Family != ITEMFAMILY::MISSION_ITEM ) + { + if (!user->addItemToInventory(INVENTORIES::temporary, item)) + { + item.deleteItem(); + break; + } + } + else + { + if (!user->addItemToInventory(INVENTORIES::bag, item)) + { + item.deleteItem(); + break; + } + } + // from here item maybe NULL (because of autostack) + + quantity -= stackSize; + } + params[2].Int = _Quality; + } + else + { + const CStaticItem * form = CSheets::getForm( _Item.getSheetId() ); + if ( !form ) + { + LOGMISSIONACTION("sheetId '" + _Item.getSheetId().toString() + "' is unknown"); + return; + } + uint quantity = _Quantity; + while (quantity > 0) + { + CGameItemPtr item = _Item.createItem(quantity); + if (item == NULL) + break; + + const uint32 stackSize = item->getStackSize(); if (!user->addItemToInventory(INVENTORIES::temporary, item)) { item.deleteItem(); break; } - } - else - { - if (!user->addItemToInventory(INVENTORIES::bag, item)) - { - item.deleteItem(); - break; - } - } - // from here item maybe NULL (because of autostack) + // from here item maybe NULL (because of autostack) - quantity -= stackSize; + quantity -= stackSize; + } + params[2].Int = _Item.getQuality(); } - params[2].Int = _Quality; + + params[0].SheetId = _SheetId; + params[1].Int = _Quantity; + PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_ITEM", params); } - else - { - const CStaticItem * form = CSheets::getForm( _Item.getSheetId() ); - if ( !form ) - { - LOGMISSIONACTION("sheetId '" + _Item.getSheetId().toString() + "' is unknown"); - return; - } - uint quantity = _Quantity; - while (quantity > 0) - { - CGameItemPtr item = _Item.createItem(quantity); - if (item == NULL) - break; - - const uint32 stackSize = item->getStackSize(); - if (!user->addItemToInventory(INVENTORIES::temporary, item)) - { - item.deleteItem(); - break; - } - // from here item maybe NULL (because of autostack) - - quantity -= stackSize; - } - params[2].Int = _Item.getQuality(); - } - - params[0].SheetId = _SheetId; - params[1].Int = _Quantity; - PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_ITEM", params); } } }; @@ -760,6 +875,7 @@ class CMissionActionRecvItem : public IMissionAction uint16 _Quantity; CSheetId _SheetId; bool _Group; + bool _Guild; MISSION_ACTION_GETNEWPTR(CMissionActionRecvItem) }; @@ -772,9 +888,9 @@ class CMissionActionRecvNamedItem : public IMissionAction bool buildAction ( uint32 line, const std::vector< std::string > & script, CMissionGlobalParsingData & globalData, CMissionSpecificParsingData & missionData) { _SourceLine = line; - if ( script.size() != 2 && script.size() != 3 ) + if ( script.size() != 2 && script.size() != 3 && script.size() != 4) { - MISLOGSYNTAXERROR(" [] [:group]"); + MISLOGSYNTAXERROR(" [] [:group] [:guild]"); return false; } vector args; @@ -813,6 +929,17 @@ class CMissionActionRecvNamedItem : public IMissionAction _Group = true; } + // We check for the guild option + _Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + _Guild = true; + break; + } + } + if ( _Quantity == 0 ) { MISLOGERROR("quantity = 0"); @@ -848,7 +975,7 @@ class CMissionActionRecvNamedItem : public IMissionAction } } } - else if ( !_Group ) + else if ( !_Group && !_Guild) { CCharacter * user = PlayerManager.getChar( entities[0] ); CTeam * team = TeamManager.getRealTeam(user->getTeamId()); @@ -859,41 +986,34 @@ class CMissionActionRecvNamedItem : public IMissionAction } } - // check free room space in inventory - // NB : in case of group, fail happens only if noone in the group have enough free space - CGameItemPtr itemTmp = CNamedItems::getInstance().createNamedItem(_NamedItem, _Quantity); - if( itemTmp != NULL ) + // If the case we want to give the item to the guild + if (_Guild) { - sint16 neededSlotCount = (sint16) ceil( (float)_Quantity / itemTmp->getMaxStackSize() ); - uint32 neededBulk = _Quantity * itemTmp->getStackBulk(); - itemTmp.deleteItem(); - - bool fail = true; - for ( uint i = 0; i < entities.size(); i++ ) - { - CCharacter * user = PlayerManager.getChar( entities[i] ); - if ( user ) - { - CInventoryPtr invBag = user->getInventory( INVENTORIES::bag ); - sint16 freeSlotcount = invBag->getFreeSlotCount(); - uint32 maxBulk = invBag->getMaxBulk(); + if (entities.size() == 0) + return; - CInventoryPtr invTemp = user->getInventory( INVENTORIES::temporary ); - if( invTemp ) - { - freeSlotcount -= invTemp->getUsedSlotCount(); - maxBulk -= invTemp->getInventoryBulk(); - } - - if( (neededSlotCount <= freeSlotcount) && ( neededBulk + invBag->getInventoryBulk() <= maxBulk) ) - { - fail = false; - break; - } - } - + CCharacter * user = PlayerManager.getChar( entities[0] ); + if (!user) + { + LOGMISSIONACTION("recv_fame : Invalid user"); + return; } - if( fail ) + + CGuild * guild = CGuildManager::getInstance()->getGuildFromId(user->getGuildId()); + if (!guild) + { + LOGMISSIONACTION("recv_fame : Invalid guild id '" + NLMISC::toString(user->getGuildId()) + "'"); + return; + } + + // add the item to inventory + CGameItemPtr item = CNamedItems::getInstance().createNamedItem(_NamedItem, _Quantity); + if (item == NULL) + { + LOGMISSIONACTION("named item '" + _NamedItem + "' is unknown"); + return; + } + if (!guild->putItem(item)) { CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() ); if ( templ ) @@ -905,39 +1025,103 @@ class CMissionActionRecvNamedItem : public IMissionAction } } } + else + { + for ( uint i = 0; i < entities.size(); i++ ) + { + CCharacter * user = PlayerManager.getChar( entities[i] ); + if ( user ) + { + SM_STATIC_PARAMS_2(params, STRING_MANAGER::dyn_string_id, STRING_MANAGER::integer); + params[0].StringId = item->sendNameId(user); + params[1].Int = _Quantity; + PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_GUILD_RECV_NAMED_ITEM", params); + } + } + } } else { - LOGMISSIONACTION("named item '" + _NamedItem + "' is unknown"); - return; - } - - // apply the action to all entities - for ( uint i = 0; i < entities.size(); i++ ) - { - CCharacter * user = PlayerManager.getChar( entities[i] ); - if ( user ) + // check free room space in inventory + // NB : in case of group, fail happens only if noone in the group have enough free space + CGameItemPtr itemTmp = CNamedItems::getInstance().createNamedItem(_NamedItem, _Quantity); + if( itemTmp != NULL ) { - if (!user->enterTempInventoryMode(TEMP_INV_MODE::MissionReward)) - continue; + sint16 neededSlotCount = (sint16) ceil( (float)_Quantity / itemTmp->getMaxStackSize() ); + uint32 neededBulk = _Quantity * itemTmp->getStackBulk(); + itemTmp.deleteItem(); + + bool fail = true; + for ( uint i = 0; i < entities.size(); i++ ) + { + CCharacter * user = PlayerManager.getChar( entities[i] ); + if ( user ) + { + CInventoryPtr invBag = user->getInventory( INVENTORIES::bag ); + sint16 freeSlotcount = invBag->getFreeSlotCount(); + uint32 maxBulk = invBag->getMaxBulk(); - // add the item to inventory - CGameItemPtr item = CNamedItems::getInstance().createNamedItem(_NamedItem, _Quantity); - if (item == NULL) - { - LOGMISSIONACTION("named item '" + _NamedItem + "' is unknown"); - return; + CInventoryPtr invTemp = user->getInventory( INVENTORIES::temporary ); + if( invTemp ) + { + freeSlotcount -= invTemp->getUsedSlotCount(); + maxBulk -= invTemp->getInventoryBulk(); + } + + if( (neededSlotCount <= freeSlotcount) && ( neededBulk + invBag->getInventoryBulk() <= maxBulk) ) + { + fail = false; + break; + } + } + } - if(!user->addItemToInventory(INVENTORIES::temporary, item)) + if( fail ) { - item.deleteItem(); + CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( instance->getTemplateId() ); + if ( templ ) + { + if ( templ->Tags.FailIfInventoryIsFull ) + { + instance->setProcessingState(CMission::ActionFailed); + return; + } + } } - else + } + else + { + LOGMISSIONACTION("named item '" + _NamedItem + "' is unknown"); + return; + } + + // apply the action to all entities + for ( uint i = 0; i < entities.size(); i++ ) + { + CCharacter * user = PlayerManager.getChar( entities[i] ); + if ( user ) { - SM_STATIC_PARAMS_2(params, STRING_MANAGER::dyn_string_id, STRING_MANAGER::integer); - params[0].StringId = item->sendNameId(user); - params[1].Int = _Quantity; - PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_NAMED_ITEM", params); + if (!user->enterTempInventoryMode(TEMP_INV_MODE::MissionReward)) + continue; + + // add the item to inventory + CGameItemPtr item = CNamedItems::getInstance().createNamedItem(_NamedItem, _Quantity); + if (item == NULL) + { + LOGMISSIONACTION("named item '" + _NamedItem + "' is unknown"); + return; + } + if(!user->addItemToInventory(INVENTORIES::temporary, item)) + { + item.deleteItem(); + } + else + { + SM_STATIC_PARAMS_2(params, STRING_MANAGER::dyn_string_id, STRING_MANAGER::integer); + params[0].StringId = item->sendNameId(user); + params[1].Int = _Quantity; + PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_NAMED_ITEM", params); + } } } } @@ -945,6 +1129,7 @@ class CMissionActionRecvNamedItem : public IMissionAction std::string _NamedItem; uint16 _Quantity; bool _Group; + bool _Guild; MISSION_ACTION_GETNEWPTR(CMissionActionRecvNamedItem) }; @@ -1043,9 +1228,9 @@ class CMissionActionDestroyItem : { // Parse the line _SourceLine = line; - if ( script.size() != 2 && script.size() != 3) + if ( script.size() != 2 && script.size() != 3 && script.size() != 4) { - MISLOGSYNTAXERROR(" [] []:[npc_name]"); + MISLOGSYNTAXERROR(" [] []:[npc_name] [:guild]"); return false; } @@ -1060,6 +1245,17 @@ class CMissionActionDestroyItem : ret= false; } + // We check for the guild option + _Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + _Guild = true; + break; + } + } + return ret; } @@ -1074,36 +1270,86 @@ class CMissionActionDestroyItem : instance->getEntities(entities); if ( entities.empty() ) return; - for ( uint i = 0; i < entities.size(); i++ ) + + // If the "guild" parameter is not set, we destroy the items for the users + if (!_Guild) { - CCharacter * user = PlayerManager.getChar( entities[i] ); - if ( user ) + + for ( uint i = 0; i < entities.size(); i++ ) { - // Select the items in Bag AND mektoub that match the request - vector itemList; - user->selectItems(INVENTORIES::bag, _SheetId, _Quality, &itemList); - for(uint pa=0;paselectItems(INVENTORIES::TInventory(INVENTORIES::pet_animal + pa), _SheetId, _Quality, &itemList); + CCharacter * user = PlayerManager.getChar( entities[i] ); + if ( user ) + { + // Select the items in Bag AND mektoub that match the request + vector itemList; + user->selectItems(INVENTORIES::bag, _SheetId, _Quality, &itemList); + for(uint pa=0;paselectItems(INVENTORIES::TInventory(INVENTORIES::pet_animal + pa), _SheetId, _Quality, &itemList); - // Destroy them, up to quantity wanted - // NB: don't care if destroying an item owned by a mektoub is strange because mektoub not near! - uint quantityReallyDestroyed; - quantityReallyDestroyed= user->destroyItems(itemList, _Quantity); + // Destroy them, up to quantity wanted + // NB: don't care if destroying an item owned by a mektoub is strange because mektoub not near! + uint quantityReallyDestroyed; + quantityReallyDestroyed= user->destroyItems(itemList, _Quantity); - // Send message - SM_STATIC_PARAMS_4(params, STRING_MANAGER::bot, STRING_MANAGER::item, STRING_MANAGER::integer, STRING_MANAGER::integer); - TAIAlias botAlias= _Npc; - if(botAlias==CAIAliasTranslator::Invalid) - botAlias= instance->getGiver(); - params[0].setEIdAIAlias(CAIAliasTranslator::getInstance()->getEntityId( botAlias ), botAlias); - params[1].SheetId = _SheetId; - params[2].Int = quantityReallyDestroyed; - params[3].Int = _Quality; - PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_DESTROY_ITEM", params); + // Send message + SM_STATIC_PARAMS_4(params, STRING_MANAGER::bot, STRING_MANAGER::item, STRING_MANAGER::integer, STRING_MANAGER::integer); + TAIAlias botAlias= _Npc; + if(botAlias==CAIAliasTranslator::Invalid) + botAlias= instance->getGiver(); + params[0].setEIdAIAlias(CAIAliasTranslator::getInstance()->getEntityId( botAlias ), botAlias); + params[1].SheetId = _SheetId; + params[2].Int = quantityReallyDestroyed; + params[3].Int = _Quality; + PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_DESTROY_ITEM", params); + } + } + + } + // We destroy the item in the guild + else + { + CCharacter * user = PlayerManager.getChar( entities[0] ); + if (!user) + { + LOGMISSIONACTION("recv_fame : Invalid user"); + return; + } + + CGuild * guild = CGuildManager::getInstance()->getGuildFromId(user->getGuildId()); + if (!guild) + { + LOGMISSIONACTION("recv_fame : Invalid guild id '" + NLMISC::toString(user->getGuildId()) + "'"); + return; + } + + vector itemList; + guild->selectItems(_SheetId, _Quality, &itemList); + + // Destroy them, up to quantity wanted + uint quantityReallyDestroyed; + quantityReallyDestroyed = guild->destroyItems(itemList, _Quantity); + + // Send message + for ( uint i = 0; i < entities.size(); i++ ) + { + CCharacter * user = PlayerManager.getChar( entities[i] ); + if ( user ) + { + SM_STATIC_PARAMS_4(params, STRING_MANAGER::bot, STRING_MANAGER::item, STRING_MANAGER::integer, STRING_MANAGER::integer); + TAIAlias botAlias= _Npc; + if(botAlias==CAIAliasTranslator::Invalid) + botAlias= instance->getGiver(); + params[0].setEIdAIAlias(CAIAliasTranslator::getInstance()->getEntityId( botAlias ), botAlias); + params[1].SheetId = _SheetId; + params[2].Int = quantityReallyDestroyed; + params[3].Int = _Quality; + PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_DESTROY_ITEM", params); + } } } }; TAIAlias _Npc; + bool _Guild; MISSION_ACTION_GETNEWPTR(CMissionActionDestroyItem) }; @@ -1607,9 +1853,9 @@ class CMissionActionRecvMoney : public IMissionAction { bool ret = true; _SourceLine = line; - if ( script.size() != 2 ) + if ( script.size() != 2 && script.size() != 3) { - MISLOGSYNTAXERROR(" OR *[;]"); + MISLOGSYNTAXERROR(" [: guild] OR *[;]"); return false; } @@ -1637,6 +1883,18 @@ class CMissionActionRecvMoney : public IMissionAction ret = false; } } + + // We check for the guild option + _Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + _Guild = true; + break; + } + } + return ret; } @@ -1647,22 +1905,67 @@ class CMissionActionRecvMoney : public IMissionAction std::vector entities; instance->getEntities(entities); - uint amount = _Amount / (uint)entities.size(); - if ( amount == 0 || _Amount % entities.size() ) - amount++; - for ( uint i = 0; i < entities.size(); i++ ) + + // If the guild parameter is not set we just divide the money and give it to each entity + if (!_Guild) { - CCharacter * user = PlayerManager.getChar( entities[i] ); - if ( user ) + + uint amount = _Amount / (uint)entities.size(); + if ( amount == 0 || _Amount % entities.size() ) + amount++; + for ( uint i = 0; i < entities.size(); i++ ) { - user->giveMoney( _Amount ); - SM_STATIC_PARAMS_1(params, STRING_MANAGER::integer); - params[0].Int = _Amount; - PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_MONEY",params); + CCharacter * user = PlayerManager.getChar( entities[i] ); + if ( user ) + { + user->giveMoney( _Amount ); + SM_STATIC_PARAMS_1(params, STRING_MANAGER::integer); + params[0].Int = _Amount; + PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_RECV_MONEY",params); + } } + + } + // Else we give the money to the guild + else + { + if (entities.size() == 0) + return; + + CCharacter * user = PlayerManager.getChar( entities[0] ); + if (!user) + { + LOGMISSIONACTION("recv_money : Invalid user"); + return; + } + + CGuild * guild = CGuildManager::getInstance()->getGuildFromId(user->getGuildId()); + if (guild) + { + guild->addMoney(_Amount); + } + else + { + LOGMISSIONACTION("recv_money : Invalid guild id '" + NLMISC::toString(user->getGuildId()) + "'"); + return; + } + + // tell everyone some money has been given to the guild + for ( uint i = 0; i < entities.size(); i++ ) + { + CCharacter * user = PlayerManager.getChar( entities[i] ); + if ( user ) + { + SM_STATIC_PARAMS_1(params, STRING_MANAGER::integer); + params[0].Int = _Amount; + PHRASE_UTILITIES::sendDynamicSystemMessage(user->getEntityRowId(),"MIS_GUILD_RECV_MONEY",params); + } + } + } }; uint _Amount; + bool _Guild; MISSION_ACTION_GETNEWPTR(CMissionActionRecvMoney) }; @@ -1675,9 +1978,9 @@ class CMissionActionRecvFame : public IMissionAction bool buildAction ( uint32 line, const std::vector< std::string > & script, CMissionGlobalParsingData & globalData, CMissionSpecificParsingData & missionData) { _SourceLine = line; - if ( script.size() != 2 ) + if ( script.size() != 2 && script.size() != 3) { - MISLOGSYNTAXERROR(" "); + MISLOGSYNTAXERROR(" [:guild]"); return false; } vector args; @@ -1700,6 +2003,18 @@ class CMissionActionRecvFame : public IMissionAction MISLOGERROR("fame = 0"); return false; } + + // We check for the guild option + _Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + _Guild = true; + break; + } + } + return true; } @@ -1708,20 +2023,63 @@ class CMissionActionRecvFame : public IMissionAction LOGMISSIONACTION("recv_fame"); std::vector entities; instance->getEntities(entities); - for ( uint i = 0; i < entities.size(); i++ ) - { - CEntityId eid = TheDataset.getEntityId(entities[i]); - CFameInterface::getInstance().addFameIndexed(eid, _Faction, _Value, true); - // Make the client refresh the icons on mission giver NPCs, at once - CCharacter *character = PlayerManager.getChar(entities[i]); - if (character) - character->sendEventForMissionAvailabilityCheck(); + // If there is no "guild" parameter we give the fame to every user + if (!_Guild) + { + + for ( uint i = 0; i < entities.size(); i++ ) + { + CEntityId eid = TheDataset.getEntityId(entities[i]); + CFameInterface::getInstance().addFameIndexed(eid, _Faction, _Value, true); + + // Make the client refresh the icons on mission giver NPCs, at once + CCharacter *character = PlayerManager.getChar(entities[i]); + if (character) + character->sendEventForMissionAvailabilityCheck(); + } + + } + // Else we just give it to the guild + else + { + + if (entities.size() == 0) + return; + + CCharacter * user = PlayerManager.getChar( entities[0] ); + if (!user) + { + LOGMISSIONACTION("recv_fame : Invalid user"); + return; + } + + CGuild * guild = CGuildManager::getInstance()->getGuildFromId(user->getGuildId()); + if (guild) + { + CFameInterface::getInstance().addFameIndexed(guild->getEId(), _Faction, _Value, true); + } + else + { + LOGMISSIONACTION("recv_fame : Invalid guild id '" + NLMISC::toString(user->getGuildId()) + "'"); + return; + } + + // tell everyone some money has been given to the guild + for ( uint i = 0; i < entities.size(); i++ ) + { + // Make the client refresh the icons on mission giver NPCs, at once + CCharacter *character = PlayerManager.getChar(entities[i]); + if (character) + character->sendEventForMissionAvailabilityCheck(); + } + } }; uint32 _Faction; sint32 _Value; + bool _Guild; MISSION_ACTION_GETNEWPTR(CMissionActionRecvFame) }; @@ -3695,15 +4053,16 @@ protected: TAIAlias Mission; TAIAlias NPCOwner; // NPC giver the mission have to be attached at spawn time + bool Guild; protected: bool buildAction ( uint32 line, const std::vector< std::string > & script, CMissionGlobalParsingData & globalData, CMissionSpecificParsingData & missionData) { _SourceLine = line; - if ( script.size() != 3 ) + if ( script.size() != 3 && script.size() != 4) { - MISLOGSYNTAXERROR(" : "); + MISLOGSYNTAXERROR(" : [: guild]"); return false; } string name = CMissionParser::getNoBlankString( script[1] ); @@ -3736,6 +4095,17 @@ protected: if (vRet.size() > 0) NPCOwner = vRet[0]; + // We check for the guild option + Guild = false; + for (std::vector< std::string >::const_iterator it = script.begin(); it != script.end(); ++it) + { + if (CMissionParser::getNoBlankString(*it) == "guild") + { + Guild = true; + break; + } + } + return true; } @@ -3746,13 +4116,13 @@ protected: { CAIAliasTranslator::getInstance()->getNPCNameFromAlias(instance->getGiver(), sDebugBotName); nlassert(instance); - CMissionEventAddMission * event = new CMissionEventAddMission( instance->getGiver(), Mission, mainMission ); + CMissionEventAddMission * event = new CMissionEventAddMission( instance->getGiver(), Mission, mainMission, Guild ); eventList.push_back( event ); } else { CAIAliasTranslator::getInstance()->getNPCNameFromAlias(NPCOwner, sDebugBotName); - CMissionEventAddMission * event = new CMissionEventAddMission( NPCOwner, Mission, mainMission ); + CMissionEventAddMission * event = new CMissionEventAddMission( NPCOwner, Mission, mainMission, Guild ); eventList.push_back( event ); } LOGMISSIONACTION("spawn_mission bot:" + sDebugBotName + " newmiss:" + CPrimitivesParser::aliasToString(Mission) diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h b/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h index d2c879799..34ff36600 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h @@ -429,11 +429,12 @@ protected: class CMissionEventAddMission: public CMissionEvent { public: - CMissionEventAddMission( TAIAlias giver, TAIAlias mission, TAIAlias mainMission ) - :CMissionEvent(AddMission, TDataSetRow()) ,Giver(giver),Mission(mission),MainMission(mainMission) {} + CMissionEventAddMission( TAIAlias giver, TAIAlias mission, TAIAlias mainMission, bool guild ) + :CMissionEvent(AddMission, TDataSetRow()) ,Giver(giver),Mission(mission),MainMission(mainMission), Guild(guild) {} TAIAlias Mission; TAIAlias Giver; TAIAlias MainMission; + bool Guild; protected: friend class CMissionEvent; bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log){return false;} diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.cpp index d3bb2c106..63b74e997 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.cpp @@ -25,18 +25,83 @@ #include "player_manager/player.h" #include "player_manager/character.h" +using namespace std; +using namespace NLMISC; + NL_INSTANCE_COUNTER_IMPL(CMissionGuild); //---------------------------------------------------------------------------- void CMissionGuild::updateUsersJournalEntry() { - /// todo guild mission + CGuild * guild = CGuildManager::getInstance()->getGuildFromId( _GuildId ); + if (!guild) + { + nlwarning( "cant find guild ID : %d", _GuildId ); + return; + } + + for ( std::map::iterator it = guild->getMembersBegin(); + it != guild->getMembersEnd();++it ) + { + CCharacter * user = PlayerManager.getChar( it->first ); + if ( !user ) + { + nlwarning( "cant find user %s", it->first.toString().c_str() ); + continue; + } + updateUserJournalEntry(*user,"GROUP:"); + } } //---------------------------------------------------------------------------- void CMissionGuild::clearUsersJournalEntry() { - /// todo guild mission + CGuild * guild = CGuildManager::getInstance()->getGuildFromId( _GuildId ); + if (!guild) + { + nlwarning( "cant find guild ID : %d", _GuildId ); + return; + } + + for ( std::map::iterator it = guild->getMembersBegin(); + it != guild->getMembersEnd();++it ) + { + CCharacter * user = PlayerManager.getChar( it->first ); + if ( !user ) + { + nlwarning( "cant find user %s", it->first.toString().c_str() ); + continue; + } + + CBankAccessor_PLR::TGROUP::TMISSIONS::TArray &missionItem = CBankAccessor_PLR::getGROUP().getMISSIONS().getArray(_ClientIndex); + // user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:TYPE",_ClientIndex), 0); + missionItem.setTYPE(user->_PropertyDatabase, 0); + // user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:ICON",_ClientIndex), 0); + missionItem.setICON(user->_PropertyDatabase, CSheetId::Unknown); + // user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:TITLE",_ClientIndex), 0); + missionItem.setTITLE(user->_PropertyDatabase, 0); + // user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:DETAIL_TEXT",_ClientIndex), 0); + missionItem.setDETAIL_TEXT(user->_PropertyDatabase, 0); + // user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:END_DATE",_ClientIndex), 0 ); + missionItem.setEND_DATE(user->_PropertyDatabase, 0); + // user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:BEGIN_DATE",_ClientIndex), 0 ); + missionItem.setBEGIN_DATE(user->_PropertyDatabase, 0); + for (uint i = 0; i < NB_JOURNAL_COORDS; i++) + { + CBankAccessor_PLR::TGROUP::TMISSIONS::TArray::TTARGET &targetItem = missionItem.getTARGET(i); + // user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:TARGET%u:TITLE",_ClientIndex,i), 0); + targetItem.setTITLE(user->_PropertyDatabase, 0); + // user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:TARGET%u:X",_ClientIndex,i), 0); + targetItem.setX(user->_PropertyDatabase, 0); + // user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:TARGET%u:Y",_ClientIndex,i), 0); + targetItem.setY(user->_PropertyDatabase, 0); + } + for (uint i = 0; i < NB_STEP_PER_MISSION; i++) + { + // user->_PropertyDatabase.setProp( NLMISC::toString( "GROUP:MISSIONS:%u:GOALS:%u:TEXT",_ClientIndex,i), 0); + missionItem.getGOALS().getArray(i).setTEXT(user->_PropertyDatabase, 0); + } + } } diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.h b/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.h index e0c65f2c2..b8635d1d4 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.h +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_guild.h @@ -32,6 +32,7 @@ public: CMissionGuild() : _Chained(false) { } + inline void setGuild( uint32 guildId ); /// override void updateUsersJournalEntry(); /// override @@ -58,6 +59,10 @@ private: bool _Chained; }; +void CMissionGuild::setGuild( uint32 guildId ) +{ + _GuildId = guildId; +} #endif // RY_MISSION_GUILD_H diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_manager.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_manager.cpp index b0bd41ffb..ca5d4bba0 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_manager.cpp @@ -44,6 +44,7 @@ #include "egs_utils.h" #include "egs_pd.h" #include "guild_manager/guild_member_module.h" +#include "guild_manager/guild_manager.h" #include "building_manager/building_manager.h" #include "building_manager/room_instance.h" #include "zone_manager.h" @@ -836,25 +837,68 @@ void CMissionManager::instanciateMission(CCharacter* user,TAIAlias alias, TAIAl } else if ( templ->Type == MISSION_DESC::Guild ) { - /// todo guild mission + /// Check to see if we can pick the mission CGuildMemberModule * module; if ( !user->getModuleParent().getModule( module ) ) { MISDBG("%s user not in a guild", sDebugPrefix.c_str()); return; } - inst = module->pickMission( templ->Alias ); - if (!inst) + /* /// This is already checked in the prerequisites + if (!module->pickMission( templ->Alias )) + { + /// Todo : error message for the member return; - /// todo guild mission : see solo - /* - todo guild mission : implement that in module - teamMission->initBasics( giver ); - soloMission->setTeam( user->getTeamId() ); + }*/ + + CGuild * guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() ); + if (!guild) + { + nlwarning( "cant find guild ID : %d", user->getGuildId() ); + return; + } + if ( !templ->Tags.NoList && guild->getMissions().size() >= MaxGuildMissionCount) + { + CCharacter::sendDynamicSystemMessage(user->getId(), "MISSION_MAX_GUILD_REACHED" ); + return; + } + + CMissionGuild * guildMission = EGS_PD_CAST( EGSPD::CMissionGuildPD::create( templ->Alias ) ); + if ( !guildMission ) + { + MISDBG("%s could not create guild mission", sDebugPrefix.c_str()); + return; + } + guildMission->onCreation( giver ); + guildMission->setGuild(user->getGuildId()); + + // Find a suitable client index (for non-invisible missions) + if ( templ->Tags.NoList == false ) + { + uint8 idx = 0; + for ( uint i = MaxGroupMissionCount; i < MaxGroupMissionCount + MaxGuildMissionCount; i++ ) + { + if ( ! CBankAccessor_PLR::getGROUP().getMISSIONS().getArray(i).getTITLE(user->_PropertyDatabase)) + { + idx = i; + break; + } + } + guildMission->setClientIndex( idx ); + } + + // Add mission + guild->addMission( guildMission ); + inst = guildMission; + + /// /!\ Do the same thing that the team missions but with the loop: for ( uint i = MaxGroupMissionCount; i < MaxGroupMissionCount + MaxGuildMissionCount; i++ ) + /// Instead of for ( uint i = 0; i < MaxGroupMissionCount; i++ ), so that we use available space for guild missions + + /*//teamMission->initBasics( giver ); + //soloMission->setTeam( user->getTeamId() ); CGuild * guild = user->getGuild(); if ( guild ) { - mission->getguild if ( guild->getMissions().size() >= MaxGuildMissionCount) { CCharacter::sendDynamicSystemMessage(user->getId(), "MISSION_MAX_GUILD_REACHED" ); @@ -880,8 +924,7 @@ void CMissionManager::instanciateMission(CCharacter* user,TAIAlias alias, TAIAl else { - } - */ + }*/ } else { diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp index ff8496eba..03ad33b28 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_misc.cpp @@ -1141,7 +1141,13 @@ MISSION_REGISTER_STEP(CMissionStepCast,"cast") // ---------------------------------------------------------------------------- class CMissionStepDoMissions : public IMissionStepTemplate { - std::vector< std::string > _Missions; + struct MissionNb + { + std::string Mission; + uint32 NbNeedCompletion; + }; + + std::vector< MissionNb > _Missions; virtual bool buildStep( uint32 line, const std::vector< std::string > & script, CMissionGlobalParsingData & globalData, CMissionSpecificParsingData & missionData ) { @@ -1158,7 +1164,23 @@ class CMissionStepDoMissions : public IMissionStepTemplate _Missions.resize(subs.size()); for ( uint i = 0; i < subs.size(); i++ ) { - _Missions[i] = CMissionParser::getNoBlankString( subs[i] ); + std::vector< std::string > params; + //NLMISC::splitString( subs[i]," \t", params ); + subs[i] = CMissionParser::getNoBlankString(subs[i]); + std::size_t pos = subs[i].find_first_of(" \t"); + std::string str = subs[i].substr(0, pos); + params.push_back(str); + if (pos != std::string::npos) + str = subs[i].substr(pos + 1); + else + str = ""; + params.push_back(str); + //std::size_t pos = _Missions[i].find_first_of(" \t"); + _Missions[i].Mission = CMissionParser::getNoBlankString( params[0] ); + if (params.size() > 1) + NLMISC::fromString(params[1], _Missions[i].NbNeedCompletion); + else + _Missions[i].NbNeedCompletion = 1; } return true; } @@ -1168,7 +1190,7 @@ class CMissionStepDoMissions : public IMissionStepTemplate if ( event.Type == CMissionEvent::MissionDone ) { CMissionEventMissionDone & eventSpe = (CMissionEventMissionDone&)event; - TAIAlias alias = CAIAliasTranslator::getInstance()->getMissionUniqueIdFromName( _Missions[subStepIndex] ); + TAIAlias alias = CAIAliasTranslator::getInstance()->getMissionUniqueIdFromName( _Missions[subStepIndex].Mission ); if ( eventSpe.Mission == alias ) { LOGMISSIONSTEPSUCCESS("mission"); @@ -1181,11 +1203,36 @@ class CMissionStepDoMissions : public IMissionStepTemplate void getInitState( std::vector& ret ) { ret.resize( _Missions.size(), 1 ); + uint32 i = 0; + for (std::vector::const_iterator it = _Missions.begin(); it != _Missions.end(); ++it) + { + ret[i] = it->NbNeedCompletion; + i++; + } } virtual void getTextParams( uint & nbSubSteps,const std::string* & textPtr,TVectorParamCheck& retParams, const std::vector& subStepStates) { - static const std::string stepText = "ERROR_UNSPECIFIED_MISSION_TEXT"; + /*static const std::string stepText = "ERROR_UNSPECIFIED_MISSION_TEXT"; + textPtr = &stepText;*/ + + // Because we can specify the number of times we want a mission to be completed, we specify the parameters + static const std::string stepText = "MIS_DO_MISSION_"; + nlassert( _Missions.size() == subStepStates.size() ); + for ( uint i = 0; i < subStepStates.size(); i++ ) + { + if( subStepStates[i] != 0 ) + { + nbSubSteps++; + retParams.push_back(STRING_MANAGER::TParam()); + retParams.back().Type = STRING_MANAGER::integer; + retParams.back().Int = subStepStates[i]; + + retParams.push_back(STRING_MANAGER::TParam()); + retParams.back().Type = STRING_MANAGER::literal; + retParams.back().Literal = _Missions[i].Mission; + } + } textPtr = &stepText; } bool checkTextConsistency() diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_template.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_template.cpp index dfd516b45..af0686f1e 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_template.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_template.cpp @@ -1307,21 +1307,57 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos else if ( Type == MISSION_DESC::Guild ) { /// todo guild mission - /* - CGuild * guild = user->getGuild(); + + CGuild * guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() ); if ( guild == NULL ) { MISDBG("No guild"); return MISSION_DESC::PreReqFail; + + /*if (logOnFail) + MISDBG("%s No guild", sDebugPrefix.c_str()); + + if (!fillPrereqInfos) + return MISSION_DESC::PreReqFail; + + prereqDesc.Description = STRING_MANAGER::sendStringToClient(user->getEntityRowId(), "MISSION_PREREQ_TEAM", TVectorParamCheck()); + prereqDesc.IsMandatory = true; + prereqDesc.Validated = false; + prereqInfos.Prerequisits.push_back(prereqDesc); + + addedPrereqTexts.insert("MISSION_PREREQ_TEAM"); + + returnValue = MISSION_DESC::PreReqFail; + logOnFail = false;*/ } // check if the mission is already picked for ( uint j = 0 ; j < guild->getMissions().size(); j++ ) { - if ( guild->getMissions()[j]->getTemplate()->Alias == alias ) + if ( guild->getMissions()[j]->getTemplateId() == alias || + guild->getMissions()[j]->getMainMissionTemplateId() == alias) { MISDBG("The guild already own this mission"); return MISSION_DESC::PreReqFail; + + /*if (logOnFail) + MISDBG("%s The guild already own this mission", sDebugPrefix.c_str()); + + if (!fillPrereqInfos) + return MISSION_DESC::PreReqFail; + + if (addedPrereqTexts.find("MISSION_PREREQ_ALREADY_DONE") == addedPrereqTexts.end()) + { + prereqDesc.Description = STRING_MANAGER::sendStringToClient(user->getEntityRowId(), "MISSION_PREREQ_ALREADY_DONE", TVectorParamCheck()); + prereqDesc.IsMandatory = true; + prereqDesc.Validated = false; + prereqInfos.Prerequisits.push_back(prereqDesc); + addedPrereqTexts.insert("MISSION_PREREQ_ALREADY_DONE"); + } + + returnValue = MISSION_DESC::PreReqFail; + logOnFail = false;*/ } + } // check non replayable missions if( !Tags.Replayable ) @@ -1329,11 +1365,29 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos if (guild->isMissionSuccessfull(alias)) // if ( std::find(guild->getSuccessfulMissions().begin(),guild->getSuccessfulMissions().end(), alias) != guild->getSuccessfulMissions().end() ) { - MISDBG("solo non replayable"); + MISDBG("mission non replayable"); return MISSION_DESC::PreReqFail; + + /*if (logOnFail) + MISDBG("%s Guild mission already done and not replayable", sDebugPrefix.c_str()); + + if (!fillPrereqInfos) + return MISSION_DESC::PreReqFailAlreadyDone; + + if (addedPrereqTexts.find("MISSION_PREREQ_ALREADY_DONE") == addedPrereqTexts.end()) + { + prereqDesc.Description = STRING_MANAGER::sendStringToClient(user->getEntityRowId(), "MISSION_PREREQ_ALREADY_DONE", TVectorParamCheck()); + prereqDesc.IsMandatory = true; + prereqDesc.Validated = false; + prereqInfos.Prerequisits.push_back(prereqDesc); + addedPrereqTexts.insert("MISSION_PREREQ_ALREADY_DONE"); + } + + returnValue = MISSION_DESC::PreReqFailAlreadyDone; + logOnFail = false;*/ } } - */ + } else { @@ -1412,7 +1466,7 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos if ( templ->Type == MISSION_DESC::Guild ) { /// todo guild mission - /* + CGuild* guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() ); if ( ! guild ) { MISDBG("Require needed mission at line %u (guild mission but player has no guild)", Prerequisits.NeededMissions[i].Line); @@ -1420,7 +1474,7 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos } if (guild->isMissionSuccessfull(templ->Alias)) break; - */ + } else if ( templ->Type == MISSION_DESC::Solo ) { @@ -1473,15 +1527,14 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos else if ( templ->Type == MISSION_DESC::Guild ) { /// todo guild mission - /* + CGuild* guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() ); if ( !guild ) break; if (!guild->isMissionSuccessfull(templ->Alias)) - - if (!guild || !guild->isMissionSuccessfull(templ->Alias)) - break; - */ + /*if (!guild || !guild->isMissionSuccessfull(templ->Alias)) + break;*/ + } else if ( templ->Type == MISSION_DESC::Solo ) { @@ -1537,8 +1590,8 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos { /// todo guild mission - /* - + + CGuild* guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() ); if ( !guild ) { MISDBG("Require running mission at line %u (guild mission but player has no guild)", Prerequisits.RunningMissions[i].Line ); @@ -1548,12 +1601,12 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos for ( ; k < guild->getMissions().size(); k++ ) { - if ( guild->getMissions()[k]->getTemplate()->Alias == templ->Alias ) + if ( guild->getMissions()[k]->getTemplateId() == templ->Alias ) break; } if (k != guild->getMissions().size()) break; - */ + } else if ( templ->Type == MISSION_DESC::Solo ) { @@ -1651,20 +1704,20 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos { /// todo guild mission - /* - + + CGuild* guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() ); if(!guild) break; uint k=0; for ( ; k < guild->getMissions().size(); k++ ) { - if ( guild->getMissions()[k]->getTemplate()->Alias == templ->Alias ) + if ( guild->getMissions()[k]->getTemplateId() == templ->Alias ) break; } if (k == guild->getMissions().size()) break; - */ + } else if ( templ->Type == MISSION_DESC::Solo ) { @@ -2041,6 +2094,15 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos if (!fillPrereqInfos) return MISSION_DESC::PreReqFail; + /*if (addedPrereqTexts.find("GUILD_BUILDING_BAD_GRADE") == addedPrereqTexts.end()) + { + prereqDesc.Description = STRING_MANAGER::sendStringToClient(user->getEntityRowId(), "GUILD_BUILDING_BAD_GRADE", TVectorParamCheck()); + prereqDesc.IsMandatory = true; + prereqDesc.Validated = false; + prereqInfos.Prerequisits.push_back(prereqDesc); + addedPrereqTexts.insert("GUILD_BUILDING_BAD_GRADE"); + }*/ + returnValue = MISSION_DESC::PreReqFail; logOnFail = false; } diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp index 78229d3a8..a5f0f863f 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/missions_commands.cpp @@ -30,7 +30,9 @@ #include "team_manager/team_manager.h" #include "mission_manager/mission_team.h" #include "mission_manager/mission_step_ai.h" +#include "mission_manager/mission_guild.h" #include "guild_manager/guild_manager.h" +#include "guild_manager/guild.h" #include "admin.h" #include "creature_manager/creature_manager.h" @@ -81,10 +83,18 @@ NLMISC_COMMAND(forceJournalUpdate,"force mission journal update","getMissions()[i]->updateUsersJournalEntry(); } } - for (uint i = 0; i < MaxGuildMissionCount; i++) + CGuild * guild = CGuildManager::getInstance()->getGuildFromId( user->getGuildId() ); + if (guild) + { + for ( uint i = 0; i < guild->getMissions().size(); i++ ) + { + guild->getMissions()[i]->updateUsersJournalEntry(); + } + } + /*for (uint i = 0; i < MaxGuildMissionCount; i++) { /// todo guild mission - } + }*/ return true; } // missionProgress // diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp index 9af9606ea..70c8238ac 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -1344,6 +1344,22 @@ uint32 CCharacter::tickUpdate() } } + // Adding UpdateCompass for guild missions + { + H_AUTO(CharacterUpdateGuildCompass); + CGuild * guild = CGuildManager::getInstance()->getGuildFromId( _GuildId ); + if ( guild ) + { + const uint size = (uint)guild->getMissions().size(); + for ( uint i = 0; i < size; i++ ) + { + nlassert(guild->getMissions()[i]); + guild->getMissions()[i]->updateCompass(*this, string("")); + guild->getMissions()[i]->updateCompass(*this, string("GROUP:")); + } + } + } + { H_AUTO(CharacterUpdateTargetCoordinatesCompass); // update compass coordinates information @@ -10709,6 +10725,7 @@ void CCharacter::acceptExchange(uint8 exchangeId) } CTeam * team = TeamManager.getRealTeam( _TeamId ); + CGuild* guild = CGuildManager::getInstance()->getGuildFromId( _GuildId ); if (_BotGift == NULL) { nlwarning("Player %s has no bot gift", _Id.toString().c_str()); @@ -10732,6 +10749,15 @@ void CCharacter::acceptExchange(uint8 exchangeId) } mission = team->getMissionByAlias( missionAlias ); } + else if (type == MISSION_DESC::Guild) + { + if (guild == NULL) + { + nlwarning("CCharacter::acceptExchange : character %s -> no guild",_Id.toString().c_str() ); + return; + } + mission = guild->getMissionByAlias( missionAlias ); + } vector vect; vector exchangePlayerPets; @@ -10765,6 +10791,8 @@ void CCharacter::acceptExchange(uint8 exchangeId) processMissionStepUserEvent( eventList,missionAlias,stepIndex ); else if ( type == MISSION_DESC::Group ) team->processTeamMissionStepEvent( eventList,missionAlias,stepIndex ); + else if ( type == MISSION_DESC::Guild ) + guild->processGuildMissionStepEvent( eventList,missionAlias,stepIndex ); eventList.pop_front(); for ( std::list< CMissionEvent* >::iterator it = eventList.begin(); it != eventList.end(); ++it ) processMissionEvent(*(*it)); @@ -10784,6 +10812,8 @@ void CCharacter::acceptExchange(uint8 exchangeId) processMissionStepUserEvent( eventList,missionAlias,stepIndex ); else if ( type == MISSION_DESC::Group ) team->processTeamMissionStepEvent( eventList,missionAlias,stepIndex ); + else if ( type == MISSION_DESC::Guild ) + guild->processGuildMissionStepEvent( eventList,missionAlias,stepIndex ); eventList.pop_front(); for ( std::list< CMissionEvent* >::iterator it = eventList.begin(); it != eventList.end(); ++it ) processMissionEvent(*(*it)); @@ -11616,7 +11646,7 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis bool processed = false; bool firstEvent = true; - CGuild * guild = NULL; + CGuild * guild = CGuildManager::getInstance()->getGuildFromId( _GuildId ); while ( !eventList.empty() ) { bool eventProcessed = false; @@ -11628,11 +11658,33 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis TAIAlias mission = eventSpe.Mission; TAIAlias giver = eventSpe.Giver; TAIAlias mainMission = eventSpe.MainMission; + bool missionForGuild = eventSpe.Guild; // add mission event are always allocated on heap delete ( CMissionEvent *) ( eventList.front() ); eventList.pop_front(); - CMissionManager::getInstance()->instanciateMission(this, mission, giver ,eventList, mainMission); + + // If the mission is not for guild members we just instanciate it + if (!missionForGuild) + CMissionManager::getInstance()->instanciateMission(this, mission, giver ,eventList, mainMission); + else + { + // We find the guild and each guild members and we instanciate the mission for them + if (guild) + { + for ( std::map::iterator it = guild->getMembersBegin(); + it != guild->getMembersEnd();++it ) + { + CCharacter * guildUser = PlayerManager.getChar( it->first ); + if ( !guildUser ) + { + nlwarning( "cant find user %s", it->first.toString().c_str() ); + continue; + } + CMissionManager::getInstance()->instanciateMission(guildUser, mission, giver ,eventList, mainMission); + } + } + } } // event may have been processed during instanciateMission if ( eventList.empty() ) @@ -11653,6 +11705,13 @@ bool CCharacter::processMissionEventList( std::list< CMissionEvent* > & eventLis eventProcessed = team->processTeamMissionEvent(eventList, alias); } + // THIRD - Check with guild missions (if event not already processed and char belongs to a guild) + if (!eventProcessed)// && (event.Restriction != CMissionEvent::NoGroup)) + { + if (guild != NULL) + eventProcessed = guild->processGuildMissionEvent(eventList, alias); + } + processed |= eventProcessed; // the first event of the list was processed, so we remove it. diff --git a/code/ryzom/tools/build_gamedata/workspace/common/characters_maps_hr/panoply_generique.cfg b/code/ryzom/tools/build_gamedata/workspace/common/characters_maps_hr/panoply_generique.cfg new file mode 100644 index 000000000..41bd8a2ef --- /dev/null +++ b/code/ryzom/tools/build_gamedata/workspace/common/characters_maps_hr/panoply_generique.cfg @@ -0,0 +1,7 @@ + +// the extension for the masks of the texture +// If "mask1" is a extension, and that there's a bitmap name "tex_mask1", it is a "mask1" mask for tex +// Each mask has its own set of colors +mask_extensions = { "skin" , "user" }; + +///////////////////////////////////////////// diff --git a/code/ryzom/tools/build_gamedata/workspace/common/exedll/directories.py b/code/ryzom/tools/build_gamedata/workspace/common/exedll/directories.py index 967111b05..dddf60ec8 100644 --- a/code/ryzom/tools/build_gamedata/workspace/common/exedll/directories.py +++ b/code/ryzom/tools/build_gamedata/workspace/common/exedll/directories.py @@ -76,6 +76,7 @@ CopyWindowsExeDllCfgSourceFiles += [ "nel_drv_opengl_win_r.dll" ] CopyWindowsExeDllCfgSourceFiles += [ "nel_drv_xaudio2_win_r.dll" ] CopyWindowsExeDllCfgSourceFiles += [ "client_ryzom_r.exe" ] +CopyWindowsExeDllCfgSourceFiles += [ "ryzom_client_r.exe" ] # i blame sfb CopyWindowsExeDllCfgSourceFiles += [ "ryzom_configuration_r.exe" ] diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/images/georges_logo.icns.orig b/code/ryzom/tools/leveldesign/georges_editor_qt/src/images/georges_logo.icns.orig deleted file mode 100644 index 1417688db..000000000 Binary files a/code/ryzom/tools/leveldesign/georges_editor_qt/src/images/georges_logo.icns.orig and /dev/null differ diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/images/georges_logo.png.orig b/code/ryzom/tools/leveldesign/georges_editor_qt/src/images/georges_logo.png.orig deleted file mode 100644 index 292941342..000000000 Binary files a/code/ryzom/tools/leveldesign/georges_editor_qt/src/images/georges_logo.png.orig and /dev/null differ diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h index 756b3859d..6f993679b 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.h @@ -318,6 +318,11 @@ public: bool isThereAJumpTo(const std::string &stepName); + bool isGuildMission() const + { + return _Guild; + } + private: std::string genPreRequisites(); diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/step.h b/code/ryzom/tools/leveldesign/mission_compiler_lib/step.h index e93db4524..fdb1db4be 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/step.h +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/step.h @@ -192,6 +192,11 @@ protected: std::vector _RoleplayObj; CPhrase _RoleplayPhrase; bool _HideObj; + + // Option nb_guild_members_needed, available for each objective + /*int _NbGuildMembersNeeded; + + std::string genNbGuildMembersNeededOption(CMissionData &md);*/ public: void init(CMissionData &md, NLLIGO::IPrimitive *prim); diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp index c0d78ab74..f327f836a 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp @@ -142,6 +142,7 @@ REGISTER_STEP_CONTENT(CActionJumpTo, "jump_to"); class CActionRecvMoney : public IStepContent { string _Amount; + bool _Guild; void getPredefParam(uint32 &numEntry, CPhrase::TPredefParams &predef) { @@ -152,12 +153,27 @@ public: { IStepContent::init(md, prim); _Amount = md.getProperty(prim, "amount", true, false); + + _Guild = md.getProperty(prim, "guild", false, true) == "true"; + // Check: if _Guild is true then check if we are in a guild mission + if (_Guild && !md.isGuildMission()) + { + string err = toString("primitive(%s): 'guild' option true 1 for non guild mission.", prim->getName().c_str()); + throw EParseException(prim, err.c_str()); + } } string genCode(CMissionData &md) { if (!_Amount.empty()) - return "recv_money : "+_Amount+NL; + { + string ret; + ret = "recv_money : "+_Amount; + if (_Guild) + ret += ": guild"; + ret += NL; + return ret; + } else return string(); } @@ -166,12 +182,79 @@ public: REGISTER_STEP_CONTENT(CActionRecvMoney, "recv_money"); +// --------------------------------------------------------------------------- +class CActionRecvChargePoint : public IStepContent +{ + string _Amount; + + void getPredefParam(uint32 &numEntry, CPhrase::TPredefParams &predef) + { + numEntry = 0; + } +public: + void init(CMissionData &md, IPrimitive *prim) + { + IStepContent::init(md, prim); + _Amount = md.getProperty(prim, "charge_points", true, false); + } + + string genCode(CMissionData &md) + { + if (!_Amount.empty()) + { + string ret; + ret = "recv_charge_point : "+_Amount; + ret += NL; + return ret; + } + else + return string(); + } + +}; +REGISTER_STEP_CONTENT(CActionRecvChargePoint, "recv_charge_point"); + + +// --------------------------------------------------------------------------- +class CActionGiveOutpostControl : public IStepContent +{ + string _OutpostName; + + void getPredefParam(uint32 &numEntry, CPhrase::TPredefParams &predef) + { + numEntry = 0; + } +public: + void init(CMissionData &md, IPrimitive *prim) + { + IStepContent::init(md, prim); + _OutpostName = md.getProperty(prim, "outpost_name", true, false); + } + + string genCode(CMissionData &md) + { + if (!_OutpostName.empty()) + { + string ret; + ret = "give_control : "+_OutpostName; + ret += NL; + return ret; + } + else + return string(); + } + +}; +REGISTER_STEP_CONTENT(CActionGiveOutpostControl, "give_control"); + + // --------------------------------------------------------------------------- class CActionSpawnMission : public IStepContent { protected: string _MissionName; string _GiverName; + bool _Guild; private: void getPredefParam(uint32 &numEntry, CPhrase::TPredefParams &predef) { @@ -186,17 +269,29 @@ public: if (_GiverName.empty()) { throw EParseException(prim, "giver_name is empty !"); - } + } + + _Guild = md.getProperty(prim, "guild", false, true) == "true"; + // Check: if _Guild is true then check if we are in a guild mission + if (_Guild && !md.isGuildMission()) + { + string err = toString("primitive(%s): 'guild' option true 1 for non guild mission.", prim->getName().c_str()); + throw EParseException(prim, err.c_str()); + } } string genCode(CMissionData &md) { + string ret = ""; if (!_MissionName.empty()) - return "spawn_mission : " + _MissionName + " : " + _GiverName + NL; - else - return string(); + { + ret = "spawn_mission : " + _MissionName + " : " + _GiverName; + if (_Guild) + ret += " : guild"; + ret += NL; + } + return ret; } - }; REGISTER_STEP_CONTENT(CActionSpawnMission, "spawn_mission"); @@ -590,6 +685,7 @@ class CActionRecvFame : public IStepContent { string _Faction; string _Fame; + bool _Guild; void getPredefParam(uint32 &numEntry, CPhrase::TPredefParams &predef) { @@ -602,12 +698,27 @@ public: _Faction = md.getProperty(prim, "faction", true, false); _Fame = md.getProperty(prim, "value", true, false); + + _Guild = md.getProperty(prim, "guild", false, true) == "true"; + // Check: if _Guild is true then check if we are in a guild mission + if (_Guild && !md.isGuildMission()) + { + string err = toString("primitive(%s): 'guild' option true 1 for non guild mission.", prim->getName().c_str()); + throw EParseException(prim, err.c_str()); + } } string genCode(CMissionData &md) { if (!_Faction.empty() && !_Fame.empty()) - return string("recv_fame : ")+_Faction+" "+_Fame+NL; + { + string ret; + ret = "recv_fame : "+_Faction+" "+_Fame; + if (_Guild) + ret += ": guild"; + ret += NL; + return ret; + } else return string(); } @@ -628,6 +739,7 @@ class CActionRecvItem : public IStepContent vector _Items; bool _QualSpec; bool _Group; + bool _Guild; void getPredefParam(uint32 &numEntry, CPhrase::TPredefParams &predef) { @@ -675,6 +787,13 @@ public: s = md.getProperty(prim, "group", true, false); _Group = (NLMISC::toLower(s) == "true"); + _Guild = md.getProperty(prim, "guild", false, true) == "true"; + // Check: if _Guild is true then check if we are in a guild mission + if (_Guild && !md.isGuildMission()) + { + string err = toString("primitive(%s): 'guild' option true 1 for non guild mission.", prim->getName().c_str()); + throw EParseException(prim, err.c_str()); + } IStepContent::init(md, prim); } @@ -693,6 +812,8 @@ public: ret += " : "+_BotGiver; if (_Group) ret += " : group"; + if (_Guild) + ret += ": guild"; ret += NL; } @@ -707,6 +828,7 @@ class CActionRecvNamedItem : public IStepContent { vector _Items; bool _Group; + bool _Guild; void getPredefParam(uint32 &numEntry, CPhrase::TPredefParams &predef) { @@ -743,6 +865,14 @@ public: s = md.getProperty(prim, "group", true, false); _Group = (NLMISC::toLower(s) == "true"); + _Guild = md.getProperty(prim, "guild", false, true) == "true"; + // Check: if _Guild is true then check if we are in a guild mission + if (_Guild && !md.isGuildMission()) + { + string err = toString("primitive(%s): 'guild' option true 1 for non guild mission.", prim->getName().c_str()); + throw EParseException(prim, err.c_str()); + } + IStepContent::init(md, prim); } @@ -756,6 +886,8 @@ public: ret += "recv_named_item : "+item.ItemName+" "+item.ItemQuant; if (_Group) ret += " : group"; + if (_Guild) + ret += ": guild"; ret += NL; } @@ -777,6 +909,7 @@ class CActionDestroyItem : public IStepContent string _BotDestroyer; vector _Items; + bool _Guild; void getPredefParam(uint32 &numEntry, CPhrase::TPredefParams &predef) { @@ -821,6 +954,14 @@ public: _Items.push_back(item); } } + + _Guild = md.getProperty(prim, "guild", false, true) == "true"; + // Check: if _Guild is true then check if we are in a guild mission + if (_Guild && !md.isGuildMission()) + { + string err = toString("primitive(%s): 'guild' option true 1 for non guild mission.", prim->getName().c_str()); + throw EParseException(prim, err.c_str()); + } IStepContent::init(md, prim); } @@ -839,6 +980,8 @@ public: ret +=" "+item.Desc.ItemQual; if (!_BotDestroyer.empty()) ret += " : "+_BotDestroyer; + if (_Guild) + ret += ": guild"; ret += NL; } @@ -1630,6 +1773,20 @@ void CContentObjective::init(CMissionData &md, IPrimitive *prim) _OverloadPhrase.initPhrase(md, prim, _OverloadObj, numEntry, params); // init the roleplay phrase _RoleplayPhrase.initPhrase(md, prim, _RoleplayObj, numEntry, params); + + // check for the 'nb_guild_members_needed' option and see if it's correct for this mission + /*string nbGuildMembersNeeded = md.getProperty(prim, "nb_guild_members_needed", false, true); + if (nbGuildMembersNeeded.empty()) + nbGuildMembersNeeded = "1"; + if (!fromString(nbGuildMembersNeeded.c_str(), _NbGuildMembersNeeded)) + _NbGuildMembersNeeded = 1; + + // Check: + if (!md.isGuildMission() && _NbGuildMembersNeeded != 1) + { + string err = toString("primitive(%s): nb_guild_members_needed != 1 for non guild mission.", prim->getName().c_str()); + throw EParseException(prim, err.c_str()); + }*/ } // --------------------------------------------------------------------------- @@ -1649,6 +1806,20 @@ string CContentObjective::genCode(CMissionData &md) return ret; } +// --------------------------------------------------------------------------- +/*std::string CContentObjective::genNbGuildMembersNeededOption(CMissionData &md) +{ + string ret = ""; + // If we are in a guild mission we add the 'nb_guild_members_needed' option to the script + if (md.isGuildMission()) + { + ret = ": nb_guild_members_needed "; + ret += toString(_NbGuildMembersNeeded); + } + + return ret; +}*/ + // --------------------------------------------------------------------------- string CContentObjective::genPhrase() { @@ -1949,6 +2120,9 @@ public: if (!_Place.empty()) ret += " : "+_Place; + + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2004,6 +2178,8 @@ public: if (!_Phrase.isEmpty()) ret += " : "+_Phrase.genScript(md); + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2078,6 +2254,8 @@ public: { ret += ": "+_Place; } + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2151,6 +2329,8 @@ public: if (i < _Mps.size()-1) ret += "; "; } + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2276,6 +2456,8 @@ public: if (i < _Items.size()-1) ret += "; "; } + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2349,6 +2531,8 @@ public: if (i < _Items.size()-1) ret += "; "; } + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2479,7 +2663,8 @@ public: if (!_Place.empty()) ret += " : " + _Place; - + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2564,6 +2749,8 @@ public: { ret += " : "+_Npc; } + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2645,6 +2832,8 @@ public: { ret += " : "+_Npc; } + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2755,7 +2944,10 @@ public: if (i < _Items.size()-1) ret += "; "; }; - ret += " : "+_Npc +NL; + ret += " : "+_Npc; + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); + ret += NL; return ret; } @@ -2790,7 +2982,10 @@ public: string ret; ret = CContentObjective::genCode(md); - ret += "give_money : "+_Amount+" : "+_Npc+NL; + ret += "give_money : "+_Amount+" : "+_Npc; + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); + ret += NL; return ret; } @@ -2841,7 +3036,8 @@ public: ret += "; "; } } - + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2877,7 +3073,8 @@ public: if (_SaveAll) ret += " : save_all"; - + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2950,7 +3147,8 @@ public: if (i < _Skills.size()-1) ret += "; "; } - + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -2968,9 +3166,12 @@ class CContentMission: public CContentObjective } public: + CContentMission(): _Prim(0) {} + void init(CMissionData &md, IPrimitive *prim) { _Missions = md.getPropertyArray(prim, "mission_names", true, false); + _Prim = prim; CContentObjective::init(md, prim); } @@ -2987,12 +3188,23 @@ public: ret += _Missions[i]; if (i < _Missions.size()-1) ret += "; "; - } + // We check to see if we specified a number after the mission name. If so, we check if it's a guild mission + std::size_t pos = _Missions[i].find_first_of(" \t"); + if (pos != std::string::npos && !md.isGuildMission()) + { + string err = toString("primitive(%s): CContentMission: Number of members needed to complete the mission specified but the mission is not a guild mission.", _Prim->getName().c_str()); + throw EParseException(_Prim, err.c_str()); + } + } + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; } + + IPrimitive *_Prim; }; REGISTER_STEP_CONTENT(CContentMission, "do_mission"); @@ -3026,7 +3238,8 @@ public: if (i < _MsgContent.size()-1) ret += " "; } - + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; @@ -3242,7 +3455,8 @@ public: ret += "ring_scenario : "; ret += _ScenarioTag; - + // Add the 'nb_guild_members_needed' parameter if needed + //ret += CContentObjective::genNbGuildMembersNeededOption(md); ret += NL; return ret; diff --git a/code/snowballs2/CMakeLists.txt b/code/snowballs2/CMakeLists.txt index 0f158fb88..0007259ee 100644 --- a/code/snowballs2/CMakeLists.txt +++ b/code/snowballs2/CMakeLists.txt @@ -1,177 +1,27 @@ -#-----------------------------------------------------------------------------^M -# Set CMake 2.6 Policies. -IF(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -ENDIF(COMMAND cmake_policy) - - -#----------------------------------------------------------------------------- -# Set default config options -# -NL_SETUP_DEFAULT_OPTIONS() -NL_SETUP_PREFIX_PATHS() - -#----------------------------------------------------------------------------- -# Override default options -OPTION(BUILD_CLIENT "Build the Snowballs Client" ON) -OPTION(ENABLE_SOUND "Enable sound in the Snowballs Client" OFF) - -OPTION(BUILD_SERVER "Build the Snowballs Servers" ON) SET(SNOWBALLS_CONFIG_FILE "${NL_ETC_PREFIX}/snowballs" CACHE FILEPATH "Snowballs config file location") SET(SNOWBALLS_DATA_FILE "${NL_SHARE_PREFIX}/games/snowballs" CACHE FILEPATH "Snowballs data file location") SET(SNOWBALLS_LOG_FILE "${NL_LOG_PREFIX}/snowballs" CACHE FILEPATH "Snowballs log file location") -INSTALL(CODE "FILE(MAKE_DIRECTORY ${SNOWBALLS_LOG_FILE})") + +# Note: Not sure if this is still the best way to do this... +#INSTALL(CODE "FILE(MAKE_DIRECTORY ${SNOWBALLS_LOG_FILE})") #----------------------------------------------------------------------------- #Platform specifics -FIND_PACKAGE(Threads REQUIRED) -FIND_PACKAGE(LibXml2 REQUIRED) -FIND_PACKAGE(PNG REQUIRED) - -NL_SETUP_BUILD() - -FIND_PACKAGE(NeL COMPONENTS nelmisc nelgeorges nel3d nelnet nelpacs REQUIRED) -FIND_PACKAGE(NeLNS COMPONENTS naming_service login_service welcome_service nel_launcher_qt) - ### # An example of finding NeL 3D and CEGUI Renderer. ### -IF(BUILD_CLIENT) - FIND_PACKAGE(FreeType) - FIND_PACKAGE(Jpeg) - - IF(ENABLE_SOUND) - FIND_PACKAGE(NeL COMPONENTS nelsound) - ENDIF(ENABLE_SOUND) -ENDIF(BUILD_CLIENT) - -IF(WIN32) - INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) - SET(WINSOCK2_LIB ws2_32.lib) -ENDIF(WIN32) - -NL_SETUP_BUILD_FLAGS() - ADD_DEFINITIONS(-DSNOWBALLS_CONFIG="${SNOWBALLS_CONFIG_FILE}/" -DSNOWBALLS_STATE="${SNOWBALLS_LOG_FILE}/" -DSNOWBALLS_LOGS="${SNOWBALLS_LOG_FILE}/") -IF(BUILD_CLIENT) +IF(WITH_SNOWBALLS_CLIENT) ADD_SUBDIRECTORY(client) -ENDIF(BUILD_CLIENT) +ENDIF(WITH_SNOWBALLS_CLIENT) -IF(BUILD_SERVER) +IF(WITH_SNOWBALLS_SERVER) ADD_SUBDIRECTORY(server) -ENDIF(BUILD_SERVER) +ENDIF(WITH_SNOWBALLS_SERVER) -# packaging information -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NeL MMORPG Framework - Snowballs Demo") -SET(CPACK_PACKAGE_VENDOR "NeL") -SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README) -SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING) -SET(CPACK_PACKAGE_VERSION_MAJOR "${SB_VERSION_MAJOR}") -SET(CPACK_PACKAGE_VERSION_MINOR "${SB_VERSION_MINOR}") -SET(CPACK_PACKAGE_VERSION_PATCH "${SB_VERSION_PATCH}") -SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};Snowballs;ALL;/") -SET(CPACK_PACKAGE_EXECUTABLES "snowballs-${SB_VERSION}" "snowballs") +IF(WITH_SNOWBALLS_PACKAGE) + INCLUDE(CMakePackaging.txt) +ENDIF(WITH_SNOWBALLS_PACKAGE) -# NSIS Specific Packing Setup -SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Snowballs") -SET(CPACK_NSIS_MODIFY_PATH "ON") -SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico) -SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico) -SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp) -SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} Snowballs") -SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel") -SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel") -SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com") - -## Source Packages -SET(CPACK_PACKAGE_FILE_NAME "snowballs-${SB_VERSION}") -SET(CPACK_SOURCE_PACKAGE_FILE_NAME "snowballs-${SB_VERSION}") -IF(WIN32) - SET(CPACK_GENERATOR "NSIS") - SET(CPACK_SOURCE_GENERATOR "ZIP") -ELSE(WIN32) - SET(CPACK_GENERATOR "TGZ") - SET(CPACK_SOURCE_GENERATOR "TGZ") -ENDIF(WIN32) -set(CPACK_SOURCE_IGNORE_FILES - "~$" - "\\\\.cvsignore$" - "^${CMAKE_SOURCE_DIR}.*/CVS/" - "^${CMAKE_SOURCE_DIR}.*/\\\\.svn/" - "^${CMAKE_SOURCE_DIR}/debian/" - "^${CMAKE_SOURCE_DIR}/old/") -IF(WIN32) - IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release") - # Install "Debug" specific stuff here. - SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE) - message(status "install debug libraries.") - ELSE(NOT CMAKE_BUILD_TYPE STREQUAL "Release") - # Install "Release" Specific stuff here. - SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE) - ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Release") - - IF(BUILD_CLIENT) - # Needed to find dependencies for nel_launcher_qt. - FIND_PACKAGE(Qt4 REQUIRED) - - # Install Qt dependencies for the launcher. - INCLUDE(${QT_USE_FILE}) - INSTALL(FILES - "${QT_LIBRARY_DIR}/QtGuid4.dll" - "${QT_LIBRARY_DIR}/QtXmld4.dll" - "${QT_LIBRARY_DIR}/QtCored4.dll" - DESTINATION bin) - - # Install the Qt Launcher. - INSTALL(FILES ${NELNS_NEL_LAUNCHER_BIN} DESTINATION bin COMPONENT snowballsclient) - - # Install the sound/video drivers - INSTALL(FILES ${NELDRVOPENGL_DLL} ${NELDRVDIRECT3D_DLL} DESTINATION bin COMPONENT snowballsclient) - ENDIF(BUILD_CLIENT) - - IF(BUILD_SERVER) - INSTALL(FILES - ${NELNS_NAMING_SERVICE_BIN} - ${NELNS_NAMING_SERVICE_CFG} - ${NELNS_LOGIN_SERVICE_BIN} - ${NELNS_LOGIN_SERVICE_CFG} - ${NELNS_WELCOME_SERVICE_BIN} - ${NELNS_WELCOME_SERVICE_CFG} - DESTINATION sbin - COMPONENT services) - ENDIF(BUILD_SERVER) - - INCLUDE(InstallRequiredSystemLibraries) -ENDIF(WIN32) - -INCLUDE(CPack) - -cpack_add_install_type(Full DISPLAY_NAME "Full Install") -cpack_add_component_group(Client - EXPANDED - DESCRPTION "Snowballs Client") -cpack_add_component_group(Server - EXPANDED - DESCRPTION "Snowballs Services") -cpack_add_component(snowballsclient - DISPLAY_NAME "Snowballs Client Runtime" - DESCRIPTION "Hello World Application" - GROUP Application - INSTALL_TYPES Full) -cpack_add_component(Unspecified - DISPLAY_NAME "Application Runtime Libraries" - DESCRIPTION "Hello World Application Libraries" - GROUP Client - INSTALL_TYPES Full) -cpack_add_component(snowballsdata - DISPLAY_NAME "Snowballs Application Data" - DESCRIPTION "Snowballs Application Data" - GROUP Client - INSTALL_TYPES Full) -cpack_add_component(services - DISPLAY_NAME "Snowballs Services" - DESCRIPTION "Snowballs Services" - GROUP Server - INSTALL_TYPES Full) \ No newline at end of file diff --git a/code/snowballs2/CMakePackaging.txt b/code/snowballs2/CMakePackaging.txt new file mode 100644 index 000000000..eb564ba3b --- /dev/null +++ b/code/snowballs2/CMakePackaging.txt @@ -0,0 +1,113 @@ +# packaging information +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NeL MMORPG Framework - Snowballs Demo") +SET(CPACK_PACKAGE_VENDOR "NeL") +SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README) +SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING) +SET(CPACK_PACKAGE_VERSION_MAJOR "${SB_VERSION_MAJOR}") +SET(CPACK_PACKAGE_VERSION_MINOR "${SB_VERSION_MINOR}") +SET(CPACK_PACKAGE_VERSION_PATCH "${SB_VERSION_PATCH}") +SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};Snowballs;ALL;/") +SET(CPACK_PACKAGE_EXECUTABLES "snowballs-${SB_VERSION}" "snowballs") + +# NSIS Specific Packing Setup +SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Snowballs") +SET(CPACK_NSIS_MODIFY_PATH "ON") +SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico) +SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico) +SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp) +SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} Snowballs") +SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel") +SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel") +SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com") + +## Source Packages +SET(CPACK_PACKAGE_FILE_NAME "snowballs-${SB_VERSION}") +SET(CPACK_SOURCE_PACKAGE_FILE_NAME "snowballs-${SB_VERSION}") +IF(WIN32) + SET(CPACK_GENERATOR "NSIS") + SET(CPACK_SOURCE_GENERATOR "ZIP") +ELSE(WIN32) + SET(CPACK_GENERATOR "TGZ") + SET(CPACK_SOURCE_GENERATOR "TGZ") +ENDIF(WIN32) +set(CPACK_SOURCE_IGNORE_FILES + "~$" + "\\\\.cvsignore$" + "^${CMAKE_SOURCE_DIR}.*/CVS/" + "^${CMAKE_SOURCE_DIR}.*/\\\\.svn/" + "^${CMAKE_SOURCE_DIR}/debian/" + "^${CMAKE_SOURCE_DIR}/old/") +IF(WIN32) + IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release") + # Install "Debug" specific stuff here. + SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE) + message(status "install debug libraries.") + ELSE(NOT CMAKE_BUILD_TYPE STREQUAL "Release") + # Install "Release" Specific stuff here. + SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE) + ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Release") + + IF(BUILD_CLIENT) + # Needed to find dependencies for nel_launcher_qt. + FIND_PACKAGE(Qt4 REQUIRED) + + # Install Qt dependencies for the launcher. + INCLUDE(${QT_USE_FILE}) + INSTALL(FILES + "${QT_LIBRARY_DIR}/QtGuid4.dll" + "${QT_LIBRARY_DIR}/QtXmld4.dll" + "${QT_LIBRARY_DIR}/QtCored4.dll" + DESTINATION bin) + + # Install the Qt Launcher. + INSTALL(FILES ${NELNS_NEL_LAUNCHER_BIN} DESTINATION bin COMPONENT snowballsclient) + + # Install the sound/video drivers + INSTALL(FILES ${NELDRVOPENGL_DLL} ${NELDRVDIRECT3D_DLL} DESTINATION bin COMPONENT snowballsclient) + ENDIF(BUILD_CLIENT) + + IF(BUILD_SERVER) + INSTALL(FILES + ${NELNS_NAMING_SERVICE_BIN} + ${NELNS_NAMING_SERVICE_CFG} + ${NELNS_LOGIN_SERVICE_BIN} + ${NELNS_LOGIN_SERVICE_CFG} + ${NELNS_WELCOME_SERVICE_BIN} + ${NELNS_WELCOME_SERVICE_CFG} + DESTINATION sbin + COMPONENT services) + ENDIF(BUILD_SERVER) + + INCLUDE(InstallRequiredSystemLibraries) +ENDIF(WIN32) + +INCLUDE(CPack) + +cpack_add_install_type(Full DISPLAY_NAME "Full Install") +cpack_add_component_group(Client + EXPANDED + DESCRPTION "Snowballs Client") +cpack_add_component_group(Server + EXPANDED + DESCRPTION "Snowballs Services") +cpack_add_component(snowballsclient + DISPLAY_NAME "Snowballs Client Runtime" + DESCRIPTION "Hello World Application" + GROUP Application + INSTALL_TYPES Full) +cpack_add_component(Unspecified + DISPLAY_NAME "Application Runtime Libraries" + DESCRIPTION "Hello World Application Libraries" + GROUP Client + INSTALL_TYPES Full) +cpack_add_component(snowballsdata + DISPLAY_NAME "Snowballs Application Data" + DESCRIPTION "Snowballs Application Data" + GROUP Client + INSTALL_TYPES Full) +cpack_add_component(services + DISPLAY_NAME "Snowballs Services" + DESCRIPTION "Snowballs Services" + GROUP Server + INSTALL_TYPES Full) + diff --git a/code/snowballs2/client/src/snowballs_client.cpp b/code/snowballs2/client/src/snowballs_client.cpp index 3aa4d5540..bde24ac83 100644 --- a/code/snowballs2/client/src/snowballs_client.cpp +++ b/code/snowballs2/client/src/snowballs_client.cpp @@ -70,6 +70,10 @@ #include "internationalization.h" #include "game_time.h" +#ifdef NL_OS_WINDOWS +#include +#endif + using namespace std; using namespace NLMISC; using namespace NL3D; @@ -602,7 +606,7 @@ void loopLogin() string LSHost(ConfigFile->getVar("LSHost").asString()); Login = ConfigFile->getVar("Login").asString(); string Password = ConfigFile->getVar("Password").asString(); - CHashKeyMD5 hk = getMD5((uint8 *)Password.c_str(), Password.size()); + CHashKeyMD5 hk = getMD5((uint8 *)Password.c_str(), (uint32)Password.size()); string CPassword = hk.toString(); nlinfo("The crypted password is %s", CPassword.c_str()); string Application = ConfigFile->getVar("ClientApplication").asString(); @@ -1073,8 +1077,8 @@ sint main(int argc, char **argv) // extract the 2 first param (argv[1] and argv[2]) it must be cookie and addr string cmd = cmdline; - int pos1 = cmd.find_first_not_of (' '); - int pos2; + string::size_type pos1 = cmd.find_first_not_of (' '); + string::size_type pos2; if (pos1 != string::npos) { pos2 = cmd.find (' ', pos1); diff --git a/code/snowballs2/server/chat/src/main.cpp b/code/snowballs2/server/chat/src/main.cpp index 9a1a3d057..37f58eb92 100644 --- a/code/snowballs2/server/chat/src/main.cpp +++ b/code/snowballs2/server/chat/src/main.cpp @@ -36,6 +36,9 @@ // We're using the NeL Service framework, and layer 5 #include +#ifdef NL_OS_WINDOWS +#include +#endif using namespace std; using namespace NLMISC; diff --git a/code/snowballs2/server/collision/src/collision_service.cpp b/code/snowballs2/server/collision/src/collision_service.cpp index fc48d02c3..ffde0c725 100644 --- a/code/snowballs2/server/collision/src/collision_service.cpp +++ b/code/snowballs2/server/collision/src/collision_service.cpp @@ -17,6 +17,10 @@ #include "collision_service.h" #include +#ifdef NL_OS_WINDOWS +#include +#endif + using namespace SBSERVICE; using namespace NLMISC; using namespace NLNET; diff --git a/code/snowballs2/server/frontend/src/CMakeLists.txt b/code/snowballs2/server/frontend/src/CMakeLists.txt index 086ecfcd1..d24c6743e 100644 --- a/code/snowballs2/server/frontend/src/CMakeLists.txt +++ b/code/snowballs2/server/frontend/src/CMakeLists.txt @@ -1,6 +1,6 @@ FILE(GLOB SRC *.cpp *.h) -ADD_EXECUTABLE(snowballs_frontend_service ${SRC}) +ADD_EXECUTABLE(snowballs_frontend_service WIN32 ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) diff --git a/code/snowballs2/server/frontend/src/main.cpp b/code/snowballs2/server/frontend/src/main.cpp index ff036fe51..74ccdc50f 100644 --- a/code/snowballs2/server/frontend/src/main.cpp +++ b/code/snowballs2/server/frontend/src/main.cpp @@ -38,6 +38,10 @@ #include #include +#ifdef NL_OS_WINDOWS +#include +#endif + using namespace NLMISC; using namespace NLNET; using namespace std; diff --git a/code/snowballs2/server/position/src/main.cpp b/code/snowballs2/server/position/src/main.cpp index b908d1e73..44a94d560 100644 --- a/code/snowballs2/server/position/src/main.cpp +++ b/code/snowballs2/server/position/src/main.cpp @@ -41,6 +41,9 @@ #include "physics.h" +#ifdef NL_OS_WINDOWS +#include +#endif using namespace NLMISC; using namespace NLNET;