From 085264e8373baf17dcdc37faf0417453b87695fb Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 7 Feb 2007 08:42:48 +0000 Subject: [PATCH] Execute result pointer is now optional fixed a bug where result could be filled with no executions --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40453 --- core/systems/ForwardSys.cpp | 17 +++++++++++------ public/IForwardSys.h | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/core/systems/ForwardSys.cpp b/core/systems/ForwardSys.cpp index 95fd06c6..70536027 100644 --- a/core/systems/ForwardSys.cpp +++ b/core/systems/ForwardSys.cpp @@ -391,15 +391,20 @@ int CForward::Execute(cell_t *result, IForwardFilter *filter) } } - if (m_ExecType == ET_Event || m_ExecType == ET_Hook) + if (success) { - cur_result = high_result; - } else if (m_ExecType == ET_Ignore) { - cur_result = 0; + if (m_ExecType == ET_Event || m_ExecType == ET_Hook) + { + cur_result = high_result; + } else if (m_ExecType == ET_Ignore) { + cur_result = 0; + } + if (result) + { + *result = cur_result; + } } - *result = cur_result; - if (filter) { filter->OnExecuteEnd(&cur_result, success, failed); diff --git a/public/IForwardSys.h b/public/IForwardSys.h index 4fddf472..63e8c5db 100644 --- a/public/IForwardSys.h +++ b/public/IForwardSys.h @@ -165,7 +165,7 @@ namespace SourceMod /** * @brief Executes the forward. * - * @param result Pointer to store result in. + * @param result Optional pointer to store result in. * @param filter Optional pointer to an IForwardFilter. * @return Error code, if any. */