From 7e1556520f5153b77d6c1ef58fec29eaa12d21bb Mon Sep 17 00:00:00 2001 From: Guillaume Dupuy Date: Sun, 21 May 2017 19:32:08 +0200 Subject: [PATCH 1/3] Fix an issue where item in groups could not be moved Multiple group move would result in some item beeing incorrectly marked as equipped --HG-- branch : fix_item_group --- code/ryzom/client/src/item_group_manager.cpp | 32 ++++++++++++++++++-- code/ryzom/client/src/item_group_manager.h | 4 +++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/code/ryzom/client/src/item_group_manager.cpp b/code/ryzom/client/src/item_group_manager.cpp index 8c18a6e37..97e7160f7 100644 --- a/code/ryzom/client/src/item_group_manager.cpp +++ b/code/ryzom/client/src/item_group_manager.cpp @@ -488,8 +488,9 @@ bool CItemGroupManager::moveGroup(std::string name, INVENTORIES::TInventory dst) for(int i=0;iisBagItemWeared(item.indexInBag)) continue; + //Workaround: sometimes item are marked as equipped by pIM->isBagItemWeared() even tho they aren't really + //Because of a synchronisation error between client and server + if(isItemReallyEquipped(item.pCS)) continue; CAHManager::getInstance()->runActionHandler("move_item", item.pCS, moveParams); } @@ -709,6 +710,33 @@ std::string CItemGroupManager::toDbPath(INVENTORIES::TInventory inventory) } } +bool CItemGroupManager::isItemReallyEquipped(CDBCtrlSheet* item) +{ + CDBCtrlSheet* pCS; + for (uint32 i = 0; i < MAX_EQUIPINV_ENTRIES; ++i) + { + SLOT_EQUIPMENT::TSlotEquipment slot = (SLOT_EQUIPMENT::TSlotEquipment)i; + //Instead of doing two separate for, just be a bit tricky for hand equipment + if(slot == SLOT_EQUIPMENT::HANDR) + pCS = CInventoryManager::getInstance()->getHandSheet(0); + else if(slot == SLOT_EQUIPMENT::HANDL) + pCS = CInventoryManager::getInstance()->getHandSheet(1); + else + pCS = CInventoryManager::getInstance()->getEquipSheet(i); + if(!pCS) continue; + //Can't directly compare ID (as pCS is like "ui:interface:inv_equip:content:equip:armors:feet" and item is like "ui:interface:inv_pa3:content:iil:bag_list:list:sheet57") + //Instead check inventory + slot + if((pCS->getInventoryIndex() == item->getInventoryIndex()) + && (pCS->getIndexInDB() == item->getIndexInDB())) + { + return true; + } + + } + + return false; +} + std::vector CItemGroupManager::matchingItems(CItemGroup *group, INVENTORIES::TInventory inventory) { //Not very clean, but no choice, it's ugly time diff --git a/code/ryzom/client/src/item_group_manager.h b/code/ryzom/client/src/item_group_manager.h index dae9d0e11..a4ff46c43 100644 --- a/code/ryzom/client/src/item_group_manager.h +++ b/code/ryzom/client/src/item_group_manager.h @@ -115,6 +115,10 @@ private: void validActions(); NLMISC::TGameCycle _EndInvalidAction; NLMISC::TGameCycle _StartInvalidAction; + //Workaround: sometimes item are marked as equipped by pIM->isBagItemWeared() even tho they aren't really + //Because of a synchronisation error between client and server + bool isItemReallyEquipped(CDBCtrlSheet *item); + //Used to migrate old groups ; keep for compatibility purpose bool migrateGroups(); From 18823c28fa861ff75189523f23884110af133ea9 Mon Sep 17 00:00:00 2001 From: Riasan Date: Mon, 22 May 2017 19:50:47 +0200 Subject: [PATCH 2/3] Changed: Add new lua command force_camera_fp to force camarea to first person view --HG-- branch : develop --- .../src/interface_v3/action_handler_move.cpp | 12 +++++++++++- code/ryzom/client/src/main_loop_debug.cpp | 1 + code/ryzom/client/src/user_entity.cpp | 17 +++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_move.cpp b/code/ryzom/client/src/interface_v3/action_handler_move.cpp index 5f02678aa..b33f71da5 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_move.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_move.cpp @@ -225,6 +225,17 @@ class CAHToggleCamera : public IActionHandler }; REGISTER_ACTION_HANDLER (CAHToggleCamera, "toggle_camera"); +// ------------------------------------------------------------------------------------------------ +class CAHToggleForceFP : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) + { + // Change the camera view to first person + UserEntity->forceCamareaFirstPerson(); + } +}; +REGISTER_ACTION_HANDLER (CAHToggleForceFP, "force_camera_fp"); + // ------------------------------------------------------------------------------------------------ class CAHToggleNames : public IActionHandler { @@ -446,4 +457,3 @@ class CAHToggleDodgeParry : public IActionHandler } }; REGISTER_ACTION_HANDLER (CAHToggleDodgeParry, "toggle_dodge_parry"); - diff --git a/code/ryzom/client/src/main_loop_debug.cpp b/code/ryzom/client/src/main_loop_debug.cpp index 5d2dcf9ac..7eb2989b4 100644 --- a/code/ryzom/client/src/main_loop_debug.cpp +++ b/code/ryzom/client/src/main_loop_debug.cpp @@ -748,6 +748,7 @@ void displayHelp() // DISP_TEXT(0.0f, "SHIFT + F11 : Test"); DISP_TEXT(0.0f, getActionKey("enter_modal", "group=ui:interface:quit_dialog") + " : Quit"); DISP_TEXT(0.0f, getActionKey("toggle_camera") + " : First/Third Person View"); + DISP_TEXT(0.0f, getActionKey("force_camera_fp") + " : Force Camera to First Person View"); line = 1.f; TextContext->setHotSpot(UTextContext::TopRight); diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index 3fd761262..5fd8c7dfb 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -3213,6 +3213,23 @@ void CUserEntity::toggleCamera() } }// toggleCamera // +//----------------------------------------------- +// forceCamareaFirstPerson : +// Force Camera to First Person View +//----------------------------------------------- +void CUserEntity::forceCamareaFirstPerson() +{ + // You cannot change the camera view when dead. + if(isDead()) + return; + // Only if not inside a building. + if(!UserEntity->forceIndoorFPV()) + { + //Enter the 1st Person View Mode + UserEntity->viewMode(CUserEntity::FirstPV); + } +}// forceCamareaFirstPerson // + //--------------------------------------------------- // getScale : // Return the entity scale. (return 1.0 if there is any problem). From 319cab93cd06255d1d041120cf1e78cff5b6e95f Mon Sep 17 00:00:00 2001 From: Riasan Date: Tue, 23 May 2017 18:24:49 +0200 Subject: [PATCH 3/3] Fixed: force_camera_fp command --HG-- branch : develop --- code/ryzom/client/src/user_entity.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/ryzom/client/src/user_entity.h b/code/ryzom/client/src/user_entity.h index 21b967e8a..e79af8dba 100644 --- a/code/ryzom/client/src/user_entity.h +++ b/code/ryzom/client/src/user_entity.h @@ -369,6 +369,8 @@ public: TView viewMode() const {return _ViewMode;} /// Toggle Camera (First/Third Person) void toggleCamera(); + /// Force Camera First Person View + void forceCamareaFirstPerson(); //@} /// Return the entity scale. (return 1.0 if there is any problem).