From 25f7a55495cb1dc91f2a60e011c0fdacfd69ffff Mon Sep 17 00:00:00 2001 From: David Cernat Date: Wed, 11 Jul 2018 19:54:56 +0300 Subject: [PATCH] [Client] Improve debug for received ActorAI packets --- apps/openmw/mwmp/DedicatedActor.cpp | 23 +++++++++++-------- .../processors/actor/ProcessorActorAI.hpp | 2 ++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwmp/DedicatedActor.cpp b/apps/openmw/mwmp/DedicatedActor.cpp index 4fef9db87..a4f70d533 100644 --- a/apps/openmw/mwmp/DedicatedActor.cpp +++ b/apps/openmw/mwmp/DedicatedActor.cpp @@ -216,15 +216,18 @@ void DedicatedActor::setAI() MWMechanics::CreatureStats *ptrCreatureStats = &ptr.getClass().getCreatureStats(ptr); ptrCreatureStats->setAiSetting(MWMechanics::CreatureStats::AI_Fight, 0); + LOG_APPEND(Log::LOG_VERBOSE, "- actor cellRef: %s %i-%i", + ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum()); + if (aiAction == mwmp::BaseActorList::CANCEL) { - LOG_APPEND(Log::LOG_VERBOSE, "--- Cancelling AI sequence"); + LOG_APPEND(Log::LOG_VERBOSE, "-- Cancelling AI sequence"); ptrCreatureStats->getAiSequence().clear(); } else if (aiAction == mwmp::BaseActorList::TRAVEL) { - LOG_APPEND(Log::LOG_VERBOSE, "--- Travelling to %f, %f, %f", + LOG_APPEND(Log::LOG_VERBOSE, "-- Travelling to %f, %f, %f", aiCoordinates.pos[0], aiCoordinates.pos[1], aiCoordinates.pos[2]); MWMechanics::AiTravel package(aiCoordinates.pos[0], aiCoordinates.pos[1], aiCoordinates.pos[2]); @@ -232,7 +235,7 @@ void DedicatedActor::setAI() } else if (aiAction == mwmp::BaseActorList::WANDER) { - LOG_APPEND(Log::LOG_VERBOSE, "--- Wandering for distance %i and duration %i, repetition is %s", + LOG_APPEND(Log::LOG_VERBOSE, "-- Wandering for distance %i and duration %i, repetition is %s", aiDistance, aiDuration, aiShouldRepeat ? "true" : "false"); std::vector idleList; @@ -248,7 +251,7 @@ void DedicatedActor::setAI() { targetPtr = MechanicsHelper::getPlayerPtr(aiTarget); - LOG_APPEND(Log::LOG_VERBOSE, "-- DedicatedActor %s %i-%i has player target %s", + LOG_APPEND(Log::LOG_VERBOSE, "-- Has player target %s", ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum(), targetPtr.getClass().getName(targetPtr).c_str()); } @@ -263,13 +266,13 @@ void DedicatedActor::setAI() if (targetPtr) { - LOG_APPEND(Log::LOG_VERBOSE, "-- DedicatedActor %s %i-%i has AI target %s %i-%i", + LOG_APPEND(Log::LOG_VERBOSE, "-- Has AI target %s %i-%i", ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum(), targetPtr.getCellRef().getRefId().c_str(), aiTarget.refNumIndex, aiTarget.mpNum); } else { - LOG_APPEND(Log::LOG_VERBOSE, "-- DedicatedActor %s %i-%i has invalid target AI target %i-%i", + LOG_APPEND(Log::LOG_VERBOSE, "-- Has invalid target AI target %i-%i", ptr.getCellRef().getRefId().c_str(), ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum(), aiTarget.refNumIndex, aiTarget.mpNum); } @@ -280,7 +283,7 @@ void DedicatedActor::setAI() { if (aiAction == mwmp::BaseActorList::ACTIVATE) { - LOG_APPEND(Log::LOG_VERBOSE, "--- Activating target"); + LOG_APPEND(Log::LOG_VERBOSE, "-- Activating target"); MWMechanics::AiActivate package(targetPtr); ptrCreatureStats->getAiSequence().stack(package, ptr, true); @@ -288,14 +291,14 @@ void DedicatedActor::setAI() if (aiAction == mwmp::BaseActorList::COMBAT) { - LOG_APPEND(Log::LOG_VERBOSE, "--- Starting combat with target"); + LOG_APPEND(Log::LOG_VERBOSE, "-- Starting combat with target"); MWMechanics::AiCombat package(targetPtr); ptrCreatureStats->getAiSequence().stack(package, ptr, true); } else if (aiAction == mwmp::BaseActorList::ESCORT) { - LOG_APPEND(Log::LOG_VERBOSE, "--- Being escorted by target, for duration %i, to coordinates %f, %f, %f", + LOG_APPEND(Log::LOG_VERBOSE, "-- Being escorted by target, for duration %i, to coordinates %f, %f, %f", aiDuration, aiCoordinates.pos[0], aiCoordinates.pos[1], aiCoordinates.pos[2]); MWMechanics::AiEscort package(targetPtr.getCellRef().getRefId(), aiDuration, @@ -304,7 +307,7 @@ void DedicatedActor::setAI() } else if (aiAction == mwmp::BaseActorList::FOLLOW) { - LOG_APPEND(Log::LOG_VERBOSE, "--- Following target"); + LOG_APPEND(Log::LOG_VERBOSE, "-- Following target"); MWMechanics::AiFollow package(targetPtr); package.allowAnyDistance(true); diff --git a/apps/openmw/mwmp/processors/actor/ProcessorActorAI.hpp b/apps/openmw/mwmp/processors/actor/ProcessorActorAI.hpp index 7da35a937..d065131f9 100644 --- a/apps/openmw/mwmp/processors/actor/ProcessorActorAI.hpp +++ b/apps/openmw/mwmp/processors/actor/ProcessorActorAI.hpp @@ -17,6 +17,8 @@ namespace mwmp virtual void Do(ActorPacket &packet, ActorList &actorList) { + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s about %s", strPacketID.c_str(), actorList.cell.getDescription().c_str()); + Main::get().getCellController()->readAI(actorList); } };