added new block_message flag in the message system

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401256
This commit is contained in:
Borja Ferrer 2007-08-02 00:47:47 +00:00
parent b20fa11911
commit 5a612d22e5
3 changed files with 12 additions and 12 deletions

View File

@ -163,11 +163,11 @@ bf_write *UserMessages::StartMessage(int msg_id, cell_t players[], unsigned int
m_InExec = true; m_InExec = true;
if (m_CurFlags & (USERMSG_PASSTHRU_ALL|USERMSG_PASSTHRU)) if (m_CurFlags & USERMSG_BLOCKHOOKS)
{ {
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
} else {
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id); buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
} else {
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
} }
return buffer; return buffer;
@ -180,11 +180,11 @@ bool UserMessages::EndMessage()
return false; return false;
} }
if (m_CurFlags & (USERMSG_PASSTHRU_ALL|USERMSG_PASSTHRU)) if (m_CurFlags & USERMSG_BLOCKHOOKS)
{ {
engine->MessageEnd();
} else {
ENGINE_CALL(MessageEnd)(); ENGINE_CALL(MessageEnd)();
} else {
engine->MessageEnd();
} }
m_InExec = false; m_InExec = false;
@ -286,7 +286,7 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
bool is_hook_empty = m_msgHooks[msg_type].empty(); bool is_hook_empty = m_msgHooks[msg_type].empty();
if ((is_intercept_empty && is_hook_empty) if ((is_intercept_empty && is_hook_empty)
|| (m_InExec && !(m_CurFlags & USERMSG_PASSTHRU_ALL))) || (m_InExec && (m_CurFlags & USERMSG_BLOCKHOOKS)))
{ {
m_InHook = false; m_InHook = false;
RETURN_META_VALUE(MRES_IGNORED, NULL); RETURN_META_VALUE(MRES_IGNORED, NULL);

View File

@ -33,9 +33,10 @@ enum UserMsg
#define USERMSG_PASSTHRU_ALL (1<<1) /**< (DEPRECATED, NO EFFECT) */ #define USERMSG_PASSTHRU_ALL (1<<1) /**< (DEPRECATED, NO EFFECT) */
#define USERMSG_RELIABLE (1<<2) /**< Message will be set on the reliable stream */ #define USERMSG_RELIABLE (1<<2) /**< Message will be set on the reliable stream */
#define USERMSG_INITMSG (1<<3) /**< Message will be considered to be an initmsg */ #define USERMSG_INITMSG (1<<3) /**< Message will be considered to be an initmsg */
#define USERMSG_BLOCK_MM (1<<4) /**< Message will be blocked from going through MM:S hooks */ #define USERMSG_BLOCK_MM (1<<4) /**< (DEPRECATED, NO EFFECT) */
#define USERMSG_BLOCK_SM (1<<5) /**< Message will be blocked from going through SourceMod hooks */ #define USERMSG_BLOCK_SM (1<<5) /**< (DEPRECATED, NO EFFECT) */
#define USERMSG_BLOCK_ALL (1<<6) /**< Message will be blocked from going through any hooks */ #define USERMSG_BLOCK_ALL (1<<6) /**< (DEPRECATED, NO EFFECT) */
#define USERMSG_BLOCKHOOKS (1<<7) /**< Prevents the message from triggering SourceMod and Metamod hooks */
/** /**
* @endsection * @endsection

View File

@ -89,10 +89,9 @@ namespace SourceMod
} }
}; };
#define USERMSG_PASSTHRU (1<<0) /**< Message will pass through other SourceMM plugins */
#define USERMSG_PASSTHRU_ALL (1<<1) /**< Message will pass through other SourceMM plugins AND SourceMod */
#define USERMSG_RELIABLE (1<<2) /**< Message will be set to reliable */ #define USERMSG_RELIABLE (1<<2) /**< Message will be set to reliable */
#define USERMSG_INITMSG (1<<3) /**< Message will be considered to be an initmsg */ #define USERMSG_INITMSG (1<<3) /**< Message will be considered to be an initmsg */
#define USERMSG_BLOCKHOOKS (1<<7) /**< Prevents the message from triggering SourceMod and Metamod hooks */
/** /**
* @brief Contains functions for hooking user messages. * @brief Contains functions for hooking user messages.