From c12f83d36d6576bf228db9ed1cb71281f7f78273 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 24 Jun 2021 17:17:18 +0800 Subject: [PATCH] Merge fixes from core --- ryzom/common/src/game_share/characteristics.h | 3 +++ ryzom/common/src/game_share/item_family.h | 3 +++ ryzom/common/src/game_share/item_origin.h | 3 +++ ryzom/common/src/game_share/item_type.h | 3 +++ ryzom/common/src/game_share/object.cpp | 4 ++-- .../src/game_share/ring_session_manager_itf.h | 4 ++-- .../src/game_share/ring_session_manager_itf.xml | 6 +++--- ryzom/common/src/game_share/scenario.cpp | 2 +- .../src/game_share/server_animation_module.cpp | 16 ++++++++-------- ryzom/common/src/game_share/skills.h | 3 +++ ryzom/common/src/game_share/utils.h | 11 +++++++++++ 11 files changed, 42 insertions(+), 16 deletions(-) diff --git a/ryzom/common/src/game_share/characteristics.h b/ryzom/common/src/game_share/characteristics.h index e2714fdf2..f984a3287 100644 --- a/ryzom/common/src/game_share/characteristics.h +++ b/ryzom/common/src/game_share/characteristics.h @@ -26,6 +26,9 @@ namespace CHARACTERISTICS { enum TCharacteristics +#ifdef NL_CPP14 + : uint8 +#endif { constitution = 0, //HP max metabolism, //Hp Regen diff --git a/ryzom/common/src/game_share/item_family.h b/ryzom/common/src/game_share/item_family.h index 68c3110b0..3237ad7c8 100644 --- a/ryzom/common/src/game_share/item_family.h +++ b/ryzom/common/src/game_share/item_family.h @@ -25,6 +25,9 @@ namespace ITEMFAMILY { // Mode enum EItemFamily +#ifdef NL_CPP14 + : uint8 +#endif { UNDEFINED = 0, SERVICE, diff --git a/ryzom/common/src/game_share/item_origin.h b/ryzom/common/src/game_share/item_origin.h index 28e3e81ac..a0deea496 100644 --- a/ryzom/common/src/game_share/item_origin.h +++ b/ryzom/common/src/game_share/item_origin.h @@ -26,6 +26,9 @@ namespace ITEM_ORIGIN { enum EItemOrigin +#ifdef NL_CPP14 + : uint8 +#endif { COMMON = 0, FYROS, diff --git a/ryzom/common/src/game_share/item_type.h b/ryzom/common/src/game_share/item_type.h index 5dfca77ff..a8681f8a5 100644 --- a/ryzom/common/src/game_share/item_type.h +++ b/ryzom/common/src/game_share/item_type.h @@ -26,6 +26,9 @@ namespace ITEM_TYPE // Mode // nb : sell filter uses two 64b database values to build a bitfield, so the item type limit is 128 for now enum TItemType +#ifdef NL_CPP14 + : uint8 +#endif { DAGGER, SWORD, diff --git a/ryzom/common/src/game_share/object.cpp b/ryzom/common/src/game_share/object.cpp index 51e5e3ef6..272dee047 100644 --- a/ryzom/common/src/game_share/object.cpp +++ b/ryzom/common/src/game_share/object.cpp @@ -2618,7 +2618,7 @@ CNpcSerializer::CNpcSerializer() static const char* optionalProp[] = { "GabaritHeight", "GabaritTorsoWidth","GabaritArmsWidth", "GabaritLegsWidth", "GabaritBreastSize", "HairType", "HairColor", "Tattoo", "EyesColor", "MorphTarget1", "MorphTarget2", "MorphTarget3", "MorphTarget4", "MorphTarget5", "MorphTarget6", "MorphTarget7", "MorphTarget8", "Sex", "JacketModel", "TrouserModel", "FeetModel", "HandsModel", "ArmModel", - "WeaponRightHand", "WeaponLeftHand", "JacketColor", "ArmColor", "HandsColor", "TrouserColor", "FeetColor", "Function","Level", + "WeaponRightHand", "WeaponLeftHand", "JacketColor", "ArmColor", "HandsColor", "TrouserColor", "FeetColor", "Function", "Profile", "Speed", "Aggro", "PlayerAttackable", "BotAttackable" }; _ClassName = "Npc"; @@ -2654,7 +2654,7 @@ CNpcCustomSerializer::CNpcCustomSerializer() "MorphTarget6", "MorphTarget7", "MorphTarget8", "JacketModel", "TrouserModel", "FeetModel", "HandsModel", "ArmModel", "JacketColor", "ArmColor", "HandsColor", "TrouserColor", "FeetColor" }; static const char* optionalProp[] = { - "Name", "Profile", "Speed", "Aggro", "PlayerAttackable", "BotAttackable", "Function", "Level", "WeaponRightHand", "WeaponLeftHand", "Sex" }; + "Name", "Profile", "Speed", "Aggro", "PlayerAttackable", "BotAttackable", "Function", "WeaponRightHand", "WeaponLeftHand", "Sex" }; _ClassName = "NpcCustom"; _Type = ObjectTableNpcCustom; diff --git a/ryzom/common/src/game_share/ring_session_manager_itf.h b/ryzom/common/src/game_share/ring_session_manager_itf.h index 7e056f3da..187d84a2b 100644 --- a/ryzom/common/src/game_share/ring_session_manager_itf.h +++ b/ryzom/common/src/game_share/ring_session_manager_itf.h @@ -41,7 +41,7 @@ #include "nel/net/login_cookie.h" -#include "../../nelns/welcome_service/welcome_service_itf.h" +#include "game_share/welcome_service_itf.h" #include "game_share/character_sync_itf.h" @@ -2527,7 +2527,7 @@ namespace RSMGR { H_AUTO(invokeResult_invokeResult); #ifdef NL_DEBUG - nldebug("CRingSessionManagerWeb::invokeResult called"); + nldebug("CRingSessionManagerWeb::invokeResult called (%s)", resultString.c_str()); #endif NLNET::CMessage message("RET"); nlWrite(message, serial, userId); diff --git a/ryzom/common/src/game_share/ring_session_manager_itf.xml b/ryzom/common/src/game_share/ring_session_manager_itf.xml index 7fc670080..a1294f0e1 100644 --- a/ryzom/common/src/game_share/ring_session_manager_itf.xml +++ b/ryzom/common/src/game_share/ring_session_manager_itf.xml @@ -1,10 +1,10 @@ - - + + - + diff --git a/ryzom/common/src/game_share/scenario.cpp b/ryzom/common/src/game_share/scenario.cpp index 3782c45cf..88ff1480a 100644 --- a/ryzom/common/src/game_share/scenario.cpp +++ b/ryzom/common/src/game_share/scenario.cpp @@ -111,7 +111,7 @@ CObject *CScenario::find(const std::string& instanceId, const std::string & attr CObject *src = _InstanceMap->find(instanceId); if (!src) { - nlwarning("Can't find object with id %s", instanceId.c_str()); + nlwarning("Can't find object with id '%s' (looking for attribute '%s[%d]' or '...[%s]')", instanceId.c_str(), attrName.c_str(), (int)position, key.c_str()); return NULL; } if (!attrName.empty()) diff --git a/ryzom/common/src/game_share/server_animation_module.cpp b/ryzom/common/src/game_share/server_animation_module.cpp index 634d518c3..d5e73c284 100644 --- a/ryzom/common/src/game_share/server_animation_module.cpp +++ b/ryzom/common/src/game_share/server_animation_module.cpp @@ -2,7 +2,7 @@ // Copyright (C) 2010 Winch Gate Property Limited // // This source file has been modified by the following contributors: -// Copyright (C) 2020 Jan BOON (Kaetemi) +// Copyright (C) 2019-2020 Jan BOON (Kaetemi) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as @@ -1811,7 +1811,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C CObject* tree = act->getAttr("UserTriggers"); if (!tree || !tree->isTable()) { - nlwarning("R2An: Data corrupted"); + nlwarning("R2An: Data corrupted: UserTriggers missing"); return false; } uint32 lastnode = tree->getSize(); @@ -1824,7 +1824,7 @@ bool CServerAnimationModule::translateActToPrimitive(CInstanceMap& components, C || !node->isString("Name") || !node->isString("Grp") ) { - nlwarning("R2An: Data corrupted"); + nlwarning("R2An: Data corrupted: Invalid UserTrigger"); return false; } @@ -1902,7 +1902,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi CObject* plotItems = rtScenario->getAttr("PlotItems"); if (!plotItems || !plotItems->isTable()) { - nlwarning("R2An: Data corrupted:session '%u'",sessionId.asInt()); + nlwarning("R2An: Data corrupted:session '%u': missing PlotItems",sessionId.asInt()); return false; } @@ -1919,7 +1919,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi || !plotItem->isString("Comment") ) { - nlwarning("R2An: Data corrupted:session '%u'",sessionId.asInt()); + nlwarning("R2An: Data corrupted:session '%u': Invalid PlotItem",sessionId.asInt()); return false; } @@ -1960,7 +1960,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi CObject* locations = rtScenario->getAttr("Locations"); if (!locations || !locations->isTable()) { - nlwarning("R2An: Data corrupted"); + nlwarning("R2An: Data corrupted: Missing Locations"); return false; } uint32 lastLocation = locations->getSize(); @@ -1976,7 +1976,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi ) { - nlwarning("R2An: Data corrupted:session '%u'",sessionId.asInt()); + nlwarning("R2An: Data corrupted:session '%u': Invalid Location",sessionId.asInt()); return false; } @@ -2013,7 +2013,7 @@ bool CServerAnimationModule::doMakeAnimationSession(CAnimationSession* animSessi bool ok = translateActToPrimitive(components, animSession, act, firstAct, primDocs[firstAct] ); //TODO if (!ok) { - nlwarning("R2An: Data corrupted:session '%u'",sessionId.asInt()); + nlwarning("R2An: Data corrupted:session '%u': Failed Act translation",sessionId.asInt()); return false; } } diff --git a/ryzom/common/src/game_share/skills.h b/ryzom/common/src/game_share/skills.h index 937158b6a..090fe18b0 100644 --- a/ryzom/common/src/game_share/skills.h +++ b/ryzom/common/src/game_share/skills.h @@ -27,6 +27,9 @@ namespace SKILLS { enum ESkills +#ifdef NL_CPP14 + : uint8 +#endif { SC = 0, SCA, diff --git a/ryzom/common/src/game_share/utils.h b/ryzom/common/src/game_share/utils.h index eb527162f..7d2fe02c8 100644 --- a/ryzom/common/src/game_share/utils.h +++ b/ryzom/common/src/game_share/utils.h @@ -60,6 +60,17 @@ inline ucstring capitalize(const ucstring & s) return ucstring::makeFromUtf8(capitalize(s.toUtf8())); } +inline std::string capitalizeFirst(const std::string &s) +{ + if (s.empty()) + return s; + + std::string res; + res.reserve(4); + ptrdiff_t i = 0; + NLMISC::appendToUpper(res, s, i); + return res + s.substr(i); +} //------------------------------------------------------------------------------------------------- // HANDY MACROS - For forcing the pre-preprocessor to evaluate concatenation operations nicely