Add source object name to Object message log

This commit is contained in:
Phillip Stephens 2022-01-09 17:15:59 -08:00
parent a5e204afe4
commit 72082fc409
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
1 changed files with 16 additions and 4 deletions

View File

@ -1330,8 +1330,14 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes
}
if (m_logScripting) {
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
dest->GetName(), dest->GetUniqueId());
auto srcObj = GetObjectById(src);
if (srcObj != nullptr) {
LogModule.report(logvisor::Info, FMT_STRING("{} is sending '{}' to '{}' id= {} -> {}"), srcObj->GetName(),
ScriptObjectMessageToStr(msg), dest->GetName(), dest->GetUniqueId(), src, dest->GetUniqueId());
} else {
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
dest->GetName(), dest->GetUniqueId());
}
}
dest->AcceptScriptMsg(msg, src, *this);
@ -1349,8 +1355,14 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb
}
if (m_logScripting) {
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
dst->GetName(), dst->GetUniqueId());
auto srcObj = GetObjectById(src);
if (srcObj != nullptr) {
LogModule.report(logvisor::Info, FMT_STRING("{} is sending '{}' to '{}' id= {} -> {}"), srcObj->GetName(),
ScriptObjectMessageToStr(msg), dst->GetName(), dst->GetUniqueId(), src, dst->GetUniqueId());
} else {
LogModule.report(logvisor::Info, FMT_STRING("Sending '{}' to '{}' id= {}"), ScriptObjectMessageToStr(msg),
dst->GetName(), dst->GetUniqueId());
}
}
dst->AcceptScriptMsg(msg, src, *this);