From f13705e8beb7e2e78a6ac98cfb096435894c869b Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 15 Jul 2018 04:09:19 +0300 Subject: [PATCH] [Client] Improve debug for ObjectActivate and ConsoleCommand --- apps/openmw/mwmp/ObjectList.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/apps/openmw/mwmp/ObjectList.cpp b/apps/openmw/mwmp/ObjectList.cpp index 97ba418ab..4eb6de0d2 100644 --- a/apps/openmw/mwmp/ObjectList.cpp +++ b/apps/openmw/mwmp/ObjectList.cpp @@ -272,8 +272,8 @@ void ObjectList::activateObjects(MWWorld::CellStore* cellStore) { if (baseObject.guid == Main::get().getLocalPlayer()->guid) { - LOG_APPEND(Log::LOG_VERBOSE, "-- Running on local player"); ptrFound = Main::get().getLocalPlayer()->getPlayerPtr(); + LOG_APPEND(Log::LOG_VERBOSE, "-- Activated object is local player"); } else { @@ -281,18 +281,18 @@ void ObjectList::activateObjects(MWWorld::CellStore* cellStore) if (player != 0) { - LOG_APPEND(Log::LOG_VERBOSE, "-- Running on player %s", player->npc.mName.c_str()); ptrFound = player->getPtr(); + LOG_APPEND(Log::LOG_VERBOSE, "-- Activated object is player %s", player->npc.mName.c_str()); } else { - LOG_APPEND(Log::LOG_VERBOSE, "-- Could not find target player!"); + LOG_APPEND(Log::LOG_VERBOSE, "-- Could not find player to activatee!"); } } } else { - LOG_APPEND(Log::LOG_VERBOSE, "-- Running on cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "-- Activated object is %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum); ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum); } @@ -301,13 +301,20 @@ void ObjectList::activateObjects(MWWorld::CellStore* cellStore) MWWorld::Ptr activatingActorPtr; if (baseObject.activatingActor.isPlayer) + { activatingActorPtr = MechanicsHelper::getPlayerPtr(baseObject.activatingActor); + LOG_APPEND(Log::LOG_VERBOSE, "-- Object has been activated by player %s", + activatingActorPtr.getClass().getName(activatingActorPtr).c_str()); + } else + { activatingActorPtr = cellStore->searchExact(baseObject.activatingActor.refNum, baseObject.activatingActor.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "-- Object has been activated by actor %s %i-%i", activatingActorPtr.getCellRef().getRefId().c_str(), + activatingActorPtr.getCellRef().getRefNum().mIndex, activatingActorPtr.getCellRef().getMpNum()); + } if (activatingActorPtr) { - LOG_APPEND(Log::LOG_VERBOSE, "-- Object has activating actor: %s", activatingActorPtr.getCellRef().getRefId().c_str()); MWBase::Environment::get().getWorld()->activate(ptrFound, activatingActorPtr); } } @@ -654,13 +661,13 @@ void ObjectList::runConsoleCommands(MWWorld::CellStore* cellStore) { MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager(); - LOG_APPEND(Log::LOG_VERBOSE, "- console command: %s", consoleCommand.c_str()); + LOG_APPEND(Log::LOG_VERBOSE, "- Console command: %s", consoleCommand.c_str()); if (baseObjects.empty()) { windowManager->clearConsolePtr(); - LOG_APPEND(Log::LOG_VERBOSE, "-- running with no object reference"); + LOG_APPEND(Log::LOG_VERBOSE, "-- Running with no object reference"); windowManager->executeCommandInConsole(consoleCommand); } else @@ -691,7 +698,7 @@ void ObjectList::runConsoleCommands(MWWorld::CellStore* cellStore) } else { - LOG_APPEND(Log::LOG_VERBOSE, "-- Running on cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum); + LOG_APPEND(Log::LOG_VERBOSE, "-- Running on object %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);