From 2928e81ec78e1868fa40aefdf411e422d092f078 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 24 Jun 2021 12:20:12 +0800 Subject: [PATCH] Merge fixes from core branch --- .../src/ai_service/combat_interface.cpp | 4 ++-- .../gpm_service/world_position_manager.cpp | 4 ++++ .../src/gpm_service/world_position_manager.h | 11 ++--------- .../input_output_service/parameter_traits.cpp | 19 +++++++++---------- .../input_output_service/string_manager.cpp | 17 +++++++++++------ .../string_manager_parser.cpp | 14 +++++++------- 6 files changed, 35 insertions(+), 34 deletions(-) diff --git a/ryzom/server/src/ai_service/combat_interface.cpp b/ryzom/server/src/ai_service/combat_interface.cpp index bbdf61f52..94d874bd8 100644 --- a/ryzom/server/src/ai_service/combat_interface.cpp +++ b/ryzom/server/src/ai_service/combat_interface.cpp @@ -82,8 +82,8 @@ void CBSAIEventReportMsg::callback(const std::string &name, NLNET::TServiceId id { uint8 actionType=ActionType[i]; if ( ( actionType!=ACTNATURE::FIGHT - || actionType!=ACTNATURE::OFFENSIVE_MAGIC - || actionType!=ACTNATURE::CURATIVE_MAGIC ) + && actionType!=ACTNATURE::OFFENSIVE_MAGIC + && actionType!=ACTNATURE::CURATIVE_MAGIC ) && AggroAdd[i]==0 ) continue; diff --git a/ryzom/server/src/gpm_service/world_position_manager.cpp b/ryzom/server/src/gpm_service/world_position_manager.cpp index 8c04790ea..61775bf68 100644 --- a/ryzom/server/src/gpm_service/world_position_manager.cpp +++ b/ryzom/server/src/gpm_service/world_position_manager.cpp @@ -1725,6 +1725,10 @@ void CWorldPositionManager::computeCellVision( CCell *cell, CVisionEntry* entiti } while (offsetPtr <= offsetEnd); } + else + { + nlassume(cell->isIndoor()); + } // then adds entities diff --git a/ryzom/server/src/gpm_service/world_position_manager.h b/ryzom/server/src/gpm_service/world_position_manager.h index a85b4cd51..0600ddd03 100644 --- a/ryzom/server/src/gpm_service/world_position_manager.h +++ b/ryzom/server/src/gpm_service/world_position_manager.h @@ -137,15 +137,8 @@ public: //friend void CWorldEntity::createPrimitive(NLPACS::UMoveContainer *pMoveContainer, uint8 worldImage); friend void CWorldEntity::removePrimitive(); - struct CEntityIdHash - { - enum { bucket_size = 4, min_buckets = 8 }; - size_t operator () (const NLMISC::CEntityId &id) const { return (uint32)id.getShortId(); } - size_t operator () (const NLMISC::CEntityId &left, const NLMISC::CEntityId &right) const { return left < right; } - }; - /// Container of entities (all entities are referenced by this container - typedef CHashMap< NLMISC::CEntityId, CWorldEntity *, CEntityIdHash > TWorldEntityContainerByEId; + typedef CHashMap< NLMISC::CEntityId, CWorldEntity *, NLMISC::CEntityIdHashMapTraits > TWorldEntityContainerByEId; typedef CHashMap TWorldEntityContainer; typedef CCell **TWorldCellsMap; @@ -164,7 +157,7 @@ public: typedef std::list< CWorldEntity * > TRemovedEntityContainer; typedef std::set< NLMISC::CEntityId > TSetId; - typedef CHashMap< NLMISC::CEntityId, CAroundEntityInfo, CEntityIdHash > TEntitiesAroundEntityContainer; + typedef CHashMap< NLMISC::CEntityId, CAroundEntityInfo, NLMISC::CEntityIdHashMapTraits > TEntitiesAroundEntityContainer; //typedef std::hash_map TMapIdToPlayerInfos; diff --git a/ryzom/server/src/input_output_service/parameter_traits.cpp b/ryzom/server/src/input_output_service/parameter_traits.cpp index 5cae1ecc3..a852af6ca 100644 --- a/ryzom/server/src/input_output_service/parameter_traits.cpp +++ b/ryzom/server/src/input_output_service/parameter_traits.cpp @@ -88,8 +88,7 @@ bool CStringManager::CParameterTraits::eval(CStringManager::TLanguages lang,cons } uint32 stringId = ew.getStringId(rowIndex, colIndex); - const std::string &str = SM->getString(stringId).toString(); - NLMISC::strlwr(str); + std::string str = NLMISC::toLowerAscii(SM->getString(stringId).toString()); LOG("SM : (paramTraits) eval condition for property %s [%s] %s [%s]", cond.Property.c_str(), str.c_str(), OperatorNames[cond.Operator], cond.ReferenceStr.c_str()); @@ -587,11 +586,11 @@ public: std::string op1; if (cond.Property == "name") { - op1 = NLMISC::toLower(si.SheetName); + op1 = NLMISC::toLowerAscii(si.SheetName); } else if (cond.Property == "gender") { - op1 = NLMISC::toLower(GSGENDER::toString(si.Gender)); + op1 = NLMISC::toLowerAscii(GSGENDER::toString(si.Gender)); } else { @@ -988,7 +987,7 @@ public: return false; } const CStringManager::TSheetInfo &si = SM->getSheetInfo(sheetId); - op1 = NLMISC::toLower(si.SheetName); + op1 = NLMISC::toLowerAscii(si.SheetName); } else if (cond.Property == "gender") { @@ -998,7 +997,7 @@ public: nlwarning("Could not find character info for EId %s to check property %s", EId.toString().c_str(), cond.Property.c_str()); return false; } - op1 = NLMISC::toLower(GSGENDER::toString(charInfo->getGender())); + op1 = NLMISC::toLowerAscii(GSGENDER::toString(charInfo->getGender())); } else { @@ -1084,14 +1083,14 @@ public: } else if (cond.Property == "role") { - op1 = NLMISC::toLower(si.ChatProfile); + op1 = NLMISC::toLowerAscii(si.ChatProfile); } else if (cond.Property == "title") { // we need to retrieve the charInfo CCharacterInfos *ci = IOS->getCharInfos(EId); if (ci != NULL) - op1 = NLMISC::toLower(ci->Title); + op1 = NLMISC::toLowerAscii(ci->Title); else { nlwarning("No character info for bot %s, can't test property 'title' !", EId.toString().c_str()); @@ -1457,11 +1456,11 @@ public: // check if checked property is gender or name if (cond.Property == "gender") { - value = NLMISC::toLower(GSGENDER::toString(charInfo->getGender())); + value = NLMISC::toLowerAscii(GSGENDER::toString(charInfo->getGender())); } else if (cond.Property == "name") { - value = NLMISC::toLower(charInfo->ShortName.toString()); + value = NLMISC::toLowerAscii(charInfo->ShortName.toString()); } else { diff --git a/ryzom/server/src/input_output_service/string_manager.cpp b/ryzom/server/src/input_output_service/string_manager.cpp index 6351ac296..7ebc7b3fa 100644 --- a/ryzom/server/src/input_output_service/string_manager.cpp +++ b/ryzom/server/src/input_output_service/string_manager.cpp @@ -832,7 +832,7 @@ const std::string &CStringManager::getLanguageCodeString(TLanguages language) return _LanguageCode[language]; nlwarning("Language number %u is out of range, returning english", language); - nlassert(english < NB_LANGUAGES); // just to avoid oopsie + nlctassert(english < NB_LANGUAGES); // just to avoid oopsie return _LanguageCode[english]; } @@ -851,6 +851,11 @@ uint32 CStringManager::storeString(const ucstring &str) } else { + // occasionally create a blank entry, + // this lets us find out if someone is scanning the string cache + if ((rand() & 7) == 0) + _StringBase.push_back(ucstring()); + // create a new entry std::pair ret; ret = _StringIdx.insert(std::make_pair(str, (uint32)_StringBase.size())); @@ -915,7 +920,7 @@ uint32 CStringManager::translateTitle(const std::string &title, TLanguages lang { const std::string colName("name"); const CStringManager::CEntityWords &ew = getEntityWords(language, STRING_MANAGER::title); - std::string rowName = NLMISC::toLower(title); + std::string rowName = NLMISC::toLowerAscii(title); uint32 stringId; stringId = ew.getStringId(rowName, colName); @@ -1198,7 +1203,7 @@ NLMISC_CATEGORISED_COMMAND(stringmanager, mergeWordFile, "Merge a word file into return false; std::string lang = args[0]; - std::string word = toLower(args[1]); + std::string word = toLowerAscii(args[1]); std::string file = args[2]; // get language @@ -1215,7 +1220,7 @@ NLMISC_CATEGORISED_COMMAND(stringmanager, mergeWordFile, "Merge a word file into uint i; for (i=0; i= typeNames.size())