From 122fef354c6eadc49825c3bc74c62134699aa03e Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 3 Oct 2012 10:08:56 +0200 Subject: [PATCH 01/13] Changed: Don't check Debian environment variables in CMake scripts (define options on cmake command-line instead) --- code/CMakeModules/nel.cmake | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 24092cfea..5a2abc665 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -13,11 +13,7 @@ ENDIF(NOT CMAKE_BUILD_TYPE) MACRO(NL_GEN_PC name) IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}") - IF(CMAKE_LIBRARY_ARCHITECTURE) - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig) - ELSE(CMAKE_LIBRARY_ARCHITECTURE) - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/pkgconfig) - ENDIF(CMAKE_LIBRARY_ARCHITECTURE) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION ${NL_LIB_PREFIX}/pkgconfig) ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) ENDMACRO(NL_GEN_PC) @@ -250,16 +246,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) ### # Optional support ### - - # Check if CMake is launched from a Debian packaging script - SET(DEB_HOST_GNU_CPU $ENV{DEB_HOST_GNU_CPU}) - - # Don't strip if generating a .deb - IF(DEB_HOST_GNU_CPU) - OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" ON ) - ELSE(DEB_HOST_GNU_CPU) - OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" OFF) - ENDIF(DEB_HOST_GNU_CPU) + OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" OFF) IF(WIN32) OPTION(WITH_STLPORT "With STLport support." ON ) @@ -371,9 +358,6 @@ MACRO(NL_SETUP_BUILD) ENDIF(HOST_CPU MATCHES "amd64") # Determine target CPU - IF(NOT TARGET_CPU) - SET(TARGET_CPU $ENV{DEB_HOST_GNU_CPU}) - ENDIF(NOT TARGET_CPU) # If not specified, use the same CPU as host IF(NOT TARGET_CPU) @@ -386,9 +370,6 @@ MACRO(NL_SETUP_BUILD) SET(TARGET_CPU "x86") ENDIF(TARGET_CPU MATCHES "amd64") - # DEB_HOST_ARCH_ENDIAN is 'little' or 'big' - # DEB_HOST_ARCH_BITS is '32' or '64' - IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") SET(CLANG ON) MESSAGE(STATUS "Using Clang compiler") @@ -449,12 +430,6 @@ MACRO(NL_SETUP_BUILD) ENDIF(TARGET_CPU STREQUAL "x86_64") # Fix library paths suffixes for Debian MultiArch - SET(DEBIAN_MULTIARCH $ENV{DEB_HOST_MULTIARCH}) - - IF(DEBIAN_MULTIARCH) - SET(CMAKE_LIBRARY_ARCHITECTURE ${DEBIAN_MULTIARCH}) - ENDIF(DEBIAN_MULTIARCH) - IF(CMAKE_LIBRARY_ARCHITECTURE) SET(CMAKE_LIBRARY_PATH /lib/${CMAKE_LIBRARY_ARCHITECTURE} /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH}) IF(TARGET_X64) From af4ed15c36592042ddf715fa86a8bab4896a6c3a Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 3 Oct 2012 22:31:12 +0200 Subject: [PATCH 02/13] Changed: CXXFLAGS and CPPFLAGS support in CMake Changed: Use LIBRARY_ARCHITECTURE to override CMAKE_LIBRARY_ARCHITECTURE --- code/CMakeModules/nel.cmake | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 5a2abc665..4875be6d6 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -407,28 +407,40 @@ MACRO(NL_SETUP_BUILD) ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}") # Use values from environment variables - SET(PLATFORM_CFLAGS "$ENV{CFLAGS} ${PLATFORM_CFLAGS}") + SET(PLATFORM_CFLAGS "$ENV{CFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CFLAGS}") + SET(PLATFORM_CXXFLAGS "$ENV{CXXFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CXXFLAGS}") SET(PLATFORM_LINKFLAGS "$ENV{LDFLAGS} ${PLATFORM_LINKFLAGS}") # Remove -g and -O flag because we are managing them ourself STRING(REPLACE "-g" "" PLATFORM_CFLAGS ${PLATFORM_CFLAGS}) + STRING(REPLACE "-g" "" PLATFORM_CXXFLAGS ${PLATFORM_CXXFLAGS}) STRING(REGEX REPLACE "-O[0-9s]" "" PLATFORM_CFLAGS ${PLATFORM_CFLAGS}) + STRING(REGEX REPLACE "-O[0-9s]" "" PLATFORM_CXXFLAGS ${PLATFORM_CXXFLAGS}) # Strip spaces STRING(STRIP ${PLATFORM_CFLAGS} PLATFORM_CFLAGS) + STRING(STRIP ${PLATFORM_CXXFLAGS} PLATFORM_CXXFLAGS) STRING(STRIP ${PLATFORM_LINKFLAGS} PLATFORM_LINKFLAGS) IF(TARGET_CPU STREQUAL "x86_64") SET(TARGET_X64 1) SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86_64") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -DHAVE_X86_64") ELSEIF(TARGET_CPU STREQUAL "x86") SET(TARGET_X86 1) SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -DHAVE_X86") ELSEIF(TARGET_CPU STREQUAL "arm") SET(TARGET_ARM 1) SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_ARM") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -DHAVE_ARM") ENDIF(TARGET_CPU STREQUAL "x86_64") + # Override CMAKE_LIBRARY_ARCHITECTURE that is automatically determinated + IF(LIBRARY_ARCHITECTURE) + SET(CMAKE_LIBRARY_ARCHITECTURE ${LIBRARY_ARCHITECTURE}) + ENDIF(LIBRARY_ARCHITECTURE) + # Fix library paths suffixes for Debian MultiArch IF(CMAKE_LIBRARY_ARCHITECTURE) SET(CMAKE_LIBRARY_PATH /lib/${CMAKE_LIBRARY_ARCHITECTURE} /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH}) @@ -461,10 +473,12 @@ MACRO(NL_SETUP_BUILD) ENDIF(MSVC10) SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zm1000 /MP /Gy-") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zm1000 /MP /Gy-") IF(TARGET_X64) # Fix a bug with Intellisense SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /D_WIN64") # Fix a compilation error for some big C++ files SET(MIN_OPTIMIZATIONS "${MIN_OPTIMIZATIONS} /bigobj") ELSE(TARGET_X64) @@ -473,7 +487,7 @@ MACRO(NL_SETUP_BUILD) ENDIF(TARGET_X64) # Exceptions are only set for C++ - SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /EHa") IF(WITH_SYMBOLS) SET(NL_RELEASE_CFLAGS "/Zi ${NL_RELEASE_CFLAGS}") @@ -494,33 +508,41 @@ MACRO(NL_SETUP_BUILD) IF(APPLE) IF(TARGET_CPU STREQUAL "x86") SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch i386") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -arch i386") ENDIF(TARGET_CPU STREQUAL "x86") IF(TARGET_CPU STREQUAL "x86_64") SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch x86_64") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -arch x86_64") ENDIF(TARGET_CPU STREQUAL "x86_64") ELSE(APPLE) IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m32 -march=i686") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -m32 -march=i686") ENDIF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m64") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -m64") ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") ENDIF(APPLE) SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -D_REENTRANT -pipe -Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -D_REENTRANT -pipe -Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing") IF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -ansi") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ansi") ENDIF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") IF(WITH_COVERAGE) SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}") + SET(PLATFORM_CXXFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CXXFLAGS}") ENDIF(WITH_COVERAGE) IF(APPLE) SET(PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}") + SET(PLATFORM_CXXFLAGS "-gdwarf-2 ${PLATFORM_CXXFLAGS}") ENDIF(APPLE) IF(APPLE AND XCODE) @@ -538,6 +560,7 @@ MACRO(NL_SETUP_BUILD) IF(CMAKE_OSX_SYSROOT) SET(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CFLAGS}") + SET(PLATFORM_CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CXXFLAGS}") ELSE(CMAKE_OSX_SYSROOT) MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated") ENDIF(CMAKE_OSX_SYSROOT) @@ -545,10 +568,12 @@ MACRO(NL_SETUP_BUILD) IF(CMAKE_OSX_ARCHITECTURES) FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES}) SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch ${_ARCH}") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -arch ${_ARCH}") ENDFOREACH(_ARCH) ENDIF(CMAKE_OSX_ARCHITECTURES) IF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG) SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") ENDIF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG) SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names") @@ -561,9 +586,10 @@ MACRO(NL_SETUP_BUILD) # 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}") + SET(PLATFORM_CXXFLAGS "-fPIC ${PLATFORM_CXXFLAGS}") ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS) - SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} -ftemplate-depth-48") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48") IF(NOT APPLE) SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed") From e4e12ff6c4ddb14b2587242e3a521b09404a1be6 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 5 Oct 2012 14:57:05 +0200 Subject: [PATCH 03/13] Changed: Synchronization with SVN --- .../src/backup_service/backup_service.cpp | 5 +- .../src/entities_game_service/admin.cpp | 153 ++++++++++++++++-- .../building_manager/building_physical.cpp | 8 + .../entities_game_service/client_messages.cpp | 4 +- .../entities_game_service.cpp | 36 +---- .../guild_manager/guild.cpp | 32 +++- .../guild_manager/guild.h | 2 + .../mission_manager/mission_step_kill.cpp | 2 - .../outpost_manager/outpost_commands.cpp | 6 +- .../phrase_manager/faber_action.cpp | 2 +- .../phrase_manager/faber_phrase.cpp | 68 ++++---- .../phrase_manager/fg_extraction_phrase.cpp | 39 +++-- .../player_manager/character.cpp | 117 +++++++++++--- .../player_manager/character.h | 32 ++++ .../player_manager/character_inlines.h | 61 +++++++ .../player_manager/persistent_player_data.cpp | 10 +- .../pvp_manager/pvp_manager_2.cpp | 27 +++- .../entities_game_service/zone_manager.cpp | 2 +- .../server/src/monitor_service/mirrors.h | 2 +- 19 files changed, 475 insertions(+), 133 deletions(-) diff --git a/code/ryzom/server/src/backup_service/backup_service.cpp b/code/ryzom/server/src/backup_service/backup_service.cpp index bb0b71d3a..698cbc02f 100644 --- a/code/ryzom/server/src/backup_service/backup_service.cpp +++ b/code/ryzom/server/src/backup_service/backup_service.cpp @@ -532,7 +532,10 @@ static CMessage getFileClassImp( CMessage& msgin) for (uint j=0; j ,[, vector res; sint32 x = 0, y = 0, z = 0; + sint32 cell = 0; + if (get) { x = e->getState().X() / 1000; @@ -1229,6 +1232,10 @@ ENTITY_VARIABLE(Position, "Position of a player (in meter) ,[, x = entityBase->getState().X + sint32 (cos (entityBase->getState ().Heading) * 2000); y = entityBase->getState().Y + sint32 (sin (entityBase->getState ().Heading) * 2000); z = entityBase->getState().Z; + + TDataSetRow dsr = entityBase->getEntityRowId(); + CMirrorPropValueRO mirrorCell( TheDataset, dsr, DSPropertyCELL ); + cell = mirrorCell; } } } @@ -1258,11 +1265,11 @@ ENTITY_VARIABLE(Position, "Position of a player (in meter) ,[, // season included uint8 season; NLMISC::fromString(res[3], season); - c->teleportCharacter(x,y,z,true, false, 0.f, 0xFF, 0, season); + c->teleportCharacter(x,y,z,true, false, 0.f, 0xFF, cell, season); } else { - c->teleportCharacter(x,y,z,true); + c->teleportCharacter(x,y,z,true, false, 0.f, 0xFF, cell); } if ( cont ) @@ -3780,7 +3787,7 @@ NLMISC_COMMAND( monitorMissions, "monitor a player missions", "getMissionsBegin() == c->getMissionsEnd() ) + if ( c->getMissionsBegin() != c->getMissionsEnd() ) { CCharacter::sendDynamicSystemMessage( c->getEntityRowId() , "CSR_HAS_MISSION" ); return true; @@ -4014,8 +4021,6 @@ NLMISC_COMMAND (unmuteUniverse, "unmute the univers chat", "getGuildId(); CGuildManager::getInstance()->setGMGuild( guildId ); @@ -4450,8 +4455,8 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", " getUserDynChannel(name); + string name = toLower(args[1]); + TChanID channel = inst->getUserDynChannel(name); if (args.size() < 3) pass = toLower(name); @@ -4499,6 +4504,38 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", " ") +{ + if ((args.size() < 2) || (args.size() > 3)) + return false; + GET_CHARACTER + + CPVPManager2 *inst = CPVPManager2::getInstance(); + + string action; + string lang = args[1]; + if (lang != "en" && lang != "fr" && lang != "de" && lang != "ru" && lang != "es") + return false; + + TChanID channel = inst->getFactionDynChannel(lang); + + if (channel != DYN_CHAT_INVALID_CHAN) + { + if (!c->getLangChannel().empty()) { + TChanID current_channel = inst->getFactionDynChannel(c->getLangChannel()); + inst->removeFactionChannelForCharacter(current_channel, c); + } + inst->addFactionChannelToCharacter(channel, c, true); + c->setLangChannel(lang); + return true; + } + + SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal); + params[0].Literal = lang; + CCharacter::sendDynamicSystemMessage( eid, "EGS_CHANNEL_INVALID_NAME", params ); + return false; +} + NLMISC_COMMAND (updateTarget, "Update current target", "") { GET_CHARACTER @@ -4601,9 +4638,15 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " = 6 && args[5] == "1") + bool new_separator = false; + // New check using HMagic + if (args.size() >= 6 && (args[5] == "1" || args[5] == "3")) new_check = true; + // New separator "|" + if (args.size() >= 6 && (args[5] == "2" || args[5] == "3")) + new_separator = true; + bool next_step = false; if (args.size() >= 7 && args[6] == "1") next_step = true; @@ -4680,7 +4723,10 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " command_args; - NLMISC::splitString(command, "!", command_args); + if (new_separator) + NLMISC::splitString(command, "|", command_args); + else + NLMISC::splitString(command, "!", command_args); if (command_args.empty()) return false; @@ -5317,8 +5363,10 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " setHairColor(value); + if (target) + target->setHairColor(value); + else + return false; } //************************************************* @@ -5468,12 +5516,35 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " getEntityRowId(); - ucstring name = ucstring(c->getName().toString()+"$"+command_args[1]+"$"); + c->setNewTitle(command_args[1]); + string fullname = c->getName().toString()+"$"+command_args[1]+"#"+c->getTagPvPA()+"#"+c->getTagPvPB()+"#"+c->getTagA()+"#"+c->getTagB()+"$"; + ucstring name; + name.fromUtf8(fullname); + NLNET::CMessage msgout("CHARACTER_NAME"); + msgout.serial(row); + msgout.serial(name); + sendMessageViaMirror("IOS", msgout); + } + + //************************************************* + //***************** set_tag + //************************************************* + + else if (command_args[0] == "set_tag") { + if (command_args.size () != 3) return false; + TDataSetRow row = c->getEntityRowId(); + if (command_args[1] == "pvpA") c->setTagPvPA(command_args[2]); + if (command_args[1] == "pvpB") c->setTagPvPB(command_args[2]); + if (command_args[1] == "A") c->setTagA(command_args[2]); + if (command_args[1] == "B") c->setTagB(command_args[2]); + string fullname = c->getName().toString()+"$"+c->getNewTitle()+"#"+c->getTagPvPA()+"#"+c->getTagPvPB()+"#"+c->getTagA()+"#"+c->getTagB()+"$"; + ucstring name; + name.fromUtf8(fullname); NLNET::CMessage msgout("CHARACTER_NAME"); msgout.serial(row); msgout.serial(name); @@ -5500,6 +5571,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " res; sint32 x = 0, y = 0, z = 0; float h = 0; + sint32 cell; if ( value.find(',') != string::npos ) // Position x,y,z,a { explode (value, string(","), res); @@ -5591,6 +5663,10 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " getState().Y + sint32 (sin (entityBase->getState ().Heading) * 2000); z = entityBase->getState().Z; h = entityBase->getState().Heading; + + TDataSetRow dsr = entityBase->getEntityRowId(); + CMirrorPropValueRO mirrorCell( TheDataset, dsr, DSPropertyCELL ); + cell = mirrorCell; } } } @@ -5620,7 +5696,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " applyRespawnEffects(); } - c->teleportCharacter(x,y,z,allowPetTp,true,h); + c->teleportCharacter(x,y,z,allowPetTp,true,h,0xFF,cell); if ( cont ) { @@ -5903,6 +5979,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_faction_points", getSalt()); + return true; } } else if (action=="set") @@ -5941,6 +6018,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " sendUrl(web_app_url+"&player_eid="+c->getId().toString()+"&event=failed&desc=no_enough_pvp_points", getSalt()); + return true; } } else if (action=="set") @@ -5957,6 +6035,51 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " [1=Read/Write,0=ReadOnly(default)]") { - if (args.size() != 2) return false; + if (args.size() < 2 || args.size() > 3) return false; GET_CHARACTER TChanID chanID = DynChatEGS.getChanIDFromName(args[1]); if (chanID == DYN_CHAT_INVALID_CHAN) diff --git a/code/ryzom/server/src/entities_game_service/building_manager/building_physical.cpp b/code/ryzom/server/src/entities_game_service/building_manager/building_physical.cpp index 9e93b7ed9..30374ec3d 100644 --- a/code/ryzom/server/src/entities_game_service/building_manager/building_physical.cpp +++ b/code/ryzom/server/src/entities_game_service/building_manager/building_physical.cpp @@ -89,7 +89,15 @@ bool IBuildingPhysical::addUser(CCharacter * user, uint16 roomIdx, uint16 ownerI return false; } + + if (user->currentHp() <= 0 ) + { + nlwarning("user %s is dead",user->getId().toString().c_str()); + return false; + } + CCharacter *owner; + if (ownerIdx < _Players.size()) { owner = PlayerManager.getChar(_Players[ownerIdx] ); diff --git a/code/ryzom/server/src/entities_game_service/client_messages.cpp b/code/ryzom/server/src/entities_game_service/client_messages.cpp index 9c40edc4a..58dc114e2 100644 --- a/code/ryzom/server/src/entities_game_service/client_messages.cpp +++ b/code/ryzom/server/src/entities_game_service/client_messages.cpp @@ -2078,7 +2078,7 @@ void cbClientSit( NLNET::CMessage& msgin, const std::string &serviceName, NLNET: } -// client send a command to chang guild motd +// client send a command to change guild motd void cbClientGuildMotd( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId ) { H_AUTO(cbClientGuildMotd); @@ -2737,7 +2737,7 @@ void cbClientSetCharacterTitle( NLNET::CMessage& msgin, const std::string & serv } // kxu: TODO: check validity of title chosen by player - c->setTitle( (CHARACTER_TITLE::ECharacterTitle) title ); + c->setNewTitle(CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)title)); c->registerName(); } diff --git a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp index f431372cd..ef0f9404e 100644 --- a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp +++ b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp @@ -4321,41 +4321,7 @@ NLMISC_COMMAND(setAllSkillsToValue,"set all skills to value","getSkills(); - skills._Skills[ i ].Base = min( value, (sint32)SkillsTree->SkillsTree[ i ].MaxSkillValue ); - skills._Skills[ i ].Current = skills._Skills[ i ].Base; - skills._Skills[ i ].MaxLvlReached = skills._Skills[ i ].Base; - - // update all parent skill with new max children - SKILLS::ESkills skillUpdated = (SKILLS::ESkills)i; - while( SkillsTree->SkillsTree[ skillUpdated ].ParentSkill != SKILLS::unknown ) - { - if( skills._Skills[ i ].Base > skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxLvlReached ) - { - skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxLvlReached = skills._Skills[ i ].Base; - skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].Base = min( skills._Skills[ skillUpdated ].Base, (sint32)SkillsTree->SkillsTree[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxSkillValue ); - skillUpdated = SkillsTree->SkillsTree[ skillUpdated ].ParentSkill; - } - else - { - break; - } - } - -// e->_PropertyDatabase.x_setProp( string("CHARACTER_INFO:SKILLS:") + NLMISC::toStringEnum( i ) + string(":SKILL"), skills._Skills[ i ].Base ); - CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setSKILL(e->_PropertyDatabase, checkedCast(skills._Skills[ i ].Base) ); -// e->_PropertyDatabase.x_setProp( string("CHARACTER_INFO:SKILLS:") + NLMISC::toStringEnum( i ) + string(":BaseSKILL"), skills._Skills[ i ].Base ); - CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setBaseSKILL(e->_PropertyDatabase, checkedCast(skills._Skills[ i ].Base) ); - } + e->setSkillsToValue(value); } else { 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 4e9b81911..b7277bc11 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 @@ -237,6 +237,16 @@ void CGuild::setMOTD( const std::string& motd, const NLMISC::CEntityId& eId) nlwarning("%s invalid member id %s",eId.toString().c_str()); return; } + + if ( motd == "?" ) + { + // Show the old MOTD + SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal); + params[0].Literal= _MessageOfTheDay; + CCharacter::sendDynamicMessageToChatGroup(user->getEntityRowId(), "GMOTD", CChatGroup::guild, params); + return; + } + EGSPD::CGuildGrade::TGuildGrade memberGrade = member->getGrade(); if( memberGrade >= EGSPD::CGuildGrade::Member) { @@ -255,9 +265,10 @@ void CGuild::setMOTD( const std::string& motd, const NLMISC::CEntityId& eId) if(!_MessageOfTheDay.empty()) { + // Show new MOTD to all members SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal); params[0].Literal= _MessageOfTheDay; - CCharacter::sendDynamicMessageToChatGroup(user->getEntityRowId(), "GMOTD", CChatGroup::guild, params); + sendMessageToGuildChat("GMOTD", params); } } else @@ -1408,6 +1419,25 @@ void CGuild::sendMessageToGuildMembers( const std::string & msg, const TVectorP IGuildUnifier::getInstance()->sendMessageToGuildMembers(this, msg, params); } +//---------------------------------------------------------------------------- +void CGuild::sendMessageToGuildChat( const std::string & msg, const TVectorParamCheck & params )const +{ + for ( std::map< EGSPD::TCharacterId, EGSPD::CGuildMemberPD*>::const_iterator it = getMembersBegin(); it != getMembersEnd(); ++it ) + { + CGuildMember * member = EGS_PD_CAST( (*it).second ); + EGS_PD_AST( member ); + + // continue if the player is offline + CGuildMemberModule * module = NULL; + if ( member->getReferencingModule(module) ) + { + CGuildCharProxy proxy; + module->getProxy(proxy); + proxy.sendDynamicMessageToChatGroup(msg, CChatGroup::guild, params); + } + } +} + //---------------------------------------------------------------------------- void CGuild::setMemberClientDB( CGuildMember* member ) { 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 e03556a0f..151c3ccce 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 @@ -165,6 +165,8 @@ public: void addMemberToGuildChat(CGuildMember *member); /// send a message to all members void sendMessageToGuildMembers( const std::string & msg, const TVectorParamCheck & params = TVectorParamCheck() )const; + /// send a message to all members in guild chat + void sendMessageToGuildChat( const std::string & msg, const TVectorParamCheck & params = TVectorParamCheck() )const; /// set information relative to a member in the guild client database void setMemberClientDB( CGuildMember* member ); /// return the best online user diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp index d31f4e795..9124c1fc3 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp @@ -215,9 +215,7 @@ class CMissionStepKillFauna : public IMissionStepTemplate ret.clear(); ret.resize( _SubSteps.size() ); for ( uint i = 0; i < _SubSteps.size(); i++ ) - { ret[i] = _SubSteps[i].Quantity; - } } virtual void getTextParams( uint & nbSubSteps,const std::string* & textPtr,TVectorParamCheck& retParams, const std::vector& subStepStates) diff --git a/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_commands.cpp b/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_commands.cpp index d0973a82c..0270eb9e6 100644 --- a/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_commands.cpp +++ b/code/ryzom/server/src/entities_game_service/outpost_manager/outpost_commands.cpp @@ -121,7 +121,7 @@ NLMISC_COMMAND(outpostSimulateTimer0End, "", " [ if (args.size()>1) { NLMISC::fromString(args[1], endTime); - if (args[1][0]=='+') + if (args[1].find('+')==0) endTime += CTime::getSecondsSince1970(); } if (endTime==0) endTime = 1; @@ -144,7 +144,7 @@ NLMISC_COMMAND(outpostSimulateTimer1End, "", " [ if (args.size()>1) { NLMISC::fromString(args[1], endTime); - if (args[1][0]=='+') + if (args[1].find('+')==0) endTime += CTime::getSecondsSince1970(); } if (endTime==0) endTime = 1; @@ -167,7 +167,7 @@ NLMISC_COMMAND(outpostSimulateTimer2End, "", " [ if (args.size()>1) { NLMISC::fromString(args[1], endTime); - if (args[1][0]=='+') + if (args[1].find('+')==0) endTime += CTime::getSecondsSince1970(); } if (endTime==0) endTime = 1; diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/faber_action.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/faber_action.cpp index 9101ac850..50a069b5e 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/faber_action.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/faber_action.cpp @@ -281,7 +281,7 @@ public: } else { - c->wearRightHandItem(); + c->wearRightHandItem(phrase->getMps().size()/10); // report Xp Gain unless used tool is worned PROGRESSIONPVE::CCharacterProgressionPVE::getInstance()->actionReport( report, true, false ); diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/faber_phrase.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/faber_phrase.cpp index f74b81196..577544e13 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/faber_phrase.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/faber_phrase.cpp @@ -54,7 +54,7 @@ CFaberPhrase::CFaberPhrase() _CraftedItemStaticForm = 0; _RootFaberBricks = false; _RootFaberPlan = 0; - + // recommended skill level for using crafted item _Recommended = 0; @@ -67,13 +67,13 @@ CFaberPhrase::CFaberPhrase() _MBORange = 0.0f; _MBOProtection = 0.0f; _MBOSapLoad = 0.0f; - + // energy buff on item _MBOHitPoint = 0; _MBOSap = 0; _MBOStamina = 0; _MBOFocus = 0; - + _IsStatic = true; _PhraseType = BRICK_TYPE::FABER; } @@ -85,7 +85,7 @@ CFaberPhrase::CFaberPhrase() bool CFaberPhrase::build( const TDataSetRow & actorRowId, const std::vector< const CStaticBrick* >& bricks, bool buildToExecute ) { H_AUTO(CFaberPhrase_build); - + // we are sure there is at least one brick and that there are non NULL; nlassert( !bricks.empty() ); @@ -112,7 +112,7 @@ bool CFaberPhrase::build( const TDataSetRow & actorRowId, const std::vector< con return false; } } - else*/ if( ( brick.Family >= BRICK_FAMILIES::BeginFaberOption && brick.Family <= BRICK_FAMILIES::EndFaberOption ) + else*/ if( ( brick.Family >= BRICK_FAMILIES::BeginFaberOption && brick.Family <= BRICK_FAMILIES::EndFaberOption ) || ( brick.Family >= BRICK_FAMILIES::BeginFaberCredit && brick.Family <= BRICK_FAMILIES::EndFaberCredit ) ) { for ( uint j = 0 ; j < brick.Params.size() ; ++j) @@ -120,7 +120,7 @@ bool CFaberPhrase::build( const TDataSetRow & actorRowId, const std::vector< con const TBrickParam::IId* param = brick.Params[j]; switch(param->id()) - { + { case TBrickParam::FOCUS: INFOLOG("FOCUS: %i",((CSBrickParamCraftFocus *)param)->Focus); _FocusCost += ((CSBrickParamCraftFocus *)param)->Focus; @@ -217,10 +217,10 @@ bool CFaberPhrase::evaluate() bool CFaberPhrase::validate() { H_AUTO(CFaberPhrase_validate); - + if ( !CraftSystemEnabled ) return false; - + CCharacter * c = (CCharacter *) CEntityBaseManager::getEntityBasePtr( _ActorRowId ); if( c == 0 ) { @@ -234,7 +234,7 @@ bool CFaberPhrase::validate() return false; } - // check right hand item is a crafting tool + // check right hand item is a crafting tool CGameItemPtr rightHandItem = c->getRightHandItem(); if (rightHandItem == NULL || rightHandItem->getStaticForm() == NULL || rightHandItem->getStaticForm()->Family != ITEMFAMILY::CRAFTING_TOOL) { @@ -249,8 +249,16 @@ bool CFaberPhrase::validate() return false; } + + // check quality of right hand item (need be >= Recommended (level of item)) + if (rightHandItem->recommended()+49 < _Recommended) + { + PHRASE_UTILITIES::sendDynamicSystemMessage(_ActorRowId, "CRAFT_NEED_RECOMMENDED_CRAFTING_TOOL"); + return false; + } + // entities cant craft if in combat - /* commented as test of right hand item is now made... + /* commented as test of right hand item is now made... TDataSetRow entityRowId = CPhraseManager::getInstance().getEntityEngagedMeleeBy( _ActorRowId ); if (TheDataset.isAccessible(entityRowId)) { @@ -258,7 +266,7 @@ bool CFaberPhrase::validate() return false; } */ - + const sint32 focus = c->getScores()._PhysicalScores[ SCORES::focus ].Current; if ( focus < _FocusCost ) { @@ -318,7 +326,7 @@ bool CFaberPhrase::update() void CFaberPhrase::execute() { H_AUTO(CFaberPhrase_execute); - + CCharacter* player = PlayerManager.getChar(_ActorRowId); if (!player) return; @@ -336,13 +344,13 @@ void CFaberPhrase::execute() _FaberTime = (NLMISC::TGameCycle)(plan->CraftingDuration * 10); } nldebug("CFaberPhrase::execute> _FaberTime = %d",_FaberTime); - + const NLMISC::TGameCycle time = CTickEventHandler::getGameCycle(); - + _ExecutionEndDate = time + _FaberTime ; player->setCurrentAction(CLIENT_ACTION_TYPE::Faber,_ExecutionEndDate); - player->staticActionInProgress(true); + player->staticActionInProgress(true); // set behaviour PHRASE_UTILITIES::sendUpdateBehaviour( _ActorRowId, MBEHAV::FABER ); @@ -366,7 +374,7 @@ bool CFaberPhrase::launch() void CFaberPhrase::apply() { H_AUTO(CFaberPhrase_apply); - + CCharacter * c = dynamic_cast< CCharacter * > ( CEntityBaseManager::getEntityBasePtr( _ActorRowId ) ); if( c == 0 ) { @@ -410,7 +418,7 @@ void CFaberPhrase::apply() } nbMp = (sint32)_MpsFormula.size(); - + uint32 nbMpForumulaNeedeInPlan = 0; neededMp = (uint32)_RootFaberPlan->Faber->NeededMpsFormula.size(); for( uint mp = 0; mp < neededMp; ++mp ) @@ -418,7 +426,7 @@ void CFaberPhrase::apply() //for each type of Mp needed nbMpForumulaNeedeInPlan += _RootFaberPlan->Faber->NeededMpsFormula[ mp ].Quantity; } - + if( nbMpForumulaNeedeInPlan != _MpsFormula.size() ) { nlwarning(" Craft plan %s need %d Raw Material Formula and client send %d Raw Material Formula", c->getCraftPlan().toString().c_str(), _RootFaberPlan->Faber->NeededMpsFormula.size(), _MpsFormula.size() ); @@ -453,7 +461,7 @@ void CFaberPhrase::apply() stop(); return; } - + neededMp = (uint32)_RootFaberPlan->Faber->NeededMps.size(); EGSPD::CPeople::TPeople civRestriction = _RootFaberPlan->CivRestriction; uint32 usedMp=0; @@ -469,7 +477,7 @@ void CFaberPhrase::apply() { // for each Mp of one type (we have Quantity by type) uint32 NumMpParameters = (uint32)usedMps[u_mp]->Mp->MpFaberParameters.size(); - + // for each Faber parameters in Mp for( uint j = 0; j < NumMpParameters; ++j ) { @@ -571,7 +579,7 @@ void CFaberPhrase::apply() CGameItemPtr CFaberPhrase::systemCraftItem( const NLMISC::CSheetId& sheet, const std::vector< NLMISC::CSheetId >& Mp, const std::vector< NLMISC::CSheetId >& MpFormula ) { H_AUTO(CFaberPhrase_systemCraftItem); - + std::vector< const CStaticBrick* > bricks; _RootFaberPlan = CSheets::getSBrickForm( sheet ); const CStaticBrick * rootFaberBricks = CSheets::getSBrickForm( CSheetId("bcpa01.sbrick") ); @@ -586,7 +594,7 @@ CGameItemPtr CFaberPhrase::systemCraftItem( const NLMISC::CSheetId& sheet, const } CGameItemPtr craftedItem = 0; - + if( _RootFaberPlan && _RootFaberPlan->Faber ) { _CraftedItemStaticForm = CSheets::getForm( _RootFaberPlan->Faber->CraftedItem ); @@ -597,7 +605,7 @@ CGameItemPtr CFaberPhrase::systemCraftItem( const NLMISC::CSheetId& sheet, const bricks.push_back( rootFaberBricks ); bricks.push_back( _RootFaberPlan ); - + for( vector< NLMISC::CSheetId >::const_iterator it = Mp.begin(); it != Mp.end(); ++it ) { const CStaticItem * mp = CSheets::getForm( (*it) ); @@ -626,7 +634,7 @@ CGameItemPtr CFaberPhrase::systemCraftItem( const NLMISC::CSheetId& sheet, const } _MpsFormula.push_back( mp ); } - + // Check quantity of gived Mps formula if( _RootFaberPlan->Faber->NeededMpsFormula.size() > _MpsFormula.size() ) { @@ -658,7 +666,7 @@ CGameItemPtr CFaberPhrase::systemCraftItem( const NLMISC::CSheetId& sheet, const void CFaberPhrase::end() { H_AUTO(CFaberPhrase_end); - + CCharacter* player = PlayerManager.getChar(_ActorRowId); if (!player) return; @@ -679,7 +687,7 @@ void CFaberPhrase::end() void CFaberPhrase::stop() { H_AUTO(CFaberPhrase_stop); - + CCharacter* player = PlayerManager.getChar(_ActorRowId); if (!player) return; @@ -697,11 +705,11 @@ void CFaberPhrase::stop() } // stop // -NLMISC_COMMAND(simuCraft, "Simulation de craft pour verifier les probabilités de reusir un item","") +NLMISC_COMMAND(simuCraft, "Craft simulation to verify probabilities to succesfully craft an item","") { if (args.size() != 3) return false; - + uint32 nbSimu, skillLevel, itemQuality; NLMISC::fromString(args[0], nbSimu); NLMISC::fromString(args[1], skillLevel); @@ -733,7 +741,7 @@ NLMISC_COMMAND(simuCraft, "Simulation de craft pour verifier les probabilit if(sf == 1.0f) { ++nbFullSuccess; - XpGain += CStaticSuccessTable::getXPGain(SUCCESS_TABLE_TYPE::Craft, deltaLvlXp); + XpGain += CStaticSuccessTable::getXPGain(SUCCESS_TABLE_TYPE::Craft, deltaLvlXp); } else if( sf > 0.0f) { @@ -747,7 +755,7 @@ NLMISC_COMMAND(simuCraft, "Simulation de craft pour verifier les probabilit nlinfo("FaberSimu: Results after %d roll: Sucess: %d (%.2f%%), partial sucess: %d (%.2f%%), Miss: %d (%.2f%%), Xp Gain %d", nbSimu, nbFullSuccess, 100.0f*nbFullSuccess/nbSimu, - nbPartialSuccess, 100.0f*nbPartialSuccess/nbSimu, + nbPartialSuccess, 100.0f*nbPartialSuccess/nbSimu, nbMiss, 100.0f*nbMiss/nbSimu, uint32(1000.f*XpGain / (nbSimu-nbMiss/2) ) ); diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_extraction_phrase.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_extraction_phrase.cpp index f9d2efe0c..6032adcfc 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_extraction_phrase.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_extraction_phrase.cpp @@ -107,7 +107,7 @@ CFgExtractionPhrase::CFgExtractionPhrase() bool CFgExtractionPhrase::build( const TDataSetRow & actorRowId, const std::vector< const CStaticBrick* >& bricks, bool buildToExecute ) { H_AUTO(CFgExtractionPhrase_build); - + _ActorRowId = actorRowId; // Check grammar @@ -120,7 +120,7 @@ bool CFgExtractionPhrase::build( const TDataSetRow & actorRowId, const std::vect for (std::vector::const_iterator ib=bricks.begin(); ib!=bricks.end(); ++ib ) { const CStaticBrick& brick = *(*ib); - + // Compute Sabrina credit and cost) if ( brick.SabrinaValue > 0 ) sabrinaCost += brick.SabrinaValue; @@ -156,7 +156,7 @@ bool CFgExtractionPhrase::build( const TDataSetRow & actorRowId, const std::vect break; case TBrickParam::FG_SRC_PRD: INFOLOG("FG_SRC_PRD: %g",((CSBrickParamForagePeriod *)param)->Period); - if ( ((CSBrickParamForagePeriod *)param)->Period != 0 ) + if ( ((CSBrickParamForagePeriod *)param)->Period != 0 ) _RequestedProps[CHarvestSource::S] = 1.0f / (((CSBrickParamForagePeriod *)param)->Period * 10.0f); // period converted from second to tick else _RequestedProps[CHarvestSource::S] = 1.0f; @@ -231,7 +231,7 @@ bool CFgExtractionPhrase::build( const TDataSetRow & actorRowId, const std::vect //nlerror( "TODO: Families" ); //if ( brick.Family >= BRICK_FAMILIES::BeginForage - + //insertProgressingSkill( brick.Skill, brick.SheetId ); } @@ -432,7 +432,7 @@ bool CFgExtractionPhrase::evaluate() bool CFgExtractionPhrase::validate() { H_AUTO(CFgExtractionPhrase_validate); - + if ( ! HarvestSystemEnabled ) return false; @@ -544,6 +544,15 @@ bool CFgExtractionPhrase::validate() return false; // has disappeared } + // test if tool have enough quality + sint depositQ = (sint)harvestSource->forageSite()->deposit()->maxQuality(); + + if ((depositQ > 0) && (item->recommended()+49 < depositQ)) + { + PHRASE_UTILITIES::sendDynamicSystemMessage(_ActorRowId, "FORAGE_TOOL_QUALITY_TOO_LOW"); + return false; + } + // Check the distance from the player to the source (ignoring Z because for tunnel case, player couldn't target the source) const CEntityState& state = player->getState(); CVector2f playerPos( (float)state.X / 1000.0f, (float)state.Y / 1000.0f ); @@ -589,7 +598,7 @@ bool CFgExtractionPhrase::validate() bool CFgExtractionPhrase::update() { H_AUTO(CFgExtractionPhrase_update); - + CCharacter* player = PlayerManager.getChar( _ActorRowId ); if ( ! player ) return false; @@ -600,7 +609,7 @@ bool CFgExtractionPhrase::update() if( idle() ) { idle(false); - + // check if actor can use action CBypassCheckFlags bypassCheckFlags = CBypassCheckFlags::NoFlags; if (player->canEntityUseAction(bypassCheckFlags,false) == false) @@ -633,7 +642,7 @@ bool CFgExtractionPhrase::update() void CFgExtractionPhrase::execute() { H_AUTO(CFgExtractionPhrase_execute); - + // Get character CCharacter* player = PlayerManager.getChar( _ActorRowId ); if (!player) @@ -676,7 +685,7 @@ void CFgExtractionPhrase::execute() void CFgExtractionPhrase::end() { H_AUTO(CFgExtractionPhrase_end); - + CCharacter* player = PlayerManager.getChar(_ActorRowId); if (!player) return; @@ -694,7 +703,7 @@ void CFgExtractionPhrase::end() void CFgExtractionPhrase::stop() { H_AUTO(CFgExtractionPhrase_stop); - + CCharacter* player = PlayerManager.getChar(_ActorRowId); if (!player) return; @@ -742,7 +751,7 @@ bool CFgExtractionPhrase::launch() void CFgExtractionPhrase::apply() { H_AUTO(CFgExtractionPhrase_apply); - + CCharacter* player = PlayerManager.getChar( _ActorRowId ); if (!player) return; @@ -778,7 +787,7 @@ void CFgExtractionPhrase::apply() void CFgExtractionPhrase::applyExtraction( CCharacter *player, float successFactor ) { H_AUTO(CFgExtractionPhrase_applyExtraction); - + nlassert( _Source ); if ( ! player->forageProgress() ) return; @@ -801,7 +810,7 @@ void CFgExtractionPhrase::applyExtraction( CCharacter *player, float successFact player->forageProgress()->fillFromExtraction( _Props.Extraction.ObtainedProps[CHarvestSource::A], _Props.Extraction.ObtainedProps[CHarvestSource::Q], player ); else return; - + // Report result of action if ( propDrop != CHarvestSource::NoDrop ) { @@ -864,7 +873,7 @@ struct CNonNullGameItemPtrPred : std::unary_function void CFgExtractionPhrase::doKamiOffering( CCharacter *player ) { H_AUTO(CFgExtractionPhrase_doKamiOffering); - + // Count the number of non empty slots // const vector &theBag = player->getInventory()[INVENTORIES::bag]()->getChildren(); CInventoryPtr theBag = player->getInventory(INVENTORIES::bag); @@ -912,7 +921,7 @@ void CFgExtractionPhrase::doKamiOffering( CCharacter *player ) (*ib)->getSheetId().toString().c_str()); */ // EGSPD::forageKamiItemOffering(player->getId(), _Source->depositForK()->name(), _Source->depositForK()->kamiAnger(), _Props.Care.KamiAngerDec[CHarvestSource::KamiAngerDec], item->getSheetId().toString()); - + // TODO: quantity, filter, etc. // player->destroyItem( INVENTORIES::bag, ib-theBag.begin(), 1/*(*ib).quantity()*/, false ); theBag->deleteItem(i); 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 b493d041b..51d6a9c39 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 @@ -675,6 +675,9 @@ CCharacter::CCharacter(): CEntityBase(false), _FriendVisibility = VisibleToAll; + _LangChannel = "en"; + _NewTitle = "Refugee"; + initDatabase(); } // CCharacter // @@ -699,6 +702,7 @@ void CCharacter::clear() _ForbidAuraUseStartDate=0; _ForbidAuraUseEndDate=0; _Title= CHARACTER_TITLE::Refugee; + _NewTitle = "Refugee"; SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatModel,0); SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatColor,0); @@ -3851,9 +3855,9 @@ void CCharacter::sendBetaTesterStatus() sendReservedTitleStatus( CHARACTER_TITLE::FBT, p->isBetaTester() ); - if (!p->isBetaTester() && _Title == CHARACTER_TITLE::FBT) + if (!p->isBetaTester() && _NewTitle == "FBT") { - _Title = CHARACTER_TITLE::Refugee; + _NewTitle = "Refugee"; registerName(); } } @@ -3869,9 +3873,9 @@ void CCharacter::sendWindermeerStatus() sendReservedTitleStatus( CHARACTER_TITLE::WIND, p->isWindermeerCommunity() ); - if ( !p->isWindermeerCommunity() && _Title == CHARACTER_TITLE::WIND) + if ( !p->isWindermeerCommunity() && _NewTitle == "WIND") { - _Title = CHARACTER_TITLE::Refugee; + _NewTitle = "Refugee"; registerName(); } } @@ -6963,11 +6967,11 @@ double CCharacter::addXpToSkillInternal( double XpGain, const std::string& ContS CBankAccessor_PLR::getCHARACTER_INFO().getRING_XP_CATALYSER().setCount(_PropertyDatabase, checkedCast(ringCatalyserCount) ); } } - } - if (!p->isTrialPlayer()) - { - xpBonus = XpGain; + if (!p->isTrialPlayer()) + { + xpBonus = XpGain; + } } XpGain += xpBonus + ringXpBonus; @@ -7081,7 +7085,7 @@ double CCharacter::addXpToSkillInternal( double XpGain, const std::string& ContS SM_STATIC_PARAMS_3(paramsP, STRING_MANAGER::skill, STRING_MANAGER::integer, STRING_MANAGER::integer); paramsP[0].Enum = skillEnum; paramsP[1].Int = max((sint32)1, sint32(100*XpGain) ); - paramsP[2].Int = max((sint32)1, sint32(100*(XpGain - (xpBonus+ringXpBonus))) ); + paramsP[2].Int = max((sint32)1, sint32(100*(XpGain - xpBonus - ringXpBonus))); PHRASE_UTILITIES::sendDynamicSystemMessage(_EntityRowId, "XP_CATALYSER_PROGRESS_NORMAL_GAIN", paramsP); if( xpBonus > 0 ) @@ -7329,11 +7333,18 @@ double CCharacter::addXpToSkillInternal( double XpGain, const std::string& ContS return XpGainRemainder; } - //----------------------------------------------- // CCharacter::setSkillTreeToMaxValue Set skill tree of character to max value of each skill //----------------------------------------------- void CCharacter::setSkillsToMaxValue() +{ + setSkillsToValue(-1); +} + +//----------------------------------------------- +// CCharacter::setSkillTreeToMaxValue Set skill tree of character to max value of each skill +//----------------------------------------------- +void CCharacter::setSkillsToValue(const sint32& value) { // get pointer on static skills tree definition CSheetId sheet("skills.skill_tree"); @@ -7342,16 +7353,31 @@ void CCharacter::setSkillsToMaxValue() for( uint i = 0; i < SKILLS::NUM_SKILLS; ++i ) { - _Skills._Skills[ i ].Base = SkillsTree->SkillsTree[ i ].MaxSkillValue; + _Skills._Skills[ i ].Base = (value < 0) ? SkillsTree->SkillsTree[ i ].MaxSkillValue : min( value, (sint32)SkillsTree->SkillsTree[ i ].MaxSkillValue ); _Skills._Skills[ i ].Current = SkillsTree->SkillsTree[ i ].MaxSkillValue + _Skills._Skills[ i ].Modifier; -// _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SKILLS.Skill[i], _Skills._Skills[ i ].Current ); - CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setSKILL(_PropertyDatabase, checkedCast(_Skills._Skills[ i ].Current) ); -// _PropertyDatabase.setProp( _DataIndexReminder->CHARACTER_INFO.SKILLS.BaseSkill[i], _Skills._Skills[ i ].Base ); + _Skills._Skills[ i ].MaxLvlReached = _Skills._Skills[ i ].Current; + CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setBaseSKILL(_PropertyDatabase, checkedCast(_Skills._Skills[ i ].Base) ); + CBankAccessor_PLR::getCHARACTER_INFO().getSKILLS().getArray(i).setSKILL(_PropertyDatabase, checkedCast(_Skills._Skills[ i ].Current) ); + + // update all parent skill with new max children + SKILLS::ESkills skillUpdated = (SKILLS::ESkills)i; + while( SkillsTree->SkillsTree[ skillUpdated ].ParentSkill != SKILLS::unknown ) + { + if( _Skills._Skills[ i ].Base > _Skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxLvlReached ) + { + _Skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxLvlReached = _Skills._Skills[ i ].Base; + _Skills._Skills[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].Base = min( _Skills._Skills[ skillUpdated ].Base, (sint32)SkillsTree->SkillsTree[ SkillsTree->SkillsTree[ skillUpdated ].ParentSkill ].MaxSkillValue ); + skillUpdated = SkillsTree->SkillsTree[ skillUpdated ].ParentSkill; + } + else + { + break; + } + } } } - //----------------------------------------------- // CCharacter::sendDynamicSystemMessage //----------------------------------------------- @@ -7949,6 +7975,7 @@ void CCharacter::setStartStatistics( const CCreateCharMsg& createCharMsg ) _Race = (EGSPD::CPeople::TPeople) createCharMsg.People; _Gender = createCharMsg.Sex; _Title = CHARACTER_TITLE::Refugee; + _NewTitle = "Refugee"; // fame information // Players start out as Neutral in their declared clans @@ -9787,7 +9814,7 @@ bool CCharacter::queryItemPrice( const CGameItemPtr item, uint32& price ) quality = theItem->quality(); if ( theItem->maxDurability() ) wornFactor = float(theItem->durability()) / float(theItem->maxDurability()); - price = (uint32) ( CShopTypeManager::computeBasePrice( theItem, quality ) * wornFactor ); + price = (uint32) ( CShopTypeManager::computeBasePrice( theItem, quality ) * wornFactor * 0.02 ); return true; } @@ -10214,6 +10241,35 @@ void CCharacter::initPvpPointDb() CBankAccessor_PLR::getUSER().getRRPS_LEVELS(0).setVALUE(_PropertyDatabase, _PvpPoint ); } +//----------------------------------------------------------------------------- +void CCharacter::setLangChannel(const string &lang) { + _LangChannel = lang; +} + +//----------------------------------------------------------------------------- +void CCharacter::setNewTitle(const string &title) { + _NewTitle = title; +} + +//----------------------------------------------------------------------------- +void CCharacter::setTagPvPA(const string &tag) { + _TagPvPA = tag; +} + +//----------------------------------------------------------------------------- +void CCharacter::setTagPvPB(const string &tag) { + _TagPvPB = tag; +} + +//----------------------------------------------------------------------------- +void CCharacter::setTagA(const string &tag) { + _TagA = tag; +} + +//----------------------------------------------------------------------------- +void CCharacter::setTagB(const string &tag) { + _TagB = tag; +} //----------------------------------------------------------------------------- void CCharacter::setOrganization(uint32 org) @@ -12895,7 +12951,7 @@ void CCharacter::registerName(const ucstring &newName) CMessage msgName("CHARACTER_NAME_LANG"); msgName.serial(_EntityRowId); - string sTitle = CHARACTER_TITLE::toString(_Title); + string sTitle = getFullTitle(); ucstring RegisteredName; if (newName.empty()) RegisteredName = getName() + string("$") + sTitle + string("$"); @@ -16161,15 +16217,30 @@ void CCharacter::applyGooDamage( float gooDistance ) if (hpLost < 1) hpLost = 1; if( hpLost > _PhysScores._PhysicalScores[ SCORES::hit_points ].Current ) { - _PhysScores._PhysicalScores[ SCORES::hit_points ].Current = 0; - // send message to player for inform is dead by goo - sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_GOO"); + _PhysScores._PhysicalScores[ SCORES::hit_points ].Current = 0; + + // send message to player for inform is dead by goo or other + if (_CurrentContinent == CONTINENT::FYROS) + sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_FIRE"); + else if (_CurrentContinent == CONTINENT::TRYKER) + sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_STEAM"); + else if (_CurrentContinent == CONTINENT::MATIS) + sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_POISON"); + else + sendDynamicSystemMessage(_EntityRowId, "KILLED_BY_GOO"); } else { _PhysScores._PhysicalScores[ SCORES::hit_points ].Current = _PhysScores._PhysicalScores[ SCORES::hit_points ].Current - hpLost; // send message to player for inform is suffer goo damage - sendDynamicSystemMessage(_EntityRowId, "SUFFER_GOO_DAMAGE"); + if (_CurrentContinent == CONTINENT::FYROS) + sendDynamicSystemMessage(_EntityRowId, "SUFFER_FIRE_DAMAGE"); + else if (_CurrentContinent == CONTINENT::TRYKER) + sendDynamicSystemMessage(_EntityRowId, "SUFFER_STEAM_DAMAGE"); + else if (_CurrentContinent == CONTINENT::MATIS) + sendDynamicSystemMessage(_EntityRowId, "SUFFER_POISON_DAMAGE"); + else + sendDynamicSystemMessage(_EntityRowId, "SUFFER_GOO_DAMAGE"); } } } @@ -19057,7 +19128,7 @@ void CCharacter::setStartupInstance(uint32 instanceId) void CCharacter::setTitle( CHARACTER_TITLE::ECharacterTitle title ) { - _Title = title; + setNewTitle(CHARACTER_TITLE::toString(title)); } @@ -20736,4 +20807,4 @@ bool CCharacter::initPetInventory(uint8 index) return true; } return false; -} \ No newline at end of file +} diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.h b/code/ryzom/server/src/entities_game_service/player_manager/character.h index f2ba0944b..8a3c127da 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.h @@ -890,6 +890,9 @@ public: // Set skill tree of character to max value of each skill void setSkillsToMaxValue(); + // Set skill tree of character to specified value + void setSkillsToValue(const sint32& value); + // for respawn management, need to modify _TimeDeath in cbTpAcknownledge callback NLMISC::TGameTime& getTimeOfDeath(); void setTimeOfDeath( NLMISC::TGameTime t); @@ -2392,6 +2395,27 @@ public: uint32 getLastConnectedTime() const; uint32 getLastConnectedDate() const; uint32 getPlayedTime() const; + + const std::string& getLangChannel() const; + void setLangChannel(const std::string &lang); + + const std::string& getNewTitle() const; + void setNewTitle(const std::string &title); + + std::string getFullTitle() const; + + std::string getTagA() const; + void setTagA(const std::string &tag); + + std::string getTagB() const; + void setTagB(const std::string &tag); + + std::string getTagPvPA() const; + void setTagPvPA(const std::string &tag); + + std::string getTagPvPB() const; + void setTagPvPB(const std::string &tag); + uint32 getOrganization() const; uint32 getOrganizationStatus() const; const std::list& getLastLogStats() const; @@ -3032,6 +3056,14 @@ private: uint32 _OrganizationStatus; uint32 _OrganizationPoints; + std::string _LangChannel; + + std::string _NewTitle; + std::string _TagPvPA; + std::string _TagPvPB; + std::string _TagA; + std::string _TagB; + /// SDB path where player wins HoF points in PvP (if not empty) std::string _SDBPvPPath; diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character_inlines.h b/code/ryzom/server/src/entities_game_service/player_manager/character_inlines.h index 7e2cd4248..615ddaeb8 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character_inlines.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/character_inlines.h @@ -894,6 +894,67 @@ inline uint32 CCharacter::getPlayedTime() const return _PlayedTime; } +//------------------------------------------------------------------------------ +inline const std::string& CCharacter::getLangChannel() const + +{ + return _LangChannel; +} + +//------------------------------------------------------------------------------ +inline const std::string& CCharacter::getNewTitle() const + +{ + return _NewTitle; +} + +//------------------------------------------------------------------------------ +inline std::string CCharacter::getTagA() const + +{ + if (_TagA.empty()) + return "_"; + return _TagA; +} + +//------------------------------------------------------------------------------ +inline std::string CCharacter::getTagB() const + +{ + if (_TagB.empty()) + return "_"; + return _TagB; +} + + +//------------------------------------------------------------------------------ +inline std::string CCharacter::getTagPvPA() const + +{ + if (_TagPvPA.empty()) + return "_"; + return _TagPvPA; +} + +//------------------------------------------------------------------------------ +inline std::string CCharacter::getTagPvPB() const + +{ + if (_TagPvPB.empty()) + return "_"; + return _TagPvPB; +} + + +//------------------------------------------------------------------------------ +inline std::string CCharacter::getFullTitle() const +{ + if (!_TagA.empty() || !_TagB.empty() || !_TagPvPA.empty() || !_TagPvPB.empty()) + return _NewTitle+"#"+getTagPvPA()+"#"+getTagPvPB()+"#"+getTagA()+"#"+getTagB(); + else + return _NewTitle; +} + //------------------------------------------------------------------------------ inline uint32 CCharacter::getOrganization() const diff --git a/code/ryzom/server/src/entities_game_service/player_manager/persistent_player_data.cpp b/code/ryzom/server/src/entities_game_service/player_manager/persistent_player_data.cpp index 703261a56..e777f3067 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/persistent_player_data.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/persistent_player_data.cpp @@ -321,8 +321,8 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons H_AUTO(CCharacterStore);\ CFameManager::getInstance().savePlayerFame(_Id, const_cast(*_Fames));\ /* Update the current playing session duration */ \ - if (_LastLogStats.size() > 0) _LastLogStats.begin()->Duration = CTime::getSecondsSince1970() - _LastLogStats.begin()->LoginTime; \ - else nlwarning("Cannot update play session duration, _LastLogStats is empty, new character?"); \ + if (!_LastLogStats.empty()) _LastLogStats.begin()->Duration = CTime::getSecondsSince1970() - _LastLogStats.begin()->LoginTime;\ + else nlwarning("Cannot update play session duration, _LastLogStats is empty, new character?");\ \ /* Unless the top of the position stack is locked, */ \ /* update the stored position stack with the current position */ \ @@ -415,6 +415,7 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons PVP_CLAN::TPVPClan k=PVP_CLAN::fromString(key); if ((k>=PVP_CLAN::BeginClans) && (k<=PVP_CLAN::EndClans)) _FactionPoint[k-PVP_CLAN::BeginClans]=val)\ \ PROP(uint32,_PvpPoint)\ + PROP2(_LangChannel,string,_LangChannel,_LangChannel=val)\ PROP(uint32,_Organization)\ PROP(uint32,_OrganizationStatus)\ PROP(uint32,_OrganizationPoints)\ @@ -438,6 +439,11 @@ static void prepareCharacterPositionForStore ( COfflineEntityState & state, cons PROP_GAME_CYCLE_COMP(_ForbidAuraUseStartDate)\ PROP_GAME_CYCLE_COMP(_ForbidAuraUseEndDate)\ PROP2(_Title, string, CHARACTER_TITLE::toString(getTitle()), setTitle(CHARACTER_TITLE::toCharacterTitle(val)))\ + PROP2(_NewTitle, string, _NewTitle, _NewTitle=val)\ + PROP2(_TagPvPA, string, _TagPvPA, _TagPvPA=val)\ + PROP2(_TagPvPB, string, _TagPvPB, _TagPvPB=val)\ + PROP2(_TagA, string, _TagA, _TagA=val)\ + PROP2(_TagB, string, _TagB, _TagB=val)\ \ /* Visual Properties */\ PROP2(HairType, uint8, _VisualPropertyA().PropertySubData.HatModel, SET_STRUCT_MEMBER(_VisualPropertyA,PropertySubData.HatModel,val))\ diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp index 3d09bc9fd..012877931 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp @@ -230,6 +230,22 @@ std::vector CPVPManager2::getCharacterChannels(CCharacter * user) } } + // Add lang channel + if (!user->getLangChannel().empty()) { + TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(user->getLangChannel()); + if (it != _ExtraFactionChannel.end()) + { + result.push_back((*it).second); + } + } else { + TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("en"); + if (it != _ExtraFactionChannel.end()) + { + result.push_back((*it).second); + } + } + + /* bool matis = CFameInterface::getInstance().getFameIndexed(user->getId(), 0) >= PVPFameRequired*6000; bool fyros = CFameInterface::getInstance().getFameIndexed(user->getId(), 1) >= PVPFameRequired*6000; bool tryker = CFameInterface::getInstance().getFameIndexed(user->getId(), 2) >= PVPFameRequired*6000; @@ -279,7 +295,7 @@ std::vector CPVPManager2::getCharacterChannels(CCharacter * user) result.push_back((*it).second); } } -// } +*/ return result; } @@ -1088,10 +1104,19 @@ bool CPVPManager2::addFactionWar( PVP_CLAN::TPVPClan clan1, PVP_CLAN::TPVPClan c void CPVPManager2::onIOSMirrorUp() { // create extra factions channels + /* createExtraFactionChannel("hominists"); createExtraFactionChannel("urasies"); createExtraFactionChannel("marauders"); createExtraFactionChannel("agnos"); + */ + + // Community Channels + createExtraFactionChannel("en"); + createExtraFactionChannel("fr"); + createExtraFactionChannel("de"); + createExtraFactionChannel("ru"); + createExtraFactionChannel("es"); for (uint i = PVP_CLAN::BeginClans; i <= PVP_CLAN::EndClans; i++) { diff --git a/code/ryzom/server/src/entities_game_service/zone_manager.cpp b/code/ryzom/server/src/entities_game_service/zone_manager.cpp index feb2e618c..dd9e817b1 100644 --- a/code/ryzom/server/src/entities_game_service/zone_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/zone_manager.cpp @@ -1508,7 +1508,7 @@ bool CZoneManager::getPlace( sint32 x, sint32 y, float& gooDistance, const CPlac } for (uint k = 0; k < _Continents[i].getRegions()[j]->getPlaces().size(); k++ ) { - if( _Continents[i].getRegions()[j]->getPlaces()[k]->isGooPath() == false ) + if(!_Continents[i].getRegions()[j]->getPlaces()[k]->isGooActive()) { if ( _Continents[i].getRegions()[j]->getPlaces()[k]->contains( vect ) ) { diff --git a/code/ryzom/server/src/monitor_service/mirrors.h b/code/ryzom/server/src/monitor_service/mirrors.h index 407292238..30031dcc1 100644 --- a/code/ryzom/server/src/monitor_service/mirrors.h +++ b/code/ryzom/server/src/monitor_service/mirrors.h @@ -47,7 +47,7 @@ public: // TODO: check if good static bool exists( const TDataSetRow& entityIndex ); static const NLMISC::CEntityId& getEntityId( const TDataSetRow& entityIndex ); - static const uint16 getTeamId(const TDataSetRow& entityIndex); + static uint16 getTeamId(const TDataSetRow& entityIndex); static CAICoord x( const TDataSetRow& entityIndex ); static CAICoord y( const TDataSetRow& entityIndex ); From 9a5b97dfff59fb2777d34078d03e71dc11d10d62 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 5 Oct 2012 20:36:10 +0200 Subject: [PATCH 04/13] Fixed: Compilation under Mac OS X --- code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp index 81fea5333..4064c8819 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp @@ -17,7 +17,7 @@ #include "stdopengl.h" #include "driver_opengl.h" -#ifdef NL_OS_UNIX +#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC) # include # ifdef HAVE_XRENDER # include @@ -25,7 +25,7 @@ # ifdef HAVE_XCURSOR # include # endif // HAVE_XCURSOR -#endif // NL_OS_UNIX +#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC) #include "nel/misc/mouse_device.h" #include "nel/misc/di_event_emitter.h" From 7c4be0fb748e6eb1c1ec7ef24fdd29bebdcb569f Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 5 Oct 2012 20:37:15 +0200 Subject: [PATCH 05/13] Changed: Synchronization with SVN --- code/ryzom/server/data_shard/client_commands_privileges.txt | 1 + code/ryzom/server/data_shard/game_event.txt | 2 +- code/ryzom/server/sheet_pack_cfg/input_output_service.cfg | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/ryzom/server/data_shard/client_commands_privileges.txt b/code/ryzom/server/data_shard/client_commands_privileges.txt index 5ce9fe6fa..b9f28f95f 100644 --- a/code/ryzom/server/data_shard/client_commands_privileges.txt +++ b/code/ryzom/server/data_shard/client_commands_privileges.txt @@ -100,6 +100,7 @@ summon :DEV:SGM:GM:VG:SG:EM: // Summon a player in front of the CSR: - <_Date type="UINT32" value="0"/> + <_Name type="STRING" value=""/> <_EventFaction1Name type="STRING" value=""/> <_EventFaction2Name type="STRING" value=""/> diff --git a/code/ryzom/server/sheet_pack_cfg/input_output_service.cfg b/code/ryzom/server/sheet_pack_cfg/input_output_service.cfg index f1059d234..8772cf07f 100644 --- a/code/ryzom/server/sheet_pack_cfg/input_output_service.cfg +++ b/code/ryzom/server/sheet_pack_cfg/input_output_service.cfg @@ -126,7 +126,7 @@ SystemCmd = {}; ReadTranslationWork = 0; TranslationWorkPath = "translation/work"; -//Paths = { "data_leveldesign/leveldesign/Game_elem" }; +//Paths += { "data_leveldesign/leveldesign/Game_elem" }; // Global shard bot name translation file. You sould overide this // in input_output_service.cfg to specialize the file From 5516d7bbd070fdc39ae76d2f0fbb6b0070e629cc Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 5 Oct 2012 21:34:10 +0200 Subject: [PATCH 06/13] Changed: libxml2 requires liblzma under Mac OS X --- code/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 07bd52eba..8cf86ecc2 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -111,10 +111,11 @@ IF(WITH_STATIC) SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB}) - # on Mac OS X libxml2 requieres iconv + # on Mac OS X libxml2 requires iconv and liblzma IF(APPLE) FIND_PACKAGE(Iconv REQUIRED) - SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES}) + FIND_PACKAGE(LibLZMA REQUIRED) + SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES} ${LIBLZMA_LIBRARIES}) INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) ENDIF(APPLE) ENDIF(WITH_STATIC) From 152df7402b9ea9220af7cfb9b5473fddc926abbe Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 6 Oct 2012 15:49:27 +0200 Subject: [PATCH 07/13] Changed: Updated description for CBitmap::load and CBitmap::loadSize --- code/nel/include/nel/misc/bitmap.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/nel/include/nel/misc/bitmap.h b/code/nel/include/nel/misc/bitmap.h index f3d532311..0b6940629 100644 --- a/code/nel/include/nel/misc/bitmap.h +++ b/code/nel/include/nel/misc/bitmap.h @@ -297,8 +297,8 @@ public: void swap(CBitmap &other); /** - * Read a bitmap(TGA or DDS) from an IStream. - * Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and + * Read a bitmap(TGA, JPEG, PNG or DDS) from an IStream. + * Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5), PNG, JPEG and * uncompressed TGA (24 and 32 bits). * \param IStream The stream must be in reading mode. * \param mipMapSkip if the file is a DDS with mipMap. N=mipMapSkip mipmaps are skipped. @@ -310,7 +310,7 @@ public: /** * Determinate the bitmap size from a bitmap(TGA or DDS) from an IStream. load just header of the file. - * Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and + * Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5), PNG, JPEG and * uncompressed TGA (24 and 32 bits). * NB: at the end, f is seeked to begin. * \param IStream The stream must be in reading mode. From 3d50e0160d0bb9b1009b1410b80aa250d645ed64 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 6 Oct 2012 17:09:03 +0200 Subject: [PATCH 08/13] Changed: #878 Fix typos in comments/code --- code/ryzom/client/src/app_bundle_utils.cpp | 2 +- code/ryzom/client/src/session_browser.cpp | 2 +- code/ryzom/server/backup_service.cfg | 4 +- code/ryzom/server/backup_service_default.cfg | 25 +++++------ code/ryzom/server/common.cfg | 5 ++- .../server/entities_game_service_default.cfg | 14 +++--- code/ryzom/server/gpm_service_default.cfg | 2 +- .../server/input_output_service_default.cfg | 43 ++++++++++--------- .../server/mail_forum_service_default.cfg | 19 ++++---- code/ryzom/server/mirror_service_default.cfg | 4 +- code/ryzom/server/session_browser_server.cfg | 3 +- .../server/shard_unifier_service_default.cfg | 2 +- .../player_manager/character.cpp | 1 - 13 files changed, 65 insertions(+), 61 deletions(-) diff --git a/code/ryzom/client/src/app_bundle_utils.cpp b/code/ryzom/client/src/app_bundle_utils.cpp index b6321ad20..b42b00b98 100644 --- a/code/ryzom/client/src/app_bundle_utils.cpp +++ b/code/ryzom/client/src/app_bundle_utils.cpp @@ -21,7 +21,7 @@ #include #endif -std::string getAppBundlePath() +std::string getAppBundlePath() { static std::string cachedPathToBundle; diff --git a/code/ryzom/client/src/session_browser.cpp b/code/ryzom/client/src/session_browser.cpp index e6932c4a2..4cae87fee 100644 --- a/code/ryzom/client/src/session_browser.cpp +++ b/code/ryzom/client/src/session_browser.cpp @@ -165,7 +165,7 @@ void CSessionBrowser::run() } disconnected: - // unconnected, waiting for message to send + // disconnected, waiting for message to send while (adaptor->_SendQueue.empty()) { nlSleep(100); diff --git a/code/ryzom/server/backup_service.cfg b/code/ryzom/server/backup_service.cfg index 2f95dea97..16d870748 100644 --- a/code/ryzom/server/backup_service.cfg +++ b/code/ryzom/server/backup_service.cfg @@ -8,7 +8,7 @@ AESAliasName = "bms_master"; -Paths = { +Paths += { ".", "../common/data_leveldesign", }; @@ -25,7 +25,7 @@ WriteFilesDirectory = "data_shard"; WebPort = 49970; - // ---- service custom variables (used by CVariable class) +// ---- service custom variables (used by CVariable class) // BS - Root directory where data are backuped to IncrementalBackupDirectory = "../incremental_backup"; diff --git a/code/ryzom/server/backup_service_default.cfg b/code/ryzom/server/backup_service_default.cfg index 6e8263dca..3e73c8928 100644 --- a/code/ryzom/server/backup_service_default.cfg +++ b/code/ryzom/server/backup_service_default.cfg @@ -1,22 +1,23 @@ #include "common.cfg" - -// ---- service NeL variables (used by ConfigFile class) - + +// ---- service NeL variables (used by ConfigFile class) + DontUseNS = 1; -// ---- service NeL variables (used by CVariable class) +// ---- service NeL variables (used by CVariable class) ListeningPort = 49990; - -// ---- service custom variables (used by ConfigFile class) - + +// ---- service custom variables (used by ConfigFile class) + // Listening port for the Web server to connect in - + WebPort = 49898; - + BSReadState = 1; - - // ---- service custom variables (used by CVariable class) + + +// ---- service custom variables (used by CVariable class) // Port for the Layer 3 interface of the backup service L3ListeningPort = 49950; @@ -25,7 +26,7 @@ L3ListeningPort = 49950; SaveTemplatePath = "$shard/characters/account_$userid_$charid$ext"; // character saves possible extension list -SaveExtList = "_pdr.bin _pdr.xml .bin"; +SaveExtList = "_pdr.bin _pdr.xml .bin"; //BSFilePrefix = "R:/code/ryzom/r2_shard/"; //BSFileSubst = "r2_shard/"; diff --git a/code/ryzom/server/common.cfg b/code/ryzom/server/common.cfg index 2c209c152..4dac4468d 100644 --- a/code/ryzom/server/common.cfg +++ b/code/ryzom/server/common.cfg @@ -4,7 +4,7 @@ ShardId = 302; // Used by CVariable in WS -PlayerLimit = 5000; +PlayerLimit = 5000; // Used to connect to AES (this file) and to set up AES service (admin_executor_service.cfg) AESPort="46702"; @@ -96,4 +96,5 @@ WriteFilesDirectory = "data_shard"; // ---- service custom variables (used by ConfigFile class) - // ---- service custom variables (used by CVariable class) + +// ---- service custom variables (used by CVariable class) diff --git a/code/ryzom/server/entities_game_service_default.cfg b/code/ryzom/server/entities_game_service_default.cfg index 82cb40d1d..3016a6f99 100644 --- a/code/ryzom/server/entities_game_service_default.cfg +++ b/code/ryzom/server/entities_game_service_default.cfg @@ -22,22 +22,22 @@ StartCommands += "lgs_gw.transportAdd L3Client masterL3c", // open the transport "lgs_gw.transportCmd masterL3c(connect addr="+MasterLGSHost+":"+L3MasterLGSPort+")", -}; - +}; + #ifndef DONT_USE_LGS_SLAVE - + StartCommands += { // add a layer 3 server transport for slave logger service "lgs_gw.transportAdd L3Client slaveL3c", // open the transport "lgs_gw.transportCmd slaveL3c(connect addr="+SlaveLGSHost+":"+L3SlaveLGSPort+")", -}; - +}; + #endif - + StartCommands += -{ +{ // Create a shard unifier client module "moduleManager.createModule ShardUnifierClient suc", // Create a client commands forwader module diff --git a/code/ryzom/server/gpm_service_default.cfg b/code/ryzom/server/gpm_service_default.cfg index ddca7f76d..a6835c65c 100644 --- a/code/ryzom/server/gpm_service_default.cfg +++ b/code/ryzom/server/gpm_service_default.cfg @@ -1,5 +1,5 @@ #include "common.cfg" - + CheckPlayerSpeed = 0; SecuritySpeedFactor = 1.5; diff --git a/code/ryzom/server/input_output_service_default.cfg b/code/ryzom/server/input_output_service_default.cfg index ba819ad8f..54aaaafe8 100644 --- a/code/ryzom/server/input_output_service_default.cfg +++ b/code/ryzom/server/input_output_service_default.cfg @@ -1,6 +1,6 @@ #include "common.cfg" - -// ---- service NeL variables (used by ConfigFile class) + +// ---- service NeL variables (used by ConfigFile class) StartCommands += { @@ -23,22 +23,22 @@ StartCommands += "lgs_gw.transportAdd L3Client masterL3c", // open the transport "lgs_gw.transportCmd masterL3c(connect addr="+MasterLGSHost+":"+L3MasterLGSPort+")", -}; - +}; + #ifndef DONT_USE_LGS_SLAVE - + StartCommands += -{ +{ // add a layer 3 server transport for slave logger service "lgs_gw.transportAdd L3Client slaveL3c", // open the transport "lgs_gw.transportCmd slaveL3c(connect addr="+SlaveLGSHost+":"+L3SlaveLGSPort+")", -}; - +}; + #endif - + StartCommands += -{ +{ // Create a chat unifier client "moduleManager.createModule ChatUnifierClient cuc", @@ -52,33 +52,34 @@ StartCommands += }; #endif - -// ---- service NeL variables (used by CVariable class) - -// ---- service custom variables (used by ConfigFile class) - + +// ---- service NeL variables (used by CVariable class) + +// ---- service custom variables (used by ConfigFile class) + // a list of system command that can be run with "sysCmd" service command. SystemCmd = {}; - + // IOS don't use work directory by default ReadTranslationWork = 0; TranslationWorkPath = "translation/work"; - + // Global shard bot name translation file. You sould overide this // in input_output_service.cfg to specialize the file // depending on the shard main language. BotNameTranslationFile = "bot_names.txt"; - + // Global shard event faction translation file. You sould override this // in input_output_service.cfg to specialize the file // depending on the shard main language. EventFactionTranslationFile = "event_factions.txt"; - - // ---- service custom variables (used by CVariable class) + + +// ---- service custom variables (used by CVariable class) // Activate/deactivate debugging of missing paremeter replacement DebugReplacementParameter = 1; - + // Default verbose debug flags: //----------------------------- diff --git a/code/ryzom/server/mail_forum_service_default.cfg b/code/ryzom/server/mail_forum_service_default.cfg index a76b710be..cd986d964 100644 --- a/code/ryzom/server/mail_forum_service_default.cfg +++ b/code/ryzom/server/mail_forum_service_default.cfg @@ -1,14 +1,15 @@ #include "common.cfg" - -// ---- service NeL variables (used by ConfigFile class) - + +// ---- service NeL variables (used by ConfigFile class) + DontUseNS = 1; - -// ---- service NeL variables (used by CVariable class) - -// ---- service custom variables (used by ConfigFile class) - - // ---- service custom variables (used by CVariable class) + +// ---- service NeL variables (used by CVariable class) + +// ---- service custom variables (used by ConfigFile class) + + +// ---- service custom variables (used by CVariable class) WebRootDirectory = "save_shard/www"; diff --git a/code/ryzom/server/mirror_service_default.cfg b/code/ryzom/server/mirror_service_default.cfg index 38f2f169a..159ee90d4 100644 --- a/code/ryzom/server/mirror_service_default.cfg +++ b/code/ryzom/server/mirror_service_default.cfg @@ -1,6 +1,6 @@ #include "common.cfg" -// ---- service custom variables (used by ConfigFile class) - +// ---- service custom variables (used by ConfigFile class) + // Linux only DestroyGhostSegments = 1; diff --git a/code/ryzom/server/session_browser_server.cfg b/code/ryzom/server/session_browser_server.cfg index 63fa70daf..c784e581e 100644 --- a/code/ryzom/server/session_browser_server.cfg +++ b/code/ryzom/server/session_browser_server.cfg @@ -46,4 +46,5 @@ HomeMainlandNames = // The max number of ring points (aka ring access) for each ecosystem MaxRingPoints = "A1:D7:F7:J8:L6:R13"; - // ---- service custom variables (used by CVariable class) + +// ---- service custom variables (used by CVariable class) diff --git a/code/ryzom/server/shard_unifier_service_default.cfg b/code/ryzom/server/shard_unifier_service_default.cfg index a9a1923e8..7e35b61f9 100644 --- a/code/ryzom/server/shard_unifier_service_default.cfg +++ b/code/ryzom/server/shard_unifier_service_default.cfg @@ -1,7 +1,7 @@ #include "common.cfg" DontUseNS = 1; - + StartCommands += { // Create a gateway for global interconnection 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 51d6a9c39..cca9cbb3b 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 @@ -7501,7 +7501,6 @@ void CCharacter::sendUserChar( uint32 userId, uint8 scenarioSeason, const R2::TU } } - //----------------------------------------------- // Return the home mainland session id for a character TSessionId CCharacter::getHomeMainlandSessionId() const From 65a3946ea80ef31362a4067dcc6fff897b26fff2 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 6 Oct 2012 17:12:23 +0200 Subject: [PATCH 09/13] Fixed: #1498 Client fails to switch shortcut bars on ctrl + number hotkeys --- code/ryzom/client/src/interface_v3/action_handler_phrase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 46dbb8c2c..26676a556 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1611,7 +1611,7 @@ public: virtual void execute(CCtrlBase * /* pCaller */, const string &Params) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); - CCDBNodeLeaf *node= pIM->getDbProp("UI:PHRASE:SELECT_MEMORY_", false); + CCDBNodeLeaf *node= pIM->getDbProp("UI:PHRASE:SELECT_MEMORY", false); if(node) { sint32 val; From 25dd379d7eb8fa87235175138ecb005dccaf32db Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 6 Oct 2012 17:17:26 +0200 Subject: [PATCH 10/13] Changed: Replaced string empty comparisons with empty() --- code/nel/src/3d/cloud_scape.cpp | 2 +- code/nel/src/3d/cluster.cpp | 2 +- code/nel/src/3d/zone_manager.cpp | 2 +- code/nel/src/net/varpath.cpp | 4 ++-- code/nel/src/pacs/retriever_bank.h | 2 +- .../client/src/interface_v3/action_handler_phrase.cpp | 2 +- code/ryzom/client/src/interface_v3/interface_manager.cpp | 2 +- .../client/src/interface_v3/item_consumable_effect.cpp | 2 +- code/ryzom/client/src/interface_v3/lua_ihm.cpp | 2 +- code/ryzom/client/src/interface_v3/view_renderer.cpp | 6 +++--- code/ryzom/client/src/pacs_client.cpp | 2 +- code/ryzom/client/src/r2/editor.cpp | 2 +- code/ryzom/common/src/game_share/generic_xml_msg_mngr.h | 2 +- code/ryzom/common/src/game_share/object.cpp | 8 ++++---- .../ryzom/common/src/game_share/scenario_entry_points.cpp | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/code/nel/src/3d/cloud_scape.cpp b/code/nel/src/3d/cloud_scape.cpp index 5a4b92155..77d046eec 100644 --- a/code/nel/src/3d/cloud_scape.cpp +++ b/code/nel/src/3d/cloud_scape.cpp @@ -193,7 +193,7 @@ void SCloudTextureClamp::init (uint32 nWidth, uint32 nHeight, uint32 nDepth, con Mem = new uint8[NbW*Width*NbH*Height]; uint32 i, j; - if (filename == "") + if (filename.empty()) { // No filename so init with default for (i = 0; i < NbW; ++i) diff --git a/code/nel/src/3d/cluster.cpp b/code/nel/src/3d/cluster.cpp index 2faebcec7..76ed153e1 100644 --- a/code/nel/src/3d/cluster.cpp +++ b/code/nel/src/3d/cluster.cpp @@ -307,7 +307,7 @@ void CCluster::serial (NLMISC::IStream&f) _SoundGroupId = CStringMapper::map(soundGroup); f.serial(envFxName); - if (envFxName == "") + if (envFxName.empty()) envFxName = "no fx"; _EnvironmentFxId = CStringMapper::map(envFxName); } diff --git a/code/nel/src/3d/zone_manager.cpp b/code/nel/src/3d/zone_manager.cpp index 6c0a727f2..efa36fa66 100644 --- a/code/nel/src/3d/zone_manager.cpp +++ b/code/nel/src/3d/zone_manager.cpp @@ -237,7 +237,7 @@ void CZoneLoadingTask::run(void) { // Lookup the zone string zonePathLookup = CPath::lookup (_ZoneName, false, false, true); - if (zonePathLookup == "") + if (zonePathLookup.empty()) zonePathLookup = _ZoneName; CZone *ZoneTmp = new CZone; diff --git a/code/nel/src/net/varpath.cpp b/code/nel/src/net/varpath.cpp index 8bee387cd..d1ce0bcf3 100644 --- a/code/nel/src/net/varpath.cpp +++ b/code/nel/src/net/varpath.cpp @@ -89,7 +89,7 @@ void CVarPath::decode () string val = getToken (); - if (val == "") + if (val.empty()) return; if (val == "[" ) @@ -105,7 +105,7 @@ void CVarPath::decode () osbnb++; // end of token - if (val == "") + if (val.empty()) { nlwarning ("VP: Bad VarPath '%s', suppose it s an empty varpath", RawVarPath.c_str()); Destination.clear (); diff --git a/code/nel/src/pacs/retriever_bank.h b/code/nel/src/pacs/retriever_bank.h index 3dacb2463..eb7afb31b 100644 --- a/code/nel/src/pacs/retriever_bank.h +++ b/code/nel/src/pacs/retriever_bank.h @@ -142,7 +142,7 @@ public: for (i=0; igetSPhraseId(); sint32 dstMacroId= pCSDst->getMacroId(); - if ((src == "") && (CHandlerPhraseMemoryCopy::haveLastPhraseElement)) + if (src.empty() && (CHandlerPhraseMemoryCopy::haveLastPhraseElement)) { // get the slot ids from save srcIsMacro= CHandlerPhraseMemoryCopy::isMacro; diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index a9a901283..52c185b58 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1563,7 +1563,7 @@ bool CInterfaceManager::loadConfig (const string &filename) CIFile f; string sFileName; sFileName = NLMISC::CPath::lookup (filename, false); - if (sFileName == "" || !f.open(sFileName)) + if (sFileName.empty() || !f.open(sFileName)) return false; diff --git a/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp b/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp index 52a3f64b7..6e50666b1 100644 --- a/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp +++ b/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp @@ -43,7 +43,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * { CSString eff = pIS->Consumable.Properties[i]; - if (eff == "") + if (eff.empty()) continue; // Get name id of effect diff --git a/code/ryzom/client/src/interface_v3/lua_ihm.cpp b/code/ryzom/client/src/interface_v3/lua_ihm.cpp index c0500eeb7..9e5160a4e 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm.cpp @@ -1228,7 +1228,7 @@ void CLuaIHM::createLuaEnumTable(CLuaState &ls, const std::string &str) p = s.splitTo('.', true); while (p.size() > 0) { - if (path == "") + if (path.empty()) path = p; else path += "." + p; diff --git a/code/ryzom/client/src/interface_v3/view_renderer.cpp b/code/ryzom/client/src/interface_v3/view_renderer.cpp index 3655697b6..8be60402a 100644 --- a/code/ryzom/client/src/interface_v3/view_renderer.cpp +++ b/code/ryzom/client/src/interface_v3/view_renderer.cpp @@ -707,7 +707,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std: SGlobalTexture gt; // Load texture file string filename = CPath::lookup (textureFileName, false); - if (filename == "") return; + if (filename.empty()) return; CIFile ifTmp; if (ifTmp.open(filename)) CBitmap::loadSize (ifTmp, gt.Width, gt.Height); @@ -724,7 +724,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std: // Load uv file CIFile iFile; filename = CPath::lookup (uvFileName, false); - if (filename == "") return; + if (filename.empty()) return; if (!iFile.open(filename)) return; _GlobalTextures.push_back (gt); @@ -866,7 +866,7 @@ sint32 CViewRenderer::createTexture (const std::string &sGlobalTextureName, SGlobalTexture gtTmp; gtTmp.FromGlobaleTexture = false; string filename = CPath::lookup (sLwrGTName, false); - if (filename == "") return -1; + if (filename.empty()) return -1; CIFile ifTmp; if (ifTmp.open(filename)) { diff --git a/code/ryzom/client/src/pacs_client.cpp b/code/ryzom/client/src/pacs_client.cpp index 04fd5cae9..5924cc935 100644 --- a/code/ryzom/client/src/pacs_client.cpp +++ b/code/ryzom/client/src/pacs_client.cpp @@ -139,7 +139,7 @@ UInstanceGroup *getCluster(const UGlobalPosition &gp) return 0; const string &strPos = GR->getIdentifier(gp); - if(strPos == "") + if(strPos.empty()) return 0; // try to find the ig in the loaded ig map std::map::const_iterator igIt = IGLoaded.find(strlwr(strPos)); diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index e8db1b390..24d8f06c0 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -6603,7 +6603,7 @@ NLMISC::CVectorD getVectorD(const CObject *obj) CObject *buildVector(const NLMISC::CVectorD &vector, const std::string &instanceId /*= ""*/) { CObject *table; - if (instanceId == "") + if (instanceId.empty()) { table = getEditor().getDMC().newComponent("Position"); table->set("x", vector.x); diff --git a/code/ryzom/common/src/game_share/generic_xml_msg_mngr.h b/code/ryzom/common/src/game_share/generic_xml_msg_mngr.h index feb8baed7..a6a6a7167 100644 --- a/code/ryzom/common/src/game_share/generic_xml_msg_mngr.h +++ b/code/ryzom/common/src/game_share/generic_xml_msg_mngr.h @@ -470,7 +470,7 @@ protected: /// display nodes void xmlDisplay() { - std::string ntype = (Name == "" ? "client_messages_description" : NbBits == 0 ? "leaf" : "branch"); + std::string ntype = (Name.empty() ? "client_messages_description" : NbBits == 0 ? "leaf" : "branch"); nlinfo("<%s name=\"%s\" description=\"%s\">", ntype.c_str(), Name.c_str(), Description.c_str()); diff --git a/code/ryzom/common/src/game_share/object.cpp b/code/ryzom/common/src/game_share/object.cpp index 1537a9995..6d1feb2fe 100644 --- a/code/ryzom/common/src/game_share/object.cpp +++ b/code/ryzom/common/src/game_share/object.cpp @@ -483,7 +483,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si nlassert(index != -1); instanceId = parent->getAttr("InstanceId")->toString(); attrName = parent->getKey(index); - if (attrName == "") + if (attrName.empty()) { position = index; } @@ -501,7 +501,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si nlassert(index2 != -1); sint32 index = parent->findIndex(this); nlassert(index != -1); - if (parent2->getKey(index2) == "") + if (parent2->getKey(index2).empty()) { nlassert(0); // TMP : want to see if may possibly happen return false; @@ -1092,7 +1092,7 @@ void CObjectTable::doSerialize(std::string& out, CSerializeContext& context) co if ( _Value[i].second->isString("Name") && _Value[i].second->isString("LocationId") && _Value[i].second->toString("Name") == "Permanent" - && _Value[i].second->toString("LocationId") == "") + && _Value[i].second->toString("LocationId").empty()) { isDefault = true; } @@ -1248,7 +1248,7 @@ bool CObjectTable::setObject(const std::string& key, CObject* value) //H_AUTO(R2_CObjectTable_setObject) CHECK_TABLE_INTEGRITY value->setGhost(this->getGhost()); - if (key == "") + if (key.empty()) { clear(); diff --git a/code/ryzom/common/src/game_share/scenario_entry_points.cpp b/code/ryzom/common/src/game_share/scenario_entry_points.cpp index 886a5ac6b..f68b1d6f8 100644 --- a/code/ryzom/common/src/game_share/scenario_entry_points.cpp +++ b/code/ryzom/common/src/game_share/scenario_entry_points.cpp @@ -406,7 +406,7 @@ void CScenarioEntryPoints::loadFromXMLFile() nlinfo("Different packages for island '%s' in file %s", island, _EntryPointsFilename.c_str()); } } - if(package == "") + if(package.empty()) nlinfo("no 'package' tag in %s island", island); else completeIsland.Package = CSString(package); From d8c7fa52f9bd8fe17c154da26321237b44c7da17 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 6 Oct 2012 18:17:57 +0200 Subject: [PATCH 11/13] Changed: Replaced string empty comparisons with empty() --- code/nel/src/net/message_recorder.cpp | 2 +- code/nel/src/net/varpath.cpp | 2 +- .../sound/source_sounds_builder/SoundPage.cpp | 2 +- .../source_sounds_builderDlg.cpp | 8 +-- .../client/src/animated_scene_object.cpp | 6 +- code/ryzom/common/src/game_share/object.cpp | 2 +- .../src/ai_service/npc_description_msg.cpp | 2 +- .../src/entities_game_service/admin.cpp | 2 +- .../creature_manager/creature_manager.cpp | 2 +- .../shop_type/shop_type_manager.cpp | 4 +- .../src/input_output_service/chat_manager.cpp | 2 +- .../tools/leveldesign/mp_generator/main.cpp | 56 +++++++++---------- .../named_items_2_csv/named_items_2_csv.cpp | 12 ++-- .../world_editor/dialog_properties.cpp | 2 +- 14 files changed, 52 insertions(+), 52 deletions(-) diff --git a/code/nel/src/net/message_recorder.cpp b/code/nel/src/net/message_recorder.cpp index 4da49cb3e..ec52ad1da 100644 --- a/code/nel/src/net/message_recorder.cpp +++ b/code/nel/src/net/message_recorder.cpp @@ -80,7 +80,7 @@ CMessageRecorder::CMessageRecorder() : _RecordAll(true) */ CMessageRecorder::~CMessageRecorder() { - if ( _Filename != "" ) + if ( !_Filename.empty() ) { nldebug( "MR:%s: End of recording", _Filename.c_str() ); } diff --git a/code/nel/src/net/varpath.cpp b/code/nel/src/net/varpath.cpp index d1ce0bcf3..729f52074 100644 --- a/code/nel/src/net/varpath.cpp +++ b/code/nel/src/net/varpath.cpp @@ -143,7 +143,7 @@ void CVarPath::decode () Destination.push_back (make_pair(RawVarPath, string(""))); return; } - else if (val != "." && val != "" && val != "=") + else if (val != "." && !val.empty() && val != "=") { nlwarning ("VP: Malformated VarPath '%s' before position %d", RawVarPath.c_str (), TokenPos); return; diff --git a/code/nel/tools/sound/source_sounds_builder/SoundPage.cpp b/code/nel/tools/sound/source_sounds_builder/SoundPage.cpp index 2664bc033..0ad410098 100644 --- a/code/nel/tools/sound/source_sounds_builder/SoundPage.cpp +++ b/code/nel/tools/sound/source_sounds_builder/SoundPage.cpp @@ -413,7 +413,7 @@ void CSoundPage::apply() nlassert( _Tree ); - if ( m_Filename != "" ) + if ( !m_Filename.empty() ) { CString s = ((CSource_sounds_builderDlg*)GetOwner())->SoundName( _HItem ) + " (" + m_Filename + ")"; _Tree->SetItemText( _HItem, s ); diff --git a/code/nel/tools/sound/source_sounds_builder/source_sounds_builderDlg.cpp b/code/nel/tools/sound/source_sounds_builder/source_sounds_builderDlg.cpp index e5643fba4..2ba1b70a5 100644 --- a/code/nel/tools/sound/source_sounds_builder/source_sounds_builderDlg.cpp +++ b/code/nel/tools/sound/source_sounds_builder/source_sounds_builderDlg.cpp @@ -364,7 +364,7 @@ CString CSource_sounds_builderDlg::SoundName( HTREEITEM hitem ) { CString s = m_Tree.GetItemText( hitem ); sint last; - if ( s != "" ) + if ( !s.empty() ) { if ( s[s.GetLength()-1] == '*' ) { @@ -425,13 +425,13 @@ void CSource_sounds_builderDlg::OnSave() } nameset.insert( (*ips)->getName() ); } - if ( duplicates != "" ) + if ( !duplicates.empty() ) { CString s; s.Format( "Warning: the following names are duplicates. The first occurence of each one was not written in the output file. Correct the names and save again:\n\n%s", duplicates.c_str() ); AfxMessageBox( s, MB_ICONWARNING ); } - if ( blanksounds != "" ) + if ( !blanksounds.empty() ) { CString s; s.Format( "Warning: the following sounds have no wave file specified:\n\n%s", blanksounds.c_str() ); @@ -569,7 +569,7 @@ void CSource_sounds_builderDlg::OnImport() if ( hitem == NULL ) { string sname = string(name); - if ( sname != "" ) // prevent from taking blank names + if ( !sname.empty() ) // prevent from taking blank names { AddSound( sname.c_str() ); } diff --git a/code/ryzom/client/src/animated_scene_object.cpp b/code/ryzom/client/src/animated_scene_object.cpp index 6367830db..9e1b4273c 100644 --- a/code/ryzom/client/src/animated_scene_object.cpp +++ b/code/ryzom/client/src/animated_scene_object.cpp @@ -105,7 +105,7 @@ CAnimatedSceneObject::CAnimatedSceneObject( const string& ObjectName, const stri } // load skeleton, bind mesh and init position, rotation, cluster - if(_SkeletonName != "" ) + if(!_SkeletonName.empty()) { _Skeleton = Scene->createSkeleton(_SkeletonName); if( _Skeleton == NULL ) @@ -340,12 +340,12 @@ void CAnimatedSceneObject::resetInitialPos( void ) // Destructor CAnimatedSceneObject::~CAnimatedSceneObject() { - if( _Instance != NULL && _MeshName != "" ) + if( _Instance != NULL && !_MeshName.empty() ) { Scene->deleteInstance( _Instance ); } - if( _Skeleton != NULL && _SkeletonName != "" ) + if( _Skeleton != NULL && !_SkeletonName.empty() ) { Scene->deleteSkeleton( _Skeleton ); } diff --git a/code/ryzom/common/src/game_share/object.cpp b/code/ryzom/common/src/game_share/object.cpp index 6d1feb2fe..a034ddb2e 100644 --- a/code/ryzom/common/src/game_share/object.cpp +++ b/code/ryzom/common/src/game_share/object.cpp @@ -602,7 +602,7 @@ bool CObjectString::set(const std::string& key, const std::string & value) bool CObjectString::setObject(const std::string& key, CObject* value) { //H_AUTO(R2_CObjectString_setObject) - BOMB_IF( key != "" || ! (value->isString() || value->isNumber()) , "Try to set the a sub value of an object that does not allowed it", return false); + BOMB_IF( !key.empty() || ! (value->isString() || value->isNumber()) , "Try to set the a sub value of an object that does not allowed it", return false); bool canSet = set(key, value->toString()); if (canSet) { diff --git a/code/ryzom/server/src/ai_service/npc_description_msg.cpp b/code/ryzom/server/src/ai_service/npc_description_msg.cpp index a5a90ad29..62ba4d9f8 100644 --- a/code/ryzom/server/src/ai_service/npc_description_msg.cpp +++ b/code/ryzom/server/src/ai_service/npc_description_msg.cpp @@ -128,7 +128,7 @@ static bool LookupShopType(std::string name,std::vector &shopList) uint i; for ( i=0; i < cvShopType.size(); ++i ) { - if ( cvShopType.asString(i) != "" ) + if ( !cvShopType.asString(i).empty() ) { // make sure the string doesn't turn up more than once in input data for (uint j=0;jasString(); string page = varPage->asString(); - if (host == "" || page == "") + if (host.empty() || page.empty()) return; char params[1024]; diff --git a/code/ryzom/server/src/entities_game_service/creature_manager/creature_manager.cpp b/code/ryzom/server/src/entities_game_service/creature_manager/creature_manager.cpp index 3def0fde0..7c0dc7780 100644 --- a/code/ryzom/server/src/entities_game_service/creature_manager/creature_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/creature_manager/creature_manager.cpp @@ -117,7 +117,7 @@ void CGenNpcDescMsgImp::callback (const std::string &serviceName, NLNET::TServic //if the creature has a user model and if the user model's script contains parse errors, change //the creature's name to - if (_UserModelId != "" && CDynamicSheetManager::getInstance()->scriptErrors(_PrimAlias, _UserModelId) == true) + if (!_UserModelId.empty() && CDynamicSheetManager::getInstance()->scriptErrors(_PrimAlias, _UserModelId) == true) { TDataSetRow row = creature->getEntityRowId(); ucstring name; diff --git a/code/ryzom/server/src/entities_game_service/shop_type/shop_type_manager.cpp b/code/ryzom/server/src/entities_game_service/shop_type/shop_type_manager.cpp index 504462410..6b1aa0d9d 100644 --- a/code/ryzom/server/src/entities_game_service/shop_type/shop_type_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/shop_type/shop_type_manager.cpp @@ -242,7 +242,7 @@ void CShopTypeManager::initShopBase() CConfigFile::CVar& cvShopType = ShopConfigFile.getVar("ShopCategory"); for (uint i = 0; i < cvShopType.size(); ++i ) { - if ( cvShopType.asString(i) != "" ) + if ( !cvShopType.asString(i).empty() ) { _CategoryName.push_back( cvShopType.asString( i ) ); } @@ -252,7 +252,7 @@ void CShopTypeManager::initShopBase() CConfigFile::CVar& cvShopAlias = ShopConfigFile.getVar("ShopNameAliases"); for ( uint i = 0; i < cvShopAlias.size(); ++i ) { - if ( cvShopAlias.asString(i) != "" ) + if ( !cvShopAlias.asString(i).empty() ) { CVectorSString args; explode(cvShopAlias.asString(i), string(":"), reinterpret_cast &>(args)); diff --git a/code/ryzom/server/src/input_output_service/chat_manager.cpp b/code/ryzom/server/src/input_output_service/chat_manager.cpp index f86ec26e6..27d1c55e8 100644 --- a/code/ryzom/server/src/input_output_service/chat_manager.cpp +++ b/code/ryzom/server/src/input_output_service/chat_manager.cpp @@ -132,7 +132,7 @@ void CChatManager::onServiceDown(const std::string &serviceShortName) */ void CChatManager::resetChatLog() { - std::string logPath = (LogChatDirectory.get() == "" ? Bsi.getLocalPath() : LogChatDirectory.get()); + std::string logPath = (LogChatDirectory.get().empty() ? Bsi.getLocalPath() : LogChatDirectory.get()); _Displayer.setParam(CPath::standardizePath(logPath) + "chat.log"); } diff --git a/code/ryzom/tools/leveldesign/mp_generator/main.cpp b/code/ryzom/tools/leveldesign/mp_generator/main.cpp index bcf7fdf52..e61546a8d 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/main.cpp +++ b/code/ryzom/tools/leveldesign/mp_generator/main.cpp @@ -113,13 +113,13 @@ void LoadCraftParts() data.readFromFile( "rm_item_parts.csv" ); - while ( data != "" ) + while ( !data.empty() ) { ligne = data.splitTo( "\n", true ); // on recherche la ligne correspondant à notre craft part info = ligne.splitTo( ";", true ); - if ( info != "" ) + if ( !info.empty() ) { index = info.c_str()[0] - 'A'; @@ -179,13 +179,13 @@ void InitCreatureMP() data.readFromFile( "creature_models.csv" ); - while ( data != "" ) + while ( !data.empty() ) { ligneN = data.splitTo( "\n", true ); ligneM = data.splitTo( "\n", true ); // on vérifie que la ligne est valide - if ( ligneN.splitTo( ";", true ) != "" ) + if ( !ligneN.splitTo( ";", true ).empty() ) { ligneM.splitTo( ";", true ); @@ -195,7 +195,7 @@ void InitCreatureMP() ligneN.splitTo( ";", true ); ligneM.splitTo( ";", true ); - while ( ligneN != "" ) + while ( !ligneN.empty() ) { ListeCreatureMP listeCreatureMP; @@ -426,7 +426,7 @@ int GetNumeroMP( const CSString& nomMP ) result = FamilyTypContent.splitFrom( buffer ); // si oui, on retourne son numéro de MP - if ( result != "" ) + if ( !result.empty() ) res = result.splitTo( "\"" ).atoi(); else { @@ -478,7 +478,7 @@ int GetNumeroGroupe( const CSString& groupe ) result = GroupTypContent.splitFrom( buffer ); // si oui, on retourne son numéro de groupe - if ( result != "" ) + if ( !result.empty() ) res = result.splitTo( "\"" ).atoi(); else { @@ -557,14 +557,14 @@ void CreateParentSItem( int numMP, // 3d output += " \n"; - if ( icon != "" ) + if ( !icon.empty() ) { output += " \n"; } - if ( overlay != "" ) + if ( !overlay.empty() ) { output += " \n"; if(craftStats.UsedAsCraftRequirement) @@ -894,7 +894,7 @@ void CreateSheet( int numMP, const CSString& nomMP, CSString statEnergy; if ( ( variation == 2 ) && ( numMP == 695 ) ) // cas particulier pour le kitin trophy (beurk) statEnergy = "0"; - else if ( !creature || ( craftStats.Craft == "" ) ) + else if ( !creature || ( craftStats.Craft.empty() ) ) statEnergy = toString( "%d", GetStatEnergy( level ) ); else if ( variation < 2 ) statEnergy = toString( "%d", GetStatEnergy( level + 1 ) ); @@ -912,7 +912,7 @@ void CreateSheet( int numMP, const CSString& nomMP, outputFileName = toString( "m%04d%s%c%c%02d", numMP, code.c_str(), eco, 'a' + level, variation ); output = outputFileName; - GenerateItemNames( nomMP, eco, level, ( craftStats.Craft == "" ), creature, itemName ); + GenerateItemNames( nomMP, eco, level, ( craftStats.Craft.empty() ), creature, itemName ); output += "\t" + itemName; itemNames.insert( output ); } @@ -947,7 +947,7 @@ void GenerateDepositItems( int numMP, const CSString& nomMP, const MPCraftStats& code = "cxx"; // pas de craft = items de mission - if ( craftStats.Craft == "" ) + if ( craftStats.Craft.empty() ) { if ( loc != "G" ) CreateSheet( numMP, nomMP, code, 'c', 0, craftStats ); @@ -1000,7 +1000,7 @@ void GenerateCreatureItems( int numMP, CSString& nomMP, const MPCraftStats& craf CSString creatureFileName = "c"; creatureFileName += (*itMP)->codeCreature.toLower(); - if ( craftStats.Craft != "" ) + if ( !craftStats.Craft.empty() ) { quality = statQuality[creatureLevel-1]; if ( quality != 6 ) @@ -1107,7 +1107,7 @@ void NewMP( CSString& ligne ) // nouveau nom de famille nomMP = ligne.splitTo( ";", true ); - if ( nomMP == "" ) + if ( nomMP.empty() ) { // cette ligne ne contient pas d'info return; @@ -1126,37 +1126,37 @@ void NewMP( CSString& ligne ) ligne.splitTo( ";", true ); stat = ligne.splitTo( ";", true ); - if ( stat.firstWord() != "" ) + if ( !stat.firstWord().empty() ) craftStats.bestStatA = stat.atoi(); else craftStats.bestStatA = -1; stat = ligne.splitTo( ";", true ); - if ( stat.firstWord() != "" ) + if ( !stat.firstWord().empty() ) craftStats.worstStatA1 = stat.atoi(); else craftStats.worstStatA1 = -1; stat = ligne.splitTo( ";", true ); - if ( stat.firstWord() != "" ) + if ( !stat.firstWord().empty() ) craftStats.worstStatA2 = stat.atoi(); else craftStats.worstStatA2 = -1; stat = ligne.splitTo( ";", true ); - if ( stat.firstWord() != "" ) + if ( !stat.firstWord().empty() ) craftStats.bestStatB = stat.atoi(); else craftStats.bestStatB = -1; stat = ligne.splitTo( ";", true ); - if ( stat.firstWord() != "" ) + if ( !stat.firstWord().empty() ) craftStats.worstStatB1 = stat.atoi(); else craftStats.worstStatB1 = -1; stat = ligne.splitTo( ";", true ); - if ( stat.firstWord() != "" ) + if ( !stat.firstWord().empty() ) craftStats.worstStatB2 = stat.atoi(); else craftStats.worstStatB2 = -1; @@ -1168,19 +1168,19 @@ void NewMP( CSString& ligne ) specialOnly = stat.firstWord().contains( "x" ); // cas particuliers - while ( ligne != "" ) + while ( !ligne.empty() ) { if ( !ligne.contains( ";" ) ) { special = ligne; - if ( special.firstWord() != "" ) + if ( !special.firstWord().empty() ) specialNames.insert( special ); ligne = ""; } else { special = ligne.splitTo( ";", true ); - if ( special != "" ) + if ( !special.empty() ) specialNames.insert( special ); } } @@ -1357,7 +1357,7 @@ void LoadCustomizedProperties() fileName = CPath::lookup( name, false, false, true ); // on vérifie que le fichier concerné existe - if ( fileName != "" ) + if ( !fileName.empty() ) { CSString zone = prop.splitTo( ".", true ); str.readFromFile( fileName ); @@ -1530,7 +1530,7 @@ void LoadFamillesMP() ligne = fileData.splitTo( "\n", true ); - while ( ligne != "" ) + while ( !ligne.empty() ) { NewMP( ligne ); ligne = fileData.splitTo( "\n", true ); diff --git a/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp b/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp index ca89cae2f..6ab9e2a26 100644 --- a/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp +++ b/code/ryzom/tools/leveldesign/named_items_2_csv/named_items_2_csv.cpp @@ -67,7 +67,7 @@ int verifItemsFile (const char *filename) string s(buffer); // null or comment - if (s == "" || s.find("//") == 0) + if (s.empty() || s.find("//") == 0) continue; if (s.find("_LocSlot") == string::npos) @@ -113,7 +113,7 @@ int verifCsvFile (const char *filename) void processItemLine(const string &s) { // null or comment - if (s == "" || s.find("//") == 0) + if (s.empty() || s.find("//") == 0) return; // other stuff @@ -176,7 +176,7 @@ int getFieldsFromFile(const char *filename) s = s.strtok("\n"); // skip null or comment - if (s == "" || s.find("//") == 0) + if (s.empty() || s.find("//") == 0) continue; // add the field @@ -294,7 +294,7 @@ void getItemBounds(const CVectorSString &lines, uint num, uint &a, uint &b) while (++i < lines.size() && !ok) { - if (lines[i] == "" || lines[i].find("//") != string::npos) + if (lines[i].empty() || lines[i].find("//") != string::npos) continue; // get item number @@ -404,7 +404,7 @@ void updateItemField(CVectorSString &lines, uint itemIndex, uint fieldIndex, uin } // param not found - if (!found && val != "" && val != "nul") + if (!found && !val.empty() && val != "nul") { // add it if (field.find("_CraftParameters") == string::npos) @@ -552,7 +552,7 @@ int main(int argc, char *argv[]) // load csv values importCsv(csvFile.c_str()); - if (itemsFile != "" && CFile::isExists(itemsFile.c_str())) + if (!itemsFile.empty() && CFile::isExists(itemsFile.c_str())) updateItems(itemsFile.c_str()); else nlerror("Can't find file : %s", itemsFile.c_str()); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp index 31189622a..e39994fc4 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/dialog_properties.cpp @@ -216,7 +216,7 @@ void CDialogProperties::removeWidgets () else if (widget.Parameter.Type == CPrimitiveClass::CParameter::StringArray) { widget.MultiLineEditBox.DestroyWindow (); - if (widget.Parameter.Folder != "" || !widget.Parameter.FileExtension.empty()) + if (!widget.Parameter.Folder.empty() || !widget.Parameter.FileExtension.empty()) { widget.CheckBox.DestroyWindow (); } From 3c19f1a2f4f4033b50042d13359581ca2dc3abc1 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 7 Oct 2012 13:58:59 +0200 Subject: [PATCH 12/13] Changed: Don't use CMAKE_LIBRARY_ARCHITECTURE at all, because not reliable enough --- code/CMakeModules/nel.cmake | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 4875be6d6..67deb84e4 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -436,21 +436,16 @@ MACRO(NL_SETUP_BUILD) SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -DHAVE_ARM") ENDIF(TARGET_CPU STREQUAL "x86_64") - # Override CMAKE_LIBRARY_ARCHITECTURE that is automatically determinated - IF(LIBRARY_ARCHITECTURE) - SET(CMAKE_LIBRARY_ARCHITECTURE ${LIBRARY_ARCHITECTURE}) - ENDIF(LIBRARY_ARCHITECTURE) - # Fix library paths suffixes for Debian MultiArch - IF(CMAKE_LIBRARY_ARCHITECTURE) - SET(CMAKE_LIBRARY_PATH /lib/${CMAKE_LIBRARY_ARCHITECTURE} /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH}) + IF(LIBRARY_ARCHITECTURE) + SET(CMAKE_LIBRARY_PATH /lib/${LIBRARY_ARCHITECTURE} /usr/lib/${LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH}) IF(TARGET_X64) SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64) ENDIF(TARGET_X64) IF(TARGET_X86) SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32) ENDIF(TARGET_X86) - ENDIF(CMAKE_LIBRARY_ARCHITECTURE) + ENDIF(LIBRARY_ARCHITECTURE) IF(MSVC) IF(MSVC10) @@ -685,11 +680,11 @@ MACRO(NL_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/lib path. IF(NOT NL_LIB_PREFIX) - IF(CMAKE_LIBRARY_ARCHITECTURE) - SET(NL_LIB_PREFIX "lib/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") - ELSE(CMAKE_LIBRARY_ARCHITECTURE) + IF(LIBRARY_ARCHITECTURE) + SET(NL_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") + ELSE(LIBRARY_ARCHITECTURE) SET(NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.") - ENDIF(CMAKE_LIBRARY_ARCHITECTURE) + ENDIF(LIBRARY_ARCHITECTURE) ENDIF(NOT NL_LIB_PREFIX) NL_MAKE_ABSOLUTE_PREFIX(NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX) @@ -698,11 +693,11 @@ MACRO(NL_SETUP_PREFIX_PATHS) IF(WIN32) SET(NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers.") ELSE(WIN32) - IF(CMAKE_LIBRARY_ARCHITECTURE) - SET(NL_DRIVER_PREFIX "lib/${CMAKE_LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.") - ELSE(CMAKE_LIBRARY_ARCHITECTURE) + IF(LIBRARY_ARCHITECTURE) + SET(NL_DRIVER_PREFIX "lib/${LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers.") + ELSE(LIBRARY_ARCHITECTURE) SET(NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers.") - ENDIF(CMAKE_LIBRARY_ARCHITECTURE) + ENDIF(LIBRARY_ARCHITECTURE) ENDIF(WIN32) ENDIF(NOT NL_DRIVER_PREFIX) NL_MAKE_ABSOLUTE_PREFIX(NL_DRIVER_PREFIX NL_DRIVER_ABSOLUTE_PREFIX) @@ -752,11 +747,11 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS) ## Allow override of install_prefix/lib path. IF(NOT RYZOM_LIB_PREFIX) - IF(CMAKE_LIBRARY_ARCHITECTURE) - SET(RYZOM_LIB_PREFIX "lib/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") - ELSE(CMAKE_LIBRARY_ARCHITECTURE) + IF(LIBRARY_ARCHITECTURE) + SET(RYZOM_LIB_PREFIX "lib/${LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries.") + ELSE(LIBRARY_ARCHITECTURE) SET(RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.") - ENDIF(CMAKE_LIBRARY_ARCHITECTURE) + ENDIF(LIBRARY_ARCHITECTURE) ENDIF(NOT RYZOM_LIB_PREFIX) NL_MAKE_ABSOLUTE_PREFIX(RYZOM_LIB_PREFIX RYZOM_LIB_ABSOLUTE_PREFIX) From b421b38defb315e8b057ea3839feb255d2c6ee52 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 8 Oct 2012 19:06:08 +0200 Subject: [PATCH 13/13] Changed: Use of CMAKE_OSX_ARCHITECTURES to compile universal binaries under Mac OS X --- code/CMakeModules/PCHSupport.cmake | 35 ++- code/CMakeModules/nel.cmake | 334 +++++++++++++++++++++-------- 2 files changed, 269 insertions(+), 100 deletions(-) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index 7cd4c6c7d..0ef2243d6 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -34,18 +34,18 @@ ENDIF(MSVC) MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) - SET(${_out_compile_flags} ${${_flags_var_name}} ) + SET(_FLAGS ${${_flags_var_name}} ) IF(NOT MSVC) GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE) IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) - LIST(APPEND ${_out_compile_flags} "-fPIC") + LIST(APPEND _FLAGS "-fPIC") ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) ENDIF(NOT MSVC) GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES ) FOREACH(item ${DIRINC}) - LIST(APPEND ${_out_compile_flags} " ${_PCH_include_prefix}\"${item}\"") + LIST(APPEND _FLAGS " ${_PCH_include_prefix}\"${item}\"") ENDFOREACH(item) # Required for CMake 2.6 @@ -57,13 +57,32 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) - LIST(APPEND ${_out_compile_flags} ${GLOBAL_DEFINITIONS}) - LIST(APPEND ${_out_compile_flags} ${_directory_flags}) - LIST(APPEND ${_out_compile_flags} ${_directory_definitions}) - LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS}) + LIST(APPEND _FLAGS ${GLOBAL_DEFINITIONS}) + LIST(APPEND _FLAGS ${_directory_flags}) + LIST(APPEND _FLAGS ${_directory_definitions}) + LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS}) # Format definitions - SEPARATE_ARGUMENTS(${_out_compile_flags}) + SEPARATE_ARGUMENTS(_FLAGS) + + IF(CLANG) + SET(_IGNORE_NEXT OFF) + FOREACH(item ${_FLAGS}) + IF(_IGNORE_NEXT) + SET(_IGNORE_NEXT OFF) + ELSE(_IGNORE_NEXT) + IF(item MATCHES "^-Xarch") + SET(_IGNORE_NEXT ON) + ELSEIF(item MATCHES "^-arch") + SET(_IGNORE_NEXT ON) + ELSE(item MATCHES "^-Xarch") + LIST(APPEND ${_out_compile_flags} ${item}) + ENDIF(item MATCHES "^-Xarch") + ENDIF(_IGNORE_NEXT) + ENDFOREACH(item) + ELSE(CLANG) + SET(${_out_compile_flags} ${_FLAGS}) + ENDIF(CLANG) ENDMACRO(_PCH_GET_COMPILE_FLAGS) MACRO(_PCH_GET_PDB_FILENAME out_filename _target) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 67deb84e4..b8f74e4de 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -326,6 +326,11 @@ MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) OPTION(WITH_SNOWBALLS_SERVER "Build Snowballs Services" ON ) ENDMACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) +MACRO(ADD_PLATFORM_FLAGS _FLAGS) + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} ${_FLAGS}") + SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} ${_FLAGS}") +ENDMACRO(ADD_PLATFORM_FLAGS) + MACRO(NL_SETUP_BUILD) #----------------------------------------------------------------------------- @@ -422,19 +427,27 @@ MACRO(NL_SETUP_BUILD) STRING(STRIP ${PLATFORM_CXXFLAGS} PLATFORM_CXXFLAGS) STRING(STRIP ${PLATFORM_LINKFLAGS} PLATFORM_LINKFLAGS) - IF(TARGET_CPU STREQUAL "x86_64") - SET(TARGET_X64 1) - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86_64") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -DHAVE_X86_64") - ELSEIF(TARGET_CPU STREQUAL "x86") - SET(TARGET_X86 1) - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -DHAVE_X86") - ELSEIF(TARGET_CPU STREQUAL "arm") - SET(TARGET_ARM 1) - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_ARM") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -DHAVE_ARM") - ENDIF(TARGET_CPU STREQUAL "x86_64") + IF(NOT CMAKE_OSX_ARCHITECTURES) + IF(TARGET_CPU STREQUAL "x86_64") + SET(TARGET_X64 1) + ELSEIF(TARGET_CPU STREQUAL "x86") + SET(TARGET_X86 1) + ELSEIF(TARGET_CPU STREQUAL "armv7s") + SET(TARGET_ARM 1) + SET(TARGET_ARMV7S 1) + ELSEIF(TARGET_CPU STREQUAL "armv7") + SET(TARGET_ARM 1) + SET(TARGET_ARMV7 1) + ELSEIF(TARGET_CPU STREQUAL "armv6") + SET(TARGET_ARM 1) + SET(TARGET_ARMV6 1) + ELSEIF(TARGET_CPU STREQUAL "armv5") + SET(TARGET_ARM 1) + SET(TARGET_ARMV5 1) + ELSEIF(TARGET_CPU STREQUAL "arm") + SET(TARGET_ARM 1) + ENDIF(TARGET_CPU STREQUAL "x86_64") + ENDIF(NOT CMAKE_OSX_ARCHITECTURES) # Fix library paths suffixes for Debian MultiArch IF(LIBRARY_ARCHITECTURE) @@ -447,35 +460,65 @@ MACRO(NL_SETUP_BUILD) ENDIF(TARGET_X86) ENDIF(LIBRARY_ARCHITECTURE) + IF(APPLE AND NOT IOS) + SET(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH}) + SET(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH}) + ENDIF(APPLE AND NOT IOS) + + IF(TARGET_ARM) + IF(TARGET_ARMV7) + ADD_PLATFORM_FLAGS("-DHAVE_ARMV7") + ENDIF(TARGET_ARMV7) + + IF(TARGET_ARMV6) + ADD_PLATFORM_FLAGS("-HAVE_ARMV6") + ENDIF(TARGET_ARMV6) + + ADD_PLATFORM_FLAGS("-DHAVE_ARM") + ENDIF(TARGET_ARM) + + IF(TARGET_X86) + ADD_PLATFORM_FLAGS("-DHAVE_X86") + ENDIF(TARGET_X86) + + IF(TARGET_X64) + ADD_PLATFORM_FLAGS("-DHAVE_X64 -DHAVE_X86_64") + ENDIF(TARGET_X64) + + IF(WITH_LOGGING) + ADD_PLATFORM_FLAGS("-DENABLE_LOGS") + ENDIF(WITH_LOGGING) + IF(MSVC) IF(MSVC10) + ADD_PLATFORM_FLAGS("/Gy- /MP") # /Ox is working with VC++ 2010, but custom optimizations don't exist - SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") + SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again - SET(MIN_OPTIMIZATIONS "/Od /Ob1") + SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}") ELSEIF(MSVC90) + ADD_PLATFORM_FLAGS("/Gy- /MP") # don't use a /O[012x] flag if you want custom optimizations - SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") + SET(RELEASE_CFLAGS "/Ob2 /Oi /Ot /Oy /GT /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again - SET(MIN_OPTIMIZATIONS "/Ob1") + SET(DEBUG_CFLAGS "/Ob1 /GF- ${DEBUG_CFLAGS}") ELSEIF(MSVC80) + ADD_PLATFORM_FLAGS("/Gy- /Wp64") # don't use a /O[012x] flag if you want custom optimizations - SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-") + SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}") # without inlining it's unusable, use custom optimizations again - SET(MIN_OPTIMIZATIONS "/Od /Ob1") + SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}") ELSE(MSVC10) MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") ENDIF(MSVC10) - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zm1000 /MP /Gy-") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zm1000 /MP /Gy-") + ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250") IF(TARGET_X64) # Fix a bug with Intellisense - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /D_WIN64") + ADD_PLATFORM_FLAGS("/D_WIN64") # Fix a compilation error for some big C++ files - SET(MIN_OPTIMIZATIONS "${MIN_OPTIMIZATIONS} /bigobj") + SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} /bigobj") ELSE(TARGET_X64) # Allows 32 bits applications to use 3 GB of RAM SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE") @@ -491,97 +534,201 @@ MACRO(NL_SETUP_BUILD) SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}") ENDIF(WITH_SYMBOLS) - SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS} ${NL_DEBUG_CFLAGS}") - SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${SPEED_OPTIMIZATIONS} ${NL_RELEASE_CFLAGS}") + SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}") + SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}") SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt /INCREMENTAL:YES ${NL_DEBUG_LINKFLAGS}") SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}") + + IF(WITH_WARNINGS) + SET(DEBUG_CFLAGS "/W4 ${DEBUG_CFLAGS}") + ELSE(WITH_WARNINGS) + SET(DEBUG_CFLAGS "/W3 ${DEBUG_CFLAGS}") + ENDIF(WITH_WARNINGS) ELSE(MSVC) IF(WIN32) - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWIN32 -D_WIN32") + ADD_PLATFORM_FLAGS("-DWIN32 -D_WIN32") + + IF(CLANG) + ADD_PLATFORM_FLAGS("-nobuiltininc") + ENDIF(CLANG) ENDIF(WIN32) + IF(TARGET_ARM) + ADD_PLATFORM_FLAGS("-mthumb") + ENDIF(TARGET_ARM) + IF(APPLE) - IF(TARGET_CPU STREQUAL "x86") - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch i386") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -arch i386") - ENDIF(TARGET_CPU STREQUAL "x86") - - IF(TARGET_CPU STREQUAL "x86_64") - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch x86_64") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -arch x86_64") - ENDIF(TARGET_CPU STREQUAL "x86_64") + IF(IOS) + SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE PATH "" FORCE) + ELSE(IOS) + IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) + SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE PATH "" FORCE) + ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) + ENDIF(IOS) + + IF(XCODE) + IF(IOS) + SET(CMAKE_OSX_SYSROOT "iphoneos" CACHE PATH "" FORCE) + ELSE(IOS) +# SET(CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE) + ENDIF(IOS) + ELSE(XCODE) + IF(CMAKE_OSX_ARCHITECTURES) + SET(TARGETS_COUNT 0) + SET(_ARCHS) + FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES}) + IF(_ARCH STREQUAL "i386") + SET(_ARCHS "${_ARCHS} i386") + SET(TARGET_X86 1) + MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1") + ELSEIF(_ARCH STREQUAL "x86_64") + SET(_ARCHS "${_ARCHS} x86_64") + SET(TARGET_X64 1) + MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1") + ELSEIF(_ARCH STREQUAL "armv7") + SET(_ARCHS "${_ARCHS} armv7") + SET(TARGET_ARMV7 1) + SET(TARGET_ARM 1) + MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1") + ELSEIF(_ARCH STREQUAL "armv6") + SET(_ARCHS "${_ARCHS} armv6") + SET(TARGET_ARMV6 1) + SET(TARGET_ARM 1) + MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1") + ELSE(_ARCH STREQUAL "i386") + SET(_ARCHS "${_ARCHS} unknwon(${_ARCH})") + ENDIF(_ARCH STREQUAL "i386") + ENDFOREACH(_ARCH) + MESSAGE(STATUS "Compiling under Mac OS X for ${TARGETS_COUNT} architectures: ${_ARCHS}") + ELSE(CMAKE_OSX_ARCHITECTURES) + SET(TARGETS_COUNT 1) + ENDIF(CMAKE_OSX_ARCHITECTURES) + + IF(TARGETS_COUNT EQUAL 1) + IF(TARGET_ARM) + IF(TARGET_ARMV7S) + ADD_PLATFORM_FLAGS("-arch armv7s") + ENDIF(TARGET_ARMV7S) + + IF(TARGET_ARMV7) + ADD_PLATFORM_FLAGS("-arch armv7") + ENDIF(TARGET_ARMV7) + + IF(TARGET_ARMV6) + ADD_PLATFORM_FLAGS("-arch armv6") + ENDIF(TARGET_ARMV6) + + IF(TARGET_ARMV5) + ADD_PLATFORM_FLAGS("-arch armv5") + ENDIF(TARGET_ARMV5) + ENDIF(TARGET_ARM) + + IF(TARGET_X86) + ADD_PLATFORM_FLAGS("-arch i386") + ENDIF(TARGET_X86) + + IF(TARGET_X64) + ADD_PLATFORM_FLAGS("-arch x86_64") + ENDIF(TARGET_X64) + ELSE(TARGETS_COUNT EQUAL 1) + IF(TARGET_ARMV6) + ADD_PLATFORM_FLAGS("-Xarch_armv6 -mthumb -Xarch_armv6 -DHAVE_ARM -Xarch_armv6 -DHAVE_ARMV6") + ENDIF(TARGET_ARMV6) + + IF(TARGET_ARMV7) + ADD_PLATFORM_FLAGS("-Xarch_armv7 -mthumb -Xarch_armv7 -DHAVE_ARM -Xarch_armv7 -DHAVE_ARMV7") + ENDIF(TARGET_ARMV7) + + IF(TARGET_X86) + ADD_PLATFORM_FLAGS("-arch i386 -Xarch_i386 -DHAVE_X86") + ENDIF(TARGET_X86) + + IF(TARGET_X64) + ADD_PLATFORM_FLAGS("-arch x86_64 -Xarch_x86_64 -DHAVE_X64 -Xarch_x86_64 -DHAVE_X86_64") + ENDIF(TARGET_X64) + ENDIF(TARGETS_COUNT EQUAL 1) + + IF(IOS) + IF(IOS_VERSION) + PARSE_VERSION_STRING(${IOS_VERSION} IOS_VERSION_MAJOR IOS_VERSION_MINOR IOS_VERSION_PATCH) + CONVERT_VERSION_NUMBER(${IOS_VERSION_MAJOR} ${IOS_VERSION_MINOR} ${IOS_VERSION_PATCH} IOS_VERSION_NUMBER) + + ADD_PLATFORM_FLAGS("-D__IPHONE_OS_VERSION_MIN_REQUIRED=${IOS_VERSION_NUMBER}") + ENDIF(IOS_VERSION) + + IF(CMAKE_IOS_SYSROOT) + ADD_PLATFORM_FLAGS("-isysroot${CMAKE_IOS_SYSROOT}") + ADD_PLATFORM_FLAGS("-miphoneos-version-min=${IOS_VERSION}") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-iphoneos_version_min,${IOS_VERSION}") + ENDIF(CMAKE_IOS_SYSROOT) + + IF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86) + IF(TARGETS_COUNT EQUAL 1) + ADD_PLATFORM_FLAGS("-arch i386") + ELSE(TARGETS_COUNT EQUAL 1) + SET(XARCH "-Xarch_i386 ") + ENDIF(TARGETS_COUNT EQUAL 1) + + # Always force -mmacosx-version-min to override environement variable + ADD_PLATFORM_FLAGS("${XARCH}-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") + ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86) + ELSE(IOS) + FOREACH(_SDK ${_CMAKE_OSX_SDKS}) + IF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk") + SET(CMAKE_OSX_SYSROOT ${_SDK} CACHE PATH "" FORCE) + ENDIF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk") + ENDFOREACH(_SDK) + + IF(CMAKE_OSX_SYSROOT) + ADD_PLATFORM_FLAGS("-isysroot ${CMAKE_OSX_SYSROOT}") + ELSE(CMAKE_OSX_SYSROOT) + MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated") + ENDIF(CMAKE_OSX_SYSROOT) + + # Always force -mmacosx-version-min to override environement variable + ADD_PLATFORM_FLAGS("-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}") + ENDIF(IOS) + + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names") + + IF(HAVE_FLAG_SEARCH_PATHS_FIRST) + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-search_paths_first") + ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST) + ENDIF(XCODE) ELSE(APPLE) IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m32 -march=i686") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -m32 -march=i686") + ADD_PLATFORM_FLAGS("-m32 -march=i686") ENDIF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m64") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -m64") + ADD_PLATFORM_FLAGS("-m64") ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") ENDIF(APPLE) - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -D_REENTRANT -pipe -Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -D_REENTRANT -pipe -Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing") - - IF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -ansi") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ansi") - ENDIF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + ADD_PLATFORM_FLAGS("-D_REENTRANT -pipe -fno-strict-aliasing") IF(WITH_COVERAGE) - SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}") - SET(PLATFORM_CXXFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CXXFLAGS}") + ADD_PLATFORM_FLAGS("-fprofile-arcs -ftest-coverage") ENDIF(WITH_COVERAGE) + IF(WITH_WARNINGS) + ADD_PLATFORM_FLAGS("-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused") + IF(CLANG) + ADD_PLATFORM_FLAGS("-std=gnu99") + ELSE(CLANG) + ADD_PLATFORM_FLAGS("-ansi") + ENDIF(CLANG) + ENDIF(WITH_WARNINGS) + IF(APPLE) - SET(PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}") - SET(PLATFORM_CXXFLAGS "-gdwarf-2 ${PLATFORM_CXXFLAGS}") + ADD_PLATFORM_FLAGS("-gdwarf-2") ENDIF(APPLE) - IF(APPLE AND XCODE) -# SET(CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE) - ELSEIF(APPLE AND NOT XCODE) - IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) - SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6") - ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) - - FOREACH(_SDK ${_CMAKE_OSX_SDKS}) - IF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk") - SET(CMAKE_OSX_SYSROOT ${_SDK} CACHE PATH "" FORCE) - ENDIF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk") - ENDFOREACH(_SDK) - - IF(CMAKE_OSX_SYSROOT) - SET(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CFLAGS}") - SET(PLATFORM_CXXFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CXXFLAGS}") - ELSE(CMAKE_OSX_SYSROOT) - MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated") - ENDIF(CMAKE_OSX_SYSROOT) - - IF(CMAKE_OSX_ARCHITECTURES) - FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES}) - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch ${_ARCH}") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -arch ${_ARCH}") - ENDFOREACH(_ARCH) - ENDIF(CMAKE_OSX_ARCHITECTURES) - IF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG) - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") - SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") - ENDIF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG) - - SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names") - - IF(HAVE_FLAG_SEARCH_PATHS_FIRST) - SET(PLATFORM_LINKFLAGS "-Wl,-search_paths_first ${PLATFORM_LINKFLAGS}") - ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST) - ENDIF(APPLE AND XCODE) - # Fix "relocation R_X86_64_32 against.." error on x64 platforms IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS) - SET(PLATFORM_CFLAGS "-fPIC ${PLATFORM_CFLAGS}") - SET(PLATFORM_CXXFLAGS "-fPIC ${PLATFORM_CXXFLAGS}") + ADD_PLATFORM_FLAGS("-fPIC") ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS) SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48") @@ -788,7 +935,10 @@ MACRO(SETUP_EXTERNAL) IF(VC_ROOT_DIR MATCHES "registry") GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE) IF(VC_ROOT_DIR MATCHES "registry") - FILE(TO_CMAKE_PATH $ENV{VS100COMNTOOLS} VC_ROOT_DIR) + SET(VS100COMNTOOLS $ENV{VS100COMNTOOLS}) + IF(VS100COMNTOOLS) + FILE(TO_CMAKE_PATH ${VS100COMNTOOLS} VC_ROOT_DIR) + ENDIF(VS100COMNTOOLS) IF(NOT VC_ROOT_DIR) MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!") ENDIF(NOT VC_ROOT_DIR)